Mercurial > hg > xemacs-beta
comparison man/lispref/glyphs.texi @ 412:697ef44129c6 r21-2-14
Import from CVS: tag r21-2-14
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:20:41 +0200 |
parents | de805c49cfc1 |
children |
comparison
equal
deleted
inserted
replaced
411:12e008d41344 | 412:697ef44129c6 |
---|---|
5 @setfilename ../../info/glyphs.info | 5 @setfilename ../../info/glyphs.info |
6 @node Glyphs, Annotations, Faces and Window-System Objects, top | 6 @node Glyphs, Annotations, Faces and Window-System Objects, top |
7 @chapter Glyphs | 7 @chapter Glyphs |
8 @cindex glyphs | 8 @cindex glyphs |
9 | 9 |
10 A @dfn{glyph} is an object that is used for pixmaps, widgets and | 10 A @dfn{glyph} is an object that is used for pixmaps and images of all |
11 images of all sorts, as well as for things that ``act'' like pixmaps, | 11 sorts, as well as for things that ``act'' like pixmaps, such as |
12 such as non-textual strings (@dfn{annotations}) displayed in a buffer or | 12 non-textual strings (@dfn{annotations}) displayed in a buffer or in the |
13 in the margins. It is used in begin-glyphs and end-glyphs attached to | 13 margins. It is used in begin-glyphs and end-glyphs attached to extents, |
14 extents, marginal and textual annotations, overlay arrows | 14 marginal and textual annotations, overlay arrows (@code{overlay-arrow-*} |
15 (@code{overlay-arrow-*} variables), toolbar buttons, mouse pointers, | 15 variables), toolbar buttons, mouse pointers, frame icons, truncation and |
16 frame icons, truncation and continuation markers, and the | 16 continuation markers, and the like. (Basically, any place there is an |
17 like. (Basically, any place there is an image or something that acts | 17 image or something that acts like an image, there will be a glyph object |
18 like an image, there will be a glyph object representing it.) | 18 representing it.) |
19 | 19 |
20 The actual image that is displayed (as opposed to its position or | 20 The actual image that is displayed (as opposed to its position or |
21 clipping) is defined by an @dfn{image specifier} object contained | 21 clipping) is defined by an @dfn{image specifier} object contained |
22 within the glyph. The separation between an image specifier object | 22 within the glyph. The separation between an image specifier object |
23 and a glyph object is made because the glyph includes other properties | 23 and a glyph object is made because the glyph includes other properties |
69 into which the glyph's image can be instantiated. @var{type} should be | 69 into which the glyph's image can be instantiated. @var{type} should be |
70 one of @code{buffer} (used for glyphs in an extent, the modeline, the | 70 one of @code{buffer} (used for glyphs in an extent, the modeline, the |
71 toolbar, or elsewhere in a buffer), @code{pointer} (used for the | 71 toolbar, or elsewhere in a buffer), @code{pointer} (used for the |
72 mouse-pointer), or @code{icon} (used for a frame's icon), and defaults | 72 mouse-pointer), or @code{icon} (used for a frame's icon), and defaults |
73 to @code{buffer}. @xref{Glyph Types}. | 73 to @code{buffer}. @xref{Glyph Types}. |
74 | |
75 A glyph in XEmacs does @strong{NOT} refer to a single unit of textual | |
76 display (the XEmacs term for this is @dfn{rune}), but rather is an | |
77 object encapsulating a graphical element, such as an image or widget (an | |
78 element such as a button or text field; @dfn{widget} is the term for | |
79 this under X Windows, and it's called a @dfn{control} under MS Windows). | |
80 This graphical element could appear in a buffer, a margin, a gutter, or | |
81 a toolbar, or as a mouse pointer or an icon, for example. | |
82 | |
83 Creating a glyph using @code{make-glyph} does not specify @emph{where} | |
84 the glyph will be used, but it does specify @emph{what} the glyph will | |
85 look like. In particular, SPEC-LIST is used to specify this, and it's | |
86 used to initialize the glyph's @code{image} property, which is an image | |
87 specifier. (Note that @dfn{image} as used in the context of a glyph's | |
88 @code{image} property or in the terms @dfn{image specifier}, @dfn{image | |
89 instantiator}, or @dfn{image instance} does not refer to what people | |
90 normally think of as an image (which in XEmacs is called a | |
91 @dfn{pixmap}), but to any graphical element---a pixmap, a widget, or | |
92 even a block of text, when used in the places that call for a glyph.) | |
93 The format of the SPEC-LIST is typically an image instantiator (a string | |
94 or a vector; @ref{Image Specifiers}), but can also be a list of such | |
95 instantiators (each one in turn is tried until an image is successfully | |
96 produced), a cons of a locale (frame, buffer, etc.) and an | |
97 instantiator, a list of such conses, or any other form accepted by | |
98 @code{canonicalize-spec-list}. @xref{Specifiers}, for more information | |
99 about specifiers. | |
100 | |
101 If you're not familiar with specifiers, you should be in order to | |
102 understand how glyphs work. The clearest introduction to specifiers | |
103 is in the Lispref manual, available under Info. (Choose | |
104 Help->Info->Info Contents on the menubar or type C-h i.) You can | |
105 also see @code{make-specifier} for a capsule summary. What's important to | |
106 keep in mind is that a specifier lets you set a different value for | |
107 any particular buffer, window, frame, device, or console. This allows | |
108 for a great deal of flexibility; in particular, only one global glyph | |
109 needs to exist for a particular purpose (e.g. the icon used to represent | |
110 an iconified frame, the mouse pointer used over particular areas of a | |
111 frame, etc.), and in these cases you do not create your own glyph, but | |
112 rather modify the existing one. | |
113 | |
114 As well as using @var{spec-list} to initialize the glyph, you can set | |
115 specifications using @code{set-glyph-image}. Note that, due to a | |
116 possibly questionable historical design decision, a glyph itself is not | |
117 actually a specifier, but rather is an object containing an image | |
118 specifier (as well as other, seldom-used properties). Therefore, you | |
119 cannot set or access specifications for the glyph's image by directly | |
120 using @code{set-specifier}, @code{specifier-instance} or the like on the | |
121 glyph; instead use them on @code{(glyph-image @var{glyph})} or use the | |
122 convenience functions @code{set-glyph-image}, | |
123 @code{glyph-image-instance}, and @code{glyph-image}. | |
124 | |
125 Once you have created a glyph, you specify where it will be used as | |
126 follows: | |
127 | |
128 @itemize @bullet | |
129 @item | |
130 To insert a glyph into a buffer, create an extent in the buffer and then | |
131 use @code{set-extent-begin-glyph} or @code{set-extent-end-glyph} to set | |
132 a glyph to be displayed at the corresponding edge of the extent. (It is | |
133 common to create zero-width extents for this purpose.) | |
134 | |
135 @item | |
136 To insert a glyph into the left or right margin of a buffer, first | |
137 make sure the margin is visible by setting a value for the specifiers | |
138 @code{left-margin-width} or @code{right-margin-width}. (Not strictly necessary | |
139 when using margin glyphs with layout policy @code{whitespace}.) Then follow | |
140 the same procedure above for inserting a glyph in a buffer, and then | |
141 set a non-default layout policy for the glyph using | |
142 @code{set-extent-begin-glyph-layout} or @code{set-extent-end-glyph-layout}. | |
143 Alternatively, use the high-level annotations API (see | |
144 @code{make-annotation}). (In point of fact, you can also use the annotations | |
145 API for glyphs in a buffer, by setting a layout policy of @code{text}.) | |
146 | |
147 @item | |
148 To insert a glyph into the modeline, just put the glyph directly as one | |
149 of the modeline elements. (Unfortunately you can't currently put a begin | |
150 glyph or end glyph on one of the modeline extents---they're ignored.) | |
151 | |
152 @item | |
153 To insert a glyph into a toolbar, specify it as part of a toolbar | |
154 instantiator (typically set on the specifier @code{default-toolbar}). | |
155 See @code{default-toolbar} for more information. (Note that it is | |
156 standard practice to use a symbol in place of the glyph list in the | |
157 toolbar instantiator; the symbol is evalled to get the glyph list. This | |
158 facilitates both creating the toolbar instantiator and modifying | |
159 individual glyphs in a toolbar later on. For example, you can change | |
160 the way that the Mail toolbar button looks by modifying the value of the | |
161 variable @code{toolbar-mail-icon} (in general, @code{toolbar-*-icon}) | |
162 and then calling @code{(set-specifier-dirty-flag default-toolbar)}. | |
163 (#### Unfortunately this doesn't quite work the way it should; the | |
164 change will appear in new frames, but not existing ones. | |
165 | |
166 @item | |
167 To insert a glyph into a gutter, create or modify a gutter instantiator | |
168 (typically set on the specifier @code{default-gutter}). Gutter | |
169 instantiators consist of strings or lists of strings, so to insert a | |
170 glyph, create an extent over the string, and use | |
171 @code{set-extent-begin-glyph} or @code{set-extent-end-glyph} to set a | |
172 glyph to be displayed at the corresponding edge of the extent, just like | |
173 for glyphs in a buffer. | |
174 | |
175 @item | |
176 To use a glyph as the icon for a frame, you do not actually create a new | |
177 glyph; rather, you change the specifications for the existing glyph | |
178 @code{frame-icon-glyph}. (Remember that, because of the specifier nature | |
179 of glyphs, you can set different values for any particular buffer or | |
180 frame.) | |
181 | |
182 @item | |
183 To use a glyph as the mouse pointer, in general you do not create a new | |
184 glyph, but rather you change the specifications of various existing | |
185 glyphs, such as @code{text-pointer-glyph} for the pointer used over | |
186 text, @code{modeline-pointer-glyph} for the pointer used over the | |
187 modeline, etc. Do an apropos over @code{*-pointer-glyph} to find all of | |
188 them. (Note also that you can temporarily set the mouse pointer to some | |
189 specific shape by using @code{set-frame-pointer}, which takes an image | |
190 instance, as obtained from calling @code{glyph-image-instance} on a glyph | |
191 of type @code{pointer} -- either one of the above-mentioned variables or | |
192 one you created yourself. (See below for what it means to create a | |
193 glyph of type @code{pointer}.) This pointer will last only until the | |
194 next mouse motion event is processed or certain other things happen, | |
195 such as creating or deleting a window. (In fact, the above-mentioned | |
196 pointer glyph variables are implemented as part of the default handler | |
197 for mouse motion events. If you want to customize this behavior, take a | |
198 look at @code{mode-motion-hook}, or @code{mouse-motion-handler} if you | |
199 really want to get low-level.) | |
200 | |
201 @item | |
202 To use a glyph to control the shape of miscellaneous redisplay effects | |
203 such as the truncation and continuation markers, set the appropriate | |
204 existing glyph variables, as for icons and pointers above. See | |
205 @code{continuation-glyph}, @code{control-arrow-glyph}, | |
206 @code{hscroll-glyph}, @code{invisible-text-glyph}, | |
207 @code{octal-escape-glyph}, and @code{truncation-glyph}. See also | |
208 @code{overlay-arrow-string}, an odd redisplay leftover which can be set | |
209 to a glyph you created, and will cause the glyph to be displayed on top | |
210 of the text position specified in the marker stored in | |
211 @code{overlay-arrow-position}. | |
212 | |
213 @item | |
214 To use a glyph in a display table (i.e. to control the appearance of any | |
215 individual character), create the appropriate character glyphs and then | |
216 set a specification for the specifier @code{current-display-table}, | |
217 which controls the appearance of characters. You can also set an | |
218 overriding display table for use with text displayed in a particular | |
219 face; see @code{set-face-display-table} and @code{make-display-table}. | |
220 #### Note: Display tables do not currently support general Mule | |
221 characters. They will be overhauled at some point to support this | |
222 and to provide other features required under Mule. | |
223 | |
224 @item | |
225 To use a glyph as the background pixmap of a face: Note that the | |
226 background pixmap of a face is actually an image specifier -- probably | |
227 the only place in XEmacs where an image specifier occurs outside of a | |
228 glyph. Similarly to how the glyph's image specifier works, you don't | |
229 create your own image specifier, but rather add specifications to the | |
230 existing one (using @code{set-face-background-pixmap}). Note that the | |
231 image instance that is generated in order to actually display the | |
232 background pixmap is of type @code{mono-pixmap}, meaning that it's a | |
233 two-color image and the foreground and background of the image get | |
234 filled in with the corresponding colors from the face. | |
235 @end itemize | |
236 | |
237 It is extremely rare that you will ever have to specify a value for | |
238 TYPE, which should be one of @code{buffer} (used for glyphs in an | |
239 extent, the modeline, the toolbar, or elsewhere in a buffer), | |
240 @code{pointer} (used for the mouse-pointer), or @code{icon} (used for a | |
241 frame's icon), and defaults to @code{buffer}. The only cases where it | |
242 needs to be specified is when creating icon or pointer glyphs, and in | |
243 both cases the necessary glyphs have already been created at startup and | |
244 are accessed through the appropriate variables, | |
245 e.g. @code{text-pointer-glyph} (or in general, @code{*-pointer-glyph}) | |
246 and @code{frame-icon-glyph}. @xref{Glyph Types}. | |
247 @end defun | 74 @end defun |
248 | 75 |
249 @defun make-glyph-internal &optional type | 76 @defun make-glyph-internal &optional type |
250 This function creates a new, uninitialized glyph of type @var{type}. | 77 This function creates a new, uninitialized glyph of type @var{type}. |
251 @end defun | 78 @end defun |
252 | 79 |
253 @defun make-pointer-glyph &optional spec-list | 80 @defun make-pointer-glyph &optional spec-list |
254 | 81 This function is equivalent to calling @code{make-glyph} with a |
255 Return a new @code{pointer-glyph} object with the specification list | 82 @var{type} of @code{pointer}. |
256 @var{spec-list}. This function is equivalent to calling | |
257 @code{make-glyph} with a @var{type} of @code{pointer}. | |
258 | |
259 It is extremely unlikely that you will ever need to create a pointer | |
260 glyph. Instead, you probably want to be calling @code{set-glyph-image} | |
261 on an existing glyph, e.g. @code{text-pointer-glyph}. | |
262 @end defun | 83 @end defun |
263 | 84 |
264 @defun make-icon-glyph &optional spec-list | 85 @defun make-icon-glyph &optional spec-list |
265 | 86 This function is equivalent to calling @code{make-glyph} with a |
266 Return a new @code{pointer-glyph} object with the specification list | 87 @var{type} of @code{icon}. |
267 @var{spec-list}. This function is equivalent to calling | |
268 @code{make-glyph} with a @var{type} of @code{icon}. | |
269 | |
270 It is extremely unlikely that you will ever need to create a pointer | |
271 glyph. Instead, you probably want to be calling @code{set-glyph-image} | |
272 on an existing glyph, e.g. @code{text-pointer-glyph}. | |
273 @end defun | 88 @end defun |
274 | 89 |
275 @node Glyph Properties | 90 @node Glyph Properties |
276 @subsection Glyph Properties | 91 @subsection Glyph Properties |
277 | 92 |
603 Usually, an image specifier results from calling @code{glyph-image} on | 418 Usually, an image specifier results from calling @code{glyph-image} on |
604 a glyph. | 419 a glyph. |
605 @end defun | 420 @end defun |
606 | 421 |
607 @defun make-image-specifier spec-list | 422 @defun make-image-specifier spec-list |
608 This function creates a new image specifier object and initializes it | 423 This function creates a new image specifier object and initializes |
609 according to @var{spec-list}. @xref{Specifiers}. | 424 it according to @var{spec-list}. It is unlikely that you will ever |
610 | 425 want to do this, but this function is provided for completeness and |
611 Note that, in practice, you rarely, if ever, need to actually create an | 426 for experimentation purposes. @xref{Specifiers}. |
612 image specifier! (This function exists mainly for completeness.) Pretty | |
613 much the only use for image specifiers is to control how glyphs are | |
614 displayed, and the image specifier associated with a glyph (the | |
615 @code{image} property of a glyph) is created automatically when a glyph | |
616 is created and need not (and cannot, for that matter) ever be changed | |
617 (@pxref{Glyphs}). In fact, the design decision to create a separate | |
618 image specifier type, rather than make glyphs themselves be specifiers, | |
619 is debatable---the other properties of glyphs are rarely used and could | |
620 conceivably have been incorporated into the glyph's instantiator. The | |
621 rarely used glyph types (buffer, pointer, icon) could also have been | |
622 incorporated into the instantiator. | |
623 @end defun | 427 @end defun |
624 | 428 |
625 Image instantiators come in many formats: @code{xbm}, @code{xpm}, | 429 Image instantiators come in many formats: @code{xbm}, @code{xpm}, |
626 @code{gif}, @code{jpeg}, etc. This describes the format of the data | 430 @code{gif}, @code{jpeg}, etc. This describes the format of the data |
627 describing the image. The resulting image instances also come in many | 431 describing the image. The resulting image instances also come in many |
628 types---@code{mono-pixmap}, @code{color-pixmap}, @code{text}, | 432 types -- @code{mono-pixmap}, @code{color-pixmap}, @code{text}, |
629 @code{pointer}, etc. This refers to the behavior of the image and the | 433 @code{pointer}, etc. This refers to the behavior of the image and the |
630 sorts of places it can appear. (For example, a color-pixmap image has | 434 sorts of places it can appear. (For example, a color-pixmap image has |
631 fixed colors specified for it, while a mono-pixmap image comes in two | 435 fixed colors specified for it, while a mono-pixmap image comes in two |
632 unspecified shades ``foreground'' and ``background'' that are determined | 436 unspecified shades ``foreground'' and ``background'' that are determined |
633 from the face of the glyph or surrounding text; a text image appears as | 437 from the face of the glyph or surrounding text; a text image appears as |
656 i.e. a format symbol followed by zero or more alternating keyword-value | 460 i.e. a format symbol followed by zero or more alternating keyword-value |
657 pairs. The @dfn{format} field should be a symbol, one of | 461 pairs. The @dfn{format} field should be a symbol, one of |
658 | 462 |
659 @table @code | 463 @table @code |
660 @item nothing | 464 @item nothing |
661 Don't display anything; no keywords are valid for this. Can only be | 465 (Don't display anything; no keywords are valid for this. Can only be |
662 instanced as @code{nothing}. | 466 instanced as @code{nothing}.) |
663 @item string | 467 @item string |
664 Display this image as a text string. Can only be instanced | 468 (Display this image as a text string. Can only be instanced |
665 as @code{text}, although support for instancing as @code{mono-pixmap} | 469 as @code{text}, although support for instancing as @code{mono-pixmap} |
666 should be added. | 470 should be added.) |
667 @item formatted-string | 471 @item formatted-string |
668 Display this image as a text string with replaceable fields, | 472 (Display this image as a text string with replaceable fields, |
669 similar to a modeline format string; not currently implemented. | 473 similar to a modeline format string; not currently implemented.) |
670 @item xbm | 474 @item xbm |
671 An X bitmap; only if X support was compiled into this XEmacs. Can be | 475 (An X bitmap; only if X support was compiled into this XEmacs. Can be |
672 instanced as @code{mono-pixmap}, @code{color-pixmap}, or | 476 instanced as @code{mono-pixmap}, @code{color-pixmap}, or |
673 @code{pointer}. | 477 @code{pointer}.) |
674 @item xpm | 478 @item xpm |
675 An XPM pixmap; only if XPM support was compiled into this XEmacs. Can | 479 (An XPM pixmap; only if XPM support was compiled into this XEmacs. Can |
676 be instanced as @code{color-pixmap}, @code{mono-pixmap}, or | 480 be instanced as @code{color-pixmap}, @code{mono-pixmap}, or |
677 @code{pointer}. XPM is an add-on library for X that was designed to | 481 @code{pointer}. XPM is an add-on library for X that was designed to |
678 rectify the shortcomings of the XBM format. Most implementations of X | 482 rectify the shortcomings of the XBM format. Most implementations of X |
679 include the XPM library as a standard part. If your vendor does not, it | 483 include the XPM library as a standard part. If your vendor does not, it |
680 is highly recommended that you download it and install it. You can get | 484 is highly recommended that you download it and install it. You can get |
681 it from the standard XEmacs FTP site, among other places. | 485 it from the standard XEmacs FTP site, among other places.) |
682 @item xface | 486 @item xface |
683 An X-Face bitmap, used to encode people's faces in e-mail messages; | 487 (An X-Face bitmap, used to encode people's faces in e-mail messages; |
684 only if X-Face support was compiled into this XEmacs. Can be instanced | 488 only if X-Face support was compiled into this XEmacs. Can be instanced |
685 as @code{mono-pixmap}, @code{color-pixmap}, or @code{pointer}. | 489 as @code{mono-pixmap}, @code{color-pixmap}, or @code{pointer}.) |
686 @item gif | 490 @item gif |
687 A GIF87 or GIF89 image; only if GIF support was compiled into this | 491 (A GIF87 or GIF89 image; only if GIF support was compiled into this |
688 XEmacs. Can be instanced as @code{color-pixmap}. Note that XEmacs | 492 XEmacs. Can be instanced as @code{color-pixmap}. Note that XEmacs |
689 includes GIF decoding functions as a standard part of it, so if you have | 493 includes GIF decoding functions as a standard part of it, so if you have |
690 X support, you will normally have GIF support, unless you explicitly | 494 X support, you will normally have GIF support, unless you explicitly |
691 disable it at configure time. | 495 disable it at configure time.) |
692 @item jpeg | 496 @item jpeg |
693 A JPEG-format image; only if JPEG support was compiled into this | 497 (A JPEG-format image; only if JPEG support was compiled into this |
694 XEmacs. Can be instanced as @code{color-pixmap}. If you have the JPEG | 498 XEmacs. Can be instanced as @code{color-pixmap}. If you have the JPEG |
695 libraries present on your system when XEmacs is built, XEmacs will | 499 libraries present on your system when XEmacs is built, XEmacs will |
696 automatically detect this and use them, unless you explicitly disable it | 500 automatically detect this and use them, unless you explicitly disable it |
697 at configure time. | 501 at configure time.) |
698 @item png | 502 @item png |
699 A PNG/GIF24 image; only if PNG support was compiled into this XEmacs. | 503 (A PNG/GIF24 image; only if PNG support was compiled into this XEmacs. |
700 Can be instanced as @code{color-pixmap}. | 504 Can be instanced as @code{color-pixmap}.) |
701 @item tiff | 505 @item tiff |
702 A TIFF-format image; only if TIFF support was compiled into this XEmacs. | 506 (A TIFF-format image; only if TIFF support was compiled into this XEmacs. |
507 Not currently implemented.) | |
703 @item cursor-font | 508 @item cursor-font |
704 One of the standard cursor-font names, such as @samp{watch} or | 509 (One of the standard cursor-font names, such as @samp{watch} or |
705 @samp{right_ptr} under X. Under X, this is, more specifically, any of | 510 @samp{right_ptr} under X. Under X, this is, more specifically, any of |
706 the standard cursor names from appendix B of the Xlib manual [also known | 511 the standard cursor names from appendix B of the Xlib manual [also known |
707 as the file @file{<X11/cursorfont.h>}] minus the @samp{XC_} prefix. On | 512 as the file @file{<X11/cursorfont.h>}] minus the @samp{XC_} prefix. On |
708 other window systems, the valid names will be specific to the type of | 513 other window systems, the valid names will be specific to the type of |
709 window system. Can only be instanced as @code{pointer}. | 514 window system. Can only be instanced as @code{pointer}.) |
710 @item font | 515 @item font |
711 A glyph from a font; i.e. the name of a font, and glyph index into it | 516 (A glyph from a font; i.e. the name of a font, and glyph index into it |
712 of the form @samp{@var{font} fontname index [[mask-font] mask-index]}. | 517 of the form @samp{@var{font} fontname index [[mask-font] mask-index]}. |
713 Only if X support was compiled into this XEmacs. Currently can only be | 518 Only if X support was compiled into this XEmacs. Currently can only be |
714 instanced as @code{pointer}, although this should probably be fixed. | 519 instanced as @code{pointer}, although this should probably be fixed.) |
715 @item mswindows-resource | |
716 An MS Windows pointer resource. Specifies a resource to retrieve | |
717 directly from the system (an OEM resource) or from a file, particularly | |
718 an executable file. If the resource is to be retrieved from a file, use | |
719 :file and optionally :resource-id. Otherwise use :resource-id. Always | |
720 specify :resource-type to specify the type (cursor, bitmap or icon) of | |
721 the resource. Possible values for :resource-id are listed below. Can | |
722 be instanced as @code{pointer} or @code{color-pixmap}. | |
723 @item subwindow | 520 @item subwindow |
724 An embedded windowing system window. Can only be instanced as | 521 (An embedded X window; not currently implemented.) |
725 @code{subwindow}. | |
726 @item button | |
727 A button widget; either a push button, radio button or toggle button. | |
728 Can only be instanced as @code{widget}. | |
729 @item combo-box | |
730 A drop list of selectable items in a widget, for editing text. | |
731 Can only be instanced as @code{widget}. | |
732 @item edit-field | |
733 A text editing widget. Can only be instanced as @code{widget}. | |
734 @item label | |
735 A static, text-only, widget; for displaying text. Can only be instanced | |
736 as @code{widget}. | |
737 @item layout | |
738 A widget for controlling the positioning of children underneath it. | |
739 Through the use of nested layouts, a widget hierarchy can be created | |
740 which can have the appearance of any standard dialog box or similar | |
741 arrangement; all of this is counted as one @dfn{glyph} and could appear | |
742 in many of the places that expect a single glyph. Can only be instanced | |
743 as @code{widget}. | |
744 @item native-layout | |
745 @c #### Document me better! | |
746 The native version of a layout widget. | |
747 Can only be instanced as @code{widget}. | |
748 @item progress-gauge | |
749 A sliding widget, for showing progress. Can only be instanced as | |
750 @code{widget}. | |
751 @item tab-control | |
752 A tab widget; a series of user selectable tabs. Can only be instanced | |
753 as @code{widget}. | |
754 @item tree-view | |
755 A folding widget. Can only be instanced as @code{widget}. | |
756 @item scrollbar | |
757 A scrollbar widget. Can only be instanced as @code{widget}. | |
758 @item autodetect | 522 @item autodetect |
759 XEmacs tries to guess what format the data is in. If X support exists, | 523 (XEmacs tries to guess what format the data is in. If X support exists, |
760 the data string will be checked to see if it names a filename. If so, | 524 the data string will be checked to see if it names a filename. If so, |
761 and this filename contains XBM or XPM data, the appropriate sort of | 525 and this filename contains XBM or XPM data, the appropriate sort of |
762 pixmap or pointer will be created. [This includes picking up any | 526 pixmap or pointer will be created. [This includes picking up any |
763 specified hotspot or associated mask file.] Otherwise, if @code{pointer} | 527 specified hotspot or associated mask file.] Otherwise, if @code{pointer} |
764 is one of the allowable image-instance types and the string names a | 528 is one of the allowable image-instance types and the string names a |
765 valid cursor-font name, the image will be created as a pointer. | 529 valid cursor-font name, the image will be created as a pointer. |
766 Otherwise, the image will be displayed as text. If no X support exists, | 530 Otherwise, the image will be displayed as text. If no X support exists, |
767 the image will always be displayed as text. | 531 the image will always be displayed as text.) |
768 @item inherit | |
769 Inherit from the background-pixmap property of a face. Can only be | |
770 instanced as @code{mono-pixmap}. | |
771 @end table | 532 @end table |
772 | 533 |
773 The valid keywords are: | 534 The valid keywords are: |
774 | 535 |
775 @table @code | 536 @table @code |
776 @item :data | 537 @item :data |
777 Inline data. For most formats above, this should be a string. For | 538 (Inline data. For most formats above, this should be a string. For |
778 XBM images, this should be a list of three elements: width, height, and | 539 XBM images, this should be a list of three elements: width, height, and |
779 a string of bit data. This keyword is not valid for instantiator | 540 a string of bit data. This keyword is not valid for instantiator |
780 format @code{nothing}. | 541 format @code{nothing}.) |
781 | 542 |
782 @item :file | 543 @item :file |
783 Data is contained in a file. The value is the name of this file. If | 544 (Data is contained in a file. The value is the name of this file. If |
784 both @code{:data} and @code{:file} are specified, the image is created | 545 both @code{:data} and @code{:file} are specified, the image is created |
785 from what is specified in @code{:data} and the string in @code{:file} | 546 from what is specified in @code{:data} and the string in @code{:file} |
786 becomes the value of the @code{image-instance-file-name} function when | 547 becomes the value of the @code{image-instance-file-name} function when |
787 applied to the resulting image-instance. This keyword is not valid for | 548 applied to the resulting image-instance. This keyword is not valid for |
788 instantiator formats @code{nothing}, @code{string}, | 549 instantiator formats @code{nothing}, @code{string}, |
789 @code{formatted-string}, @code{cursor-font}, @code{font}, and | 550 @code{formatted-string}, @code{cursor-font}, @code{font}, and |
790 @code{autodetect}. | 551 @code{autodetect}.) |
791 | 552 |
792 @item :foreground | 553 @item :foreground |
793 @itemx :background | 554 @itemx :background |
794 For @code{xbm}, @code{xface}, @code{cursor-font}, and @code{font}. | 555 (For @code{xbm}, @code{xface}, @code{cursor-font}, and @code{font}. |
795 These keywords allow you to explicitly specify foreground and background | 556 These keywords allow you to explicitly specify foreground and background |
796 colors. The argument should be anything acceptable to | 557 colors. The argument should be anything acceptable to |
797 @code{make-color-instance}. This will cause what would be a | 558 @code{make-color-instance}. This will cause what would be a |
798 @code{mono-pixmap} to instead be colorized as a two-color color-pixmap, | 559 @code{mono-pixmap} to instead be colorized as a two-color color-pixmap, |
799 and specifies the foreground and/or background colors for a pointer | 560 and specifies the foreground and/or background colors for a pointer |
800 instead of black and white. | 561 instead of black and white.) |
801 | 562 |
802 @item :mask-data | 563 @item :mask-data |
803 For @code{xbm} and @code{xface}. This specifies a mask to be used with the | 564 (For @code{xbm} and @code{xface}. This specifies a mask to be used with the |
804 bitmap. The format is a list of width, height, and bits, like for | 565 bitmap. The format is a list of width, height, and bits, like for |
805 @code{:data}. | 566 @code{:data}.) |
806 | 567 |
807 @item :mask-file | 568 @item :mask-file |
808 For @code{xbm} and @code{xface}. This specifies a file containing the | 569 (For @code{xbm} and @code{xface}. This specifies a file containing the |
809 mask data. If neither a mask file nor inline mask data is given for an | 570 mask data. If neither a mask file nor inline mask data is given for an |
810 XBM image, and the XBM image comes from a file, XEmacs will look for a | 571 XBM image, and the XBM image comes from a file, XEmacs will look for a |
811 mask file with the same name as the image file but with @samp{Mask} or | 572 mask file with the same name as the image file but with @samp{Mask} or |
812 @samp{msk} appended. For example, if you specify the XBM file | 573 @samp{msk} appended. For example, if you specify the XBM file |
813 @file{left_ptr} [usually located in @file{/usr/include/X11/bitmaps}], | 574 @file{left_ptr} [usually located in @file{/usr/include/X11/bitmaps}], |
814 the associated mask file @file{left_ptrmsk} will automatically be picked | 575 the associated mask file @file{left_ptrmsk} will automatically be picked |
815 up. | 576 up.) |
816 | 577 |
817 @item :hotspot-x | 578 @item :hotspot-x |
818 @itemx :hotspot-y | 579 @itemx :hotspot-y |
819 For @code{xbm} and @code{xface}. These keywords specify a hotspot if | 580 (For @code{xbm} and @code{xface}. These keywords specify a hotspot if |
820 the image is instantiated as a @code{pointer}. Note that if the XBM | 581 the image is instantiated as a @code{pointer}. Note that if the XBM |
821 image file specifies a hotspot, it will automatically be picked up if no | 582 image file specifies a hotspot, it will automatically be picked up if no |
822 explicit hotspot is given. | 583 explicit hotspot is given.) |
823 | 584 |
824 @item :color-symbols | 585 @item :color-symbols |
825 Only for @code{xpm}. This specifies an alist that maps strings that | 586 (Only for @code{xpm}. This specifies an alist that maps strings that |
826 specify symbolic color names to the actual color to be used for that | 587 specify symbolic color names to the actual color to be used for that |
827 symbolic color (in the form of a string or a color-specifier object). | 588 symbolic color (in the form of a string or a color-specifier object). |
828 If this is not specified, the contents of @code{xpm-color-symbols} are | 589 If this is not specified, the contents of @code{xpm-color-symbols} are |
829 used to generate the alist. | 590 used to generate the alist.) |
830 @item :resource-id | |
831 Only for @code{mswindows-resource}. This must be either an integer | |
832 (which directly specifies a resource number) or a string. Valid strings | |
833 are | |
834 | |
835 For bitmaps: | |
836 | |
837 "close", "uparrow", "dnarrow", "rgarrow", "lfarrow", | |
838 "reduce", "zoom", "restore", "reduced", "zoomd", | |
839 "restored", "uparrowd", "dnarrowd", "rgarrowd", "lfarrowd", | |
840 "mnarrow", "combo", "uparrowi", "dnarrowi", "rgarrowi", | |
841 "lfarrowi", "size", "btsize", "check", "checkboxes", and | |
842 "btncorners". | |
843 | |
844 For cursors: | |
845 | |
846 "normal", "ibeam", "wait", "cross", "up", "sizenwse", | |
847 "sizenesw", "sizewe", "sizens", "sizeall", and "no". | |
848 | |
849 For icons: | |
850 | |
851 "sample", "hand", "ques", "bang", "note", and "winlogo". | |
852 @item :resource-type | |
853 Only for @code{mswindows-resource}. This must be a symbol, either | |
854 @code{cursor}, @code{icon}, or @code{bitmap}, specifying the type of | |
855 resource to be retrieved. | |
856 @item :face | |
857 Only for @code{inherit}. This specifies the face to inherit from. For | |
858 widgets this also specifies the face to use for display. It defaults to | |
859 gui-element-face. | |
860 @end table | 591 @end table |
861 | |
862 Keywords accepted as menu item specs are also accepted by widgets. | |
863 These are @code{:selected}, @code{:active}, @code{:suffix}, | |
864 @code{:keys}, @code{:style}, @code{:filter}, @code{:config}, | |
865 @code{:included}, @code{:key-sequence}, @code{:accelerator}, | |
866 @code{:label} and @code{:callback}. | |
867 | 592 |
868 If instead of a vector, the instantiator is a string, it will be | 593 If instead of a vector, the instantiator is a string, it will be |
869 converted into a vector by looking it up according to the specs in the | 594 converted into a vector by looking it up according to the specs in the |
870 @code{console-type-image-conversion-list} for the console type of | 595 @code{console-type-image-conversion-list} for the console type of |
871 the domain (usually a window; sometimes a frame or device) over which | 596 the domain (usually a window; sometimes a frame or device) over which |
1044 @defun nothing-image-instance-p object | 769 @defun nothing-image-instance-p object |
1045 This function returns non-@code{nil} if @var{object} is an image | 770 This function returns non-@code{nil} if @var{object} is an image |
1046 instance of type @code{nothing}. | 771 instance of type @code{nothing}. |
1047 @end defun | 772 @end defun |
1048 | 773 |
1049 @defun widget-image-instance-p object | |
1050 Return t if @var{object} is an image instance of type @code{widget}. | |
1051 @end defun | |
1052 | |
1053 @node Image Instance Functions | 774 @node Image Instance Functions |
1054 @subsubsection Image Instance Functions | 775 @subsubsection Image Instance Functions |
1055 | 776 |
1056 @defun make-image-instance data &optional domain dest-types no-error | 777 @defun make-image-instance data &optional device dest-types no-error |
1057 This function creates a new image-instance object. | 778 This function creates a new image-instance object. |
1058 | 779 |
1059 @var{data} is an image instantiator, which describes the image | 780 @var{data} is an image instantiator, which describes the image |
1060 (@pxref{Image Specifiers}). | 781 (@pxref{Image Specifiers}). |
1061 | 782 |
1067 @code{color-pixmap}, followed by @code{pointer}. For the other normal | 788 @code{color-pixmap}, followed by @code{pointer}. For the other normal |
1068 image formats, the most natural types are @code{color-pixmap}, followed | 789 image formats, the most natural types are @code{color-pixmap}, followed |
1069 by @code{mono-pixmap}, followed by @code{pointer}. For the string and | 790 by @code{mono-pixmap}, followed by @code{pointer}. For the string and |
1070 formatted-string formats, the most natural types are @code{text}, | 791 formatted-string formats, the most natural types are @code{text}, |
1071 followed by @code{mono-pixmap} (not currently implemented), followed by | 792 followed by @code{mono-pixmap} (not currently implemented), followed by |
1072 @code{color-pixmap} (not currently implemented). For MS Windows | 793 @code{color-pixmap} (not currently implemented). The other formats can |
1073 resources, the most natural type for pointer resources is | 794 only be instantiated as one type. (If you want to control more |
1074 @code{pointer}, and for the others it's @code{color-pixmap}. The other | 795 specifically the order of the types into which an image is instantiated, |
1075 formats can only be instantiated as one type. (If you want to control | 796 just call @code{make-image-instance} repeatedly until it succeeds, |
1076 more specifically the order of the types into which an image is | 797 passing less and less preferred destination types each time. |
1077 instantiated, just call @code{make-image-instance} repeatedly until it | |
1078 succeeds, passing less and less preferred destination types each time. | |
1079 | 798 |
1080 If @var{dest-types} is omitted, all possible types are allowed. | 799 If @var{dest-types} is omitted, all possible types are allowed. |
1081 | |
1082 @var{domain} specifies the domain to which the image instance will be | |
1083 attached. This domain is termed the @dfn{governing domain}. The type | |
1084 of the governing domain depends on the image instantiator | |
1085 format. (Although, more correctly, it should probably depend on the | |
1086 image instance type.) For example, pixmap image instances are specific | |
1087 to a device, but widget image instances are specific to a particular | |
1088 XEmacs window because in order to display such a widget when two windows | |
1089 onto the same buffer want to display the widget, two separate underlying | |
1090 widgets must be created. (That's because a widget is actually a child | |
1091 window-system window, and all window-system windows have a unique | |
1092 existence on the screen.) This means that the governing domain for a | |
1093 pixmap image instance will be some device (most likely, the only | |
1094 existing device), whereas the governing domain for a widget image | |
1095 instance will be some XEmacs window. | |
1096 | |
1097 If you specify an overly general @var{domain} (e.g. a frame when a | |
1098 window was wanted), an error is signaled. If you specify an overly | |
1099 specific @var{domain} (e.g. a window when a device was wanted), the | |
1100 corresponding general domain is fetched and used instead. For | |
1101 @code{make-image-instance}, it makes no difference whether you specify | |
1102 an overly specific domain or the properly general domain derived from | |
1103 it. However, it does matter when creating an image instance by | |
1104 instantiating a specifier or glyph (e.g. with | |
1105 @code{glyph-image-instance}), because the more specific domain causes | |
1106 spec lookup to start there and proceed to more general domains. (It | |
1107 would also matter when creating an image instance with an instantiator | |
1108 format of @code{inherit}, but we currently disallow this. #### We should | |
1109 fix this.) | |
1110 n | |
1111 If omitted, @var{domain} defaults to the selected window. | |
1112 | 800 |
1113 @var{no-error} controls what happens when the image cannot be generated. | 801 @var{no-error} controls what happens when the image cannot be generated. |
1114 If @var{nil}, an error message is generated. If @var{t}, no messages | 802 If @var{nil}, an error message is generated. If @var{t}, no messages |
1115 are generated and this function returns @var{nil}. If anything else, a | 803 are generated and this function returns @var{nil}. If anything else, a |
1116 warning message is generated and this function returns @var{nil}. | 804 warning message is generated and this function returns @var{nil}. |
1129 | 817 |
1130 @defun image-instance-name image-instance | 818 @defun image-instance-name image-instance |
1131 This function returns the name of the given image instance. | 819 This function returns the name of the given image instance. |
1132 @end defun | 820 @end defun |
1133 | 821 |
1134 @defun image-instance-domain image-instance | |
1135 | |
1136 Return the governing domain of the given @var{image-instance}. The | |
1137 governing domain of an image instance is the domain that the image | |
1138 instance is specific to. It is @emph{NOT} necessarily the domain that | |
1139 was given to the call to @code{specifier-instance} that resulted in the | |
1140 creation of this image instance. See @code{make-image-instance} for | |
1141 more information on governing domains. | |
1142 @end defun | |
1143 | |
1144 | |
1145 @defun image-instance-string image-instance | 822 @defun image-instance-string image-instance |
1146 This function returns the string of the given image instance. This will | 823 This function returns the string of the given image instance. This will |
1147 only be non-@code{nil} for text image instances. | 824 only be non-@code{nil} for text image instances. |
1148 @end defun | 825 @end defun |
1149 | 826 |