comparison lisp/glyphs.el @ 412:697ef44129c6 r21-2-14

Import from CVS: tag r21-2-14
author cvs
date Mon, 13 Aug 2007 11:20:41 +0200
parents 501cfd01ee6d
children
comparison
equal deleted inserted replaced
411:12e008d41344 412:697ef44129c6
1 ;;; glyphs.el --- Lisp interface to C glyphs 1 ;;; glyphs.el --- Lisp interface to C glyphs
2 2
3 ;; Copyright (C) 1994, 1997 Free Software Foundation, Inc. 3 ;; Copyright (C) 1994, 1997 Free Software Foundation, Inc.
4 ;; Copyright (C) 1995, 1996, 2000 Ben Wing. 4 ;; Copyright (C) 1995, 1996 Ben Wing.
5 5
6 ;; Author: Chuck Thompson <cthomp@cs.uiuc.edu>, Ben Wing <ben@xemacs.org> 6 ;; Author: Chuck Thompson <cthomp@cs.uiuc.edu>, Ben Wing <ben@xemacs.org>
7 ;; Maintainer: XEmacs Development Team 7 ;; Maintainer: XEmacs Development Team
8 ;; Keywords: extensions, internal, dumped 8 ;; Keywords: extensions, internal, dumped
9 9
24 ;; Free Software Foundation, 59 Temple Place - Suite 330, 24 ;; Free Software Foundation, 59 Temple Place - Suite 330,
25 ;; Boston, MA 02111-1307, USA. 25 ;; Boston, MA 02111-1307, USA.
26 26
27 ;;; Synched up with: Not in FSF. 27 ;;; Synched up with: Not in FSF.
28 28
29 ;;; Authorship:
30
31 ;; Prototype created 1995 by Chuck Thompson.
32 ;; Completely rewritten by Ben Wing, 1995.
33 ;; Various cleanups (esp. doc strings) by Ben Wing, May 2000.
34
35 ;;; Commentary: 29 ;;; Commentary:
36 30
37 ;; This file is dumped with XEmacs. 31 ;; This file is dumped with XEmacs.
38 32
39 ;;; Code: 33 ;;; Code:
40 34
41 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; image specifiers 35 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; font specifiers
42 36
43 (defun make-image-specifier (spec-list) 37 (defun make-image-specifier (spec-list)
44 "Return a new `image' specifier object with the specification list SPEC-LIST. 38 "Return a new `image' specifier object with the specification list SPEC-LIST.
45 SPEC-LIST can be a list of specifications (each of which is a cons of a 39 SPEC-LIST can be a list of specifications (each of which is a cons of a
46 locale and a list of instantiators), a single instantiator, or a list 40 locale and a list of instantiators), a single instantiator, or a list
47 of instantiators. See `make-specifier' for more information about 41 of instantiators. See `make-specifier' for more information about
48 specifiers. 42 specifiers."
49
50 An image specifier is used for images (pixmaps, widgets and the like).
51 It is used to describe the actual image in a glyph. It is instanced
52 as an image-instance. Note that \"image\" as used in XEmacs does not
53 actually refer to what the term \"image\" normally means (a picture,
54 e.g. in .GIF or .JPG format, and called a \"pixmap\" in XEmacs), but
55 includes all types of graphical elements, including pixmaps, widgets
56 \(buttons, sliders, text fields, etc.) and even strings of text.
57
58 Note that, in practice, you rarely, if ever, need to actually create
59 an image specifier! (The function `make-image-specifier' exists mainly
60 for completeness.) Pretty much the only use for image specifiers is to
61 control how glyphs are displayed, and the image specifier associated
62 with a glyph (the `image' property of a glyph) is created
63 automatically when a glyph is created (see `make-glyph') and need not
64 \(and cannot, for that matter) ever be changed. In fact, the design
65 decision to create a separate image specifier type, rather than make
66 glyphs themselves be specifiers, is debatable -- the other properties
67 of glyphs are rarely used and could conceivably have been incorporated
68 into the glyph's instantiator. The rarely used glyph types (buffer,
69 pointer, icon) could also have been incorporated into the instantiator.
70
71 Image instantiators come in many formats: `xbm', `xpm', `gif', `jpeg',
72 etc. This describes the format of the data describing the image. The
73 resulting image instances also come in many types -- `mono-pixmap',
74 `color-pixmap', `text', `pointer', etc. This refers to the behavior of
75 the image and the sorts of places it can appear. (For example, a
76 color-pixmap image has fixed colors specified for it, while a
77 mono-pixmap image comes in two unspecified shades \"foreground\" and
78 \"background\" that are determined from the face of the glyph or
79 surrounding text; a text image appears as a string of text and has an
80 unspecified foreground, background, and font; a pointer image behaves
81 like a mono-pixmap image but can only be used as a mouse pointer
82 \[mono-pixmap images cannot be used as mouse pointers]; etc.) It is
83 important to keep the distinction between image instantiator format and
84 image instance type in mind. Typically, a given image instantiator
85 format can result in many different image instance types (for example,
86 `xpm' can be instanced as `color-pixmap', `mono-pixmap', or `pointer';
87 whereas `cursor-font' can be instanced only as `pointer'), and a
88 particular image instance type can be generated by many different
89 image instantiator formats (e.g. `color-pixmap' can be generated by `xpm',
90 `gif', `jpeg', etc.).
91
92 See `make-image-instance' for a more detailed discussion of image
93 instance types.
94
95 An image instantiator should be a string or a vector of the form
96
97 [FORMAT :KEYWORD VALUE ...]
98
99 i.e. a format symbol followed by zero or more alternating keyword-value
100 pairs. FORMAT should be one of
101
102 'nothing
103 Don't display anything; no keywords are valid for this.
104 Can only be instanced as `nothing'.
105 'string
106 Display this image as a text string. Can only be instanced
107 as `text', although support for instancing as `mono-pixmap'
108 and `color-pixmap' should be added.
109 'formatted-string
110 Display this image as a text string, with replaceable fields;
111 not currently implemented. (It is, instead, equivalent to `string'.)
112 'xbm
113 An X bitmap; only if X or MS Windows support was compiled into this
114 XEmacs. Can be instanced as `mono-pixmap', `color-pixmap', or `pointer'.
115 'xpm
116 An XPM pixmap; only if XPM support was compiled into this XEmacs.
117 Can be instanced as `color-pixmap', `mono-pixmap', or `pointer'.
118 'xface
119 An X-Face bitmap, used to encode people's faces in e-mail messages;
120 only if X-Face support was compiled into this XEmacs. Can be
121 instanced as `mono-pixmap', `color-pixmap', or `pointer'.
122 'gif
123 A GIF87 or GIF89 image; only if GIF support was compiled into this
124 XEmacs. NOTE: only the first frame of animated gifs will be displayed.
125 Can be instanced as `color-pixmap'.
126 'jpeg
127 A JPEG image; only if JPEG support was compiled into this XEmacs.
128 Can be instanced as `color-pixmap'.
129 'png
130 A PNG image; only if PNG support was compiled into this XEmacs.
131 Can be instanced as `color-pixmap'.
132 'tiff
133 A TIFF image; only if TIFF support was compiled into this XEmacs.
134 Can be instanced as `color-pixmap'.
135 'bmp
136 A MS Windows BMP image; only if MS Windows support was compiled into
137 this XEmacs. Can be instanced as `color-pixmap'.
138 'cursor-font
139 One of the standard cursor-font names, such as \"watch\" or
140 \"right_ptr\" under X. Under X, this is, more specifically, any
141 of the standard cursor names from appendix B of the Xlib manual
142 [also known as the file <X11/cursorfont.h>] minus the XC_ prefix.
143 On other window systems, the valid names will be specific to the
144 type of window system. Can only be instanced as `pointer'.
145 'mswindows-resource
146 An MS Windows pointer resource. Specifies a resource to retrieve
147 directly from the system (an OEM resource) or from a file, particularly
148 an executable file. If the resource is to be retrieved from a file, use
149 :file and optionally :resource-id. Otherwise use :resource-id. Always
150 specify :resource-type to specify the type (cursor, bitmap or icon) of
151 the resource. Possible values for :resource-id are listed below. Can
152 be instanced as `pointer' or `color-pixmap'.
153 'font
154 A glyph from a font; i.e. the name of a font, and glyph index into it
155 of the form \"FONT fontname index [[mask-font] mask-index]\".
156 Currently can only be instanced as `pointer', although this should
157 probably be fixed.
158 'subwindow
159 An embedded windowing system window. Can only be instanced as
160 `subwindow'.
161 'button
162 A button widget; either a push button, radio button or toggle button.
163 Can only be instanced as `widget'.
164 'combo-box
165 A drop list of selectable items in a widget, for editing text.
166 Can only be instanced as `widget'.
167 'edit-field
168 A text editing widget. Can only be instanced as `widget'.
169 'label
170 A static, text-only, widget; for displaying text. Can only be instanced
171 as `widget'.
172 'layout
173 A widget for controlling the positioning of children underneath it.
174 Through the use of nested layouts, a widget hierarchy can be created
175 which can have the appearance of any standard dialog box or similar
176 arrangement; all of this is counted as one \"glyph\" and could appear
177 in many of the places that expect a single glyph. Can only be instanced
178 as `widget'.
179 'native-layout
180 The native version of a layout widget. #### Document me better!
181 Can only be instanced as `widget'.
182 'progress-gauge
183 A sliding widget, for showing progress. Can only be instanced as
184 `widget'.
185 'tab-control
186 A tab widget; a series of user selectable tabs. Can only be instanced
187 as `widget'.
188 'tree-view
189 A folding widget. Can only be instanced as `widget'.
190 'scrollbar
191 A scrollbar widget. Can only be instanced as `widget'.
192 'autodetect
193 XEmacs tries to guess what format the data is in. If X support
194 exists, the data string will be checked to see if it names a filename.
195 If so, and this filename contains XBM or XPM data, the appropriate
196 sort of pixmap or pointer will be created. [This includes picking up
197 any specified hotspot or associated mask file.] Otherwise, if `pointer'
198 is one of the allowable image-instance types and the string names a
199 valid cursor-font name, the image will be created as a pointer.
200 Otherwise, the image will be displayed as text. If no X support
201 exists, the image will always be displayed as text. Can be instanced as
202 `mono-pixmap', `color-pixmap', `pointer', or `text'.
203 'inherit
204 Inherit from the background-pixmap property of a face. Can only be
205 instanced as `mono-pixmap'.
206
207 The valid keywords are:
208
209 :data
210 Inline data. For most formats above, this should be a string. For
211 XBM images, this should be a list of three elements: width, height, and
212 a string of bit data. This keyword is valid for all of the bitmap/pixmap
213 formats, as well as `string', `formatted-string', `font', `cursor-font',
214 and `autodetect'.
215 :file
216 Data is contained in a file. The value is the name of this file.
217 If both :data and :file are specified, the image is created from
218 what is specified in :data and the string in :file becomes the
219 value of the `image-instance-file-name' function when applied to
220 the resulting image-instance. This keyword is valid for all of the
221 bitmap/pixmap formats as well as `mswindows-resource'.
222 :foreground
223 :background
224 For `xbm', `xface', `cursor-font', `widget' and `font'. These keywords
225 allow you to explicitly specify foreground and background colors.
226 The argument should be anything acceptable to `make-color-instance'.
227 This will cause what would be a `mono-pixmap' to instead be colorized
228 as a two-color color-pixmap, and specifies the foreground and/or
229 background colors for a pointer instead of black and white.
230 :mask-data
231 For `xbm' and `xface'. This specifies a mask to be used with the
232 bitmap. The format is a list of width, height, and bits, like for
233 :data.
234 :mask-file
235 For `xbm' and `xface'. This specifies a file containing the mask data.
236 If neither a mask file nor inline mask data is given for an XBM image,
237 and the XBM image comes from a file, XEmacs will look for a mask file
238 with the same name as the image file but with \"Mask\" or \"msk\"
239 appended. For example, if you specify the XBM file \"left_ptr\"
240 [usually located in \"/usr/include/X11/bitmaps\"], the associated
241 mask file \"left_ptrmsk\" will automatically be picked up.
242 :hotspot-x
243 :hotspot-y
244 For `xbm' and `xface'. These keywords specify a hotspot if the image
245 is instantiated as a `pointer'. Note that if the XBM image file
246 specifies a hotspot, it will automatically be picked up if no
247 explicit hotspot is given.
248 :color-symbols
249 Only for `xpm'. This specifies an alist that maps strings
250 that specify symbolic color names to the actual color to be used
251 for that symbolic color (in the form of a string or a color-specifier
252 object). If this is not specified, the contents of `xpm-color-symbols'
253 are used to generate the alist.
254 :resource-id
255 Only for `mswindows-resource'. This must be either an integer (which
256 directly specifies a resource number) or a string. Valid strings are
257
258 -- For bitmaps:
259
260 \"close\", \"uparrow\", \"dnarrow\", \"rgarrow\", \"lfarrow\",
261 \"reduce\", \"zoom\", \"restore\", \"reduced\", \"zoomd\",
262 \"restored\", \"uparrowd\", \"dnarrowd\", \"rgarrowd\", \"lfarrowd\",
263 \"mnarrow\", \"combo\", \"uparrowi\", \"dnarrowi\", \"rgarrowi\",
264 \"lfarrowi\", \"size\", \"btsize\", \"check\", \"checkboxes\", and
265 \"btncorners\".
266
267 -- For cursors:
268
269 \"normal\", \"ibeam\", \"wait\", \"cross\", \"up\", \"sizenwse\",
270 \"sizenesw\", \"sizewe\", \"sizens\", \"sizeall\", and \"no\".
271
272 -- For icons:
273
274 \"sample\", \"hand\", \"ques\", \"bang\", \"note\", and \"winlogo\".
275 :resource-type
276 Only for `mswindows-resource'. This must be a symbol, either `cursor',
277 `icon', or `bitmap', specifying the type of resource to be retrieved.
278 :face
279 Only for `inherit'. This specifies the face to inherit from.
280 For widgets this also specifies the face to use for display. It defaults
281 to gui-element-face.
282
283 Keywords accepted as menu item specs are also accepted by widgets.
284 These are `:selected', `:active', `:suffix', `:keys', `:style',
285 `:filter', `:config', `:included', `:key-sequence', `:accelerator',
286 `:label' and `:callback'.
287
288 If instead of a vector, the instantiator is a string, it will be
289 converted into a vector by looking it up according to the specs in the
290 `console-type-image-conversion-list' (q.v.) for the console type of
291 the domain (usually a window; sometimes a frame or device) over which
292 the image is being instantiated.
293
294 If the instantiator specifies data from a file, the data will be read
295 in at the time that the instantiator is added to the image (which may
296 be well before when the image is actually displayed), and the
297 instantiator will be converted into one of the inline-data forms, with
298 the filename retained using a :file keyword. This implies that the
299 file must exist when the instantiator is added to the image, but does
300 not need to exist at any other time (e.g. it may safely be a temporary
301 file).
302 "
303 (make-specifier-and-init 'image spec-list)) 43 (make-specifier-and-init 'image spec-list))
304 44
305 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; glyphs 45 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; glyphs
306 46
307 (defconst built-in-glyph-specifiers 47 (defconst built-in-glyph-specifiers
308 '(image contrib-p baseline) 48 '(image contrib-p baseline)
309 "A list of the built-in glyph properties that are specifiers.") 49 "A list of the built-in face properties that are specifiers.")
310 50
311 (defun glyph-property (glyph property &optional locale) 51 (defun glyph-property (glyph property &optional locale)
312 "Return GLYPH's value of PROPERTY in LOCALE. 52 "Return GLYPH's value of PROPERTY in LOCALE.
313 53
314 If LOCALE is omitted, the GLYPH's actual value for PROPERTY will be 54 If LOCALE is omitted, the GLYPH's actual value for PROPERTY will be
545 285
546 (defun set-glyph-image (glyph spec &optional locale tag-set how-to-add) 286 (defun set-glyph-image (glyph spec &optional locale tag-set how-to-add)
547 "Change the image of GLYPH in LOCALE. 287 "Change the image of GLYPH in LOCALE.
548 288
549 SPEC should be an instantiator (a string or vector; see 289 SPEC should be an instantiator (a string or vector; see
550 `make-image-specifier' for a description of possible values here), 290 `image-specifier-p' for a description of possible values here),
551 a list of (possibly tagged) instantiators, an alist of specifications 291 a list of (possibly tagged) instantiators, an alist of specifications
552 (each mapping a locale to an instantiator list), or an image specifier 292 (each mapping a locale to an instantiator list), or an image specifier
553 object. 293 object.
554 294
555 If SPEC is an alist, LOCALE must be omitted. If SPEC is a 295 If SPEC is an alist, LOCALE must be omitted. If SPEC is a
638 See `set-glyph-property' for more information." 378 See `set-glyph-property' for more information."
639 ; (interactive (glyph-interactive "baseline")) 379 ; (interactive (glyph-interactive "baseline"))
640 (set-glyph-property glyph 'baseline spec locale tag-set how-to-add)) 380 (set-glyph-property glyph 'baseline spec locale tag-set how-to-add))
641 381
642 (defun make-glyph (&optional spec-list type) 382 (defun make-glyph (&optional spec-list type)
643 "Create a new glyph of type TYPE. 383 "Return a new `glyph' object of type TYPE.
644 384
645 A glyph in XEmacs does NOT refer to a single unit of textual display (the 385 TYPE should be one of `buffer' (used for glyphs in an extent, the modeline,
646 XEmacs term for this is \"rune\"), but rather is an object encapsulating
647 a graphical element, such as an image or widget (an element such as a
648 button or text field; \"widget\" is the term for this under X Windows,
649 and it's called a \"control\" under MS Windows). This graphical element
650 could appear in a buffer, a margin, a gutter, or a toolbar, or as a mouse
651 pointer or an icon, for example.
652
653 Creating a glyph using `make-glyph' does not specify *where* the glyph
654 will be used, but it does specify *what* the glyph will look like. In
655 particular, SPEC-LIST is used to specify this, and it's used to
656 initialize the glyph's `image' property, which is an image
657 specifier. (Note that \"image\" as used in the context of a glyph's
658 `image' property or in the terms \"image specifier\", \"image
659 instantiator\", or \"image instance\" does not refer to what people
660 normally think of as an image (which in XEmacs is called a
661 \"pixmap\"), but to any graphical element -- a pixmap, a widget, or
662 even a block of text, when used in the places that call for a glyph.)
663 The format of the SPEC-LIST is typically an image instantiator (a
664 string or a vector; see `make-image-specifier' for a detailed description
665 of the valid image instantiators), but can also be a list of such
666 instantiators (each one in turn is tried until an image is
667 successfully produced), a cons of a locale (frame, buffer, etc.) and
668 an instantiator, a list of such conses, or any other form accepted by
669 `canonicalize-spec-list'.
670
671 If you're not familiar with specifiers, you should be in order to
672 understand how glyphs work. The clearest introduction to specifiers
673 is in the Lispref manual, available under Info. (Choose
674 Help->Info->Info Contents on the menubar or type \\[info].) You can
675 also see `make-specifier' for a capsule summary. What's important to
676 keep in mind is that a specifier lets you set a different value for
677 any particular buffer, window, frame, device, or console. This allows
678 for a great deal of flexibility; in particular, only one global glyph
679 needs to exist for a particular purpose (e.g. the icon used to represent
680 an iconified frame, the mouse pointer used over particular areas of a
681 frame, etc.), and in these cases you do not create your own glyph, but
682 rather modify the existing one.
683
684 As well as using SPEC-LIST to initialize the glyph, you can set
685 specifications using `set-glyph-image'. Note that, due to a possibly
686 questionable historical design decision, a glyph itself is not
687 actually a specifier, but rather is an object containing an image
688 specifier (as well as other, seldom-used properties). Therefore, you
689 cannot set or access specifications for the glyph's image by directly
690 using `set-specifier', `specifier-instance' or the like on the glyph;
691 instead use them on `(glyph-image GLYPH)' or use the convenience
692 functions `set-glyph-image', `glyph-image-instance', and
693 `glyph-image'.
694
695 Once you have created a glyph, you specify where it will be used as follows:
696
697 -- To insert a glyph into a buffer, create an extent in the buffer and then
698 use `set-extent-begin-glyph' or `set-extent-end-glyph' to set a glyph
699 to be displayed at the corresponding edge of the extent. (It is common
700 to create zero-width extents for this purpose.)
701
702 -- To insert a glyph into the left or right margin of a buffer, first
703 make sure the margin is visible by setting a value for the specifiers
704 `left-margin-width' or `right-margin-width'. (Not strictly necessary
705 when using margin glyphs with layout policy `whitespace'.) Then follow
706 the same procedure above for inserting a glyph in a buffer, and then
707 set a non-default layout policy for the glyph using
708 `set-extent-begin-glyph-layout' or `set-extent-end-glyph-layout'.
709 Alternatively, use the high-level annotations API (see
710 `make-annotation'). (In point of fact, you can also use the annotations
711 API for glyphs in a buffer, by setting a layout policy of `text'.)
712
713 -- To insert a glyph into the modeline, just put the glyph directly as
714 one of the modeline elements. (Unfortunately you can't currently
715 put a begin glyph or end glyph on one of the modeline extents --
716 they're ignored.)
717
718 -- To insert a glyph into a toolbar, specify it as part of a toolbar
719 instantiator (typically set on the specifier `default-toolbar').
720 See `default-toolbar' for more information. (Note that it is standard
721 practice to use a symbol in place of the glyph list in the toolbar
722 instantiator; the symbol is evalled to get the glyph list. This
723 facilitates both creating the toolbar instantiator and modifying
724 individual glyphs in a toolbar later on. For example, you can
725 change the way that the Mail toolbar button looks by modifying the
726 value of the variable `toolbar-mail-icon' (in general, `toolbar-*-icon')
727 and then calling `(set-specifier-dirty-flag default-toolbar)'.
728 (#### Unfortunately this doesn't quite work the way it should; the
729 change will appear in new frames, but not existing ones.
730
731 -- To insert a glyph into a gutter, create or modify a gutter instantiator
732 (typically set on the specifier `default-gutter'). Gutter instantiators
733 consist of strings or lists of strings, so to insert a glyph, create an
734 extent over the string, and use `set-extent-begin-glyph' or
735 `set-extent-end-glyph' to set a glyph to be displayed at the corresponding
736 edge of the extent, just like for glyphs in a buffer.
737
738 -- To use a glyph as the icon for a frame, you do not actually create a new
739 glyph; rather, you change the specifications for the existing glyph
740 `frame-icon-glyph'. (Remember that, because of the specifier nature of
741 glyphs, you can set different values for any particular buffer or frame.)
742
743 -- To use a glyph as the mouse pointer, in general you do not create a
744 new glyph, but rather you change the specifications of various existing
745 glyphs, such as `text-pointer-glyph' for the pointer used over text,
746 `modeline-pointer-glyph' for the pointer used over the modeline, etc.
747 Do an apropos over `*-pointer-glyph' to find all of them. (Note also
748 that you can temporarily set the mouse pointer to some specific shape
749 by using `set-frame-pointer', which takes an image instace, as obtained
750 from calling `glyph-image-instance' on a glyph of type `pointer' --
751 either one of the above-mentioned variables or one you created yourself.
752 (See below for what it means to create a glyph of type `pointer'.)
753 This pointer will last only until the next mouse motion event is
754 processed or certain other things happen, such as creating or deleting
755 a window. (In fact, the above-mentioned pointer glyph variables are
756 implemented as part of the default handler for mouse motion events.
757 If you want to customize this behavior, take a look at `mode-motion-hook',
758 or `mouse-motion-handler' if you really want to get low-level.)
759
760 -- To use a glyph to control the shape of miscellaneous redisplay effects
761 such as the truncation and continuation markers, set the appropriate
762 existing glyph variables, as for icons and pointers above. See
763 `continuation-glyph', `control-arrow-glyph', `hscroll-glyph',
764 `invisible-text-glyph', `octal-escape-glyph', and `truncation-glyph'.
765 See also `overlay-arrow-string', an odd redisplay leftover which can
766 be set to a glyph you created, and will cause the glyph to be displayed
767 on top of the text position specified in the marker stored in
768 `overlay-arrow-position'.
769
770 -- To use a glyph in a display table (i.e. to control the appearance of
771 any individual character), create the appropriate character glyphs
772 and then set a specification for the specifier `current-display-table',
773 which controls the appearance of characters. You can also set an
774 overriding display table for use with text displayed in a particular
775 face; see `set-face-display-table' and `make-display-table'.
776 #### Note: Display tables do not currently support general Mule
777 characters. They will be overhauled at some point to support this
778 and to provide other features required under Mule.
779
780 -- To use a glyph as the background pixmap of a face: Note that the
781 background pixmap of a face is actually an image specifier -- probably
782 the only place in XEmacs where an image specifier occurs outside of
783 a glyph. Similarly to how the glyph's image specifier works, you
784 don't create your own image specifier, but rather add specifications
785 to the existing one (using `set-face-background-pixmap'). Note that
786 the image instance that is generated in order to actually display the
787 background pixmap is of type `mono-pixmap', meaning that it's a two-color
788 image and the foreground and background of the image get filled in with
789 the corresponding colors from the face.
790
791 It is extremely rare that you will ever have to specify a value for TYPE,
792 which should be one of `buffer' (used for glyphs in an extent, the modeline,
793 the toolbar, or elsewhere in a buffer), `pointer' (used for the mouse-pointer), 386 the toolbar, or elsewhere in a buffer), `pointer' (used for the mouse-pointer),
794 or `icon' (used for a frame's icon), and defaults to `buffer'. The only cases 387 or `icon' (used for a frame's icon), and defaults to `buffer'.
795 where it needs to be specified is when creating icon or pointer glyphs, and 388
796 in both cases the necessary glyphs have already been created at startup and 389 SPEC-LIST is used to initialize the glyph's image. It is typically an
797 are accessed through the appropriate variables, e.g. `text-pointer-glyph' 390 image instantiator (a string or a vector; see `image-specifier-p' for
798 (or in general, `*-pointer-glyph') and `frame-icon-glyph'." 391 a detailed description of the valid image instantiators), but can also
392 be a list of such instantiators (each one in turn is tried until an
393 image is successfully produced), a cons of a locale (frame, buffer, etc.)
394 and an instantiator, a list of such conses, or any other form accepted
395 by `canonicalize-spec-list'. See `make-specifier' for more information
396 about specifiers."
799 (let ((glyph (make-glyph-internal type))) 397 (let ((glyph (make-glyph-internal type)))
800 (and spec-list (set-glyph-image glyph spec-list)) 398 (and spec-list (set-glyph-image glyph spec-list))
801 glyph)) 399 glyph))
802 400
803 (defun buffer-glyph-p (object) 401 (defun buffer-glyph-p (object)
812 "Return t if OBJECT is a glyph of type `icon'." 410 "Return t if OBJECT is a glyph of type `icon'."
813 (and (glyphp object) (eq 'icon (glyph-type object)))) 411 (and (glyphp object) (eq 'icon (glyph-type object))))
814 412
815 (defun make-pointer-glyph (&optional spec-list) 413 (defun make-pointer-glyph (&optional spec-list)
816 "Return a new `pointer-glyph' object with the specification list SPEC-LIST. 414 "Return a new `pointer-glyph' object with the specification list SPEC-LIST.
415
817 This is equivalent to calling `make-glyph', specifying a type of `pointer'. 416 This is equivalent to calling `make-glyph', specifying a type of `pointer'.
818 See `make-glyph' for more information. 417
819 418 SPEC-LIST is used to initialize the glyph's image. It is typically an
820 It is extremely unlikely that you will ever need to create a pointer glyph. 419 image instantiator (a string or a vector; see `image-specifier-p' for
821 Instead, you probably want to be calling `set-glyph-image' on an existing 420 a detailed description of the valid image instantiators), but can also
822 glyph, e.g. `text-pointer-glyph'." 421 be a list of such instantiators (each one in turn is tried until an
422 image is successfully produced), a cons of a locale (frame, buffer, etc.)
423 and an instantiator, a list of such conses, or any other form accepted
424 by `canonicalize-spec-list'. See `make-specifier' for more information
425 about specifiers.
426
427 You can also create a glyph with an empty SPEC-LIST and add image
428 instantiators afterwards using `set-glyph-image'."
823 (make-glyph spec-list 'pointer)) 429 (make-glyph spec-list 'pointer))
824 430
825 (defun make-icon-glyph (&optional spec-list) 431 (defun make-icon-glyph (&optional spec-list)
826 "Return a new `icon-glyph' object with the specification list SPEC-LIST. 432 "Return a new `icon-glyph' object with the specification list SPEC-LIST.
433
827 This is equivalent to calling `make-glyph', specifying a type of `icon'. 434 This is equivalent to calling `make-glyph', specifying a type of `icon'.
828 See `make-glyph' for more information. 435
829 436 SPEC-LIST is used to initialize the glyph's image. It is typically an
830 It is extremely unlikely that you will ever need to create a icon glyph. 437 image instantiator (a string or a vector; see `image-specifier-p' for
831 Instead, you probably want to be calling `set-glyph-image' on 438 a detailed description of the valid image instantiators), but can also
832 `frame-icon-glyph'." 439 be a list of such instantiators (each one in turn is tried until an
440 image is successfully produced), a cons of a locale (frame, buffer, etc.)
441 and an instantiator, a list of such conses, or any other form accepted
442 by `canonicalize-spec-list'. See `make-specifier' for more information
443 about specifiers.
444
445 You can also create a glyph with an empty SPEC-LIST and add image
446 instantiators afterwards using `set-glyph-image'."
833 (make-glyph spec-list 'icon)) 447 (make-glyph spec-list 'icon))
834 448
835 (defun nothing-image-instance-p (object) 449 (defun nothing-image-instance-p (object)
836 "Return t if OBJECT is an image instance of type `nothing'." 450 "Return t if OBJECT is an image instance of type `nothing'."
837 (and (image-instance-p object) (eq 'nothing (image-instance-type object)))) 451 (and (image-instance-p object) (eq 'nothing (image-instance-type object))))
852 466
853 (defun pointer-image-instance-p (object) 467 (defun pointer-image-instance-p (object)
854 "Return t if OBJECT is an image instance of type `pointer'." 468 "Return t if OBJECT is an image instance of type `pointer'."
855 (and (image-instance-p object) (eq 'pointer (image-instance-type object)))) 469 (and (image-instance-p object) (eq 'pointer (image-instance-type object))))
856 470
857 (defun widget-image-instance-p (object)
858 "Return t if OBJECT is an image instance of type `widget'."
859 (and (image-instance-p object) (eq 'widget (image-instance-type object))))
860
861 (defun subwindow-image-instance-p (object) 471 (defun subwindow-image-instance-p (object)
862 "Return t if OBJECT is an image instance of type `subwindow'." 472 "Return t if OBJECT is an image instance of type `subwindow'.
473 Subwindows are not implemented in this version of XEmacs."
863 (and (image-instance-p object) (eq 'subwindow (image-instance-type object)))) 474 (and (image-instance-p object) (eq 'subwindow (image-instance-type object))))
864 475
865 ;;;;;;;;;; the built-in glyphs 476 ;;;;;;;;;; the built-in glyphs
866 477
867 (defvar text-pointer-glyph (make-pointer-glyph) 478 (defvar text-pointer-glyph (make-pointer-glyph)