384
|
1 /* Widget-specific glyph objects.
|
412
|
2 Copyright (C) 1998 Andy Piper
|
384
|
3
|
|
4 This file is part of XEmacs.
|
|
5
|
|
6 XEmacs is free software; you can redistribute it and/or modify it
|
|
7 under the terms of the GNU General Public License as published by the
|
|
8 Free Software Foundation; either version 2, or (at your option) any
|
|
9 later version.
|
|
10
|
|
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 for more details.
|
|
15
|
|
16 You should have received a copy of the GNU General Public License
|
|
17 along with XEmacs; see the file COPYING. If not, write to
|
|
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
19 Boston, MA 02111-1307, USA. */
|
|
20
|
|
21 /* Synched up with: Not in FSF. */
|
|
22
|
388
|
23 /* written by Andy Piper <andy@xemacs.org> */
|
|
24
|
384
|
25 #include <config.h>
|
|
26 #include "lisp.h"
|
|
27 #include "lstream.h"
|
|
28 #include "console.h"
|
|
29 #include "device.h"
|
|
30 #include "faces.h"
|
|
31 #include "glyphs.h"
|
|
32 #include "objects.h"
|
388
|
33 #include "bytecode.h"
|
384
|
34 #include "window.h"
|
|
35 #include "buffer.h"
|
|
36 #include "frame.h"
|
|
37 #include "insdel.h"
|
|
38 #include "opaque.h"
|
|
39
|
|
40 DEFINE_IMAGE_INSTANTIATOR_FORMAT (button);
|
412
|
41 DEFINE_IMAGE_INSTANTIATOR_FORMAT (combo);
|
|
42 Lisp_Object Qcombo;
|
|
43 DEFINE_IMAGE_INSTANTIATOR_FORMAT (edit);
|
|
44 Lisp_Object Qedit;
|
384
|
45 DEFINE_IMAGE_INSTANTIATOR_FORMAT (scrollbar);
|
|
46 Lisp_Object Qscrollbar;
|
|
47 DEFINE_IMAGE_INSTANTIATOR_FORMAT (widget);
|
412
|
48 #if 0
|
|
49 DEFINE_IMAGE_INSTANTIATOR_FORMAT (group);
|
|
50 Lisp_Object Qgroup;
|
|
51 #endif
|
384
|
52 DEFINE_IMAGE_INSTANTIATOR_FORMAT (label);
|
|
53 Lisp_Object Qlabel;
|
412
|
54 DEFINE_IMAGE_INSTANTIATOR_FORMAT (progress);
|
|
55 Lisp_Object Qprogress;
|
418
|
56 DEFINE_IMAGE_INSTANTIATOR_FORMAT (tree);
|
|
57 Lisp_Object Qtree;
|
|
58 DEFINE_IMAGE_INSTANTIATOR_FORMAT (tab);
|
|
59 Lisp_Object Qtab;
|
384
|
60
|
|
61 Lisp_Object Q_descriptor, Q_height, Q_width, Q_properties, Q_items;
|
412
|
62 Lisp_Object Q_image, Q_text, Q_percent;
|
384
|
63
|
412
|
64 #define WIDGET_BORDER_HEIGHT 2
|
|
65 #define WIDGET_BORDER_WIDTH 4
|
384
|
66
|
|
67 /* TODO:
|
412
|
68 - more complex controls.
|
|
69 - tooltips for controls.
|
384
|
70 */
|
|
71
|
412
|
72 /* In windows normal windows work in pixels, dialog boxes work in
|
384
|
73 dialog box units. Why? sigh. We could reuse the metrics for dialogs
|
|
74 if this were not the case. As it is we have to position things
|
|
75 pixel wise. I'm not even sure that X has this problem at least for
|
|
76 buttons in groups. */
|
412
|
77 Lisp_Object
|
|
78 widget_face_font_info (Lisp_Object domain, Lisp_Object face,
|
|
79 int *height, int *width)
|
|
80 {
|
|
81 Lisp_Object font_instance = FACE_FONT (face, domain, Vcharset_ascii);
|
|
82
|
|
83 if (height)
|
|
84 *height = XFONT_INSTANCE (font_instance)->height;
|
|
85 if (width)
|
|
86 *width = XFONT_INSTANCE (font_instance)->width;
|
|
87
|
|
88 return font_instance;
|
|
89 }
|
|
90
|
|
91 void
|
|
92 widget_text_to_pixel_conversion (Lisp_Object domain, Lisp_Object face,
|
|
93 int th, int tw,
|
|
94 int* height, int* width)
|
|
95 {
|
|
96 int ch=0, cw=0;
|
|
97 widget_face_font_info (domain, face, &ch, &cw);
|
|
98 if (height)
|
|
99 *height = th * (ch + 2 * WIDGET_BORDER_HEIGHT);
|
|
100 if (width)
|
|
101 *width = tw * cw + 2 * WIDGET_BORDER_WIDTH;
|
|
102 }
|
|
103
|
384
|
104 static int
|
|
105 widget_possible_dest_types (void)
|
|
106 {
|
|
107 return IMAGE_WIDGET_MASK;
|
|
108 }
|
|
109
|
|
110 static void
|
412
|
111 check_valid_glyph_or_image (Lisp_Object data)
|
384
|
112 {
|
388
|
113 Lisp_Object glyph = data;
|
384
|
114 if (SYMBOLP (data))
|
388
|
115 glyph = XSYMBOL (data)->value;
|
|
116
|
|
117 if (IMAGE_INSTANCEP (glyph))
|
|
118 CHECK_IMAGE_INSTANCE (glyph);
|
412
|
119 else if (!CONSP (glyph))
|
388
|
120 CHECK_BUFFER_GLYPH (glyph);
|
|
121 }
|
|
122
|
|
123 static void
|
|
124 check_valid_anything (Lisp_Object data)
|
|
125 {
|
384
|
126 }
|
388
|
127
|
|
128 static void
|
|
129 check_valid_callback (Lisp_Object data)
|
|
130 {
|
|
131 if (!SYMBOLP (data)
|
|
132 && !COMPILED_FUNCTIONP (data)
|
|
133 && !CONSP (data))
|
|
134 {
|
|
135 signal_simple_error (":callback must be a function or expression", data);
|
|
136 }
|
|
137 }
|
|
138
|
|
139 static void
|
|
140 check_valid_symbol (Lisp_Object data)
|
|
141 {
|
|
142 CHECK_SYMBOL (data);
|
|
143 }
|
|
144
|
|
145 static void
|
|
146 check_valid_string_or_vector (Lisp_Object data)
|
|
147 {
|
|
148 if (!STRINGP (data) && !VECTORP (data))
|
|
149 signal_simple_error (":descriptor must be a string or a vector", data);
|
|
150 }
|
384
|
151
|
412
|
152 static void
|
418
|
153 check_valid_item_list_1 (Lisp_Object items)
|
384
|
154 {
|
|
155 Lisp_Object rest;
|
|
156
|
|
157 CHECK_LIST (items);
|
|
158 EXTERNAL_LIST_LOOP (rest, items)
|
|
159 {
|
418
|
160 if (STRINGP (XCAR (rest)))
|
|
161 CHECK_STRING (XCAR (rest));
|
|
162 else if (VECTORP (XCAR (rest)))
|
|
163 gui_parse_item_keywords (XCAR (rest));
|
|
164 else if (LISTP (XCAR (rest)))
|
|
165 check_valid_item_list_1 (XCAR (rest));
|
|
166 else
|
|
167 signal_simple_error ("Items must be vectors, lists or strings", items);
|
384
|
168 }
|
|
169 }
|
|
170
|
418
|
171 static void
|
|
172 check_valid_item_list (Lisp_Object data)
|
|
173 {
|
|
174 Lisp_Object items;
|
|
175
|
|
176 Fcheck_valid_plist (data);
|
|
177 items = Fplist_get (data, Q_items, Qnil);
|
|
178
|
|
179 check_valid_item_list_1 (items);
|
|
180 }
|
|
181
|
412
|
182 /* wire widget property invocations to specific widgets ... The
|
|
183 problem we are solving here is that when instantiators get converted
|
|
184 to instances they lose some type information (they just become
|
|
185 subwindows or widgets for example). For widgets we need to preserve
|
|
186 this type information so that we can do widget specific operations on
|
|
187 the instances. This is encoded in the widget type
|
|
188 field. widget_property gets invoked by decoding the primary type
|
|
189 (Qwidget), widget property then invokes based on the secondary type
|
|
190 (Qedit for example). It is debatable that we should wire things in this
|
|
191 generalised way rather than treating widgets specially in
|
|
192 image_instance_property. */
|
384
|
193 static Lisp_Object
|
|
194 widget_property (Lisp_Object image_instance, Lisp_Object prop)
|
|
195 {
|
412
|
196 struct Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance);
|
384
|
197 struct image_instantiator_methods* meths;
|
|
198
|
|
199 /* first see if its a general property ... */
|
|
200 if (!NILP (Fplist_member (IMAGE_INSTANCE_WIDGET_PROPS (ii), prop)))
|
|
201 return Fplist_get (IMAGE_INSTANCE_WIDGET_PROPS (ii), prop, Qnil);
|
|
202
|
|
203 /* .. then try device specific methods ... */
|
412
|
204 meths = decode_device_ii_format (IMAGE_INSTANCE_DEVICE (ii),
|
384
|
205 IMAGE_INSTANCE_WIDGET_TYPE (ii),
|
|
206 ERROR_ME_NOT);
|
|
207 if (meths && HAS_IIFORMAT_METH_P (meths, property))
|
|
208 return IIFORMAT_METH (meths, property, (image_instance, prop));
|
|
209 /* ... then format specific methods ... */
|
|
210 meths = decode_device_ii_format (Qnil, IMAGE_INSTANCE_WIDGET_TYPE (ii),
|
|
211 ERROR_ME_NOT);
|
|
212 if (meths && HAS_IIFORMAT_METH_P (meths, property))
|
|
213 return IIFORMAT_METH (meths, property, (image_instance, prop));
|
|
214 /* ... then fail */
|
|
215 return Qunbound;
|
|
216 }
|
|
217
|
|
218 static Lisp_Object
|
|
219 widget_set_property (Lisp_Object image_instance, Lisp_Object prop, Lisp_Object val)
|
|
220 {
|
412
|
221 struct Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance);
|
384
|
222 struct image_instantiator_methods* meths;
|
|
223 Lisp_Object ret;
|
|
224
|
412
|
225 /* try device specific methods first ... */
|
|
226 meths = decode_device_ii_format (IMAGE_INSTANCE_DEVICE (ii),
|
384
|
227 IMAGE_INSTANCE_WIDGET_TYPE (ii),
|
|
228 ERROR_ME_NOT);
|
|
229 if (meths && HAS_IIFORMAT_METH_P (meths, set_property)
|
|
230 &&
|
|
231 !UNBOUNDP (ret =
|
|
232 IIFORMAT_METH (meths, set_property, (image_instance, prop, val))))
|
|
233 {
|
|
234 return ret;
|
|
235 }
|
|
236 /* ... then format specific methods ... */
|
|
237 meths = decode_device_ii_format (Qnil, IMAGE_INSTANCE_WIDGET_TYPE (ii),
|
|
238 ERROR_ME_NOT);
|
|
239 if (meths && HAS_IIFORMAT_METH_P (meths, set_property)
|
|
240 &&
|
|
241 !UNBOUNDP (ret =
|
|
242 IIFORMAT_METH (meths, set_property, (image_instance, prop, val))))
|
|
243 {
|
|
244 return ret;
|
|
245 }
|
|
246 /* we didn't do any device specific properties, so shove the property in our plist */
|
|
247 IMAGE_INSTANCE_WIDGET_PROPS (ii)
|
|
248 = Fplist_put (IMAGE_INSTANCE_WIDGET_PROPS (ii), prop, val);
|
|
249 return val;
|
|
250 }
|
|
251
|
|
252 static void
|
|
253 widget_validate (Lisp_Object instantiator)
|
|
254 {
|
|
255 Lisp_Object desc = find_keyword_in_vector (instantiator, Q_descriptor);
|
418
|
256
|
384
|
257 if (NILP (desc))
|
|
258 signal_simple_error ("Must supply :descriptor", instantiator);
|
|
259
|
388
|
260 if (VECTORP (desc))
|
418
|
261 gui_parse_item_keywords (desc);
|
384
|
262
|
|
263 if (!NILP (find_keyword_in_vector (instantiator, Q_width))
|
418
|
264 && !NILP (find_keyword_in_vector (instantiator, Q_pixel_width)))
|
384
|
265 signal_simple_error ("Must supply only one of :width and :pixel-width", instantiator);
|
|
266
|
|
267 if (!NILP (find_keyword_in_vector (instantiator, Q_height))
|
|
268 && !NILP (find_keyword_in_vector (instantiator, Q_pixel_height)))
|
|
269 signal_simple_error ("Must supply only one of :height and :pixel-height", instantiator);
|
|
270 }
|
|
271
|
|
272 static void
|
412
|
273 combo_validate (Lisp_Object instantiator)
|
384
|
274 {
|
|
275 widget_validate (instantiator);
|
|
276 if (NILP (find_keyword_in_vector (instantiator, Q_properties)))
|
|
277 signal_simple_error ("Must supply item list", instantiator);
|
|
278 }
|
|
279
|
388
|
280 /* we need to convert things like glyphs to images, eval expressions
|
|
281 etc.*/
|
|
282 static Lisp_Object
|
|
283 widget_normalize (Lisp_Object inst, Lisp_Object console_type)
|
|
284 {
|
|
285 /* This function can call lisp */
|
|
286 Lisp_Object glyph = find_keyword_in_vector (inst, Q_image);
|
|
287
|
|
288 /* we need to eval glyph if its an expression, we do this for the
|
|
289 same reasons we normalize file to data. */
|
|
290 if (!NILP (glyph))
|
|
291 {
|
412
|
292 int i;
|
|
293 struct gcpro gcpro1;
|
|
294 if (SYMBOLP (glyph))
|
|
295 glyph = XSYMBOL (glyph)->value;
|
|
296 GCPRO1 (glyph);
|
|
297
|
|
298 if (CONSP (glyph))
|
|
299 glyph = Feval (glyph);
|
|
300 /* substitute the new glyph */
|
|
301 for (i = 0; i < XVECTOR_LENGTH (inst); i++)
|
|
302 {
|
|
303 if (EQ (Q_image, XVECTOR_DATA (inst)[i]))
|
|
304 {
|
|
305 XVECTOR_DATA (inst)[i+1] = glyph;
|
|
306 break;
|
|
307 }
|
|
308 }
|
|
309 UNGCPRO;
|
398
|
310 }
|
388
|
311 return inst;
|
|
312 }
|
|
313
|
384
|
314 static void
|
412
|
315 initialize_widget_image_instance (struct Lisp_Image_Instance *ii, Lisp_Object type)
|
384
|
316 {
|
|
317 /* initialize_subwindow_image_instance (ii);*/
|
|
318 IMAGE_INSTANCE_WIDGET_TYPE (ii) = type;
|
|
319 IMAGE_INSTANCE_WIDGET_PROPS (ii) = Qnil;
|
412
|
320 IMAGE_INSTANCE_WIDGET_FACE (ii) = Vwidget_face;
|
418
|
321 IMAGE_INSTANCE_WIDGET_ITEM (ii) = allocate_gui_item ();
|
384
|
322 }
|
|
323
|
|
324 /* Instantiate a button widget. Unfortunately instantiated widgets are
|
|
325 particular to a frame since they need to have a parent. It's not
|
|
326 like images where you just select the image into the context you
|
418
|
327 want to display it in and BitBlt it. So image instances can have a
|
384
|
328 many-to-one relationship with things you see, whereas widgets can
|
|
329 only be one-to-one (i.e. per frame) */
|
412
|
330 static void
|
|
331 widget_instantiate_1 (Lisp_Object image_instance, Lisp_Object instantiator,
|
|
332 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
|
|
333 int dest_mask, Lisp_Object domain, int default_textheight,
|
418
|
334 int default_pixheight, int default_textwidth)
|
384
|
335 {
|
412
|
336 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
|
384
|
337 Lisp_Object face = find_keyword_in_vector (instantiator, Q_face);
|
|
338 Lisp_Object height = find_keyword_in_vector (instantiator, Q_height);
|
|
339 Lisp_Object width = find_keyword_in_vector (instantiator, Q_width);
|
|
340 Lisp_Object pixwidth = find_keyword_in_vector (instantiator, Q_pixel_width);
|
|
341 Lisp_Object pixheight = find_keyword_in_vector (instantiator, Q_pixel_height);
|
|
342 Lisp_Object desc = find_keyword_in_vector (instantiator, Q_descriptor);
|
388
|
343 Lisp_Object glyph = find_keyword_in_vector (instantiator, Q_image);
|
384
|
344 int pw=0, ph=0, tw=0, th=0;
|
|
345
|
|
346 /* this just does pixel type sizing */
|
|
347 subwindow_instantiate (image_instance, instantiator, pointer_fg, pointer_bg,
|
|
348 dest_mask, domain);
|
412
|
349
|
408
|
350 if (!(dest_mask & IMAGE_WIDGET_MASK))
|
|
351 incompatible_image_types (instantiator, dest_mask, IMAGE_WIDGET_MASK);
|
384
|
352
|
|
353 initialize_widget_image_instance (ii, XVECTOR_DATA (instantiator)[0]);
|
|
354
|
|
355 /* retrieve the fg and bg colors */
|
|
356 if (!NILP (face))
|
412
|
357 IMAGE_INSTANCE_WIDGET_FACE (ii) = Fget_face (face);
|
384
|
358
|
412
|
359 /* data items for some widgets */
|
|
360 IMAGE_INSTANCE_WIDGET_PROPS (ii) =
|
|
361 find_keyword_in_vector (instantiator, Q_properties);
|
|
362
|
388
|
363 /* retrieve the gui item information. This is easy if we have been
|
|
364 provided with a vector, more difficult if we have just been given
|
|
365 keywords */
|
408
|
366 if (STRINGP (desc) || NILP (desc))
|
388
|
367 {
|
|
368 /* big cheat - we rely on the fact that a gui item looks like an instantiator */
|
418
|
369 IMAGE_INSTANCE_WIDGET_ITEM (ii) =
|
|
370 gui_parse_item_keywords_no_errors (instantiator);
|
388
|
371 IMAGE_INSTANCE_WIDGET_TEXT (ii) = desc;
|
|
372 }
|
384
|
373 else
|
418
|
374 IMAGE_INSTANCE_WIDGET_ITEM (ii) =
|
|
375 gui_parse_item_keywords_no_errors (desc);
|
384
|
376
|
412
|
377 /* normalize size information */
|
|
378 if (!NILP (width))
|
|
379 tw = XINT (width);
|
|
380 if (!NILP (height))
|
|
381 th = XINT (height);
|
|
382 if (!NILP (pixwidth))
|
|
383 pw = XINT (pixwidth);
|
384
|
384 if (!NILP (pixheight))
|
412
|
385 ph = XINT (pixheight);
|
384
|
386
|
388
|
387 /* for a widget with an image pick up the dimensions from that */
|
|
388 if (!NILP (glyph))
|
|
389 {
|
412
|
390 if (!pw && !tw)
|
|
391 pw = glyph_width (glyph, Qnil, DEFAULT_INDEX, domain)
|
|
392 + 2 * WIDGET_BORDER_WIDTH;
|
|
393 if (!ph && !th)
|
|
394 ph = glyph_height (glyph, Qnil, DEFAULT_INDEX, domain)
|
|
395 + 2 * WIDGET_BORDER_HEIGHT;
|
388
|
396 }
|
|
397
|
412
|
398 /* if we still don' t have sizes, guess from text size */
|
418
|
399 if (!tw && !pw)
|
|
400 {
|
|
401 if (default_textwidth)
|
|
402 tw = default_textwidth;
|
|
403 else if (!NILP (IMAGE_INSTANCE_WIDGET_TEXT (ii)))
|
|
404 tw = XSTRING_LENGTH (IMAGE_INSTANCE_WIDGET_TEXT (ii));
|
|
405 }
|
|
406
|
412
|
407 if (!th && !ph)
|
384
|
408 {
|
412
|
409 if (default_textheight)
|
|
410 th = default_textheight;
|
|
411 else if (!NILP (IMAGE_INSTANCE_WIDGET_TEXT (ii)))
|
|
412 th = 1;
|
|
413 else
|
|
414 ph = default_pixheight;
|
398
|
415 }
|
412
|
416
|
|
417 if (tw !=0 || th !=0)
|
|
418 widget_text_to_pixel_conversion (domain,
|
|
419 IMAGE_INSTANCE_WIDGET_FACE (ii),
|
|
420 th, tw, th ? &ph : 0, tw ? &pw : 0);
|
406
|
421
|
412
|
422 IMAGE_INSTANCE_SUBWINDOW_WIDTH (ii) = pw;
|
|
423 IMAGE_INSTANCE_SUBWINDOW_HEIGHT (ii) = ph;
|
408
|
424 }
|
|
425
|
|
426 static void
|
412
|
427 widget_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
|
|
428 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
|
|
429 int dest_mask, Lisp_Object domain)
|
408
|
430 {
|
412
|
431 widget_instantiate_1 (image_instance, instantiator, pointer_fg,
|
418
|
432 pointer_bg, dest_mask, domain, 1, 0, 0);
|
408
|
433 }
|
|
434
|
418
|
435 /* combo-box generic instantiation - get he heigh right */
|
384
|
436 static void
|
412
|
437 combo_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
|
|
438 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
|
|
439 int dest_mask, Lisp_Object domain)
|
384
|
440 {
|
412
|
441 Lisp_Object data = Fplist_get (find_keyword_in_vector (instantiator, Q_properties),
|
|
442 Q_items, Qnil);
|
|
443 int len;
|
|
444 GET_LIST_LENGTH (data, len);
|
|
445 widget_instantiate_1 (image_instance, instantiator, pointer_fg,
|
418
|
446 pointer_bg, dest_mask, domain, len + 1, 0, 0);
|
|
447 }
|
|
448
|
|
449 static void
|
|
450 tab_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
|
|
451 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
|
|
452 int dest_mask, Lisp_Object domain)
|
|
453 {
|
|
454 Lisp_Object data = Fplist_get (find_keyword_in_vector (instantiator, Q_properties),
|
|
455 Q_items, Qnil);
|
|
456 Lisp_Object rest;
|
|
457 int len = 0;
|
|
458
|
|
459 LIST_LOOP (rest, data)
|
|
460 {
|
|
461 len += 3; /* some bias */
|
|
462 if (STRINGP (XCAR (rest)))
|
|
463 len += XSTRING_LENGTH (XCAR (rest));
|
|
464 else if (VECTORP (XCAR (rest)))
|
|
465 {
|
|
466 Lisp_Object gui = gui_parse_item_keywords (XCAR (rest));
|
|
467 len += XSTRING_LENGTH (XGUI_ITEM (gui)->name);
|
|
468 }
|
|
469 }
|
|
470
|
|
471 widget_instantiate_1 (image_instance, instantiator, pointer_fg,
|
|
472 pointer_bg, dest_mask, domain, 0, 0, len);
|
384
|
473 }
|
|
474
|
412
|
475 /* Instantiate a static control */
|
|
476 static void
|
|
477 static_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
|
|
478 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
|
|
479 int dest_mask, Lisp_Object domain)
|
384
|
480 {
|
412
|
481 widget_instantiate_1 (image_instance, instantiator, pointer_fg,
|
418
|
482 pointer_bg, dest_mask, domain, 0, 4, 0);
|
384
|
483 }
|
|
484
|
|
485
|
|
486 /************************************************************************/
|
|
487 /* initialization */
|
|
488 /************************************************************************/
|
|
489
|
|
490 void
|
|
491 syms_of_glyphs_widget (void)
|
|
492 {
|
|
493 defkeyword (&Q_descriptor, ":descriptor");
|
|
494 defkeyword (&Q_height, ":height");
|
|
495 defkeyword (&Q_width, ":width");
|
|
496 defkeyword (&Q_properties, ":properties");
|
|
497 defkeyword (&Q_items, ":items");
|
388
|
498 defkeyword (&Q_image, ":image");
|
412
|
499 defkeyword (&Q_percent, ":percent");
|
418
|
500 defkeyword (&Q_text, ":text");
|
398
|
501 }
|
384
|
502
|
398
|
503 void
|
|
504 image_instantiator_format_create_glyphs_widget (void)
|
|
505 {
|
412
|
506 #define VALID_GUI_KEYWORDS(type) \
|
|
507 IIFORMAT_VALID_KEYWORD (type, Q_active, check_valid_anything); \
|
|
508 IIFORMAT_VALID_KEYWORD (type, Q_suffix, check_valid_anything); \
|
|
509 IIFORMAT_VALID_KEYWORD (type, Q_keys, check_valid_string); \
|
|
510 IIFORMAT_VALID_KEYWORD (type, Q_style, check_valid_symbol); \
|
|
511 IIFORMAT_VALID_KEYWORD (type, Q_selected, check_valid_anything); \
|
|
512 IIFORMAT_VALID_KEYWORD (type, Q_filter, check_valid_anything); \
|
|
513 IIFORMAT_VALID_KEYWORD (type, Q_config, check_valid_symbol); \
|
|
514 IIFORMAT_VALID_KEYWORD (type, Q_included, check_valid_anything); \
|
|
515 IIFORMAT_VALID_KEYWORD (type, Q_key_sequence, check_valid_string); \
|
|
516 IIFORMAT_VALID_KEYWORD (type, Q_accelerator, check_valid_string); \
|
|
517 IIFORMAT_VALID_KEYWORD (type, Q_label, check_valid_anything); \
|
|
518 IIFORMAT_VALID_KEYWORD (type, Q_callback, check_valid_callback); \
|
|
519 IIFORMAT_VALID_KEYWORD (type, Q_descriptor, check_valid_string_or_vector)
|
|
520
|
|
521 #define VALID_WIDGET_KEYWORDS(type) \
|
|
522 IIFORMAT_VALID_KEYWORD (type, Q_width, check_valid_int); \
|
|
523 IIFORMAT_VALID_KEYWORD (type, Q_height, check_valid_int); \
|
|
524 IIFORMAT_VALID_KEYWORD (type, Q_pixel_width, check_valid_int); \
|
|
525 IIFORMAT_VALID_KEYWORD (type, Q_pixel_height, check_valid_int); \
|
|
526 IIFORMAT_VALID_KEYWORD (type, Q_face, check_valid_face)
|
|
527
|
|
528 /* we only do this for properties */
|
|
529 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT_NO_SYM (widget, "widget");
|
|
530 IIFORMAT_HAS_METHOD (widget, property);
|
|
531 IIFORMAT_HAS_METHOD (widget, set_property);
|
|
532
|
|
533 /* widget image-instantiator types - buttons */
|
|
534 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (button, "button");
|
|
535 IIFORMAT_HAS_SHARED_METHOD (button, validate, widget);
|
|
536 IIFORMAT_HAS_SHARED_METHOD (button, possible_dest_types, widget);
|
|
537 IIFORMAT_HAS_SHARED_METHOD (button, instantiate, widget);
|
|
538 IIFORMAT_HAS_SHARED_METHOD (button, normalize, widget);
|
|
539 IIFORMAT_VALID_KEYWORD (button, Q_image, check_valid_glyph_or_image);
|
|
540 VALID_WIDGET_KEYWORDS (button);
|
|
541 VALID_GUI_KEYWORDS (button);
|
|
542
|
|
543 /* edit fields */
|
|
544 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (edit, "edit");
|
|
545 IIFORMAT_HAS_SHARED_METHOD (edit, validate, widget);
|
|
546 IIFORMAT_HAS_SHARED_METHOD (edit, possible_dest_types, widget);
|
|
547 IIFORMAT_HAS_SHARED_METHOD (edit, instantiate, widget);
|
|
548 VALID_WIDGET_KEYWORDS (edit);
|
|
549 VALID_GUI_KEYWORDS (edit);
|
398
|
550
|
412
|
551 /* combo box */
|
|
552 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (combo, "combo");
|
|
553 IIFORMAT_HAS_METHOD (combo, validate);
|
|
554 IIFORMAT_HAS_SHARED_METHOD (combo, possible_dest_types, widget);
|
|
555 IIFORMAT_HAS_METHOD (combo, instantiate);
|
|
556 VALID_GUI_KEYWORDS (combo);
|
|
557
|
|
558 IIFORMAT_VALID_KEYWORD (combo, Q_width, check_valid_int);
|
|
559 IIFORMAT_VALID_KEYWORD (combo, Q_height, check_valid_int);
|
|
560 IIFORMAT_VALID_KEYWORD (combo, Q_pixel_width, check_valid_int);
|
|
561 IIFORMAT_VALID_KEYWORD (combo, Q_face, check_valid_face);
|
|
562 IIFORMAT_VALID_KEYWORD (combo, Q_properties, check_valid_item_list);
|
|
563
|
|
564 /* scrollbar */
|
|
565 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (scrollbar, "scrollbar");
|
|
566 IIFORMAT_HAS_SHARED_METHOD (scrollbar, validate, widget);
|
|
567 IIFORMAT_HAS_SHARED_METHOD (scrollbar, possible_dest_types, widget);
|
|
568 IIFORMAT_HAS_SHARED_METHOD (scrollbar, instantiate, widget);
|
|
569 VALID_GUI_KEYWORDS (scrollbar);
|
|
570
|
|
571 IIFORMAT_VALID_KEYWORD (scrollbar, Q_pixel_width, check_valid_int);
|
|
572 IIFORMAT_VALID_KEYWORD (scrollbar, Q_pixel_height, check_valid_int);
|
|
573 IIFORMAT_VALID_KEYWORD (scrollbar, Q_face, check_valid_face);
|
|
574
|
|
575 /* progress guage */
|
|
576 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (progress, "progress");
|
|
577 IIFORMAT_HAS_SHARED_METHOD (progress, validate, widget);
|
|
578 IIFORMAT_HAS_SHARED_METHOD (progress, possible_dest_types, widget);
|
418
|
579 IIFORMAT_HAS_SHARED_METHOD (progress, instantiate, combo);
|
412
|
580 VALID_WIDGET_KEYWORDS (progress);
|
|
581 VALID_GUI_KEYWORDS (progress);
|
|
582
|
418
|
583 /* tree view */
|
|
584 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (tree, "tree");
|
|
585 IIFORMAT_HAS_SHARED_METHOD (tree, validate, combo);
|
|
586 IIFORMAT_HAS_SHARED_METHOD (tree, possible_dest_types, widget);
|
|
587 IIFORMAT_HAS_SHARED_METHOD (tree, instantiate, combo);
|
|
588 VALID_WIDGET_KEYWORDS (tree);
|
|
589 VALID_GUI_KEYWORDS (tree);
|
|
590 IIFORMAT_VALID_KEYWORD (tree, Q_properties, check_valid_item_list);
|
|
591
|
|
592 /* tab control */
|
|
593 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (tab, "tab");
|
|
594 IIFORMAT_HAS_SHARED_METHOD (tab, validate, combo);
|
|
595 IIFORMAT_HAS_SHARED_METHOD (tab, possible_dest_types, widget);
|
|
596 IIFORMAT_HAS_METHOD (tab, instantiate);
|
|
597 VALID_WIDGET_KEYWORDS (tab);
|
|
598 VALID_GUI_KEYWORDS (tab);
|
|
599 IIFORMAT_VALID_KEYWORD (tab, Q_properties, check_valid_item_list);
|
|
600
|
412
|
601 /* labels */
|
|
602 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (label, "label");
|
|
603 IIFORMAT_HAS_SHARED_METHOD (label, possible_dest_types, widget);
|
|
604 IIFORMAT_HAS_SHARED_METHOD (label, instantiate, static);
|
|
605 VALID_WIDGET_KEYWORDS (label);
|
|
606 IIFORMAT_VALID_KEYWORD (label, Q_descriptor, check_valid_string);
|
|
607
|
|
608 #if 0
|
|
609 /* group */
|
|
610 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (group, "group");
|
|
611 IIFORMAT_HAS_SHARED_METHOD (group, possible_dest_types, widget);
|
|
612 IIFORMAT_HAS_METHOD (group, instantiate);
|
|
613
|
|
614 IIFORMAT_VALID_KEYWORD (group, Q_width, check_valid_int);
|
|
615 IIFORMAT_VALID_KEYWORD (group, Q_height, check_valid_int);
|
|
616 IIFORMAT_VALID_KEYWORD (group, Q_pixel_width, check_valid_int);
|
|
617 IIFORMAT_VALID_KEYWORD (group, Q_pixel_height, check_valid_int);
|
|
618 IIFORMAT_VALID_KEYWORD (group, Q_face, check_valid_face);
|
|
619 IIFORMAT_VALID_KEYWORD (group, Q_background, check_valid_string);
|
|
620 IIFORMAT_VALID_KEYWORD (group, Q_descriptor, check_valid_string);
|
384
|
621 #endif
|
|
622 }
|
|
623
|
|
624 void
|
|
625 vars_of_glyphs_widget (void)
|
|
626 {
|
|
627 }
|