Mercurial > hg > xemacs-beta
comparison man/lispref/glyphs.texi @ 2182:c91543697b09
[xemacs-hg @ 2004-07-19 08:24:24 by stephent]
manual improvements <87n01w9zi9.fsf@tleepslib.sk.tsukuba.ac.jp>
author | stephent |
---|---|
date | Mon, 19 Jul 2004 08:24:28 +0000 |
parents | 4657b5a54253 |
children | 13a418960a88 |
comparison
equal
deleted
inserted
replaced
2181:5baae9bff30e | 2182:c91543697b09 |
---|---|
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, widgets, and |
11 images of all sorts, as well as for things that ``act'' like pixmaps, | 11 images of all sorts, as well as for things that ``act'' like pixmaps, |
12 such as non-textual strings (@dfn{annotations}) displayed in a buffer or | 12 such as non-textual strings (@dfn{annotations}) displayed in a buffer or |
13 in the margins. It is used in begin-glyphs and end-glyphs attached to | 13 in the margins. It is used in begin-glyphs and end-glyphs attached to |
14 extents, marginal and textual annotations, overlay arrows | 14 extents, marginal and textual annotations, overlay arrows |
15 (@code{overlay-arrow-*} variables), toolbar buttons, mouse pointers, | 15 (@code{overlay-arrow-*} variables), toolbar buttons, mouse pointers, |
16 frame icons, truncation and continuation markers, and the | 16 frame icons, truncation and continuation markers, and the |
17 like. (Basically, any place there is an image or something that acts | 17 like. Basically, any place there is an image or something that acts |
18 like an image, there will be a glyph object representing it.) | 18 like an image, there will be a glyph object representing it. |
19 | |
20 The actual image that is displayed (as opposed to its position or | |
21 clipping) is defined by an @dfn{image specifier} object contained | |
22 within the glyph. The separation between an image specifier object | |
23 and a glyph object is made because the glyph includes other properties | |
24 than just the actual image: e.g. the face it is displayed in (for text | |
25 images), the alignment of the image (when it is in a buffer), etc. | |
26 | 19 |
27 @defun glyphp object | 20 @defun glyphp object |
28 This function returns @code{t} if @var{object} is a glyph. | 21 This function returns @code{t} if @var{object} is a glyph. |
29 @end defun | 22 @end defun |
30 | 23 |
31 @menu | 24 @menu |
32 * Glyph Functions:: Functions for working with glyphs. | 25 * Glyph Intro:: Glyphs are abstract image specifications. |
33 * Images:: Graphical images displayed in a frame. | 26 * Images:: Specifying the appearance of glyphs. |
34 * Glyph Types:: Each glyph has a particular type. | 27 * Using Glyphs:: Creating and displaying glyphs. |
35 * Mouse Pointer:: Controlling the mouse pointer. | 28 * Manipulating Glyphs:: Getting and setting glyph properties. |
36 * Redisplay Glyphs:: Glyphs controlling various redisplay functions. | 29 * Glyph Examples:: Examples of how to work with glyphs. |
37 * Native GUI Widgets:: Complex active images treated as a single glyph. | |
38 * Subwindows:: Inserting an externally-controlled subwindow | |
39 into a buffer. | |
40 * Glyph Examples:: Examples of how to work with glyphs. | |
41 @end menu | 30 @end menu |
42 | 31 |
43 @node Glyph Functions | 32 |
44 @section Glyph Functions | 33 @node Glyph Intro |
34 @section Glyph Introduction | |
35 | |
36 In XEmacs, ``glyph'' does @strong{not} refer to a single unit of textual | |
37 display (the XEmacs term for that is @dfn{rune}, and runes are confined | |
38 to the internal implementation of redisplay), but rather is an | |
39 object encapsulating a graphical element, such as an image or widget (an | |
40 active GUI element such as a button or text entry field; X11 calls this a | |
41 @dfn{widget}, while MS Windows uses the term @dfn{control}). | |
42 This graphical element could appear in a buffer, a margin, a gutter, or | |
43 a toolbar, or even externally to XEmacs as a mouse pointer or an icon, | |
44 for example. | |
45 | |
46 On the other hand, by contrast with GNU Emacs 21, an XEmacs glyph is | |
47 not ``just'' an image. The actual image that is displayed (as opposed | |
48 to its position or clipping) is defined by an ``image specifier'' object | |
49 contained within the glyph. The separation between an image specifier | |
50 object and a glyph object is made because the glyph includes other | |
51 properties than just the actual image: e.g. the face it is displayed in, | |
52 the alignment of the image, @emph{etc}. Also, an image specifier is | |
53 used in at least one place in XEmacs in lieu of a glyphs, namely the | |
54 backing pixmap of a face. | |
55 | |
56 An image specifier is used because glyphs often have locale-specific | |
57 semantics. The most important example is semantics determined by the | |
58 display device: you can't usefully display a JPEG on stdout, or a color | |
59 image on a monochrome display. But because the image property is a | |
60 specifier in XEmacs, you can specify that a given glyph appear as a | |
61 monochrome image on monochrome displays, a color image on color | |
62 displays, and as a string on TTYs. (Specifying a string for the | |
63 @code{tty} device locale would give behavior like the @code{ALT} | |
64 attribute of an @code{IMG} element in HTML.) Another is semantics | |
65 determined by the buffer or mode. (Unfortunately, currently there are | |
66 no compelling examples of this for glyphs.) | |
67 | |
68 All this means that only one global glyph needs to exist for a | |
69 particular purpose (e.g. the icon used to represent an iconified frame, | |
70 the mouse pointer used over particular areas of a frame, etc.). Often | |
71 you need not (and should not!) create your own glyph, but rather modify | |
72 an existing one. | |
73 | |
74 In working with glyphs it is important to keep in mind the distinction | |
75 between a locale and a domain. A @dfn{locale} is specified by the | |
76 programmer, and is an abstract link between a specification (for a | |
77 glyph, its visual appearance) and a displayable object. The displayable | |
78 object may be a buffer or a window, or an object containing buffers or | |
79 windows such as frame, device, or console. A @dfn{domain} is an actual | |
80 display context, which must be concrete enough to enable XEmacs to | |
81 identify the device type. (Buffers may be displayed in windows on | |
82 different devices, even simultaneously, so a buffer cannot be a domain. | |
83 Similarly, the global locale cannot be a domain.) @ref{Specifiers}, for | |
84 more information about specifier locales and domains. | |
85 | |
86 | |
87 @node Images | |
88 @section Images | |
89 | |
90 @menu | |
91 * Image Specifiers:: Specifying an image's appearance. | |
92 * Image Instantiator Conversion:: Lazy realization of graphics. | |
93 * Image Instantiator Formats:: A catalog of image descriptors. | |
94 * Image Instances:: Classes of graphical objects. | |
95 @end menu | |
96 | |
97 | |
98 @node Image Specifiers | |
99 @subsection Image Specifiers | |
100 @cindex image specifiers | |
101 | |
102 An image specifier is a description of the actual graphical | |
103 realization of a glyph. For example, a typical image description is | |
104 @emph{the file system path to a PNG file}. Since redisplay doesn't know | |
105 about files, and in any case the image may need to be manipulated | |
106 (@emph{e.g.}, a face's background pixmap must be clipped and tiled), the | |
107 PNG file must be converted internally to a window system bitmap or | |
108 pixmap object. We describe this process by writing that when XEmacs | |
109 displays the image, it @dfn{instantiates} the @dfn{image instantiator} | |
110 into an @dfn{image instance}. Image instances are an internal object | |
111 type (similar to font instances and color instances), describing how the | |
112 image appears in a particular domain. On the other hand, image | |
113 instantiators, which are just descriptions of how the image should | |
114 appear, are represented using Lisp strings or vectors. | |
115 | |
116 Furthermore the graphical realization will vary, and for some devices | |
117 may not even be a bitmapped graphic. These variations may be controlled | |
118 by the program by specifying different @dfn{image instantiators} in | |
119 different locales. This is implemented with an @dfn{image specifier}, | |
120 a specifier whose specifications are image instantiators. | |
121 | |
122 Image specifiers are rarely if ever found by themselves. However, an | |
123 image specifier results from calling @code{glyph-image} on a glyph, or | |
124 retrieving the @code{background-pixmap} property of a face, and you can | |
125 check if some random object is an image specifier. | |
126 | |
127 @defun image-specifier-p object | |
128 This function returns non-@code{nil} if @var{object} is an image specifier. | |
129 @end defun | |
130 | |
131 @defun make-image-specifier spec-list | |
132 This function creates a new image specifier object and initializes it | |
133 according to @var{spec-list}. @xref{Specifiers}. | |
134 @end defun | |
135 | |
136 This function exists mainly for completeness. In practice, you rarely, | |
137 if ever, need to actually create an image specifier. Instead, they are | |
138 implicitly created by the initialization of glyphs and faces, and the | |
139 specifier member of these objects cannot be changed after | |
140 initialization; you may only set the specifications it contains. | |
141 | |
142 Image instantiators come in many formats: @code{xbm}, @code{xpm}, | |
143 @code{gif}, @code{jpeg}, etc. These denote the format of the data | |
144 describing the image. The resulting image instances also come in many | |
145 types---@code{mono-pixmap}, @code{color-pixmap}, @code{text}, | |
146 @code{pointer}, etc. This refers to the behavior of the image and the | |
147 sorts of places it can appear. (For example, a color-pixmap image has | |
148 fixed colors specified for it, while a mono-pixmap image comes in two | |
149 unspecified shades ``foreground'' and ``background'' that are determined | |
150 from the face of the glyph or surrounding text; a text image appears as | |
151 a string of text and has an unspecified foreground, background, and | |
152 font; a pointer image behaves like a mono-pixmap image but can only be | |
153 used as a mouse pointer [mono-pixmap images cannot be used as mouse | |
154 pointers]; etc.) | |
155 | |
156 It is important to keep the distinction between image instantiator | |
157 format and image instance type in mind. Typically, a given image | |
158 instantiator format can result in many different image instance types. | |
159 For example, @code{xpm} can be instanced as @code{color-pixmap}, | |
160 @code{mono-pixmap}, or @code{pointer}; whereas @code{cursor-font} can be | |
161 instanced only as @code{pointer}. On the other hand, a particular image | |
162 instance type can be generated by many different image instantiator | |
163 formats (e.g. @code{color-pixmap} can be generated by @code{xpm}, | |
164 @code{gif}, @code{jpeg}, etc.). | |
165 | |
166 @xref{Image Instances}, for a more detailed discussion of image | |
167 instance types. | |
168 | |
169 An image instantiator should be a string or a vector of the form | |
170 | |
171 @example | |
172 @code{[@var{format} @var{:keyword} @var{value} ...]} | |
173 @end example | |
174 | |
175 i.e. a format symbol followed by zero or more alternating keyword-value | |
176 pairs. | |
177 | |
178 The form of an instantiator can be checked with | |
179 @code{valid-instantiator-p} with a @var{TYPE} of @code{image}, | |
180 @ref{Specifier Validation Functions}. | |
181 | |
182 For a complete list of the format symbols and their usage, | |
183 @ref{Image Instantiator Formats}. | |
184 | |
185 If the instantiator is a string, it will be converted into a vector by | |
186 looking it up according to the specs in the | |
187 @code{console-type-image-conversion-list} for the console type of the | |
188 domain (usually a window; sometimes a frame or device) over which the | |
189 image is being instantiated. | |
190 | |
191 If the instantiator specifies data from a file, the data will be read in | |
192 at the time that the instantiator is added to the image specifier (which | |
193 may be well before the image is actually displayed), and the | |
194 instantiator will be converted into one of the inline-data forms, with | |
195 the filename retained using a @code{:file} keyword. This implies that | |
196 the file must exist when the instantiator is added to the image, but | |
197 does not need to exist at any other time (e.g. it may safely be a | |
198 temporary file). | |
199 | |
200 The available keywords are given below. Note that some keywords are | |
201 generally available (for example, the @code{:data} keyword may be used | |
202 with any format except @code{nothing}), while others are only available | |
203 for one format (@code{resource-id} is unique to the | |
204 @code{mswindows-resource} format). | |
205 | |
206 @table @code | |
207 @item :data | |
208 Inline image data. If available for a given format, it may be specified | |
209 directly by the program, or it may be a cache of file data previously | |
210 read. When present, it is used to instantiate the image in preference | |
211 to the file named by the @code{:file} property. | |
212 | |
213 The format of inline data is image-format-specific. For example, in | |
214 pixmap formats, the value should be a string, which is interpreted as an | |
215 octet-stream representing a bitmap or pixmap. But for text formats, | |
216 it's string containing the text to be displayed, and for resource | |
217 formats, it's a string containing the name of the resource. | |
218 | |
219 @item :file | |
220 Data contained in a file. The value is the name of this file. If both | |
221 @code{:data} and @code{:file} are specified, the image is created from | |
222 what is specified in @code{:data} and the string in @code{:file} becomes | |
223 the value of the @code{image-instance-file-name} function when applied | |
224 to the resulting image-instance. Note that there is nothing to stop a | |
225 program from changing either the @code{:file} or the @code{:data} | |
226 property, and there is no way to detect such mischief. This means that | |
227 the data will @emph{not} be automatically reread if you change the | |
228 @code{file} property; you must force it by removing the @code{:data} | |
229 property. | |
230 @c #### If there are ways to do this in-place, describe them. | |
231 (One way to do this is replacing the whole specification with a new | |
232 vector.) This keyword is not valid for instantiator formats | |
233 @code{nothing}, @code{string}, @code{formatted-string}, | |
234 @code{cursor-font}, @code{font}, and @code{autodetect}. | |
235 | |
236 @item :mask-data | |
237 Inline data for @code{xbm} and @code{xface}. This specifies a mask to | |
238 be used with the bitmap. Pixels which are not set in the mask will not | |
239 be written to the imaging device. The format is a list of width, | |
240 height, and bits, as for @code{:data}. | |
241 | |
242 @item :mask-file | |
243 For @code{xbm} and @code{xface}. This specifies a file containing the | |
244 mask data. If neither a mask file nor inline mask data is given for an | |
245 XBM image, and the XBM image comes from a file, XEmacs will look for a | |
246 mask file with the same name as the image file but with @samp{Mask} or | |
247 @samp{msk} appended. For example, if you specify the XBM file | |
248 @file{left_ptr} [usually located in @file{/usr/include/X11/bitmaps}], | |
249 the associated mask file @file{left_ptrmsk} will automatically be picked | |
250 up. | |
251 | |
252 @item :resource-id | |
253 Only for @code{mswindows-resource}. This must be either an integer | |
254 (which directly specifies a resource number) or a string. See the | |
255 description of @code{mswindows-resource} for valid strings. @xref{Image | |
256 Instantiator Formats}. | |
257 | |
258 @item :foreground | |
259 @itemx :background | |
260 For @code{xbm}, @code{xface}, @code{cursor-font}, and @code{font}. | |
261 These keywords allow you to explicitly specify foreground and background | |
262 colors. The value should be anything acceptable to | |
263 @code{make-color-instance}. This will cause an external format that | |
264 would by default be instantiated as a @code{mono-pixmap} to instead be | |
265 instantiated as a two-color color-pixmap. This can be used to override | |
266 the colors specified by a glyph's face, for example. If the image is | |
267 instantiated as a pointer, they specify its foreground and/or | |
268 background, instead of the defaults of black and white. | |
269 | |
270 @item :hotspot-x | |
271 @itemx :hotspot-y | |
272 For @code{xbm} and @code{xface}. These keywords specify a hotspot if | |
273 the image is instantiated as a @code{pointer}. Note that if the XBM | |
274 image file specifies a hotspot, it will automatically be picked up if no | |
275 explicit hotspot is given. | |
276 | |
277 @item :color-symbols | |
278 Only for @code{xpm}. This specifies an alist that maps strings that | |
279 specify symbolic color names to the actual color to be used for that | |
280 symbolic color (in the form of a string or a color-specifier object). | |
281 If this is not specified, the contents of @code{xpm-color-symbols} are | |
282 used to generate the alist. | |
283 | |
284 @item :resource-type | |
285 Only for @code{mswindows-resource}. This must be a symbol, either | |
286 @code{cursor}, @code{icon}, or @code{bitmap}, specifying the type of | |
287 resource to be retrieved. | |
288 | |
289 @item :face | |
290 For @code{inherit} and the widget formats. This specifies the face to | |
291 inherit from. For widgets this specifies the face to use for display. | |
292 It defaults to gui-element-face. | |
293 | |
294 @item :selected | |
295 @itemx :active | |
296 @itemx :suffix | |
297 @itemx :keys | |
298 @itemx :style | |
299 @itemx :filter | |
300 @itemx :config | |
301 @itemx :included | |
302 @itemx :key-sequence | |
303 @itemx :accelerator | |
304 @itemx :label | |
305 @itemx :callback | |
306 These keywords, accepted as menu item specs, are also accepted by images | |
307 instantiated as @code{widget}. For their semantics, @ref{Menu Format}. | |
308 @end table | |
309 | |
310 | |
311 @node Image Instantiator Conversion | |
312 @subsection Image Instantiator Conversion | |
313 @cindex image instantiator conversion | |
314 @cindex conversion of image instantiators | |
315 | |
316 Conversion is applied to image instantiators at the time they are added | |
317 to an image specifier or at the time they are passed to | |
318 @code{make-image-instance}. | |
319 | |
320 @defun set-console-type-image-conversion-list console-type list | |
321 This function sets the image-conversion-list for consoles of the given | |
322 @var{console-type}. The image-conversion-list specifies how image | |
323 instantiators that are strings should be interpreted. Each element of | |
324 the list should be a list of two elements (a regular expression string | |
325 and a vector) or a list of three elements (the preceding two plus an | |
326 integer index into the vector). The string is converted to the vector | |
327 associated with the first matching regular expression. If a vector | |
328 index is specified, the string itself is substituted into that position | |
329 in the vector. | |
330 | |
331 Note: The conversion above is applied when the image instantiator is | |
332 added to an image specifier, not when the specifier is actually | |
333 instantiated. Therefore, changing the image-conversion-list only affects | |
334 newly-added instantiators. Existing instantiators in glyphs and image | |
335 specifiers will not be affected. | |
336 @end defun | |
337 | |
338 @defun console-type-image-conversion-list console-type | |
339 This function returns the image-conversion-list for consoles of the given | |
340 @var{console-type}. | |
341 @end defun | |
342 | |
343 | |
344 @node Image Instantiator Formats | |
345 @subsection Image Instantiator Formats | |
346 @cindex image instantiator formats | |
347 | |
348 The @dfn{format} field of an image instantiator should be a symbol | |
349 denoting a valid format. Which formats are valid will depend on the | |
350 features (such as image decoding libraries) available, on platform | |
351 support (MS Windows resource IDs make no sense on other platforms), and | |
352 on the locale. | |
353 | |
354 @defun valid-image-instantiator-format-p format &optional locale | |
355 This function returns non-@code{nil} if @var{format} is a valid image | |
356 instantiator format. | |
357 | |
358 If @var{locale} is non-@code{nil} then the format is checked in that locale. | |
359 If @var{locale} is @code{nil} the current console is used. | |
360 | |
361 Note that the return value for many formats listed above depends on | |
362 whether XEmacs was compiled with support for that format. | |
363 @end defun | |
364 | |
365 @defun image-instantiator-format-list | |
366 This function returns a list of valid image-instantiator formats. | |
367 @end defun | |
368 | |
369 Here is a table of image-instantiator formats, giving the keywords that | |
370 are usable with each, and the kinds of instances that may result. | |
371 | |
372 @table @code | |
373 @item nothing | |
374 Don't display anything; no keywords are valid for this format. Can only be | |
375 instanced as @code{nothing}. | |
376 | |
377 @item string | |
378 Display this image as a text string. Can only be instanced | |
379 as @code{text}, although support for instancing as @code{mono-pixmap} | |
380 should be added. The valid keyword is @code{:data}. The value should | |
381 be a string, and it is interpreted as a string of characters. | |
382 | |
383 @item formatted-string | |
384 Display this image as a text string with replaceable fields, | |
385 similar to a modeline format string. The valid keyword is @code{:data}. | |
386 The value should be a string, and it is interpreted as a string of | |
387 characters containing format sequences. | |
388 | |
389 Not currently implemented. | |
390 | |
391 @item xbm | |
392 An X bitmap; available only if X support was compiled into this XEmacs. | |
393 | |
394 If used in a buffer glyph, icon glyph, or face background pixmap, it | |
395 will be instantiated as @code{mono-pixmap} unless the @code{:foreground} | |
396 or @code{:background} keywords are present. In the latter case it will | |
397 be instantiated as @code{color-pixmap} with the two specified colors. | |
398 @c #### Check this. | |
399 (Probably if @code{:foreground} or @code{:background} is omitted, it | |
400 defaults to black or white respectively.) If used in a pointer glyph, | |
401 it will be instantiated as an @code{pointer}. | |
402 | |
403 The valid keywords and their values are | |
404 @table @code | |
405 @item :data | |
406 A list containing the height and width of the bitmap as integers, and | |
407 a string interpreted as a bit vector according to the X11 standard XBM | |
408 bitmap format, in that order. | |
409 @item :file | |
410 The name of a file containing standard XBM-format data. If it contains | |
411 a hotspot specification, it will be parsed and used if the hotspot is | |
412 not explicitly specified. | |
413 @item :mask-data | |
414 A list containing the height and width of the bitmap as integers, and | |
415 a string interpreted as a bit vector according to the X11 standard XBM | |
416 bitmap format, in that order. This bitmap is interpreted as the | |
417 clipping region for the bitmap contained in the @code{:data} property. | |
418 @item :mask-file | |
419 The name of a file containing standard XBM-format data. Interpreted as | |
420 the clipping region for the bitmap contained in the @code{:data} property. | |
421 @item :foreground | |
422 @itemx :background | |
423 These keywords allow you to explicitly specify foreground and background | |
424 colors. The values should be acceptable to @code{make-color-instance}. | |
425 @item :hotspot-x | |
426 @itemx :hotspot-y | |
427 Integers denoting the hotspot (mouse pointer position), with (0,0) at | |
428 the top left corner. If given, these override any specification in the | |
429 XBM file. | |
430 @end table | |
431 | |
432 @item xpm | |
433 An XPM pixmap; only available if XPM support was compiled into this XEmacs. | |
434 | |
435 Can be instanced as @code{color-pixmap}, @code{mono-pixmap}, or | |
436 @code{pointer}. | |
437 | |
438 XPM is an add-on library for X that was designed to rectify the | |
439 shortcomings of the XBM format. Many icons and labels used in the | |
440 XEmacs GUI are still distributed in XPM format (although we are moving | |
441 to standardize on the PNG format). It is therefore highly desirable | |
442 that XPM be available in your XEmacs. | |
443 | |
444 Most implementations of X include the XPM library as a standard part. | |
445 If your vendor does not, it is highly recommended that you download it | |
446 and install it. You can get it from the XEmacs FTP site and mirrors, as | |
447 well as from most sites that distribute X11. | |
448 | |
449 The valid keywords and their values are | |
450 @table @code | |
451 @item :data | |
452 A string interpreted as the contents of a standard XPM file. | |
453 @item :file | |
454 The name of a file containing standard XPM-format data. If it contains | |
455 a hotspot specification, it will be parsed and used if the hotspot is | |
456 not explicitly specified. | |
457 @c #### Does XPM provide for a hotspot? | |
458 @item :hotspot-x | |
459 @itemx :hotspot-y | |
460 Integers denoting the hotspot (mouse pointer position), with (0,0) at | |
461 the top left corner. If given, these override any specification in the | |
462 XBM file. | |
463 @c #### Check this. | |
464 (This may not be true. The original documentation doesn't mention them | |
465 in connection with XPM, but a pointer needs a hotspot.) | |
466 @item :color-symbols | |
467 An alist that maps the one- or two-character strings that specify | |
468 symbolic color names in the XPM file to the actual color to be used for | |
469 that symbolic color (in the form of a string acceptable as a color | |
470 instantiator, @ref{Color Specifiers}, or a color-specifier object). | |
471 If this is not specified, the contents of @code{xpm-color-symbols} are | |
472 used to generate the alist. | |
473 @end table | |
474 | |
475 @item xface | |
476 An X-Face bitmap, used to encode people's faces in e-mail messages; | |
477 only available if X-Face support was compiled into this XEmacs. | |
478 | |
479 Will be instanced as @code{mono-pixmap}, @code{color-pixmap}, or | |
480 @code{pointer}, depending on the target instance type and the presence | |
481 of color keywords. | |
482 | |
483 The valid keywords and their values are | |
484 @table @code | |
485 @item :data | |
486 A list containing the height and width of the bitmap as integers, and | |
487 a string interpreted as a bit vector according to the X11 standard XBM | |
488 bitmap format, in that order. | |
489 @item :file | |
490 The name of a file containing standard XBM-format data. If it contains | |
491 a hotspot specification, it will be parsed and used if the hotspot is | |
492 not explicitly specified. | |
493 @item :mask-data | |
494 A list containing the height and width of the bitmap as integers, and | |
495 a string interpreted as a bit vector according to the X11 standard XBM | |
496 bitmap format, in that order. This bitmap is interpreted as the | |
497 clipping region for the bitmap contained in the @code{:data} property. | |
498 @item :mask-file | |
499 The name of a file containing standard XBM-format data. Interpreted as | |
500 the clipping region for the bitmap contained in the @code{:data} property. | |
501 @item :foreground | |
502 @itemx :background | |
503 These keywords allow you to explicitly specify foreground and background | |
504 colors. The values should be acceptable to @code{make-color-instance}. | |
505 @item :hotspot-x | |
506 @itemx :hotspot-y | |
507 Integers denoting the hotspot (mouse pointer position), with (0,0) at | |
508 the top left corner. If given, these override any specification in the | |
509 XBM file. | |
510 @end table | |
511 | |
512 @item gif | |
513 @itemx jpeg | |
514 @itemx png | |
515 @itemx tiff | |
516 These are GIF87- or GIF89-format, JPEG-format, PNG/GIF24-format, and | |
517 TIFF-format images, respectively. They are available only if | |
518 appropriate decoding support was built into XEmacs. XEmacs includes GIF | |
519 decoding functions as a standard part of it, so if you have X support, | |
520 you will normally have GIF support, unless you explicitly disable it at | |
521 configure time. If you have development support (both the libraries and | |
522 the relevant C header files) available when XEmacs is built, the JPEG, | |
523 PNG, and TIFF libraries will automatically be detected (in the ``usual | |
524 places'') and linked into the build. | |
525 | |
526 Note that PNG is the standard format for images distributed with XEmacs, | |
527 so it is highly recommended that PNG support be built in. | |
528 | |
529 All of these instantiators will be instanced as @code{color-pixmap}. | |
530 | |
531 The valid keywords and their values are | |
532 @table @code | |
533 @item :data | |
534 A string interpreted as the contents of a file containing data in the | |
535 appropriate standard format. | |
536 @item :file | |
537 The name of a file containing standard-format data. | |
538 @end table | |
539 | |
540 @item cursor-font | |
541 Most window systems provide a set of standard cursors, which in X11 is | |
542 called a cursor font. Can only be instanced as @code{pointer}. This | |
543 should probably be fixed. | |
544 | |
545 The valid keyword is @code{:data}. Its value should be a string | |
546 containing one of the standard cursor-font names, such as @samp{watch} | |
547 or @samp{right_ptr} under X. More specifically, in the X Window System | |
548 it may be any of the standard cursor names from appendix B of the Xlib | |
549 manual, provided in the file @file{<X11/cursorfont.h>} by most | |
550 distributions, minus the @samp{XC_} prefix. For MS Windows, use | |
551 @code{mswindows-resource} instantiator format, not @code{cursor-font}. | |
552 Other window systems may have different lists. | |
553 | |
554 @item font | |
555 A glyph from a font; i.e. the name of a font, and glyph index into it | |
556 of the form @samp{@var{font} fontname index [[mask-font] mask-index]}. | |
557 Only if X support was compiled into this XEmacs. Currently can only be | |
558 instanced as @code{pointer}. This should probably be fixed. | |
559 @c #### The above description is not very helpful, so it's not obvious | |
560 @c how to instantiate a font image. | |
561 | |
562 @item mswindows-resource | |
563 An MS Windows pointer resource. Specifies a resource to retrieve | |
564 directly from the system (an OEM resource) or from a file, particularly | |
565 an executable file. Can be instanced as @code{pointer} or | |
566 @code{color-pixmap}. | |
567 | |
568 The valid keywords and their values are | |
569 | |
570 @table @code | |
571 @item :resource-type | |
572 A string naming the type (@code{cursor}, @code{bitmap}, or @code{icon}) | |
573 of the resource. Required. | |
574 @item :file | |
575 A string containing the name of the file containing the resource (often | |
576 an executable). If a system resource, @code{:file} should be omitted. | |
577 @item :resource-id | |
578 A string containing the name of a resource. Required if @code{:file} | |
579 is not specified. | |
580 | |
581 This must be either an integer (which directly specifies a resource | |
582 number) or a string. Valid strings are | |
583 | |
584 For bitmaps: | |
585 | |
586 "close", "uparrow", "dnarrow", "rgarrow", "lfarrow", | |
587 "reduce", "zoom", "restore", "reduced", "zoomd", | |
588 "restored", "uparrowd", "dnarrowd", "rgarrowd", "lfarrowd", | |
589 "mnarrow", "combo", "uparrowi", "dnarrowi", "rgarrowi", | |
590 "lfarrowi", "size", "btsize", "check", "checkboxes", and | |
591 "btncorners". | |
592 | |
593 For cursors: | |
594 | |
595 "normal", "ibeam", "wait", "cross", "up", "sizenwse", | |
596 "sizenesw", "sizewe", "sizens", "sizeall", and "no". | |
597 | |
598 For icons: | |
599 | |
600 "sample", "hand", "ques", "bang", "note", and "winlogo". | |
601 @end table | |
602 | |
603 @item subwindow | |
604 An embedded windowing system window. Can only be instanced as | |
605 @code{subwindow}. Not implemented. | |
606 @c #### Check status of subwindows ... I thought Andy implemented them. | |
607 | |
608 @item button | |
609 A button widget; either a push button, radio button or toggle button. | |
610 Can only be instanced as @code{widget}. | |
611 | |
612 @item combo-box | |
613 A drop list of selectable items in a widget, for editing text. | |
614 Can only be instanced as @code{widget}. | |
615 | |
616 @item edit-field | |
617 A text editing widget. Can only be instanced as @code{widget}. | |
618 | |
619 @item label | |
620 A static, text-only, widget; for displaying text. Can only be instanced | |
621 as @code{widget}. | |
622 | |
623 @item layout | |
624 A widget for controlling the positioning of children underneath it. | |
625 Through the use of nested layouts, a widget hierarchy can be created | |
626 which can have the appearance of any standard dialog box or similar | |
627 arrangement; all of this is counted as one @dfn{glyph} and could appear | |
628 in many of the places that expect a single glyph. Can only be instanced | |
629 as @code{widget}. | |
630 | |
631 @item native-layout | |
632 The native version of a layout widget. | |
633 Can only be instanced as @code{widget}. | |
634 | |
635 @item progress-gauge | |
636 A sliding widget, for showing progress. Can only be instanced as | |
637 @code{widget}. | |
638 | |
639 @item tab-control | |
640 A tab widget; a series of user selectable tabs. Can only be instanced | |
641 as @code{widget}. | |
642 | |
643 @item tree-view | |
644 A folding widget. Can only be instanced as @code{widget}. | |
645 | |
646 @item scrollbar | |
647 A scrollbar widget. Can only be instanced as @code{widget}. | |
648 | |
649 @item autodetect | |
650 XEmacs tries to guess what format the data is in. If X support exists, | |
651 the data string will be checked to see if it names a filename. If so, | |
652 and this filename contains XBM or XPM data, the appropriate sort of | |
653 pixmap or pointer will be created. [This includes picking up any | |
654 specified hotspot or associated mask file.] Otherwise, if @code{pointer} | |
655 is one of the allowable image-instance types and the string names a | |
656 valid cursor-font name, the image will be created as a pointer. | |
657 Otherwise, the image will be displayed as text. If no X support exists, | |
658 the image will always be displayed as text. | |
659 | |
660 @item inherit | |
661 Inherit from the background-pixmap property of a face. Can only be | |
662 instanced as @code{mono-pixmap}. | |
663 @end table | |
664 | |
665 There are two convenience variables for use with the XBM and XPM image | |
666 formats. | |
667 | |
668 @defvar xpm-color-symbols | |
669 This variable holds definitions of logical color-names used when reading | |
670 XPM files. Elements of this list should be of the form | |
671 @code{(@var{color-name} @var{form-to-evaluate})}. The @var{color-name} | |
672 should be a string, which is the name of the color to define; the | |
673 @var{form-to-evaluate} should evaluate to a color specifier object, or a | |
674 string to be passed to @code{make-color-instance} (@pxref{Colors}). If | |
675 a loaded XPM file references a symbolic color called @var{color-name}, | |
676 it will display as the computed color instead. | |
677 | |
678 The default value of this variable defines the logical color names | |
679 @samp{"foreground"} and @samp{"background"} to be the colors of the | |
680 @code{default} face. | |
681 @end defvar | |
682 | |
683 @defvar x-bitmap-file-path | |
684 A list of the directories in which X bitmap files may be found. If @code{nil}, | |
685 this is initialized from the @samp{"*bitmapFilePath"} resource. This is | |
686 used by the @code{make-image-instance} function (however, note that if | |
687 the environment variable @samp{XBMLANGPATH} is set, it is consulted | |
688 first). | |
689 @end defvar | |
690 | |
691 | |
692 @node Image Instances | |
693 @subsection Image Instances | |
694 @cindex image instances | |
695 | |
696 Image-instance objects encapsulate the way a particular image (pixmap, | |
697 etc.) is displayed on a particular device. | |
698 | |
699 In most circumstances, you do not need to directly create image | |
700 instances; use a glyph instead. However, it may occasionally be useful | |
701 to explicitly create image instances, if you want more control over the | |
702 instantiation process. | |
703 | |
704 @defun image-instance-p object | |
705 This function returns non-@code{nil} if @var{object} is an image instance. | |
706 @end defun | |
707 | |
708 @menu | |
709 * Image Instance Types:: Each image instances has a particular type. | |
710 * Image Instance Functions:: Functions for working with image instances. | |
711 @end menu | |
712 | |
713 | |
714 @node Image Instance Types | |
715 @subsubsection Image Instance Types | |
716 @cindex image instance types | |
717 | |
718 Image instances come in a number of different types. The type | |
719 of an image instance specifies the nature of the image: Whether | |
720 it is a text string, a mono pixmap, a color pixmap, etc. | |
721 | |
722 The valid image instance types are | |
723 | |
724 @table @code | |
725 @item nothing | |
726 Nothing is displayed. | |
727 | |
728 @item text | |
729 Displayed as text. The foreground and background colors and the | |
730 font of the text are specified independent of the pixmap. Typically | |
731 these attributes will come from the face of the surrounding text, | |
732 unless a face is specified for the glyph in which the image appears. | |
733 | |
734 @item mono-pixmap | |
735 Displayed as a mono pixmap (a pixmap with only two colors where the | |
736 foreground and background can be specified independent of the pixmap; | |
737 typically the pixmap assumes the foreground and background colors of | |
738 the text around it, unless a face is specified for the glyph in which | |
739 the image appears). | |
740 @item color-pixmap | |
741 | |
742 Displayed as a color pixmap. | |
743 | |
744 @item pointer | |
745 Used as the mouse pointer for a window. | |
746 | |
747 @item subwindow | |
748 A child window that is treated as an image. This allows (e.g.) | |
749 another program to be responsible for drawing into the window. | |
750 Not currently implemented. | |
751 @c #### Check status of subwindows ... I thought Andy implemented them. | |
752 | |
753 @item widget | |
754 An active GUI element implemented as a ``widget'' or ``control'' of the | |
755 underlying window system. | |
756 @end table | |
757 | |
758 The following functions are used to check whether an image instance type | |
759 is valid in the running XEmacs. | |
760 | |
761 @defun valid-image-instance-type-p type | |
762 This function returns non-@code{nil} if @var{type} is a valid image | |
763 instance type. | |
764 @end defun | |
765 | |
766 @defun image-instance-type-list | |
767 This function returns a list of the valid image instance types. | |
768 @end defun | |
769 | |
770 The following functions are used to determine the type of an image | |
771 instance. | |
772 | |
773 @defun image-instance-type image-instance | |
774 Return the type of the given image instance. The return | |
775 value will be one of @code{nothing}, @code{text}, @code{mono-pixmap}, | |
776 @code{color-pixmap}, @code{pointer}, @code{subwindow}, or @code{widget}. | |
777 @c #### Check status of subwindows ... I thought Andy implemented them. | |
778 @end defun | |
779 | |
780 @defun text-image-instance-p object | |
781 Return non-@code{nil} if @var{object} is an image instance of type | |
782 @code{text}. | |
783 @end defun | |
784 | |
785 @defun mono-pixmap-image-instance-p object | |
786 Return non-@code{nil} if @var{object} is an image instance of type | |
787 @code{mono-pixmap}. | |
788 @end defun | |
789 | |
790 @defun color-pixmap-image-instance-p object | |
791 Return non-@code{nil} if @var{object} is an image instance of type | |
792 @code{color-pixmap}. | |
793 @end defun | |
794 | |
795 @defun pointer-image-instance-p object | |
796 Return non-@code{nil} if @var{object} is an image instance of type | |
797 @code{pointer}. | |
798 @end defun | |
799 | |
800 @defun subwindow-image-instance-p object | |
801 Return non-@code{nil} if @var{object} is an image instance of type | |
802 @code{subwindow}. | |
803 @c #### Check status of subwindows ... I thought Andy implemented them. | |
804 @end defun | |
805 | |
806 @defun nothing-image-instance-p object | |
807 Return non-@code{nil} if @var{object} is an image instance of type | |
808 @code{nothing}. | |
809 @end defun | |
810 | |
811 @defun widget-image-instance-p object | |
812 Return non-@code{nil} if @var{object} is an image instance of type | |
813 @code{widget}. | |
814 @end defun | |
815 | |
816 | |
817 @node Image Instance Functions | |
818 @subsubsection Image Instance Functions | |
819 | |
820 @defun make-image-instance data &optional domain dest-types noerror | |
821 This function creates a new image-instance object. | |
822 | |
823 @var{data} is an image instantiator, which describes the image | |
824 (@pxref{Image Specifiers}). | |
825 | |
826 @var{dest-types} should be a list of allowed image instance types that | |
827 can be generated. The @var{dest-types} list is unordered. If multiple | |
828 destination types are possible for a given instantiator, the ``most | |
829 natural'' type for the instantiator's format is chosen. These are | |
830 | |
831 @table @code | |
832 @item XBM | |
833 @c #### check xface | |
834 @itemx xface | |
835 @code{mono-pixmap}, then @code{color-pixmap}, then @code{pointer}. | |
836 | |
837 @item XPM | |
838 @itemx GIF | |
839 @itemx JPEG | |
840 @itemx PNG | |
841 @itemx TIFF | |
842 @code{color-pixmap}, then @code{mono-pixmap}, then @code{pointer}. | |
843 | |
844 @item string | |
845 @itemx formatted-string formats | |
846 @code{text}, then @code{mono-pixmap} (not currently implemented), then | |
847 @code{color-pixmap} (not currently implemented). | |
848 | |
849 @item mswindows-resource | |
850 For pointer resources, @code{pointer}. | |
851 | |
852 For the others, @code{color-pixmap}. | |
853 @end table | |
854 | |
855 @c #### So what? This is a reference manual, list them, you lazy bastard! | |
856 The other formats can only be instantiated as one type. | |
857 | |
858 If you want to control more specifically the order of the types into | |
859 which an image is instantiated, call @code{make-image-instance} | |
860 repeatedly until it succeeds, passing less and less preferred | |
861 destination types each time. | |
862 | |
863 If @var{dest-types} is omitted, all possible types are allowed. | |
864 | |
865 @var{domain} specifies the domain to which the image instance will be | |
866 attached. This domain is termed the @dfn{governing domain}. The type | |
867 of the governing domain depends on the image instantiator format. | |
868 (Although, more correctly, it should probably depend on the image | |
869 instance type.) For example, pixmap image instances are specific to a | |
870 device, but widget image instances are specific to a particular XEmacs | |
871 window because in order to display such a widget when two windows onto | |
872 the same buffer want to display the widget, two separate underlying | |
873 widgets must be created. (That's because a widget is actually a child | |
874 window-system window, and all window-system windows have a unique | |
875 existence on the screen.) This means that the governing domain for a | |
876 pixmap image instance will be some device (most likely, the only | |
877 existing device), whereas the governing domain for a widget image | |
878 instance will be some XEmacs window. | |
879 | |
880 If you specify an overly general @var{domain} (e.g. a frame when a | |
881 window was wanted), an error is signaled. If you specify an overly | |
882 specific @var{domain} (e.g. a window when a device was wanted), the | |
883 corresponding general domain is fetched and used instead. For | |
884 @code{make-image-instance}, it makes no difference whether you specify | |
885 an overly specific domain or the properly general domain derived from | |
886 it. However, it does matter when creating an image instance by | |
887 instantiating a specifier or glyph (e.g. with | |
888 @code{glyph-image-instance}), because the more specific domain causes | |
889 spec lookup to start there and proceed to more general domains. (It | |
890 would also matter when creating an image instance with an instantiator | |
891 format of @code{inherit}, but we currently disallow this.) | |
892 @c #### We should fix that. | |
893 | |
894 If omitted, @var{domain} defaults to the selected window. | |
895 | |
896 @var{noerror} controls what happens when the image cannot be generated. | |
897 If @code{nil}, an error message is generated. If @code{t}, no messages | |
898 are generated and this function returns @code{nil}. If anything else, a | |
899 warning message is generated and this function returns @code{nil}. | |
900 @end defun | |
901 | |
902 @defun colorize-image-instance image-instance foreground background | |
903 This function makes the image instance be displayed in the given | |
904 colors. Image instances come in two varieties: bitmaps, which are 1 | |
905 bit deep which are rendered in the prevailing foreground and background | |
906 colors; and pixmaps, which are of arbitrary depth (including 1) and | |
907 which have the colors explicitly specified. This function converts a | |
908 bitmap to a pixmap. If the image instance was a pixmap already, | |
909 nothing is done (and @code{nil} is returned). Otherwise @code{t} is | |
910 returned. | |
911 @end defun | |
912 | |
913 The following functions are | |
914 | |
915 @defun image-instance-name image-instance | |
916 This function returns the name of the given image instance. The name is | |
917 typically taken from the @code{:file} property of the instantiator if | |
918 present, otherwise from the @code{:data} property. | |
919 @end defun | |
920 | |
921 @defun image-instance-domain image-instance | |
922 Return the governing domain of the given @var{image-instance}. The | |
923 governing domain of an image instance is the domain that the image | |
924 instance is specific to. It is @emph{NOT} necessarily the domain that | |
925 was given to the call to @code{specifier-instance} that resulted in the | |
926 creation of this image instance. See @code{make-image-instance} for | |
927 more information on governing domains. | |
928 @end defun | |
929 | |
930 @defun image-instance-string image-instance | |
931 This function returns the string of the given image instance. This will | |
932 only be non-@code{nil} for text image instances. | |
933 @end defun | |
934 | |
935 @defun image-instance-file-name image-instance | |
936 This function returns the file name from which @var{image-instance} was | |
937 read, if known. | |
938 @end defun | |
939 | |
940 @defun image-instance-mask-file-name image-instance | |
941 This function returns the file name from which @var{image-instance}'s | |
942 mask was read, if known. | |
943 @end defun | |
944 | |
945 Pixmaps are considered to be three-dimensional. The height and width of | |
946 the pixel array that is displayed, and the color depth of its pixels, | |
947 are accessed with these functions. | |
948 | |
949 @defun image-instance-depth image-instance | |
950 This function returns the depth of the image instance. This is 0 for a | |
951 mono pixmap, or a positive integer for a color pixmap. | |
952 @end defun | |
953 | |
954 @defun image-instance-height image-instance | |
955 This function returns the height of the image instance, in pixels. | |
956 @end defun | |
957 | |
958 @defun image-instance-width image-instance | |
959 This function returns the width of the image instance, in pixels. | |
960 @end defun | |
961 | |
962 The hotspot is a point relative to the origin of the pixmap. When | |
963 an image is used as a mouse pointer, the hotspot is the point on the | |
964 image that sits over the location that the pointer points to. This is, | |
965 for example, the tip of the arrow or the center of the crosshairs. | |
966 | |
967 These functions access the coordinates of the hotspot. They simply | |
968 return @code{nil} for a non-pointer image instance. | |
969 | |
970 @defun image-instance-hotspot-x image-instance | |
971 This function returns the X coordinate of the image instance's hotspot, | |
972 if known. | |
973 @end defun | |
974 | |
975 @defun image-instance-hotspot-y image-instance | |
976 This function returns the Y coordinate of the image instance's hotspot, | |
977 if known. | |
978 @end defun | |
979 | |
980 Mono pixmaps and pointers may have their foreground and background | |
981 colors set when instanced. Use these functions to access color | |
982 information. | |
983 | |
984 @defun image-instance-foreground image-instance | |
985 This function returns the foreground color of @var{image-instance}, if | |
986 applicable. This will be a color instance or @code{nil}. (It will only | |
987 be non-@code{nil} for colorized mono pixmaps and for pointers.) | |
988 @end defun | |
989 | |
990 @defun image-instance-background image-instance | |
991 This function returns the background color of @var{image-instance}, if | |
992 applicable. This will be a color instance or @code{nil}. (It will only | |
993 be non-@code{nil} for colorized mono pixmaps and for pointers.) | |
994 @end defun | |
995 | |
996 | |
997 @node Using Glyphs | |
998 @section Using Glyphs | |
999 | |
1000 Glyph usage is unfortunately somewhat arcane. (For discussion of | |
1001 rationale, @ref{Glyphs,,,Internals}.) Because they are not ``text,'' | |
1002 they cannot be inserted directly into a buffer. Instead, they are | |
1003 values of properties of extents attached to buffers or strings, values | |
1004 of global variables such as mouse pointers, or as a component of a | |
1005 complex data structure such as a toolbar initializer. Although these | |
1006 uses could probably streamlined, each structure has its own | |
1007 requirements. Since glyphs are very flexible, it is possible to create | |
1008 applications like the @file{edit-toolbar} and @file{xpm-mode} libraries | |
1009 which display glyphs in a buffer (for reference while editing) that are | |
1010 normally used in a different context. | |
1011 | |
1012 Usage of glyphs can roughly be categorized as follows: | |
1013 | |
1014 @table @strong | |
1015 @item Buffer glyphs | |
1016 Glyphs that are inserted in a buffer may be used for their own sake (for | |
1017 example, image display in @file{w3}), as an accurate representation of | |
1018 text that can't be displayed in usual fonts (equation display in | |
1019 @file{preview-latex}), or as annotations (such as a marginal indication | |
1020 of a bookmark). Glyphs are attached to buffers via extents. | |
1021 | |
1022 @item Redisplay glyphs | |
1023 Glyphs can be used to create XEmacs-specific ``fonts''. For example, | |
1024 the character that indicates truncation of lines is implemented as the | |
1025 @code{truncation-glyph}. It is also possible to have XEmacs display a | |
1026 certain character using a custom glyph, via display tables. | |
1027 | |
1028 @item Frame glyphs | |
1029 Glyphs are used to control the appearance of various other components of | |
1030 the frame. They can be inserted in the modeline, the favicons are used | |
1031 in Web browsers. They are used to specify the labels on toolbar | |
1032 buttons. Finally, they can be inserted in the gutters. (The difference | |
1033 between a glyph inserted in a gutter and a marginal annotation is that | |
1034 the marginal annotation is tied to the text in the buffer. If the | |
1035 buffer line scrolls out of view, the marginal annotation will, as well. | |
1036 A gutter glyph does not move with the text.) | |
1037 | |
1038 Unfortunately, all these uses are special cases, and have their own | |
1039 APIs, in contrast to glyphs in a buffer. | |
1040 | |
1041 @item External glyphs | |
1042 External glyphs simply allow a consistent API for images. The images | |
1043 are then passed to external software such as the window system itself | |
1044 (mouse cursor shapes) and the window manager (icons to represent | |
1045 minimized windows). XEmacs has no role in managing their use. | |
1046 | |
1047 @item Subwindow and widget glyphs | |
1048 These do not constitute a context of use, but rather an important class of | |
1049 glyph types. The difference between these and other glyphs is that | |
1050 while their geometry is determined by XEmacs, their behavior is managed | |
1051 separately, by internal mechanisms in the case of widgets, and | |
1052 (possibly) by another process in the case of subwindows. | |
1053 @c #### Check status of subwindows ... I thought Andy implemented them. | |
1054 @end table | |
1055 | |
1056 Some simple concrete examples showing how to insert a glyph in a | |
1057 buffer are presented later. @ref{Glyph Examples}. | |
1058 | |
1059 ``Creating Glyphs'' explains how to create glyphs. Creating a glyph | |
1060 using @code{make-glyph} does not specify @emph{where} the glyph will be | |
1061 used, it only specifies @emph{what} the glyph will look like. The next | |
1062 four sections explain how to embed glyphs in different display | |
1063 contexts. Finally, the last two sections explain the special | |
1064 considerations of using glyphs whose behavior is not determined by the | |
1065 code creating them, but by the glyph itself (a ``widget'' in X11 or | |
1066 ``control'' in MS Windows or Aqua), or even by a separate process. | |
45 | 1067 |
46 @menu | 1068 @menu |
47 * Creating Glyphs:: Creating new glyphs. | 1069 * Creating Glyphs:: Creating new glyphs. |
48 * Glyph Properties:: Accessing and modifying a glyph's properties. | 1070 * Buffer Glyphs:: Annotations are glyphs that appear in a buffer. |
49 * Glyph Convenience Functions:: | 1071 * Redisplay Glyphs:: Glyphs controlling various redisplay functions. |
50 Convenience functions for accessing particular | 1072 * Frame Glyphs:: Displaying glyphs in GUI components of the frame. |
51 properties of a glyph. | 1073 * External Glyphs:: Icons and mouse pointers for the window system. |
52 * Glyph Dimensions:: Determining the height, width, etc. of a glyph. | 1074 * Native GUI Widgets:: Complex active elements treated as a single glyph. |
1075 * Subwindows:: Externally-controlled subwindows in buffers. | |
1076 @c #### Check status of subwindows ... I thought Andy implemented them. | |
53 @end menu | 1077 @end menu |
54 | 1078 |
55 @node Creating Glyphs | 1079 @node Creating Glyphs |
56 @subsection Creating Glyphs | 1080 @subsection Creating Glyphs |
57 | 1081 |
58 @defun make-glyph &optional spec-list type | 1082 @defun make-glyph &optional spec-list type |
59 This function creates a new glyph object of type @var{type}. | 1083 This function creates a new glyph object of type @var{type}. |
60 | 1084 |
61 @var{spec-list} is used to initialize the glyph's image. It is | 1085 The optional @var{spec-list} is used to initialize the glyph's image. |
62 typically an image instantiator (a string or a vector; @ref{Image | 1086 It can be any spec-list of @dfn{image instantiator} accepted by |
63 Specifiers}), but can also be a list of such instantiators (each one in | 1087 @code{canonicalize-spec-list}, @ref{Adding Specifications}. An |
64 turn is tried until an image is successfully produced), a cons of a | 1088 individual image instantiator may be a string, which is converted to a |
65 locale (frame, buffer, etc.) and an instantiator, a list of such conses, | 1089 vector according to @code{console-type-image-conversion-list}, or a |
66 or any other form accepted by @code{canonicalize-spec-list}. | 1090 vector. The vector's first element specifies the @emph{external} format |
67 @xref{Specifiers}, for more information about specifiers. | 1091 of the data, such as a string, a PNG file, or an MS Windows resource. |
68 | 1092 This is followed by properties (keyword-value pairs) specifying such |
69 @var{type} specifies the type of the glyph, which specifies in which | 1093 information as the name of a file containing an image, or pixmap data |
70 contexts the glyph can be used, and controls the allowable image types | 1094 directly. @xref{Image Specifiers}. |
71 into which the glyph's image can be instantiated. @var{type} should be | 1095 |
72 one of @code{buffer} (used for glyphs in an extent, the modeline, the | 1096 The optional @var{type} specifies the type of the glyph. @var{type} |
73 toolbar, or elsewhere in a frame), @code{pointer} (used for the | 1097 should be one of @code{buffer} (used for glyphs in an extent, the |
74 mouse-pointer), or @code{icon} (used for a frame's icon), and defaults | 1098 modeline, the toolbar, or elsewhere in a frame), @code{pointer} (used |
75 to @code{buffer}. @xref{Glyph Types}. | 1099 for the mouse-pointer), or @code{icon} (used for a frame's icon), and |
76 | 1100 defaults to @code{buffer}. |
77 A glyph in XEmacs does @strong{NOT} refer to a single unit of textual | 1101 @end defun |
78 display (the XEmacs term for this is @dfn{rune}, and runes are confined | 1102 |
79 to the internal implementation of redisplay), but rather is an | 1103 @var{spec-list} is the initializer for the glyph's @code{image} |
80 object encapsulating a graphical element, such as an image or widget (an | 1104 property, which is an image specifier. (Note that @dfn{image} as used |
81 element such as a button or text entry field; @dfn{widget} is the term for | 1105 in the context of a glyph's @code{image} property or in the terms |
82 this under X Windows, while @dfn{control} is the term under MS Windows). | 1106 @dfn{image specifier}, @dfn{image instantiator}, or @dfn{image instance} |
83 This graphical element could appear in a buffer, a margin, a gutter, or | 1107 does not refer to what people normally think of as an image (which in |
84 a toolbar, or as a mouse pointer or an icon, for example. | 1108 XEmacs is called a @dfn{pixmap}), but to any graphical element---a |
1109 pixmap, a widget, or even a block of text, when used in the places that | |
1110 call for a glyph.) | |
1111 | |
1112 The most common form of @var{spec-list} is a single image instantiator. | |
1113 (@strong{Compatibility note:} in GNU Emacs 21, a string used to | |
1114 instantiate an image is interpreted as the name of an image file, which | |
1115 is searched for and instantiated.) The conversion controlled by | |
1116 @code{console-type-image-conversion-list} typically attempts to look up | |
1117 the string as a file name in XEmacs's data directory path, and if this | |
1118 fails, defaults to displaying the string as a text image instance | |
1119 (@emph{i.e.}. the string itself. | |
1120 | |
1121 Fine control of a particular specification is provided by using a vector | |
1122 as the image instantiator. More complicated instantiators allow lists | |
1123 of instantiators to be specified (which are tried in order), or mappings | |
1124 from locales to lists of instantiators, @emph{etc}. @xref{Specifiers}, | |
1125 for more information about specification formats. | |
1126 | |
1127 As well as using @var{spec-list} to initialize the glyph, you can set | |
1128 specifications using @code{set-glyph-image}. The glyph itself is not | |
1129 actually a specifier, but rather is an object containing an image | |
1130 specifier (as well as other properties seldom set by user code). | |
1131 Therefore, you cannot set or access specifications for the glyph's image | |
1132 by directly using @code{set-specifier}, @code{specifier-instance} or the | |
1133 like on the glyph; instead use them on @code{(glyph-image @var{glyph})} | |
1134 or use the convenience functions @code{set-glyph-image}, | |
1135 @code{glyph-image-instance}, and @code{glyph-image}. | |
1136 | |
1137 Glyph types reflect the fact that glyphs are used in contexts like | |
1138 pointers and window manager icons, which are defined by external | |
1139 programs such as the window system or window manager. These require | |
1140 somewhat different @emph{internal} format, which is opaque to the user. | |
1141 | |
1142 It is extremely rare that you will ever have to specify a value for | |
1143 @var{type}, which should be one of @code{buffer} (used for glyphs in an | |
1144 extent, the modeline, the toolbar, or elsewhere in a buffer), | |
1145 @code{pointer} (used for the mouse-pointer), or @code{icon} (used for a | |
1146 frame's icon), and defaults to @code{buffer}. The only cases where it | |
1147 needs to be specified is when creating icon or pointer glyphs, and in | |
1148 both cases the necessary glyphs have already been created at startup and | |
1149 are accessed through the appropriate variables, | |
1150 e.g. @code{text-pointer-glyph} (or in general, any | |
1151 @samp{*-pointer-glyph}) and @code{frame-icon-glyph}. User code should | |
1152 never need to create @code{pointer} or @code{icon} glyphs. @xref{Glyph | |
1153 Types}. | |
1154 | |
1155 There are a few other glyph creation functions, normally used only | |
1156 internally or at XEmacs initialization. | |
1157 | |
1158 @defun make-glyph-internal &optional type | |
1159 This function creates a new, uninitialized glyph of type @var{type}. | |
1160 @end defun | |
1161 | |
1162 @defun make-pointer-glyph &optional spec-list | |
1163 | |
1164 Return a new @code{pointer-glyph} object with the specification list | |
1165 @var{spec-list}. This function is equivalent to calling | |
1166 @code{make-glyph} with a @var{type} of @code{pointer}. | |
1167 @end defun | |
1168 | |
1169 @code{make-pointer-glyph} is normally used only by XEmacs initialization | |
1170 code. It is extremely unlikely that you will ever need to create a | |
1171 pointer glyph. Instead, you probably want to be calling | |
1172 @code{set-glyph-image} on an existing glyph, | |
1173 e.g. @code{text-pointer-glyph}. | |
1174 | |
1175 @defun make-icon-glyph &optional spec-list | |
1176 | |
1177 Return a new @code{icon-glyph} object with the specification list | |
1178 @var{spec-list}. This function is equivalent to calling | |
1179 @code{make-glyph} with a @var{type} of @code{icon}. | |
1180 @end defun | |
1181 | |
1182 @code{make-icon-glyph} is normally used only by XEmacs initialization | |
1183 code. It is extremely unlikely that you will ever need to create a icon | |
1184 glyph. Instead, you probably want to be calling @code{set-glyph-image} | |
1185 on the existing glyph, @code{frame-icon-glyph}. | |
1186 | |
1187 | |
1188 @node Buffer Glyphs | |
1189 @subsection Buffer Glyphs | |
85 | 1190 |
86 Creating a glyph using @code{make-glyph} does not specify @emph{where} | 1191 Creating a glyph using @code{make-glyph} does not specify @emph{where} |
87 the glyph will be used, but it does specify @emph{what} the glyph will | 1192 the glyph will be used, it only specifies @emph{what} the glyph will |
88 look like. @var{spec-list} is used to specify this, and it is the | 1193 look like. Once you have created a glyph, you specify where it will be |
89 initializer for the glyph's @code{image} property, which is an image | 1194 used by attaching it to an extent as a @emph{begin-glyph} or |
90 specifier. (Note that @dfn{image} as used in the context of a glyph's | 1195 @emph{end-glyph}. |
91 @code{image} property or in the terms @dfn{image specifier}, @dfn{image | 1196 |
92 instantiator}, or @dfn{image instance} does not refer to what people | 1197 @table @code |
93 normally think of as an image (which in XEmacs is called a | 1198 @item buffer text |
94 @dfn{pixmap}), but to any graphical element---a pixmap, a widget, or | |
95 even a block of text, when used in the places that call for a glyph.) | |
96 The format of the @var{spec-list} is typically an image instantiator (a string | |
97 or a vector; @ref{Image Specifiers}), but can also be a list of such | |
98 instantiators (each one in turn is tried until an image is successfully | |
99 produced), a cons of a locale (frame, buffer, etc.) and an | |
100 instantiator, a list of such conses, or any other form accepted by | |
101 @code{canonicalize-spec-list}. | |
102 | |
103 Some understanding of specifiers is necessary in working with glyphs, | |
104 because they do not behave like ordinary variables, and are accessed and | |
105 mutated with special APIs. @xref{Specifiers}, for more information | |
106 about specifiers. The docstring of | |
107 @code{make-specifier} gives a capsule summary. The most important | |
108 aspect of specifiers is that a specifier lets you set a value for | |
109 each buffer, window, frame, device, or console, or it will compute an | |
110 appropriate default if no specific value is set for a particular | |
111 @emph{locale} or @emph{domain} (display contexts; locales are used by | |
112 the programmer create an abstract link between an object such as a | |
113 buffer position and an image, while domains must be concrete enough to | |
114 enable XEmacs to identify the device type: you can't | |
115 usefully display a JPEG on stdout). Therefore only one global glyph | |
116 needs to exist for a particular purpose (e.g. the icon used to represent | |
117 an iconified frame, the mouse pointer used over particular areas of a | |
118 frame, etc.), and in these cases you do not create your own glyph, but | |
119 rather modify the existing one. You can specify that a given glyph | |
120 appear as a monochrome image on monochrome displays, a color image on | |
121 color displays, and as a string on TTYs. | |
122 | |
123 As well as using @var{spec-list} to initialize the glyph, you can set | |
124 specifications using @code{set-glyph-image}. Due to an | |
125 arguable historical design decision, a glyph itself is not | |
126 actually a specifier, but rather is an object containing an image | |
127 specifier (as well as other, seldom-used properties). Therefore, you | |
128 cannot set or access specifications for the glyph's image by directly | |
129 using @code{set-specifier}, @code{specifier-instance} or the like on the | |
130 glyph; instead use them on @code{(glyph-image @var{glyph})} or use the | |
131 convenience functions @code{set-glyph-image}, | |
132 @code{glyph-image-instance}, and @code{glyph-image}. | |
133 | |
134 Once you have created a glyph, you specify where it will be used by | |
135 attaching it to an extent as a @emph{begin-glyph} or @emph{end-glyph}. | |
136 There are also a number of special objects whose appearance is specified | |
137 by a glyph. Most of these a global objects that you update with | |
138 @code{set-glyph-image}, such as mouse pointers and the glyph that | |
139 denotes a line truncation. Frame icons, toolbar button icons, and the | |
140 modeline are the main non-text objects which accept glyphs as elements. | |
141 | |
142 @itemize @bullet | |
143 @item | |
144 To insert a glyph into a buffer, create an extent in the buffer and then | 1199 To insert a glyph into a buffer, create an extent in the buffer and then |
145 use @code{set-extent-begin-glyph} or @code{set-extent-end-glyph} to set | 1200 use @code{set-extent-begin-glyph} or @code{set-extent-end-glyph} to set |
146 a glyph to be displayed at the corresponding edge of the extent. (It is | 1201 a glyph to be displayed at the corresponding edge of the extent. (It is |
147 common to create zero-width extents for this purpose.) | 1202 common to create zero-width extents for this purpose.) |
148 | 1203 |
149 @item | 1204 @item margins |
150 To insert a glyph into the left or right margin of a buffer, first | 1205 To insert a glyph into the left or right margin of a buffer, first |
151 make sure the margin is visible by setting a value for the specifiers | 1206 make sure the margin is visible by setting a value for the specifiers |
152 @code{left-margin-width} or @code{right-margin-width}. (Not strictly necessary | 1207 @code{left-margin-width} or @code{right-margin-width}. (Not strictly necessary |
153 when using margin glyphs with layout policy @code{whitespace}.) Then follow | 1208 when using margin glyphs with layout policy @code{whitespace}.) Follow |
154 the same procedure above for inserting a glyph in a buffer, and then | 1209 the same procedure above for inserting a glyph in a buffer, then |
155 set a non-default layout policy for the glyph using | 1210 set a non-default layout policy for the glyph using |
156 @code{set-extent-begin-glyph-layout} or @code{set-extent-end-glyph-layout}. | 1211 @code{set-extent-begin-glyph-layout} or @code{set-extent-end-glyph-layout}. |
157 Alternatively, use the high-level annotations API (see | 1212 Alternatively, use the high-level annotations API (see |
158 @code{make-annotation}). (In fact, you can also use the annotations | 1213 @code{make-annotation}). (In fact, you can also use the annotations |
159 API for glyphs in a buffer, by setting a layout policy of @code{text}.) | 1214 API for glyphs in a buffer, by setting a layout policy of @code{text}.) |
160 | 1215 |
161 @item | 1216 @end table |
1217 | |
1218 | |
1219 @node Redisplay Glyphs | |
1220 @subsection Redisplay Glyphs | |
1221 | |
1222 To use a glyph to control the shape of miscellaneous redisplay effects | |
1223 such as the truncation and continuation markers, set the appropriate | |
1224 existing glyph variables with @code{set-glyph-image}. See | |
1225 @code{continuation-glyph}, @code{control-arrow-glyph}, | |
1226 @code{hscroll-glyph}, @code{invisible-text-glyph}, | |
1227 @code{octal-escape-glyph}, and @code{truncation-glyph}. See also | |
1228 @code{overlay-arrow-string}, an odd redisplay leftover which can be set | |
1229 to a glyph you created, and will cause the glyph to be displayed on top | |
1230 of the text position specified in the marker stored in | |
1231 @code{overlay-arrow-position}. | |
1232 | |
1233 To use a glyph in a display table (i.e. to control the appearance of any | |
1234 individual character), create the appropriate character glyphs and then | |
1235 set a specification for the specifier @code{current-display-table}, | |
1236 which controls the appearance of characters. You can also set an | |
1237 overriding display table for use with text displayed in a particular | |
1238 face; see @code{set-face-display-table} and @code{make-display-table}. | |
1239 #### Note: Display tables do not currently support general Mule | |
1240 characters. They will be overhauled at some point to support this | |
1241 and to provide other features required under Mule. @ref{Display Tables}. | |
1242 | |
1243 Glyphs are not actually used as the background pixmaps of faces, but the | |
1244 API is similar. The | |
1245 background pixmap of a face is actually an image specifier -- probably | |
1246 the only place in XEmacs where an image specifier occurs outside of a | |
1247 glyph. If you would like to use a glyph's image as a background pixmap, | |
1248 you can extract it with @code{glyph-image}, and then add it to a face. | |
1249 @xref{Face Convenience Functions}. | |
1250 | |
1251 @defvr Glyph truncation-glyph | |
1252 This variable specifies what is displayed at the end of truncated lines. | |
1253 @end defvr | |
1254 | |
1255 @defvr Glyph continuation-glyph | |
1256 This variable specifies what is displayed at the end of wrapped lines. | |
1257 @end defvr | |
1258 | |
1259 @defvr Glyph octal-escape-glyph | |
1260 This variable specifies what to prefix character codes displayed in octal | |
1261 with. | |
1262 @end defvr | |
1263 | |
1264 @defvr Glyph hscroll-glyph | |
1265 This variable specifies what to display at the beginning of horizontally | |
1266 scrolled lines. | |
1267 @end defvr | |
1268 | |
1269 @defvr Glyph invisible-text-glyph | |
1270 This variable specifies what to use to indicate the presence of | |
1271 invisible text. This is the glyph that is displayed when an ellipsis is | |
1272 called for, according to @code{selective-display-ellipses} or | |
1273 @code{buffer-invisibility-spec}). Normally this is three dots (``...''). | |
1274 @end defvr | |
1275 | |
1276 @defvr Glyph control-arrow-glyph | |
1277 This variable specifies what to use as an arrow for control characters. | |
1278 @end defvr | |
1279 | |
1280 | |
1281 @node Frame Glyphs | |
1282 @subsection Frame Glyphs | |
1283 | |
1284 There are also a number of special objects whose appearance is specified | |
1285 by a glyph. Most of these a global objects that you update with | |
1286 @code{set-glyph-image}, such as mouse pointers. Frame icons, toolbar | |
1287 button icons, and the modeline are the main non-text objects which | |
1288 accept glyphs as elements. | |
1289 | |
1290 @table @code | |
1291 @item modeline | |
162 A glyph may be displayed in the modeline by inserting the glyph as one | 1292 A glyph may be displayed in the modeline by inserting the glyph as one |
163 of the elements of the modeline format. (Unfortunately you can't | 1293 of the elements of the modeline format. (Unfortunately you can't |
164 currently put a begin glyph or end glyph on one of the modeline | 1294 currently put a begin glyph or end glyph on one of the modeline |
165 extents---they're ignored.) | 1295 extents---they're ignored.) |
166 | 1296 |
167 @item | 1297 @item toolbar |
168 To insert a glyph into a toolbar, specify it as the icon part of a toolbar | 1298 To insert a glyph into a toolbar, specify it as the icon part of a toolbar |
169 button, which in turn must be part of a toolbar instantiator (typically | 1299 button, which in turn must be part of a toolbar instantiator (typically |
170 set on the specifier @code{default-toolbar}). | 1300 set on the specifier @code{default-toolbar}). |
171 See @code{default-toolbar} for more information. (As a convenience, you | 1301 See @code{default-toolbar} for more information. (As a convenience, you |
172 may use a symbol in place of the glyph list in the toolbar button | 1302 may use a symbol in place of the glyph list in the toolbar button |
178 and then calling @code{(set-specifier-dirty-flag default-toolbar)}. | 1308 and then calling @code{(set-specifier-dirty-flag default-toolbar)}. |
179 (#### Unfortunately this doesn't quite work the way it should; the | 1309 (#### Unfortunately this doesn't quite work the way it should; the |
180 change will appear in new frames, but not existing ones, because once an | 1310 change will appear in new frames, but not existing ones, because once an |
181 image has been displayed the pixmap replaces the symbol for those domains.) | 1311 image has been displayed the pixmap replaces the symbol for those domains.) |
182 | 1312 |
183 @item | 1313 @item gutter |
184 To insert a glyph into a gutter, use | 1314 To insert a glyph into a gutter, use |
185 @code{set-extent-begin-glyph} or @code{set-extent-end-glyph} to set a | 1315 @code{set-extent-begin-glyph} or @code{set-extent-end-glyph} to set a |
186 glyph to be displayed at the corresponding edge of extent in a string, | 1316 glyph to be displayed at the corresponding edge of extent in a string, |
187 similar to the way you insert glyphs in a buffer. Then insert the | 1317 similar to the way you insert glyphs in a buffer. Then insert the |
188 string into the gutter @ref{Specifying a Gutter}. | 1318 string into the gutter @ref{Specifying a Gutter}. Glyphs that are |
189 | 1319 frequently used in this way are @code{tab control} and @code{progress |
190 @item To use a glyph as the icon for a frame, you do not actually create | 1320 bar} glyphs. |
191 a new glyph; rather, you change the specifications for the existing | 1321 |
192 glyph @code{frame-icon-glyph}. (This is a unique, predefined object. | 1322 @end table |
193 Remember that, because of the specifier nature of glyphs, you can set | 1323 |
194 different values for any particular buffer or frame.) | 1324 |
195 | 1325 @node External Glyphs |
196 @item | 1326 @subsection External Glyphs |
1327 @cindex frame icon | |
1328 @cindex icon, frame | |
1329 @cindex mouse cursor | |
1330 @cindex cursor (mouse) | |
1331 @cindex pointer (mouse) | |
1332 @cindex mouse pointer | |
1333 | |
1334 There are two special kinds of glyph that are not displayed by XEmacs. | |
1335 Instead, they are used to set the appearance of iconified frames and the | |
1336 mouse pointer. Because these uses are constrained by the window system, | |
1337 icons and pointers have their own special types @xref{Glyph Types}. | |
1338 | |
1339 You may use a glyph as the icon for a frame. Do not create a new glyph; | |
1340 instead, change the specifications for the existing glyph | |
1341 @code{frame-icon-glyph} with @code{set-glyph-image}. This is a unique, | |
1342 predefined object. Although the natural usage is to set specifications | |
1343 for the global locale or a frame locale, you can also arrange for a | |
1344 special icon when a frame's selected window displays a particular buffer | |
1345 by using a buffer locale. | |
1346 | |
1347 The shape of the mouse pointer when over a particular section of a frame | |
1348 is controlled using various glyph variables. Since the image of a glyph | |
1349 is a specifier, it can be controlled on a per-buffer, per-frame, per-window, | |
1350 or per-device basis. | |
1351 | |
197 To use a glyph as the mouse pointer, in general you do not create a new | 1352 To use a glyph as the mouse pointer, in general you do not create a new |
198 glyph, but rather you change the specifications of various existing | 1353 glyph, but rather you change the specifications of various existing |
199 glyphs, such as @code{text-pointer-glyph} for the pointer used over | 1354 glyphs, such as @code{text-pointer-glyph} for the pointer used over |
200 text, @code{modeline-pointer-glyph} for the pointer used over the | 1355 text, @code{modeline-pointer-glyph} for the pointer used over the |
201 modeline, etc. Do an apropos over @samp{pointer-glyph} to find all of | 1356 modeline, etc. Do an apropos over @samp{pointer-glyph} to find all of |
210 pointer glyph variables are implemented as part of the default handler | 1365 pointer glyph variables are implemented as part of the default handler |
211 for mouse motion events. If you want to customize this behavior, take a | 1366 for mouse motion events. If you want to customize this behavior, take a |
212 look at @code{mode-motion-hook}, or @code{mouse-motion-handler} if you | 1367 look at @code{mode-motion-hook}, or @code{mouse-motion-handler} if you |
213 really want to get low-level.) | 1368 really want to get low-level.) |
214 | 1369 |
215 @item | |
216 To use a glyph to control the shape of miscellaneous redisplay effects | |
217 such as the truncation and continuation markers, set the appropriate | |
218 existing glyph variables, as for icons and pointers above. See | |
219 @code{continuation-glyph}, @code{control-arrow-glyph}, | |
220 @code{hscroll-glyph}, @code{invisible-text-glyph}, | |
221 @code{octal-escape-glyph}, and @code{truncation-glyph}. See also | |
222 @code{overlay-arrow-string}, an odd redisplay leftover which can be set | |
223 to a glyph you created, and will cause the glyph to be displayed on top | |
224 of the text position specified in the marker stored in | |
225 @code{overlay-arrow-position}. | |
226 | |
227 @item | |
228 To use a glyph in a display table (i.e. to control the appearance of any | |
229 individual character), create the appropriate character glyphs and then | |
230 set a specification for the specifier @code{current-display-table}, | |
231 which controls the appearance of characters. You can also set an | |
232 overriding display table for use with text displayed in a particular | |
233 face; see @code{set-face-display-table} and @code{make-display-table}. | |
234 #### Note: Display tables do not currently support general Mule | |
235 characters. They will be overhauled at some point to support this | |
236 and to provide other features required under Mule. | |
237 | |
238 @item | |
239 Glyphs are not actually used as the background pixmaps of faces, but the | |
240 API is similar. The | |
241 background pixmap of a face is actually an image specifier -- probably | |
242 the only place in XEmacs where an image specifier occurs outside of a | |
243 glyph. If you would like to use a glyph's image as a background pixmap, | |
244 you can extract it with @code{glyph-image}, and then add it to a face. | |
245 @xref{Face Convenience Functions}. | |
246 @end itemize | |
247 | |
248 It is extremely rare that you will ever have to specify a value for | |
249 @var{type}, which should be one of @code{buffer} (used for glyphs in an | |
250 extent, the modeline, the toolbar, or elsewhere in a buffer), | |
251 @code{pointer} (used for the mouse-pointer), or @code{icon} (used for a | |
252 frame's icon), and defaults to @code{buffer}. The only cases where it | |
253 needs to be specified is when creating icon or pointer glyphs, and in | |
254 both cases the necessary glyphs have already been created at startup and | |
255 are accessed through the appropriate variables, | |
256 e.g. @code{text-pointer-glyph} (or in general, any @samp{*-pointer-glyph}) | |
257 and @code{frame-icon-glyph}. @xref{Glyph Types}. | |
258 @end defun | |
259 | |
260 @defun make-glyph-internal &optional type | |
261 This function creates a new, uninitialized glyph of type @var{type}. | |
262 @end defun | |
263 | |
264 @defun make-pointer-glyph &optional spec-list | |
265 | |
266 Return a new @code{pointer-glyph} object with the specification list | |
267 @var{spec-list}. This function is equivalent to calling | |
268 @code{make-glyph} with a @var{type} of @code{pointer}. | |
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 | |
274 | |
275 @defun make-icon-glyph &optional spec-list | |
276 | |
277 Return a new @code{pointer-glyph} object with the specification list | |
278 @var{spec-list}. This function is equivalent to calling | |
279 @code{make-glyph} with a @var{type} of @code{icon}. | |
280 | |
281 It is extremely unlikely that you will ever need to create a pointer | |
282 glyph. Instead, you probably want to be calling @code{set-glyph-image} | |
283 on the existing glyph, @code{frame-icon-glyph}. | |
284 @end defun | |
285 | |
286 @node Glyph Properties | |
287 @subsection Glyph Properties | |
288 | |
289 Each glyph has a list of properties, which control all of the aspects of | |
290 the glyph's appearance. The following symbols have predefined meanings: | |
291 | |
292 @table @code | |
293 @item image | |
294 The image used to display the glyph. | |
295 | |
296 @item baseline | |
297 Percent above baseline that glyph is to be displayed. Only for glyphs | |
298 displayed inside of a buffer. | |
299 | |
300 @item contrib-p | |
301 Whether the glyph contributes to the height of the line it's on. | |
302 Only for glyphs displayed inside of a buffer. | |
303 | |
304 @item face | |
305 Face of this glyph (@emph{not} a specifier). | |
306 @end table | |
307 | |
308 @defun set-glyph-property glyph property value &optional locale tag-set how-to-add | |
309 This function changes a property of a @var{glyph}. | |
310 | |
311 For built-in properties, the actual value of the property is a specifier | |
312 and you cannot change this; but you can change the specifications within | |
313 the specifier, and that is what this function will do. For user-defined | |
314 properties, you can use this function to either change the actual value | |
315 of the property or, if this value is a specifier, change the | |
316 specifications within it. | |
317 | |
318 If @var{property} is a built-in property, the specifications to be added | |
319 to this property can be supplied in many different ways: | |
320 | |
321 @itemize @bullet | |
322 @item | |
323 If @var{value} is a simple instantiator (e.g. a string naming a pixmap | |
324 filename) or a list of instantiators, then the instantiator(s) will be | |
325 added as a specification of the property for the given @var{locale} | |
326 (which defaults to @code{global} if omitted). | |
327 | |
328 @item | |
329 If @var{value} is a list of specifications (each of which is a cons of a | |
330 locale and a list of instantiators), then @var{locale} must be | |
331 @code{nil} (it does not make sense to explicitly specify a locale in | |
332 this case), and specifications will be added as given. | |
333 | |
334 @item | |
335 If @var{value} is a specifier (as would be returned by | |
336 @code{glyph-property} if no @var{locale} argument is given), then some | |
337 or all of the specifications in the specifier will be added to the | |
338 property. In this case, the function is really equivalent to | |
339 @code{copy-specifier} and @var{locale} has the same semantics (if it is | |
340 a particular locale, the specification for the locale will be copied; if | |
341 a locale type, specifications for all locales of that type will be | |
342 copied; if @code{nil} or @code{all}, then all specifications will be | |
343 copied). | |
344 @end itemize | |
345 | |
346 @var{how-to-add} should be either @code{nil} or one of the symbols | |
347 @code{prepend}, @code{append}, @code{remove-tag-set-prepend}, | |
348 @code{remove-tag-set-append}, @code{remove-locale}, | |
349 @code{remove-locale-type}, or @code{remove-all}. See | |
350 @code{copy-specifier} and @code{add-spec-to-specifier} for a description | |
351 of what each of these means. Most of the time, you do not need to worry | |
352 about this argument; the default behavior usually is fine. | |
353 | |
354 In general, it is OK to pass an instance object (e.g. as returned by | |
355 @code{glyph-property-instance}) as an instantiator in place of an actual | |
356 instantiator. In such a case, the instantiator used to create that | |
357 instance object will be used (for example, if you set a font-instance | |
358 object as the value of the @code{font} property, then the font name used | |
359 to create that object will be used instead). In some cases, however, | |
360 doing this conversion does not make sense, and this will be noted in the | |
361 documentation for particular types of instance objects. | |
362 | |
363 If @var{property} is not a built-in property, then this function will | |
364 simply set its value if @var{locale} is @code{nil}. However, if | |
365 @var{locale} is given, then this function will attempt to add | |
366 @var{value} as the instantiator for the given @var{locale}, using | |
367 @code{add-spec-to-specifier}. If the value of the property is not a | |
368 specifier, it will automatically be converted into a @code{generic} | |
369 specifier. | |
370 @end defun | |
371 | |
372 @defun glyph-property glyph property &optional locale | |
373 This function returns @var{glyph}'s value of the given @var{property}. | |
374 | |
375 If @var{locale} is omitted, the @var{glyph}'s actual value for | |
376 @var{property} will be returned. For built-in properties, this will be | |
377 a specifier object of a type appropriate to the property (e.g. a font or | |
378 color specifier). For other properties, this could be anything. | |
379 | |
380 If @var{locale} is supplied, then instead of returning the actual value, | |
381 the specification(s) for the given locale or locale type will be | |
382 returned. This will only work if the actual value of @var{property} is | |
383 a specifier (this will always be the case for built-in properties, but | |
384 may or may not apply to user-defined properties). If the actual value | |
385 of @var{property} is not a specifier, this value will simply be returned | |
386 regardless of @var{locale}. | |
387 | |
388 The return value will be a list of instantiators (e.g. vectors | |
389 specifying pixmap data), or a list of specifications, each of which is a | |
390 cons of a locale and a list of instantiators. Specifically, if | |
391 @var{locale} is a particular locale (a buffer, window, frame, device, or | |
392 @code{global}), a list of instantiators for that locale will be | |
393 returned. Otherwise, if @var{locale} is a locale type (one of the | |
394 symbols @code{buffer}, @code{window}, @code{frame}, or @code{device}), | |
395 the specifications for all locales of that type will be returned. | |
396 Finally, if @var{locale} is @code{all}, the specifications for all | |
397 locales of all types will be returned. | |
398 | |
399 The specifications in a specifier determine what the value of | |
400 @var{property} will be in a particular @dfn{domain} or set of | |
401 circumstances, which is typically a particular Emacs window along with | |
402 the buffer it contains and the frame and device it lies within. The | |
403 value is derived from the instantiator associated with the most specific | |
404 locale (in the order buffer, window, frame, device, and @code{global}) | |
405 that matches the domain in question. In other words, given a domain | |
406 (i.e. an Emacs window, usually), the specifier for @var{property} will | |
407 first be searched for a specification whose locale is the buffer | |
408 contained within that window; then for a specification whose locale is | |
409 the window itself; then for a specification whose locale is the frame | |
410 that the window is contained within; etc. The first instantiator that | |
411 is valid for the domain (usually this means that the instantiator is | |
412 recognized by the device [i.e. the X server or TTY device] that the | |
413 domain is on). The function @code{glyph-property-instance} actually does | |
414 all this, and is used to determine how to display the glyph. | |
415 @end defun | |
416 | |
417 @defun glyph-property-instance glyph property &optional domain default no-fallback | |
418 This function returns the instance of @var{glyph}'s @var{property} in the | |
419 specified @var{domain}. | |
420 | |
421 Under most circumstances, @var{domain} will be a particular window, and | |
422 the returned instance describes how the specified property actually is | |
423 displayed for that window and the particular buffer in it. Note that | |
424 this may not be the same as how the property appears when the buffer is | |
425 displayed in a different window or frame, or how the property appears in | |
426 the same window if you switch to another buffer in that window; and in | |
427 those cases, the returned instance would be different. | |
428 | |
429 The returned instance is an image-instance object, and you can query it | |
430 using the appropriate image instance functions. For example, you could use | |
431 @code{image-instance-depth} to find out the depth (number of color | |
432 planes) of a pixmap displayed in a particular window. The results might | |
433 be different from the results you would get for another window (perhaps | |
434 the user specified a different image for the frame that window is on; or | |
435 perhaps the same image was specified but the window is on a different X | |
436 server, and that X server has different color capabilities from this | |
437 one). | |
438 | |
439 @var{domain} defaults to the selected window if omitted. | |
440 | |
441 @var{domain} can be a frame or device, instead of a window. The value | |
442 returned for such a domain is used in special circumstances when a | |
443 more specific domain does not apply; for example, a frame value might be | |
444 used for coloring a toolbar, which is conceptually attached to a frame | |
445 rather than a particular window. The value is also useful in | |
446 determining what the value would be for a particular window within the | |
447 frame or device, if it is not overridden by a more specific | |
448 specification. | |
449 | |
450 If @var{property} does not name a built-in property, its value will | |
451 simply be returned unless it is a specifier object, in which case it | |
452 will be instanced using @code{specifier-instance}. | |
453 | |
454 Optional arguments @var{default} and @var{no-fallback} are the same as | |
455 in @code{specifier-instance}. @xref{Specifiers}. | |
456 @end defun | |
457 | |
458 @defun remove-glyph-property glyph property &optional locale tag-set exact-p | |
459 This function removes a property from a glyph. For built-in properties, | |
460 this is analogous to @code{remove-specifier}. @xref{Specifiers, | |
461 remove-specifier-p}, for the meaning of the @var{locale}, @var{tag-set}, | |
462 and @var{exact-p} arguments. | |
463 @end defun | |
464 | |
465 @node Glyph Convenience Functions | |
466 @subsection Glyph Convenience Functions | |
467 | |
468 The following functions are provided for working with specific | |
469 properties of a glyph. Note that these are exactly like calling | |
470 the general functions described above and passing in the | |
471 appropriate value for @var{property}. | |
472 | |
473 Remember that if you want to determine the ``value'' of a | |
474 specific glyph property, you probably want to use the @code{*-instance} | |
475 functions. For example, to determine whether a glyph contributes | |
476 to its line height, use @code{glyph-contrib-p-instance}, not | |
477 @code{glyph-contrib-p}. (The latter will return a boolean specifier | |
478 or a list of specifications, and you probably aren't concerned with | |
479 these.) | |
480 | |
481 @defun glyph-image glyph &optional locale | |
482 This function is equivalent to calling @code{glyph-property} with | |
483 a property of @code{image}. The return value will be an image | |
484 specifier if @var{locale} is @code{nil} or omitted; otherwise, | |
485 it will be a specification or list of specifications. | |
486 @end defun | |
487 | |
488 @defun set-glyph-image glyph spec &optional locale tag-set how-to-add | |
489 This function is equivalent to calling @code{set-glyph-property} with | |
490 a property of @code{image}. | |
491 @end defun | |
492 | |
493 @defun glyph-image-instance glyph &optional domain default no-fallback | |
494 This function returns the instance of @var{glyph}'s image in the given | |
495 @var{domain}, and is equivalent to calling | |
496 @code{glyph-property-instance} with a property of @code{image}. The | |
497 return value will be an image instance. | |
498 | |
499 Normally @var{domain} will be a window or @code{nil} (meaning the | |
500 selected window), and an instance object describing how the image | |
501 appears in that particular window and buffer will be returned. | |
502 @end defun | |
503 | |
504 @defun glyph-contrib-p glyph &optional locale | |
505 This function is equivalent to calling @code{glyph-property} with | |
506 a property of @code{contrib-p}. The return value will be a boolean | |
507 specifier if @var{locale} is @code{nil} or omitted; otherwise, | |
508 it will be a specification or list of specifications. | |
509 @end defun | |
510 | |
511 @defun set-glyph-contrib-p glyph spec &optional locale tag-set how-to-add | |
512 This function is equivalent to calling @code{set-glyph-property} with | |
513 a property of @code{contrib-p}. | |
514 @end defun | |
515 | |
516 @defun glyph-contrib-p-instance glyph &optional domain default no-fallback | |
517 This function returns whether the glyph contributes to its line height | |
518 in the given @var{domain}, and is equivalent to calling | |
519 @code{glyph-property-instance} with a property of @code{contrib-p}. The | |
520 return value will be either @code{nil} or @code{t}. (Normally @var{domain} | |
521 will be a window or @code{nil}, meaning the selected window.) | |
522 @end defun | |
523 | |
524 @defun glyph-baseline glyph &optional locale | |
525 This function is equivalent to calling @code{glyph-property} with a | |
526 property of @code{baseline}. The return value will be a specifier if | |
527 @var{locale} is @code{nil} or omitted; otherwise, it will be a | |
528 specification or list of specifications. | |
529 @end defun | |
530 | |
531 @defun set-glyph-baseline glyph spec &optional locale tag-set how-to-add | |
532 This function is equivalent to calling @code{set-glyph-property} with | |
533 a property of @code{baseline}. | |
534 @end defun | |
535 | |
536 @defun glyph-baseline-instance glyph &optional domain default no-fallback | |
537 This function returns the instance of @var{glyph}'s baseline value in | |
538 the given @var{domain}, and is equivalent to calling | |
539 @code{glyph-property-instance} with a property of @code{baseline}. The | |
540 return value will be an integer or @code{nil}. | |
541 | |
542 Normally @var{domain} will be a window or @code{nil} (meaning the | |
543 selected window), and an instance object describing the baseline value | |
544 appears in that particular window and buffer will be returned. | |
545 @end defun | |
546 | |
547 @defun glyph-face glyph | |
548 This function returns the face of @var{glyph}. (Remember, this is | |
549 not a specifier, but a simple property.) | |
550 @end defun | |
551 | |
552 @defun set-glyph-face glyph face | |
553 This function changes the face of @var{glyph} to @var{face}. | |
554 @end defun | |
555 | |
556 @node Glyph Dimensions | |
557 @subsection Glyph Dimensions | |
558 | |
559 @defun glyph-width glyph &optional window | |
560 This function returns the width of @var{glyph} on @var{window}. This | |
561 may not be exact as it does not take into account all of the context | |
562 that redisplay will. | |
563 @end defun | |
564 | |
565 @defun glyph-ascent glyph &optional window | |
566 This function returns the ascent value of @var{glyph} on @var{window}. | |
567 This may not be exact as it does not take into account all of the | |
568 context that redisplay will. | |
569 @end defun | |
570 | |
571 @defun glyph-descent glyph &optional window | |
572 This function returns the descent value of @var{glyph} on @var{window}. | |
573 This may not be exact as it does not take into account all of the | |
574 context that redisplay will. | |
575 @end defun | |
576 | |
577 @defun glyph-height glyph &optional window | |
578 This function returns the height of @var{glyph} on @var{window}. (This | |
579 is equivalent to the sum of the ascent and descent values.) This may | |
580 not be exact as it does not take into account all of the context that | |
581 redisplay will. | |
582 @end defun | |
583 | |
584 @node Images | |
585 @section Images | |
586 | |
587 @menu | |
588 * Image Specifiers:: Specifying how an image will appear. | |
589 * Image Instantiator Conversion:: | |
590 Conversion is applied to image instantiators | |
591 at the time they are added to an | |
592 image specifier or at the time they | |
593 are passed to @code{make-image-instance}. | |
594 * Image Instances:: What an image specifier gets instanced as. | |
595 @end menu | |
596 | |
597 @node Image Specifiers | |
598 @subsection Image Specifiers | |
599 @cindex image specifiers | |
600 | |
601 An image specifier is used to describe the actual image of a glyph. | |
602 It works like other specifiers (@pxref{Specifiers}), in that it contains | |
603 a number of specifications describing how the image should appear in a | |
604 variety of circumstances. These specifications are called @dfn{image | |
605 instantiators}. When XEmacs wants to display the image, it instantiates | |
606 the image into an @dfn{image instance}. Image instances are their own | |
607 primitive object type (similar to font instances and color instances), | |
608 describing how the image appears in a particular domain. (On the other | |
609 hand, image instantiators, which are just descriptions of how the image | |
610 should appear, are represented using strings or vectors.) | |
611 | |
612 @defun image-specifier-p object | |
613 This function returns non-@code{nil} if @var{object} is an image specifier. | |
614 Usually, an image specifier results from calling @code{glyph-image} on | |
615 a glyph. | |
616 @end defun | |
617 | |
618 @defun make-image-specifier spec-list | |
619 This function creates a new image specifier object and initializes it | |
620 according to @var{spec-list}. @xref{Specifiers}. | |
621 | |
622 Note that, in practice, you rarely, if ever, need to actually create an | |
623 image specifier! (This function exists mainly for completeness.) Pretty | |
624 much the only use for image specifiers is to control how glyphs are | |
625 displayed, and the image specifier associated with a glyph (the | |
626 @code{image} property of a glyph) is created automatically when a glyph | |
627 is created and need not (and cannot, for that matter) ever be changed | |
628 (@pxref{Glyphs}). In fact, the design decision to create a separate | |
629 image specifier type, rather than make glyphs themselves be specifiers, | |
630 is debatable---the other properties of glyphs are rarely used and could | |
631 conceivably have been incorporated into the glyph's instantiator. The | |
632 rarely used glyph types (buffer, pointer, icon) could also have been | |
633 incorporated into the instantiator. | |
634 @end defun | |
635 | |
636 Image instantiators come in many formats: @code{xbm}, @code{xpm}, | |
637 @code{gif}, @code{jpeg}, etc. This describes the format of the data | |
638 describing the image. The resulting image instances also come in many | |
639 types---@code{mono-pixmap}, @code{color-pixmap}, @code{text}, | |
640 @code{pointer}, etc. This refers to the behavior of the image and the | |
641 sorts of places it can appear. (For example, a color-pixmap image has | |
642 fixed colors specified for it, while a mono-pixmap image comes in two | |
643 unspecified shades ``foreground'' and ``background'' that are determined | |
644 from the face of the glyph or surrounding text; a text image appears as | |
645 a string of text and has an unspecified foreground, background, and | |
646 font; a pointer image behaves like a mono-pixmap image but can only be | |
647 used as a mouse pointer [mono-pixmap images cannot be used as mouse | |
648 pointers]; etc.) It is important to keep the distinction between image | |
649 instantiator format and image instance type in mind. Typically, a given | |
650 image instantiator format can result in many different image instance | |
651 types (for example, @code{xpm} can be instanced as @code{color-pixmap}, | |
652 @code{mono-pixmap}, or @code{pointer}; whereas @code{cursor-font} can be | |
653 instanced only as @code{pointer}), and a particular image instance type | |
654 can be generated by many different image instantiator formats (e.g. | |
655 @code{color-pixmap} can be generated by @code{xpm}, @code{gif}, | |
656 @code{jpeg}, etc.). | |
657 | |
658 @xref{Image Instances}, for a more detailed discussion of image | |
659 instance types. | |
660 | |
661 An image instantiator should be a string or a vector of the form | |
662 | |
663 @example | |
664 @code{[@var{format} @var{:keyword} @var{value} ...]} | |
665 @end example | |
666 | |
667 i.e. a format symbol followed by zero or more alternating keyword-value | |
668 pairs. The @dfn{format} field should be a symbol, one of | |
669 | |
670 @table @code | |
671 @item nothing | |
672 Don't display anything; no keywords are valid for this. Can only be | |
673 instanced as @code{nothing}. | |
674 @item string | |
675 Display this image as a text string. Can only be instanced | |
676 as @code{text}, although support for instancing as @code{mono-pixmap} | |
677 should be added. | |
678 @item formatted-string | |
679 Display this image as a text string with replaceable fields, | |
680 similar to a modeline format string; not currently implemented. | |
681 @item xbm | |
682 An X bitmap; only if X support was compiled into this XEmacs. Can be | |
683 instanced as @code{mono-pixmap}, @code{color-pixmap}, or | |
684 @code{pointer}. | |
685 @item xpm | |
686 An XPM pixmap; only if XPM support was compiled into this XEmacs. Can | |
687 be instanced as @code{color-pixmap}, @code{mono-pixmap}, or | |
688 @code{pointer}. XPM is an add-on library for X that was designed to | |
689 rectify the shortcomings of the XBM format. Most implementations of X | |
690 include the XPM library as a standard part. If your vendor does not, it | |
691 is highly recommended that you download it and install it. You can get | |
692 it from the standard XEmacs FTP site, among other places. | |
693 @item xface | |
694 An X-Face bitmap, used to encode people's faces in e-mail messages; | |
695 only if X-Face support was compiled into this XEmacs. Can be instanced | |
696 as @code{mono-pixmap}, @code{color-pixmap}, or @code{pointer}. | |
697 @item gif | |
698 A GIF87 or GIF89 image; only if GIF support was compiled into this | |
699 XEmacs. Can be instanced as @code{color-pixmap}. Note that XEmacs | |
700 includes GIF decoding functions as a standard part of it, so if you have | |
701 X support, you will normally have GIF support, unless you explicitly | |
702 disable it at configure time. | |
703 @item jpeg | |
704 A JPEG-format image; only if JPEG support was compiled into this | |
705 XEmacs. Can be instanced as @code{color-pixmap}. If you have the JPEG | |
706 libraries present on your system when XEmacs is built, XEmacs will | |
707 automatically detect this and use them, unless you explicitly disable it | |
708 at configure time. | |
709 @item png | |
710 A PNG/GIF24 image; only if PNG support was compiled into this XEmacs. | |
711 Can be instanced as @code{color-pixmap}. | |
712 @item tiff | |
713 A TIFF-format image; only if TIFF support was compiled into this XEmacs. | |
714 @item cursor-font | |
715 One of the standard cursor-font names, such as @samp{watch} or | |
716 @samp{right_ptr} under X. Under X, this is, more specifically, any of | |
717 the standard cursor names from appendix B of the Xlib manual [also known | |
718 as the file @file{<X11/cursorfont.h>}] minus the @samp{XC_} prefix. On | |
719 other window systems, the valid names will be specific to the type of | |
720 window system. Can only be instanced as @code{pointer}. | |
721 @item font | |
722 A glyph from a font; i.e. the name of a font, and glyph index into it | |
723 of the form @samp{@var{font} fontname index [[mask-font] mask-index]}. | |
724 Only if X support was compiled into this XEmacs. Currently can only be | |
725 instanced as @code{pointer}, although this should probably be fixed. | |
726 @item mswindows-resource | |
727 An MS Windows pointer resource. Specifies a resource to retrieve | |
728 directly from the system (an OEM resource) or from a file, particularly | |
729 an executable file. If the resource is to be retrieved from a file, use | |
730 :file and optionally :resource-id. Otherwise use :resource-id. Always | |
731 specify :resource-type to specify the type (cursor, bitmap or icon) of | |
732 the resource. Possible values for :resource-id are listed below. Can | |
733 be instanced as @code{pointer} or @code{color-pixmap}. | |
734 @item subwindow | |
735 An embedded windowing system window. Can only be instanced as | |
736 @code{subwindow}. | |
737 @item button | |
738 A button widget; either a push button, radio button or toggle button. | |
739 Can only be instanced as @code{widget}. | |
740 @item combo-box | |
741 A drop list of selectable items in a widget, for editing text. | |
742 Can only be instanced as @code{widget}. | |
743 @item edit-field | |
744 A text editing widget. Can only be instanced as @code{widget}. | |
745 @item label | |
746 A static, text-only, widget; for displaying text. Can only be instanced | |
747 as @code{widget}. | |
748 @item layout | |
749 A widget for controlling the positioning of children underneath it. | |
750 Through the use of nested layouts, a widget hierarchy can be created | |
751 which can have the appearance of any standard dialog box or similar | |
752 arrangement; all of this is counted as one @dfn{glyph} and could appear | |
753 in many of the places that expect a single glyph. Can only be instanced | |
754 as @code{widget}. | |
755 @item native-layout | |
756 @c #### Document me better! | |
757 The native version of a layout widget. | |
758 Can only be instanced as @code{widget}. | |
759 @item progress-gauge | |
760 A sliding widget, for showing progress. Can only be instanced as | |
761 @code{widget}. | |
762 @item tab-control | |
763 A tab widget; a series of user selectable tabs. Can only be instanced | |
764 as @code{widget}. | |
765 @item tree-view | |
766 A folding widget. Can only be instanced as @code{widget}. | |
767 @item scrollbar | |
768 A scrollbar widget. Can only be instanced as @code{widget}. | |
769 @item autodetect | |
770 XEmacs tries to guess what format the data is in. If X support exists, | |
771 the data string will be checked to see if it names a filename. If so, | |
772 and this filename contains XBM or XPM data, the appropriate sort of | |
773 pixmap or pointer will be created. [This includes picking up any | |
774 specified hotspot or associated mask file.] Otherwise, if @code{pointer} | |
775 is one of the allowable image-instance types and the string names a | |
776 valid cursor-font name, the image will be created as a pointer. | |
777 Otherwise, the image will be displayed as text. If no X support exists, | |
778 the image will always be displayed as text. | |
779 @item inherit | |
780 Inherit from the background-pixmap property of a face. Can only be | |
781 instanced as @code{mono-pixmap}. | |
782 @end table | |
783 | |
784 The valid keywords are: | |
785 | |
786 @table @code | |
787 @item :data | |
788 Inline data. For most formats above, this should be a string. For | |
789 XBM images, this should be a list of three elements: width, height, and | |
790 a string of bit data. This keyword is not valid for instantiator | |
791 format @code{nothing}. | |
792 | |
793 @item :file | |
794 Data is contained in a file. The value is the name of this file. If | |
795 both @code{:data} and @code{:file} are specified, the image is created | |
796 from what is specified in @code{:data} and the string in @code{:file} | |
797 becomes the value of the @code{image-instance-file-name} function when | |
798 applied to the resulting image-instance. This keyword is not valid for | |
799 instantiator formats @code{nothing}, @code{string}, | |
800 @code{formatted-string}, @code{cursor-font}, @code{font}, and | |
801 @code{autodetect}. | |
802 | |
803 @item :foreground | |
804 @itemx :background | |
805 For @code{xbm}, @code{xface}, @code{cursor-font}, and @code{font}. | |
806 These keywords allow you to explicitly specify foreground and background | |
807 colors. The argument should be anything acceptable to | |
808 @code{make-color-instance}. This will cause what would be a | |
809 @code{mono-pixmap} to instead be colorized as a two-color color-pixmap, | |
810 and specifies the foreground and/or background colors for a pointer | |
811 instead of black and white. | |
812 | |
813 @item :mask-data | |
814 For @code{xbm} and @code{xface}. This specifies a mask to be used with the | |
815 bitmap. The format is a list of width, height, and bits, like for | |
816 @code{:data}. | |
817 | |
818 @item :mask-file | |
819 For @code{xbm} and @code{xface}. This specifies a file containing the | |
820 mask data. If neither a mask file nor inline mask data is given for an | |
821 XBM image, and the XBM image comes from a file, XEmacs will look for a | |
822 mask file with the same name as the image file but with @samp{Mask} or | |
823 @samp{msk} appended. For example, if you specify the XBM file | |
824 @file{left_ptr} [usually located in @file{/usr/include/X11/bitmaps}], | |
825 the associated mask file @file{left_ptrmsk} will automatically be picked | |
826 up. | |
827 | |
828 @item :hotspot-x | |
829 @itemx :hotspot-y | |
830 For @code{xbm} and @code{xface}. These keywords specify a hotspot if | |
831 the image is instantiated as a @code{pointer}. Note that if the XBM | |
832 image file specifies a hotspot, it will automatically be picked up if no | |
833 explicit hotspot is given. | |
834 | |
835 @item :color-symbols | |
836 Only for @code{xpm}. This specifies an alist that maps strings that | |
837 specify symbolic color names to the actual color to be used for that | |
838 symbolic color (in the form of a string or a color-specifier object). | |
839 If this is not specified, the contents of @code{xpm-color-symbols} are | |
840 used to generate the alist. | |
841 @item :resource-id | |
842 Only for @code{mswindows-resource}. This must be either an integer | |
843 (which directly specifies a resource number) or a string. Valid strings | |
844 are | |
845 | |
846 For bitmaps: | |
847 | |
848 "close", "uparrow", "dnarrow", "rgarrow", "lfarrow", | |
849 "reduce", "zoom", "restore", "reduced", "zoomd", | |
850 "restored", "uparrowd", "dnarrowd", "rgarrowd", "lfarrowd", | |
851 "mnarrow", "combo", "uparrowi", "dnarrowi", "rgarrowi", | |
852 "lfarrowi", "size", "btsize", "check", "checkboxes", and | |
853 "btncorners". | |
854 | |
855 For cursors: | |
856 | |
857 "normal", "ibeam", "wait", "cross", "up", "sizenwse", | |
858 "sizenesw", "sizewe", "sizens", "sizeall", and "no". | |
859 | |
860 For icons: | |
861 | |
862 "sample", "hand", "ques", "bang", "note", and "winlogo". | |
863 @item :resource-type | |
864 Only for @code{mswindows-resource}. This must be a symbol, either | |
865 @code{cursor}, @code{icon}, or @code{bitmap}, specifying the type of | |
866 resource to be retrieved. | |
867 @item :face | |
868 Only for @code{inherit}. This specifies the face to inherit from. For | |
869 widgets this also specifies the face to use for display. It defaults to | |
870 gui-element-face. | |
871 @end table | |
872 | |
873 Keywords accepted as menu item specs are also accepted by widgets. | |
874 These are @code{:selected}, @code{:active}, @code{:suffix}, | |
875 @code{:keys}, @code{:style}, @code{:filter}, @code{:config}, | |
876 @code{:included}, @code{:key-sequence}, @code{:accelerator}, | |
877 @code{:label} and @code{:callback}. | |
878 | |
879 If instead of a vector, the instantiator is a string, it will be | |
880 converted into a vector by looking it up according to the specs in the | |
881 @code{console-type-image-conversion-list} for the console type of | |
882 the domain (usually a window; sometimes a frame or device) over which | |
883 the image is being instantiated. | |
884 | |
885 If the instantiator specifies data from a file, the data will be read in | |
886 at the time that the instantiator is added to the image specifier (which | |
887 may be well before the image is actually displayed), and the | |
888 instantiator will be converted into one of the inline-data forms, with | |
889 the filename retained using a @code{:file} keyword. This implies that | |
890 the file must exist when the instantiator is added to the image, but | |
891 does not need to exist at any other time (e.g. it may safely be a | |
892 temporary file). | |
893 | |
894 @defun valid-image-instantiator-format-p format &optional locale | |
895 This function returns non-@code{nil} if @var{format} is a valid image | |
896 instantiator format. | |
897 | |
898 If @var{locale} is non-@code{nil} then the format is checked in that locale. | |
899 If @var{locale} is @code{nil} the current console is used. | |
900 | |
901 Note that the return value for many formats listed above depends on | |
902 whether XEmacs was compiled with support for that format. | |
903 @end defun | |
904 | |
905 @defun image-instantiator-format-list | |
906 This function return a list of valid image-instantiator formats. | |
907 @end defun | |
908 | |
909 @defvar xpm-color-symbols | |
910 This variable holds definitions of logical color-names used when reading | |
911 XPM files. Elements of this list should be of the form | |
912 @code{(@var{color-name} @var{form-to-evaluate})}. The @var{color-name} | |
913 should be a string, which is the name of the color to define; the | |
914 @var{form-to-evaluate} should evaluate to a color specifier object, or a | |
915 string to be passed to @code{make-color-instance} (@pxref{Colors}). If | |
916 a loaded XPM file references a symbolic color called @var{color-name}, | |
917 it will display as the computed color instead. | |
918 | |
919 The default value of this variable defines the logical color names | |
920 @samp{"foreground"} and @samp{"background"} to be the colors of the | |
921 @code{default} face. | |
922 @end defvar | |
923 | |
924 @defvar x-bitmap-file-path | |
925 A list of the directories in which X bitmap files may be found. If @code{nil}, | |
926 this is initialized from the @samp{"*bitmapFilePath"} resource. This is | |
927 used by the @code{make-image-instance} function (however, note that if | |
928 the environment variable @samp{XBMLANGPATH} is set, it is consulted | |
929 first). | |
930 @end defvar | |
931 | |
932 @node Image Instantiator Conversion | |
933 @subsection Image Instantiator Conversion | |
934 @cindex image instantiator conversion | |
935 @cindex conversion of image instantiators | |
936 | |
937 @defun set-console-type-image-conversion-list console-type list | |
938 This function sets the image-conversion-list for consoles of the given | |
939 @var{console-type}. The image-conversion-list specifies how image | |
940 instantiators that are strings should be interpreted. Each element of | |
941 the list should be a list of two elements (a regular expression string | |
942 and a vector) or a list of three elements (the preceding two plus an | |
943 integer index into the vector). The string is converted to the vector | |
944 associated with the first matching regular expression. If a vector | |
945 index is specified, the string itself is substituted into that position | |
946 in the vector. | |
947 | |
948 Note: The conversion above is applied when the image instantiator is | |
949 added to an image specifier, not when the specifier is actually | |
950 instantiated. Therefore, changing the image-conversion-list only affects | |
951 newly-added instantiators. Existing instantiators in glyphs and image | |
952 specifiers will not be affected. | |
953 @end defun | |
954 | |
955 @defun console-type-image-conversion-list console-type | |
956 This function returns the image-conversion-list for consoles of the given | |
957 @var{console-type}. | |
958 @end defun | |
959 | |
960 @node Image Instances | |
961 @subsection Image Instances | |
962 @cindex image instances | |
963 | |
964 Image-instance objects encapsulate the way a particular image (pixmap, | |
965 etc.) is displayed on a particular device. | |
966 | |
967 In most circumstances, you do not need to directly create image | |
968 instances; use a glyph instead. However, it may occasionally be useful | |
969 to explicitly create image instances, if you want more control over the | |
970 instantiation process. | |
971 | |
972 @defun image-instance-p object | |
973 This function returns non-@code{nil} if @var{object} is an image instance. | |
974 @end defun | |
975 | |
976 @menu | |
977 * Image Instance Types:: Each image instances has a particular type. | |
978 * Image Instance Functions:: Functions for working with image instances. | |
979 @end menu | |
980 | |
981 @node Image Instance Types | |
982 @subsubsection Image Instance Types | |
983 @cindex image instance types | |
984 | |
985 Image instances come in a number of different types. The type | |
986 of an image instance specifies the nature of the image: Whether | |
987 it is a text string, a mono pixmap, a color pixmap, etc. | |
988 | |
989 The valid image instance types are | |
990 | |
991 @table @code | |
992 @item nothing | |
993 Nothing is displayed. | |
994 | |
995 @item text | |
996 Displayed as text. The foreground and background colors and the | |
997 font of the text are specified independent of the pixmap. Typically | |
998 these attributes will come from the face of the surrounding text, | |
999 unless a face is specified for the glyph in which the image appears. | |
1000 | |
1001 @item mono-pixmap | |
1002 Displayed as a mono pixmap (a pixmap with only two colors where the | |
1003 foreground and background can be specified independent of the pixmap; | |
1004 typically the pixmap assumes the foreground and background colors of | |
1005 the text around it, unless a face is specified for the glyph in which | |
1006 the image appears). | |
1007 @item color-pixmap | |
1008 | |
1009 Displayed as a color pixmap. | |
1010 | |
1011 @item pointer | |
1012 Used as the mouse pointer for a window. | |
1013 | |
1014 @item subwindow | |
1015 A child window that is treated as an image. This allows (e.g.) | |
1016 another program to be responsible for drawing into the window. | |
1017 Not currently implemented. | |
1018 @end table | |
1019 | |
1020 @defun valid-image-instance-type-p type | |
1021 This function returns non-@code{nil} if @var{type} is a valid image | |
1022 instance type. | |
1023 @end defun | |
1024 | |
1025 @defun image-instance-type-list | |
1026 This function returns a list of the valid image instance types. | |
1027 @end defun | |
1028 | |
1029 @defun image-instance-type image-instance | |
1030 This function returns the type of the given image instance. The return | |
1031 value will be one of @code{nothing}, @code{text}, @code{mono-pixmap}, | |
1032 @code{color-pixmap}, @code{pointer}, or @code{subwindow}. | |
1033 @end defun | |
1034 | |
1035 @defun text-image-instance-p object | |
1036 This function returns non-@code{nil} if @var{object} is an image | |
1037 instance of type @code{text}. | |
1038 @end defun | |
1039 | |
1040 @defun mono-pixmap-image-instance-p object | |
1041 This function returns non-@code{nil} if @var{object} is an image | |
1042 instance of type @code{mono-pixmap}. | |
1043 @end defun | |
1044 | |
1045 @defun color-pixmap-image-instance-p object | |
1046 This function returns non-@code{nil} if @var{object} is an image | |
1047 instance of type @code{color-pixmap}. | |
1048 @end defun | |
1049 | |
1050 @defun pointer-image-instance-p object | |
1051 This function returns non-@code{nil} if @var{object} is an image | |
1052 instance of type @code{pointer}. | |
1053 @end defun | |
1054 | |
1055 @defun subwindow-image-instance-p object | |
1056 This function returns non-@code{nil} if @var{object} is an image | |
1057 instance of type @code{subwindow}. | |
1058 @end defun | |
1059 | |
1060 @defun nothing-image-instance-p object | |
1061 This function returns non-@code{nil} if @var{object} is an image | |
1062 instance of type @code{nothing}. | |
1063 @end defun | |
1064 | |
1065 @defun widget-image-instance-p object | |
1066 Return @code{t} if @var{object} is an image instance of type @code{widget}. | |
1067 @end defun | |
1068 | |
1069 @node Image Instance Functions | |
1070 @subsubsection Image Instance Functions | |
1071 | |
1072 @defun make-image-instance data &optional domain dest-types noerror | |
1073 This function creates a new image-instance object. | |
1074 | |
1075 @var{data} is an image instantiator, which describes the image | |
1076 (@pxref{Image Specifiers}). | |
1077 | |
1078 @var{dest-types} should be a list of allowed image instance types that | |
1079 can be generated. The @var{dest-types} list is unordered. If multiple | |
1080 destination types are possible for a given instantiator, the ``most | |
1081 natural'' type for the instantiator's format is chosen. (For XBM, the | |
1082 most natural types are @code{mono-pixmap}, followed by | |
1083 @code{color-pixmap}, followed by @code{pointer}. For the other normal | |
1084 image formats, the most natural types are @code{color-pixmap}, followed | |
1085 by @code{mono-pixmap}, followed by @code{pointer}. For the string and | |
1086 formatted-string formats, the most natural types are @code{text}, | |
1087 followed by @code{mono-pixmap} (not currently implemented), followed by | |
1088 @code{color-pixmap} (not currently implemented). For MS Windows | |
1089 resources, the most natural type for pointer resources is | |
1090 @code{pointer}, and for the others it's @code{color-pixmap}. The other | |
1091 formats can only be instantiated as one type. (If you want to control | |
1092 more specifically the order of the types into which an image is | |
1093 instantiated, just call @code{make-image-instance} repeatedly until it | |
1094 succeeds, passing less and less preferred destination types each time. | |
1095 | |
1096 If @var{dest-types} is omitted, all possible types are allowed. | |
1097 | |
1098 @var{domain} specifies the domain to which the image instance will be | |
1099 attached. This domain is termed the @dfn{governing domain}. The type | |
1100 of the governing domain depends on the image instantiator | |
1101 format. (Although, more correctly, it should probably depend on the | |
1102 image instance type.) For example, pixmap image instances are specific | |
1103 to a device, but widget image instances are specific to a particular | |
1104 XEmacs window because in order to display such a widget when two windows | |
1105 onto the same buffer want to display the widget, two separate underlying | |
1106 widgets must be created. (That's because a widget is actually a child | |
1107 window-system window, and all window-system windows have a unique | |
1108 existence on the screen.) This means that the governing domain for a | |
1109 pixmap image instance will be some device (most likely, the only | |
1110 existing device), whereas the governing domain for a widget image | |
1111 instance will be some XEmacs window. | |
1112 | |
1113 If you specify an overly general @var{domain} (e.g. a frame when a | |
1114 window was wanted), an error is signaled. If you specify an overly | |
1115 specific @var{domain} (e.g. a window when a device was wanted), the | |
1116 corresponding general domain is fetched and used instead. For | |
1117 @code{make-image-instance}, it makes no difference whether you specify | |
1118 an overly specific domain or the properly general domain derived from | |
1119 it. However, it does matter when creating an image instance by | |
1120 instantiating a specifier or glyph (e.g. with | |
1121 @code{glyph-image-instance}), because the more specific domain causes | |
1122 spec lookup to start there and proceed to more general domains. (It | |
1123 would also matter when creating an image instance with an instantiator | |
1124 format of @code{inherit}, but we currently disallow this. #### We should | |
1125 fix this.) | |
1126 n | |
1127 If omitted, @var{domain} defaults to the selected window. | |
1128 | |
1129 @var{noerror} controls what happens when the image cannot be generated. | |
1130 If @code{nil}, an error message is generated. If @code{t}, no messages | |
1131 are generated and this function returns @code{nil}. If anything else, a | |
1132 warning message is generated and this function returns @code{nil}. | |
1133 @end defun | |
1134 | |
1135 @defun colorize-image-instance image-instance foreground background | |
1136 This function makes the image instance be displayed in the given | |
1137 colors. Image instances come in two varieties: bitmaps, which are 1 | |
1138 bit deep which are rendered in the prevailing foreground and background | |
1139 colors; and pixmaps, which are of arbitrary depth (including 1) and | |
1140 which have the colors explicitly specified. This function converts a | |
1141 bitmap to a pixmap. If the image instance was a pixmap already, | |
1142 nothing is done (and @code{nil} is returned). Otherwise @code{t} is | |
1143 returned. | |
1144 @end defun | |
1145 | |
1146 @defun image-instance-name image-instance | |
1147 This function returns the name of the given image instance. | |
1148 @end defun | |
1149 | |
1150 @defun image-instance-domain image-instance | |
1151 | |
1152 Return the governing domain of the given @var{image-instance}. The | |
1153 governing domain of an image instance is the domain that the image | |
1154 instance is specific to. It is @emph{NOT} necessarily the domain that | |
1155 was given to the call to @code{specifier-instance} that resulted in the | |
1156 creation of this image instance. See @code{make-image-instance} for | |
1157 more information on governing domains. | |
1158 @end defun | |
1159 | |
1160 | |
1161 @defun image-instance-string image-instance | |
1162 This function returns the string of the given image instance. This will | |
1163 only be non-@code{nil} for text image instances. | |
1164 @end defun | |
1165 | |
1166 @defun image-instance-file-name image-instance | |
1167 This function returns the file name from which @var{image-instance} was | |
1168 read, if known. | |
1169 @end defun | |
1170 | |
1171 @defun image-instance-mask-file-name image-instance | |
1172 This function returns the file name from which @var{image-instance}'s | |
1173 mask was read, if known. | |
1174 @end defun | |
1175 | |
1176 @defun image-instance-depth image-instance | |
1177 This function returns the depth of the image instance. This is 0 for a | |
1178 mono pixmap, or a positive integer for a color pixmap. | |
1179 @end defun | |
1180 | |
1181 @defun image-instance-height image-instance | |
1182 This function returns the height of the image instance, in pixels. | |
1183 @end defun | |
1184 | |
1185 @defun image-instance-width image-instance | |
1186 This function returns the width of the image instance, in pixels. | |
1187 @end defun | |
1188 | |
1189 @defun image-instance-hotspot-x image-instance | |
1190 This function returns the X coordinate of the image instance's hotspot, | |
1191 if known. This is a point relative to the origin of the pixmap. When | |
1192 an image is used as a mouse pointer, the hotspot is the point on the | |
1193 image that sits over the location that the pointer points to. This is, | |
1194 for example, the tip of the arrow or the center of the crosshairs. | |
1195 | |
1196 This will always be @code{nil} for a non-pointer image instance. | |
1197 @end defun | |
1198 | |
1199 @defun image-instance-hotspot-y image-instance | |
1200 This function returns the Y coordinate of the image instance's hotspot, | |
1201 if known. | |
1202 @end defun | |
1203 | |
1204 @defun image-instance-foreground image-instance | |
1205 This function returns the foreground color of @var{image-instance}, if | |
1206 applicable. This will be a color instance or @code{nil}. (It will only | |
1207 be non-@code{nil} for colorized mono pixmaps and for pointers.) | |
1208 @end defun | |
1209 | |
1210 @defun image-instance-background image-instance | |
1211 This function returns the background color of @var{image-instance}, if | |
1212 applicable. This will be a color instance or @code{nil}. (It will only | |
1213 be non-@code{nil} for colorized mono pixmaps and for pointers.) | |
1214 @end defun | |
1215 | |
1216 @node Glyph Types | |
1217 @section Glyph Types | |
1218 | |
1219 Each glyph has a particular type, which controls how the glyph's image | |
1220 is generated. Each glyph type has a corresponding list of allowable | |
1221 image instance types that can be generated. When you call | |
1222 @code{glyph-image-instance} to retrieve the image instance of a glyph, | |
1223 XEmacs does the equivalent of calling @code{make-image-instance} and | |
1224 passing in @var{dest-types} the list of allowable image instance types | |
1225 for the glyph's type. | |
1226 | |
1227 @itemize @bullet | |
1228 @item | |
1229 @code{buffer} glyphs can be used as the begin-glyph or end-glyph of an | |
1230 extent, in the modeline, and in the toolbar. Their image can be | |
1231 instantiated as @code{nothing}, @code{mono-pixmap}, @code{color-pixmap}, | |
1232 @code{text}, and @code{subwindow}. | |
1233 | |
1234 @item | |
1235 @code{pointer} glyphs can be used to specify the mouse pointer. Their | |
1236 image can be instantiated as @code{pointer}. | |
1237 | |
1238 @item | |
1239 @code{icon} glyphs can be used to specify the icon used when a frame is | |
1240 iconified. Their image can be instantiated as @code{mono-pixmap} and | |
1241 @code{color-pixmap}. | |
1242 @end itemize | |
1243 | |
1244 @defun glyph-type glyph | |
1245 This function returns the type of the given glyph. The return value | |
1246 will be a symbol, one of @code{buffer}, @code{pointer}, or @code{icon}. | |
1247 @end defun | |
1248 | |
1249 @defun valid-glyph-type-p glyph-type | |
1250 Given a @var{glyph-type}, this function returns non-@code{nil} if it is | |
1251 valid. | |
1252 @end defun | |
1253 | |
1254 @defun glyph-type-list | |
1255 This function returns a list of valid glyph types. | |
1256 @end defun | |
1257 | |
1258 @defun buffer-glyph-p object | |
1259 This function returns non-@code{nil} if @var{object} is a glyph of type | |
1260 @code{buffer}. | |
1261 @end defun | |
1262 | |
1263 @defun icon-glyph-p object | |
1264 This function returns non-@code{nil} if @var{object} is a glyph of type | |
1265 @code{icon}. | |
1266 @end defun | |
1267 | |
1268 @defun pointer-glyph-p object | |
1269 This function returns non-@code{nil} if @var{object} is a glyph of type | |
1270 @code{pointer}. | |
1271 @end defun | |
1272 | |
1273 @node Mouse Pointer | |
1274 @section Mouse Pointer | |
1275 @cindex mouse cursor | |
1276 @cindex cursor (mouse) | |
1277 @cindex pointer (mouse) | |
1278 @cindex mouse pointer | |
1279 | |
1280 The shape of the mouse pointer when over a particular section of a frame | |
1281 is controlled using various glyph variables. Since the image of a glyph | |
1282 is a specifier, it can be controlled on a per-buffer, per-frame, per-window, | |
1283 or per-device basis. | |
1284 | |
1285 You should use @code{set-glyph-image} to set the following variables, | 1370 You should use @code{set-glyph-image} to set the following variables, |
1286 @emph{not} @code{setq}. | 1371 @emph{not} @code{setq}. |
1287 | 1372 |
1288 @defvr Glyph text-pointer-glyph | 1373 @defvr Glyph text-pointer-glyph |
1289 This variable specifies the shape of the mouse pointer when over text. | 1374 This variable specifies the shape of the mouse pointer when over text. |
1348 This function sets the mouse pointer of @var{frame} to the given pointer | 1433 This function sets the mouse pointer of @var{frame} to the given pointer |
1349 image instance. You should not call this function directly. | 1434 image instance. You should not call this function directly. |
1350 (If you do, the pointer will change again the next time the mouse moves.) | 1435 (If you do, the pointer will change again the next time the mouse moves.) |
1351 @end defun | 1436 @end defun |
1352 | 1437 |
1353 @node Redisplay Glyphs | |
1354 @section Redisplay Glyphs | |
1355 | |
1356 @defvr Glyph truncation-glyph | |
1357 This variable specifies what is displayed at the end of truncated lines. | |
1358 @end defvr | |
1359 | |
1360 @defvr Glyph continuation-glyph | |
1361 This variable specifies what is displayed at the end of wrapped lines. | |
1362 @end defvr | |
1363 | |
1364 @defvr Glyph octal-escape-glyph | |
1365 This variable specifies what to prefix character codes displayed in octal | |
1366 with. | |
1367 @end defvr | |
1368 | |
1369 @defvr Glyph hscroll-glyph | |
1370 This variable specifies what to display at the beginning of horizontally | |
1371 scrolled lines. | |
1372 @end defvr | |
1373 | |
1374 @defvr Glyph invisible-text-glyph | |
1375 This variable specifies what to use to indicate the presence of | |
1376 invisible text. This is the glyph that is displayed when an ellipsis is | |
1377 called for, according to @code{selective-display-ellipses} or | |
1378 @code{buffer-invisibility-spec}). Normally this is three dots (``...''). | |
1379 @end defvr | |
1380 | |
1381 @defvr Glyph control-arrow-glyph | |
1382 This variable specifies what to use as an arrow for control characters. | |
1383 @end defvr | |
1384 | 1438 |
1385 @node Native GUI Widgets | 1439 @node Native GUI Widgets |
1386 @section Native GUI Widgets | 1440 @subsection Native GUI Widgets |
1387 @cindex native widget | 1441 @cindex native widget |
1388 | 1442 |
1389 A ``native widget'' is a primitive GUI object defined either by the host | 1443 A ``native widget'' is a primitive GUI object defined either by the host |
1390 GUI platform or an external toolkit, and accessed from Lisp as a | 1444 GUI platform or an external toolkit, and accessed from Lisp as a |
1391 ``glyph.'' | 1445 ``glyph.'' |
1397 * Layouts:: Specifying composite widgets from Lisp. | 1451 * Layouts:: Specifying composite widgets from Lisp. |
1398 * Primitive Widgets:: Catalogue of available native widgets. | 1452 * Primitive Widgets:: Catalogue of available native widgets. |
1399 @end menu | 1453 @end menu |
1400 | 1454 |
1401 @node Introduction to Widgets | 1455 @node Introduction to Widgets |
1402 @subsection Introduction to Native Widgets and Subwindow Glyphs | 1456 @subsubsection Introduction to Native Widgets and Subwindow Glyphs |
1403 | 1457 |
1404 Traditionally Emacsen have hidden the GUI apparatus from the Lisp | 1458 Traditionally Emacsen have hidden the GUI apparatus from the Lisp |
1405 programmer, but in XEmacs 21.4 the ability to embed autonomous GUI | 1459 programmer, but in XEmacs 21.4 the ability to embed autonomous GUI |
1406 objects, called @dfn{native widgets}, in text was added to Lisp. They | 1460 objects, called @dfn{native widgets}, in text was added to Lisp. They |
1407 are handled as @emph{glyphs}. Unlike traditional XEmacs | 1461 are handled as @emph{glyphs}. Unlike traditional XEmacs |
1414 However, composite widgets can be created in Lisp using ``layouts,'' | 1468 However, composite widgets can be created in Lisp using ``layouts,'' |
1415 which are horizontal or vertical arrays of subwidgets. For example, the | 1469 which are horizontal or vertical arrays of subwidgets. For example, the |
1416 search dialog is formatted using layouts. | 1470 search dialog is formatted using layouts. |
1417 | 1471 |
1418 @node Lisp API to Native Widgets | 1472 @node Lisp API to Native Widgets |
1419 @subsection Lisp API to Native Widgets | 1473 @subsubsection Lisp API to Native Widgets |
1420 | 1474 |
1421 Native widgets are manipulated as @emph{glyphs} (@pxref{Glyphs}). Thus | 1475 Native widgets are manipulated as @emph{glyphs} (@pxref{Glyphs}). Thus |
1422 they are created using @code{make-glyph}, with a format of one of the | 1476 they are created using @code{make-glyph}, with a format of one of the |
1423 widget types and a @code{:data} property specific to the widget being | 1477 widget types and a @code{:data} property specific to the widget being |
1424 instanced. | 1478 instanced. |
1425 | 1479 |
1426 However, there is a technical difference between widgets and other kinds | 1480 However, there is a technical difference between widgets and other kinds |
1427 of glyphs that is theoretically important, which is that because widgets | 1481 of glyphs that is theoretically important. Because widgets |
1428 are active (that is, they can respond to user input events themselves), | 1482 are active (that is, they can respond to user input events themselves), |
1429 it is possible for the user to become aware that two appearances of the | 1483 it is possible for the user to become aware that two appearances of the |
1430 ``same'' glyph are actually separate instances. For example, if a user | 1484 ``same'' glyph are actually separate instances. For example, if a user |
1431 changes an image glyph from red to blue, and the buffer containing the | 1485 changes an image glyph from red to blue, and the buffer containing the |
1432 glyph appears in more than one window, the user will perceive all the | 1486 glyph appears in more than one window, the user will perceive all the |
1442 that attention will focus on the widget being manipulated, and having | 1496 that attention will focus on the widget being manipulated, and having |
1443 other instances of the widget respond simultaneously might be more | 1497 other instances of the widget respond simultaneously might be more |
1444 disconcerting than the actual case. | 1498 disconcerting than the actual case. |
1445 | 1499 |
1446 @node Layouts | 1500 @node Layouts |
1447 @subsection Layouts | 1501 @subsubsection Layouts |
1448 | 1502 |
1449 An XEmacs @dfn{layout} is a one-dimensional array of glyphs. It is a | 1503 An XEmacs @dfn{layout} is a one-dimensional array of glyphs. It is a |
1450 widget for controlling the positioning of children underneath it. | 1504 widget for controlling the positioning of children underneath it. |
1451 Through the use of nested layouts, a widget hierarchy can be created | 1505 Through the use of nested layouts, a widget hierarchy can be created |
1452 which can have the appearance of any standard dialog box or similar | 1506 which can have the appearance of any standard dialog box or similar |
1471 value must be one of the symbols @code{:right}, @code{:center}, or | 1525 value must be one of the symbols @code{:right}, @code{:center}, or |
1472 @code{:left}. | 1526 @code{:left}. |
1473 | 1527 |
1474 @item :vertically-justify | 1528 @item :vertically-justify |
1475 Specifies the vertical justification of the items in the array. The | 1529 Specifies the vertical justification of the items in the array. The |
1476 value must be one of the symbols @code{:center}, @code{:center}, or | 1530 value must be one of the symbols @code{:top}, @code{:center}, or |
1477 @code{:bottom}. | 1531 @code{:bottom}. |
1478 | 1532 |
1479 @item :justify | 1533 @item :justify |
1480 Specifies justification. #### not understood. | 1534 Specifies justification. #### not understood. |
1481 | 1535 |
1542 (delete-frame | 1596 (delete-frame |
1543 (event-channel event)))])])]) | 1597 (event-channel event)))])])]) |
1544 @end example | 1598 @end example |
1545 | 1599 |
1546 @node Primitive Widgets | 1600 @node Primitive Widgets |
1547 @subsection Primitive Widgets | 1601 @subsubsection Primitive Widgets |
1548 | 1602 |
1549 @c #### the following table should be replaced with a menu of nodes | 1603 @c #### the following table should be replaced with a menu of nodes |
1550 @table @code | 1604 @table @code |
1551 @item button | 1605 @item button |
1552 A button widget; either a push button, radio button or toggle | 1606 A button widget; either a push button, radio button or toggle |
1575 controlling an Emacs window.) | 1629 controlling an Emacs window.) |
1576 @end table | 1630 @end table |
1577 | 1631 |
1578 | 1632 |
1579 @node Subwindows | 1633 @node Subwindows |
1580 @section Subwindows | 1634 @subsection Subwindows |
1581 | 1635 |
1582 Subwindows are not currently implemented. | 1636 Subwindows are not currently implemented. |
1637 @c #### Check status of subwindows ... I thought Andy implemented them. | |
1583 | 1638 |
1584 @defun subwindowp object | 1639 @defun subwindowp object |
1585 This function returns non-@code{nil} if @var{object} is a subwindow. | 1640 This function returns non-@code{nil} if @var{object} is a subwindow. |
1586 @end defun | 1641 @end defun |
1642 | |
1643 | |
1644 @node Manipulating Glyphs | |
1645 @section Manipulating Glyphs | |
1646 | |
1647 Each glyphs has properties that may be accessed. Most of these can | |
1648 also be set after the glyph is initialized, with the exception of the | |
1649 glyph's type. This is not a real restriction, as it is almost never | |
1650 useful to create glyphs of types other than @code{buffer}. | |
1651 | |
1652 @menu | |
1653 * Glyph Properties:: Accessing and modifying a glyph's properties. | |
1654 * Glyph Convenience Functions:: Accessing particular properties of a glyph. | |
1655 * Glyph Dimensions:: Determining the height, width, etc. of a glyph. | |
1656 * Glyph Types:: Each glyph has a particular type. | |
1657 @end menu | |
1658 | |
1659 | |
1660 @node Glyph Properties | |
1661 @subsection Glyph Properties | |
1662 | |
1663 Each glyph has a list of properties, which control all of the aspects of | |
1664 the glyph's appearance. The following symbols have predefined meanings: | |
1665 | |
1666 @table @code | |
1667 @item image | |
1668 The image used to display the glyph. | |
1669 | |
1670 @item baseline | |
1671 Percent above baseline that glyph is to be displayed. Only for glyphs | |
1672 displayed inside of a buffer. | |
1673 | |
1674 @item contrib-p | |
1675 Whether the glyph contributes to the height of the line it's on. | |
1676 Only for glyphs displayed inside of a buffer. | |
1677 | |
1678 @item face | |
1679 Face of this glyph (@emph{not} a specifier). | |
1680 @end table | |
1681 | |
1682 @defun set-glyph-property glyph property value &optional locale tag-set how-to-add | |
1683 This function changes a property of a @var{glyph}. | |
1684 | |
1685 For built-in properties, the actual value of the property is a specifier | |
1686 and you cannot change this; but you can change the specifications within | |
1687 the specifier, and that is what this function will do. The glyph face | |
1688 is an exception; it is a face name (a symbol) or a face object, not a | |
1689 specifier. (The face properties themselves are typically specifiers.) | |
1690 For user-defined properties, you can use this function to either change | |
1691 the actual value of the property or, if this value is a specifier, | |
1692 change the specifications within it. | |
1693 | |
1694 If @var{property} is a built-in property, the specifications to be added | |
1695 to this property can be supplied in many different ways: | |
1696 | |
1697 @itemize @bullet | |
1698 @item | |
1699 If @var{value} is a simple instantiator (e.g. a string naming a pixmap | |
1700 filename) or a list of instantiators, then the instantiator(s) will be | |
1701 added as a specification of the property for the given @var{locale} | |
1702 (which defaults to @code{global} if omitted). | |
1703 | |
1704 @item | |
1705 If @var{value} is a list of specifications (each of which is a cons of a | |
1706 locale and a list of instantiators), then @var{locale} must be | |
1707 @code{nil} (it does not make sense to explicitly specify a locale in | |
1708 this case), and specifications will be added as given. | |
1709 | |
1710 @item | |
1711 If @var{value} is a specifier (as would be returned by | |
1712 @code{glyph-property} if no @var{locale} argument is given), then some | |
1713 or all of the specifications in the specifier will be added to the | |
1714 property. In this case, the function is really equivalent to | |
1715 @code{copy-specifier} and @var{locale} has the same semantics (if it is | |
1716 a particular locale, the specification for the locale will be copied; if | |
1717 a locale type, specifications for all locales of that type will be | |
1718 copied; if @code{nil} or @code{all}, then all specifications will be | |
1719 copied). | |
1720 @end itemize | |
1721 | |
1722 @var{how-to-add} should be either @code{nil} or one of the symbols | |
1723 @code{prepend}, @code{append}, @code{remove-tag-set-prepend}, | |
1724 @code{remove-tag-set-append}, @code{remove-locale}, | |
1725 @code{remove-locale-type}, or @code{remove-all}. See | |
1726 @code{copy-specifier} and @code{add-spec-to-specifier} for a description | |
1727 of what each of these means. Most of the time, you do not need to worry | |
1728 about this argument; the default behavior usually is fine. | |
1729 | |
1730 In general, it is OK to pass an instance object (e.g. as returned by | |
1731 @code{glyph-property-instance}) as an instantiator in place of an actual | |
1732 instantiator. In such a case, the instantiator used to create that | |
1733 instance object will be used (for example, if you set a font-instance | |
1734 object as the value of the @code{font} property, then the font name used | |
1735 to create that object will be used instead). In some cases, however, | |
1736 doing this conversion does not make sense, and this will be noted in the | |
1737 documentation for particular types of instance objects. | |
1738 | |
1739 If @var{property} is not a built-in property, then this function will | |
1740 simply set its value if @var{locale} is @code{nil}. However, if | |
1741 @var{locale} is given, then this function will attempt to add | |
1742 @var{value} as the instantiator for the given @var{locale}, using | |
1743 @code{add-spec-to-specifier}. If the value of the property is not a | |
1744 specifier, it will automatically be converted into a @code{generic} | |
1745 specifier. | |
1746 @end defun | |
1747 | |
1748 @defun glyph-property glyph property &optional locale | |
1749 This function returns @var{glyph}'s value of the given @var{property}. | |
1750 | |
1751 If @var{locale} is omitted, the @var{glyph}'s actual value for | |
1752 @var{property} will be returned. For built-in properties, this will be | |
1753 a specifier object of a type appropriate to the property (e.g. a font or | |
1754 color specifier). For other properties, this could be anything. | |
1755 | |
1756 If @var{locale} is supplied, then instead of returning the actual value, | |
1757 the specification(s) for the given locale or locale type will be | |
1758 returned. This will only work if the actual value of @var{property} is | |
1759 a specifier (this will always be the case for built-in properties, but | |
1760 may or may not apply to user-defined properties). If the actual value | |
1761 of @var{property} is not a specifier, this value will simply be returned | |
1762 regardless of @var{locale}. | |
1763 | |
1764 The return value will be a list of instantiators (e.g. vectors | |
1765 specifying pixmap data), or a list of specifications, each of which is a | |
1766 cons of a locale and a list of instantiators. Specifically, if | |
1767 @var{locale} is a particular locale (a buffer, window, frame, device, or | |
1768 @code{global}), a list of instantiators for that locale will be | |
1769 returned. Otherwise, if @var{locale} is a locale type (one of the | |
1770 symbols @code{buffer}, @code{window}, @code{frame}, or @code{device}), | |
1771 the specifications for all locales of that type will be returned. | |
1772 Finally, if @var{locale} is @code{all}, the specifications for all | |
1773 locales of all types will be returned. | |
1774 | |
1775 The specifications in a specifier determine what the value of | |
1776 @var{property} will be in a particular @dfn{domain} or set of | |
1777 circumstances, which is typically a particular Emacs window along with | |
1778 the buffer it contains and the frame and device it lies within. The | |
1779 value is derived from the instantiator associated with the most specific | |
1780 locale (in the order buffer, window, frame, device, and @code{global}) | |
1781 that matches the domain in question. In other words, given a domain | |
1782 (i.e. an Emacs window, usually), the specifier for @var{property} will | |
1783 first be searched for a specification whose locale is the buffer | |
1784 contained within that window; then for a specification whose locale is | |
1785 the window itself; then for a specification whose locale is the frame | |
1786 that the window is contained within; etc. The first instantiator that | |
1787 is valid for the domain (usually this means that the instantiator is | |
1788 recognized by the device [i.e. the X server or TTY device] that the | |
1789 domain is on). The function @code{glyph-property-instance} actually does | |
1790 all this, and is used to determine how to display the glyph. | |
1791 @end defun | |
1792 | |
1793 @defun glyph-property-instance glyph property &optional domain default no-fallback | |
1794 This function returns the instance of @var{glyph}'s @var{property} in the | |
1795 specified @var{domain}. | |
1796 | |
1797 Under most circumstances, @var{domain} will be a particular window, and | |
1798 the returned instance describes how the specified property actually is | |
1799 displayed for that window and the particular buffer in it. Note that | |
1800 this may not be the same as how the property appears when the buffer is | |
1801 displayed in a different window or frame, or how the property appears in | |
1802 the same window if you switch to another buffer in that window; and in | |
1803 those cases, the returned instance would be different. | |
1804 | |
1805 The returned instance is an image-instance object, and you can query it | |
1806 using the appropriate image instance functions. For example, you could use | |
1807 @code{image-instance-depth} to find out the depth (number of color | |
1808 planes) of a pixmap displayed in a particular window. The results might | |
1809 be different from the results you would get for another window (perhaps | |
1810 the user specified a different image for the frame that window is on; or | |
1811 perhaps the same image was specified but the window is on a different X | |
1812 server, and that X server has different color capabilities from this | |
1813 one). | |
1814 | |
1815 @var{domain} defaults to the selected window if omitted. | |
1816 | |
1817 @var{domain} can be a frame or device, instead of a window. The value | |
1818 returned for such a domain is used in special circumstances when a | |
1819 more specific domain does not apply; for example, a frame value might be | |
1820 used for coloring a toolbar, which is conceptually attached to a frame | |
1821 rather than a particular window. The value is also useful in | |
1822 determining what the value would be for a particular window within the | |
1823 frame or device, if it is not overridden by a more specific | |
1824 specification. | |
1825 | |
1826 If @var{property} does not name a built-in property, its value will | |
1827 simply be returned unless it is a specifier object, in which case it | |
1828 will be instanced using @code{specifier-instance}. | |
1829 | |
1830 Optional arguments @var{default} and @var{no-fallback} are the same as | |
1831 in @code{specifier-instance}. @xref{Specifiers}. | |
1832 @end defun | |
1833 | |
1834 @defun remove-glyph-property glyph property &optional locale tag-set exact-p | |
1835 This function removes a property from a glyph. For built-in properties, | |
1836 this is analogous to @code{remove-specifier}. @xref{Specifiers, | |
1837 remove-specifier-p}, for the meaning of the @var{locale}, @var{tag-set}, | |
1838 and @var{exact-p} arguments. | |
1839 @end defun | |
1840 | |
1841 | |
1842 @node Glyph Convenience Functions | |
1843 @subsection Glyph Convenience Functions | |
1844 | |
1845 The following functions are provided for working with specific | |
1846 properties of a glyph. Note that these are exactly like calling | |
1847 the general functions described above and passing in the | |
1848 appropriate value for @var{property}. | |
1849 | |
1850 Remember that if you want to determine the ``value'' of a | |
1851 specific glyph property, you probably want to use the @code{*-instance} | |
1852 functions. For example, to determine whether a glyph contributes | |
1853 to its line height, use @code{glyph-contrib-p-instance}, not | |
1854 @code{glyph-contrib-p}. (The latter will return a boolean specifier | |
1855 or a list of specifications, and you probably aren't concerned with | |
1856 these.) | |
1857 | |
1858 @defun glyph-image glyph &optional locale | |
1859 This function is equivalent to calling @code{glyph-property} with | |
1860 a property of @code{image}. The return value will be an image | |
1861 specifier if @var{locale} is @code{nil} or omitted; otherwise, | |
1862 it will be a specification or list of specifications. | |
1863 @end defun | |
1864 | |
1865 @defun set-glyph-image glyph spec &optional locale tag-set how-to-add | |
1866 This function is equivalent to calling @code{set-glyph-property} with | |
1867 a property of @code{image}. | |
1868 @end defun | |
1869 | |
1870 @defun glyph-image-instance glyph &optional domain default no-fallback | |
1871 This function returns the instance of @var{glyph}'s image in the given | |
1872 @var{domain}, and is equivalent to calling | |
1873 @code{glyph-property-instance} with a property of @code{image}. The | |
1874 return value will be an image instance. | |
1875 | |
1876 Normally @var{domain} will be a window or @code{nil} (meaning the | |
1877 selected window), and an instance object describing how the image | |
1878 appears in that particular window and buffer will be returned. | |
1879 @end defun | |
1880 | |
1881 @defun glyph-contrib-p glyph &optional locale | |
1882 This function is equivalent to calling @code{glyph-property} with | |
1883 a property of @code{contrib-p}. The return value will be a boolean | |
1884 specifier if @var{locale} is @code{nil} or omitted; otherwise, | |
1885 it will be a specification or list of specifications. | |
1886 @end defun | |
1887 | |
1888 @defun set-glyph-contrib-p glyph spec &optional locale tag-set how-to-add | |
1889 This function is equivalent to calling @code{set-glyph-property} with | |
1890 a property of @code{contrib-p}. | |
1891 @end defun | |
1892 | |
1893 @defun glyph-contrib-p-instance glyph &optional domain default no-fallback | |
1894 This function returns whether the glyph contributes to its line height | |
1895 in the given @var{domain}, and is equivalent to calling | |
1896 @code{glyph-property-instance} with a property of @code{contrib-p}. The | |
1897 return value will be either @code{nil} or @code{t}. (Normally @var{domain} | |
1898 will be a window or @code{nil}, meaning the selected window.) | |
1899 @end defun | |
1900 | |
1901 @defun glyph-baseline glyph &optional locale | |
1902 This function is equivalent to calling @code{glyph-property} with a | |
1903 property of @code{baseline}. The return value will be a specifier if | |
1904 @var{locale} is @code{nil} or omitted; otherwise, it will be a | |
1905 specification or list of specifications. | |
1906 @end defun | |
1907 | |
1908 @defun set-glyph-baseline glyph spec &optional locale tag-set how-to-add | |
1909 This function is equivalent to calling @code{set-glyph-property} with | |
1910 a property of @code{baseline}. | |
1911 @end defun | |
1912 | |
1913 @defun glyph-baseline-instance glyph &optional domain default no-fallback | |
1914 This function returns the instance of @var{glyph}'s baseline value in | |
1915 the given @var{domain}, and is equivalent to calling | |
1916 @code{glyph-property-instance} with a property of @code{baseline}. The | |
1917 return value will be an integer or @code{nil}. | |
1918 | |
1919 Normally @var{domain} will be a window or @code{nil} (meaning the | |
1920 selected window), and an instance object describing the baseline value | |
1921 appears in that particular window and buffer will be returned. | |
1922 @end defun | |
1923 | |
1924 @defun glyph-face glyph | |
1925 This function returns the face of @var{glyph}. (Remember, this is | |
1926 not a specifier, but a simple property.) | |
1927 @end defun | |
1928 | |
1929 @defun set-glyph-face glyph face | |
1930 This function changes the face of @var{glyph} to @var{face}. | |
1931 @end defun | |
1932 | |
1933 | |
1934 @node Glyph Dimensions | |
1935 @subsection Glyph Dimensions | |
1936 | |
1937 @defun glyph-width glyph &optional window | |
1938 This function returns the width of @var{glyph} on @var{window}. This | |
1939 may not be exact as it does not take into account all of the context | |
1940 that redisplay will. | |
1941 @end defun | |
1942 | |
1943 @defun glyph-ascent glyph &optional window | |
1944 This function returns the ascent value of @var{glyph} on @var{window}. | |
1945 This may not be exact as it does not take into account all of the | |
1946 context that redisplay will. | |
1947 @end defun | |
1948 | |
1949 @defun glyph-descent glyph &optional window | |
1950 This function returns the descent value of @var{glyph} on @var{window}. | |
1951 This may not be exact as it does not take into account all of the | |
1952 context that redisplay will. | |
1953 @end defun | |
1954 | |
1955 @defun glyph-height glyph &optional window | |
1956 This function returns the height of @var{glyph} on @var{window}. (This | |
1957 is equivalent to the sum of the ascent and descent values.) This may | |
1958 not be exact as it does not take into account all of the context that | |
1959 redisplay will. | |
1960 @end defun | |
1961 | |
1962 | |
1963 @node Glyph Types | |
1964 @subsection Glyph Types | |
1965 | |
1966 Each glyph has a particular type, which controls how the glyph's image | |
1967 is generated. Each glyph type has a corresponding list of allowable | |
1968 image instance types that can be generated. When you call | |
1969 @code{glyph-image-instance} to retrieve the image instance of a glyph, | |
1970 XEmacs does the equivalent of calling @code{make-image-instance} and | |
1971 passing in @var{dest-types} the list of allowable image instance types | |
1972 for the glyph's type. | |
1973 | |
1974 @itemize @bullet | |
1975 @item | |
1976 @code{buffer} glyphs can be used as the begin-glyph or end-glyph of an | |
1977 extent, in the modeline, and in the toolbar. Their image can be | |
1978 instantiated as @code{nothing}, @code{mono-pixmap}, @code{color-pixmap}, | |
1979 @code{text}, and @code{subwindow}. | |
1980 @c #### Check status of subwindows ... I thought Andy implemented them. | |
1981 | |
1982 @item | |
1983 @code{pointer} glyphs can be used to specify the mouse pointer. Their | |
1984 image can be instantiated as @code{pointer}. | |
1985 | |
1986 @item | |
1987 @code{icon} glyphs can be used to specify the icon used when a frame is | |
1988 iconified. Their image can be instantiated as @code{mono-pixmap} and | |
1989 @code{color-pixmap}. | |
1990 @end itemize | |
1991 | |
1992 @defun glyph-type glyph | |
1993 This function returns the type of the given glyph. The return value | |
1994 will be a symbol, one of @code{buffer}, @code{pointer}, or @code{icon}. | |
1995 @end defun | |
1996 | |
1997 @defun valid-glyph-type-p glyph-type | |
1998 Given a @var{glyph-type}, this function returns non-@code{nil} if it is | |
1999 valid. | |
2000 @end defun | |
2001 | |
2002 @defun glyph-type-list | |
2003 This function returns a list of valid glyph types. | |
2004 @end defun | |
2005 | |
2006 @defun buffer-glyph-p object | |
2007 This function returns non-@code{nil} if @var{object} is a glyph of type | |
2008 @code{buffer}. | |
2009 @end defun | |
2010 | |
2011 @defun icon-glyph-p object | |
2012 This function returns non-@code{nil} if @var{object} is a glyph of type | |
2013 @code{icon}. | |
2014 @end defun | |
2015 | |
2016 @defun pointer-glyph-p object | |
2017 This function returns non-@code{nil} if @var{object} is a glyph of type | |
2018 @code{pointer}. | |
2019 @end defun | |
2020 | |
1587 | 2021 |
1588 @node Glyph Examples | 2022 @node Glyph Examples |
1589 @section Glyph Examples | 2023 @section Glyph Examples |
1590 | 2024 |
1591 For many applications, displaying graphics is a simple process: you | 2025 For many applications, displaying graphics is a simple process: you |