annotate src/glyphs-widget.c @ 418:e804706bfb8c r21-2-17

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