annotate src/glyphs-widget.c @ 384:bbff43aa5eb7 r21-2-7

Import from CVS: tag r21-2-7
author cvs
date Mon, 13 Aug 2007 11:08:24 +0200
parents
children aabb7f5b1c81
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.
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
2 Copyright (C) 1998 Andy Piper
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
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
23 #include <config.h>
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
24 #include "lisp.h"
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
25 #include "lstream.h"
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
26 #include "console.h"
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
27 #include "device.h"
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
28 #include "faces.h"
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
29 #include "glyphs.h"
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
30 #include "objects.h"
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
31
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
32 #include "window.h"
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
33 #include "buffer.h"
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
34 #include "frame.h"
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
35 #include "insdel.h"
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
36 #include "opaque.h"
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
37
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
38 DEFINE_IMAGE_INSTANTIATOR_FORMAT (button);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
39 DEFINE_IMAGE_INSTANTIATOR_FORMAT (combo);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
40 Lisp_Object Qcombo;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
41 DEFINE_IMAGE_INSTANTIATOR_FORMAT (edit);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
42 Lisp_Object Qedit;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
43 DEFINE_IMAGE_INSTANTIATOR_FORMAT (scrollbar);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
44 Lisp_Object Qscrollbar;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
45 DEFINE_IMAGE_INSTANTIATOR_FORMAT (widget);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
46 #if 0
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
47 DEFINE_IMAGE_INSTANTIATOR_FORMAT (group);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
48 Lisp_Object Qgroup;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
49 #endif
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
50 DEFINE_IMAGE_INSTANTIATOR_FORMAT (label);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
51 Lisp_Object Qlabel;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
52
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
53 Lisp_Object Q_descriptor, Q_height, Q_width, Q_properties, Q_items;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
54
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
55 #define WIDGET_BORDER_HEIGHT 2
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
56 #define WIDGET_BORDER_WIDTH 4
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
57
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
58 /* TODO:
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
59 - more complex controls.
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
60 - tooltips for controls.
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
61 - images in controls.
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
62 */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
63
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
64 /* In windows normal windows work in pixels, dialog boxes work in
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
65 dialog box units. Why? sigh. We could reuse the metrics for dialogs
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
66 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
67 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
68 buttons in groups. */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
69 Lisp_Object
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
70 widget_face_font_info (Lisp_Object domain, Lisp_Object face,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
71 int *height, int *width)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
72 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
73 Lisp_Object font_instance = FACE_FONT (face, domain, Vcharset_ascii);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
74
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
75 if (height)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
76 *height = XFONT_INSTANCE (font_instance)->height;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
77 if (width)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
78 *width = XFONT_INSTANCE (font_instance)->width;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
79
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
80 return font_instance;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
81 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
82
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
83 void
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
84 widget_text_to_pixel_conversion (Lisp_Object domain, Lisp_Object face,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
85 int th, int tw,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
86 int* height, int* width)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
87 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
88 int ch=0, cw=0;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
89 widget_face_font_info (domain, face, &ch, &cw);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
90 if (height)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
91 *height = th * (ch + 2 * WIDGET_BORDER_HEIGHT);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
92 if (width)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
93 *width = tw * cw + 2 * WIDGET_BORDER_WIDTH;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
94 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
95
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
96 static int
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
97 widget_possible_dest_types (void)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
98 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
99 return IMAGE_WIDGET_MASK;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
100 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
101
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
102 #if 0 /* currently unused */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
103 static void
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
104 check_valid_glyph (Lisp_Object data)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
105 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
106 if (SYMBOLP (data))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
107 CHECK_BUFFER_GLYPH (XSYMBOL (data)->value);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
108 else
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
109 CHECK_BUFFER_GLYPH (data);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
110 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
111 #endif /* currently unused */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
112
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
113 static void
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
114 check_valid_item_list (Lisp_Object data)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
115 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
116 Lisp_Object rest;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
117 Lisp_Object items;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
118 Fcheck_valid_plist (data);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
119
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
120 items = Fplist_get (data, Q_items, Qnil);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
121
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
122 CHECK_LIST (items);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
123 EXTERNAL_LIST_LOOP (rest, items)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
124 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
125 CHECK_STRING (XCAR (rest));
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
126 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
127 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
128
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
129 /* wire widget property invocations to specific widgets ... The
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
130 problem we are solving here is that when instantiators get converted
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
131 to instances they lose some type information (they just become
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
132 subwindows or widgets for example). For widgets we need to preserve
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
133 this type information so that we can do widget specific operations on
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
134 the instances. This is encoded in the widget type
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
135 field. widget_property gets invoked by decoding the primary type
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
136 (Qwidget), widget property then invokes based on the secondary type
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
137 (Qedit for example). It is debatable that we should wire things in this
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
138 generalised way rather than treating widgets specially in
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
139 image_instance_property. */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
140 static Lisp_Object
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
141 widget_property (Lisp_Object image_instance, Lisp_Object prop)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
142 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
143 struct Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
144 struct image_instantiator_methods* meths;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
145
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
146 /* first see if its a general property ... */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
147 if (!NILP (Fplist_member (IMAGE_INSTANCE_WIDGET_PROPS (ii), prop)))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
148 return Fplist_get (IMAGE_INSTANCE_WIDGET_PROPS (ii), prop, Qnil);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
149
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
150 /* .. then try device specific methods ... */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
151 meths = decode_device_ii_format (IMAGE_INSTANCE_DEVICE (ii),
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
152 IMAGE_INSTANCE_WIDGET_TYPE (ii),
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
153 ERROR_ME_NOT);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
154 if (meths && HAS_IIFORMAT_METH_P (meths, property))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
155 return IIFORMAT_METH (meths, property, (image_instance, prop));
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
156 /* ... then format specific methods ... */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
157 meths = decode_device_ii_format (Qnil, IMAGE_INSTANCE_WIDGET_TYPE (ii),
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
158 ERROR_ME_NOT);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
159 if (meths && HAS_IIFORMAT_METH_P (meths, property))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
160 return IIFORMAT_METH (meths, property, (image_instance, prop));
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
161 /* ... then fail */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
162 return Qunbound;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
163 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
164
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
165 static Lisp_Object
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
166 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
167 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
168 struct Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
169 struct image_instantiator_methods* meths;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
170 Lisp_Object ret;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
171
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
172 /* try device specific methods first ... */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
173 meths = decode_device_ii_format (IMAGE_INSTANCE_DEVICE (ii),
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
174 IMAGE_INSTANCE_WIDGET_TYPE (ii),
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
175 ERROR_ME_NOT);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
176 if (meths && HAS_IIFORMAT_METH_P (meths, set_property)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
177 &&
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
178 !UNBOUNDP (ret =
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
179 IIFORMAT_METH (meths, set_property, (image_instance, prop, val))))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
180 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
181 return ret;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
182 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
183 /* ... then format specific methods ... */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
184 meths = decode_device_ii_format (Qnil, IMAGE_INSTANCE_WIDGET_TYPE (ii),
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
185 ERROR_ME_NOT);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
186 if (meths && HAS_IIFORMAT_METH_P (meths, set_property)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
187 &&
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
188 !UNBOUNDP (ret =
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
189 IIFORMAT_METH (meths, set_property, (image_instance, prop, val))))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
190 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
191 return ret;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
192 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
193 /* 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
194 IMAGE_INSTANCE_WIDGET_PROPS (ii)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
195 = Fplist_put (IMAGE_INSTANCE_WIDGET_PROPS (ii), prop, val);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
196 return val;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
197 }
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 static void
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
200 widget_validate (Lisp_Object instantiator)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
201 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
202 Lisp_Object desc = find_keyword_in_vector (instantiator, Q_descriptor);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
203 struct gui_item gui;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
204 if (NILP (desc))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
205 signal_simple_error ("Must supply :descriptor", instantiator);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
206
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
207 gui_parse_item_keywords (desc, &gui);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
208
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
209 if (!NILP (find_keyword_in_vector (instantiator, Q_width))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
210 && !NILP (find_keyword_in_vector (instantiator, Q_pixel_width)))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
211 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
212
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
213 if (!NILP (find_keyword_in_vector (instantiator, Q_height))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
214 && !NILP (find_keyword_in_vector (instantiator, Q_pixel_height)))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
215 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
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 void
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
219 combo_validate (Lisp_Object instantiator)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
220 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
221 widget_validate (instantiator);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
222 if (NILP (find_keyword_in_vector (instantiator, Q_properties)))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
223 signal_simple_error ("Must supply item list", instantiator);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
224 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
225
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
226 static void
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
227 initialize_widget_image_instance (struct Lisp_Image_Instance *ii, Lisp_Object type)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
228 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
229 /* initialize_subwindow_image_instance (ii);*/
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
230 IMAGE_INSTANCE_WIDGET_TYPE (ii) = type;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
231 IMAGE_INSTANCE_WIDGET_PROPS (ii) = Qnil;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
232 IMAGE_INSTANCE_WIDGET_FACE (ii) = Vwidget_face;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
233 gui_item_init (&IMAGE_INSTANCE_WIDGET_ITEM (ii));
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
234 }
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 /* Instantiate a button widget. Unfortunately instantiated widgets are
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
237 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
238 like images where you just select the image into the context you
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
239 want to display it in and BitBlt it. So images instances can have a
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
240 many-to-one relationship with things you see, whereas widgets can
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
241 only be one-to-one (i.e. per frame) */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
242 static void
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
243 widget_instantiate_1 (Lisp_Object image_instance, Lisp_Object instantiator,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
244 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
245 int dest_mask, Lisp_Object domain, int default_textheight,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
246 int default_pixheight)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
247 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
248 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
249 struct gui_item* pgui = &IMAGE_INSTANCE_WIDGET_ITEM (ii);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
250 Lisp_Object face = find_keyword_in_vector (instantiator, Q_face);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
251 Lisp_Object height = find_keyword_in_vector (instantiator, Q_height);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
252 Lisp_Object width = find_keyword_in_vector (instantiator, Q_width);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
253 Lisp_Object pixwidth = find_keyword_in_vector (instantiator, Q_pixel_width);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
254 Lisp_Object pixheight = find_keyword_in_vector (instantiator, Q_pixel_height);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
255 Lisp_Object desc = find_keyword_in_vector (instantiator, Q_descriptor);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
256 int pw=0, ph=0, tw=0, th=0;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
257
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
258 /* this just does pixel type sizing */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
259 subwindow_instantiate (image_instance, instantiator, pointer_fg, pointer_bg,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
260 dest_mask, domain);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
261
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
262 if (!(dest_mask & IMAGE_WIDGET_MASK))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
263 incompatible_image_types (instantiator, dest_mask, IMAGE_WIDGET_MASK);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
264
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
265 initialize_widget_image_instance (ii, XVECTOR_DATA (instantiator)[0]);
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 /* retrieve the fg and bg colors */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
268 if (!NILP (face))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
269 IMAGE_INSTANCE_WIDGET_FACE (ii) = Fget_face (face);
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 /* data items for some widgets */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
272 IMAGE_INSTANCE_WIDGET_PROPS (ii) =
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
273 find_keyword_in_vector (instantiator, Q_properties);
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 /* retrieve the gui item information */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
276 if (STRINGP (desc) || NILP (desc))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
277 IMAGE_INSTANCE_WIDGET_TEXT (ii) = desc;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
278 else
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
279 gui_parse_item_keywords (find_keyword_in_vector (instantiator, Q_descriptor),
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
280 pgui);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
281
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
282 /* normalize size information */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
283 if (!NILP (width))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
284 tw = XINT (width);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
285 if (!NILP (height))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
286 th = XINT (height);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
287 if (!NILP (pixwidth))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
288 pw = XINT (pixwidth);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
289 if (!NILP (pixheight))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
290 ph = XINT (pixheight);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
291
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
292 if (!tw && !pw && !NILP (IMAGE_INSTANCE_WIDGET_TEXT (ii)))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
293 tw = XSTRING_LENGTH (IMAGE_INSTANCE_WIDGET_TEXT (ii));
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
294 if (!th && !ph)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
295 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
296 if (default_textheight)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
297 th = default_textheight;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
298 else if (!NILP (IMAGE_INSTANCE_WIDGET_TEXT (ii)))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
299 th = 1;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
300 else
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
301 ph = default_pixheight;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
302 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
303
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
304 if (tw !=0 || th !=0)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
305 widget_text_to_pixel_conversion (domain,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
306 IMAGE_INSTANCE_WIDGET_FACE (ii),
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
307 th, tw, th ? &ph : 0, tw ? &pw : 0);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
308
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
309 IMAGE_INSTANCE_SUBWINDOW_WIDTH (ii) = pw;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
310 IMAGE_INSTANCE_SUBWINDOW_HEIGHT (ii) = ph;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
311 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
312
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
313 static void
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
314 widget_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
315 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
316 int dest_mask, Lisp_Object domain)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
317 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
318 widget_instantiate_1 (image_instance, instantiator, pointer_fg,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
319 pointer_bg, dest_mask, domain, 1, 0);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
320 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
321
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
322 static void
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
323 combo_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
324 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
325 int dest_mask, Lisp_Object domain)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
326 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
327 Lisp_Object data = Fplist_get (find_keyword_in_vector (instantiator, Q_properties),
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
328 Q_items, Qnil);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
329 int len;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
330 GET_LIST_LENGTH (data, len);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
331 widget_instantiate_1 (image_instance, instantiator, pointer_fg,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
332 pointer_bg, dest_mask, domain, len + 1, 0);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
333 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
334
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
335 /* Instantiate a static control */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
336 static void
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
337 static_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
338 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
339 int dest_mask, Lisp_Object domain)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
340 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
341 widget_instantiate_1 (image_instance, instantiator, pointer_fg,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
342 pointer_bg, dest_mask, domain, 0, 4);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
343 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
344
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 /************************************************************************/
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
347 /* initialization */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
348 /************************************************************************/
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
349
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
350 void
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
351 syms_of_glyphs_widget (void)
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 defkeyword (&Q_descriptor, ":descriptor");
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
354 defkeyword (&Q_height, ":height");
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
355 defkeyword (&Q_width, ":width");
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
356 defkeyword (&Q_properties, ":properties");
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
357 defkeyword (&Q_items, ":items");
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
358 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
359
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
360 void
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
361 image_instantiator_format_create_glyphs_widget (void)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
362 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
363 /* we only do this for properties */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
364 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT_NO_SYM (widget, "widget");
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
365 IIFORMAT_HAS_METHOD (widget, property);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
366 IIFORMAT_HAS_METHOD (widget, set_property);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
367
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
368 /* widget image-instantiator types - buttons */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
369 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (button, "button");
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
370 IIFORMAT_HAS_SHARED_METHOD (button, validate, widget);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
371 IIFORMAT_HAS_SHARED_METHOD (button, possible_dest_types, widget);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
372 IIFORMAT_HAS_SHARED_METHOD (button, instantiate, widget);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
373
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
374 IIFORMAT_VALID_KEYWORD (button, Q_width, check_valid_int);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
375 IIFORMAT_VALID_KEYWORD (button, Q_height, check_valid_int);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
376 IIFORMAT_VALID_KEYWORD (button, Q_pixel_width, check_valid_int);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
377 IIFORMAT_VALID_KEYWORD (button, Q_pixel_height, check_valid_int);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
378 IIFORMAT_VALID_KEYWORD (button, Q_face, check_valid_face);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
379 IIFORMAT_VALID_KEYWORD (button, Q_descriptor, check_valid_vector);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
380 /* edit fields */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
381 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (edit, "edit");
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
382 IIFORMAT_HAS_SHARED_METHOD (edit, validate, widget);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
383 IIFORMAT_HAS_SHARED_METHOD (edit, possible_dest_types, widget);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
384 IIFORMAT_HAS_SHARED_METHOD (edit, instantiate, widget);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
385
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
386 IIFORMAT_VALID_KEYWORD (edit, Q_width, check_valid_int);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
387 IIFORMAT_VALID_KEYWORD (edit, Q_height, check_valid_int);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
388 IIFORMAT_VALID_KEYWORD (edit, Q_pixel_width, check_valid_int);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
389 IIFORMAT_VALID_KEYWORD (edit, Q_pixel_height, check_valid_int);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
390 IIFORMAT_VALID_KEYWORD (edit, Q_face, check_valid_face);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
391 IIFORMAT_VALID_KEYWORD (edit, Q_descriptor, check_valid_vector);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
392 /* combo box */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
393 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (combo, "combo");
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
394 IIFORMAT_HAS_METHOD (combo, validate);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
395 IIFORMAT_HAS_SHARED_METHOD (combo, possible_dest_types, widget);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
396 IIFORMAT_HAS_METHOD (combo, instantiate);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
397
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
398 IIFORMAT_VALID_KEYWORD (combo, Q_width, check_valid_int);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
399 IIFORMAT_VALID_KEYWORD (combo, Q_height, check_valid_int);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
400 IIFORMAT_VALID_KEYWORD (combo, Q_pixel_width, check_valid_int);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
401 IIFORMAT_VALID_KEYWORD (combo, Q_face, check_valid_face);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
402 IIFORMAT_VALID_KEYWORD (combo, Q_descriptor, check_valid_vector);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
403 IIFORMAT_VALID_KEYWORD (combo, Q_properties, check_valid_item_list);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
404 /* scrollbar */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
405 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (scrollbar, "scrollbar");
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
406 IIFORMAT_HAS_SHARED_METHOD (scrollbar, validate, widget);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
407 IIFORMAT_HAS_SHARED_METHOD (scrollbar, possible_dest_types, widget);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
408 IIFORMAT_HAS_SHARED_METHOD (scrollbar, instantiate, widget);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
409
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
410 IIFORMAT_VALID_KEYWORD (scrollbar, Q_pixel_width, check_valid_int);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
411 IIFORMAT_VALID_KEYWORD (scrollbar, Q_pixel_height, check_valid_int);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
412 IIFORMAT_VALID_KEYWORD (scrollbar, Q_face, check_valid_face);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
413 IIFORMAT_VALID_KEYWORD (scrollbar, Q_descriptor, check_valid_vector);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
414 /* labels */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
415 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (label, "label");
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
416 IIFORMAT_HAS_SHARED_METHOD (label, possible_dest_types, widget);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
417 IIFORMAT_HAS_SHARED_METHOD (label, instantiate, static);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
418
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
419 IIFORMAT_VALID_KEYWORD (label, Q_pixel_width, check_valid_int);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
420 IIFORMAT_VALID_KEYWORD (label, Q_pixel_height, check_valid_int);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
421 IIFORMAT_VALID_KEYWORD (label, Q_width, check_valid_int);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
422 IIFORMAT_VALID_KEYWORD (label, Q_height, check_valid_int);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
423 IIFORMAT_VALID_KEYWORD (label, Q_face, check_valid_face);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
424 IIFORMAT_VALID_KEYWORD (label, Q_descriptor, check_valid_string);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
425 #if 0
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
426 /* group */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
427 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (group, "group");
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
428 IIFORMAT_HAS_SHARED_METHOD (group, possible_dest_types, widget);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
429 IIFORMAT_HAS_METHOD (group, instantiate);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
430
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
431 IIFORMAT_VALID_KEYWORD (group, Q_width, check_valid_int);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
432 IIFORMAT_VALID_KEYWORD (group, Q_height, check_valid_int);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
433 IIFORMAT_VALID_KEYWORD (group, Q_pixel_width, check_valid_int);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
434 IIFORMAT_VALID_KEYWORD (group, Q_pixel_height, check_valid_int);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
435 IIFORMAT_VALID_KEYWORD (group, Q_face, check_valid_face);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
436 IIFORMAT_VALID_KEYWORD (group, Q_background, check_valid_string);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
437 IIFORMAT_VALID_KEYWORD (group, Q_descriptor, check_valid_string);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
438 #endif
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
439 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
440
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
441 void
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
442 vars_of_glyphs_widget (void)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
443 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
444 }