annotate src/glyphs-widget.c @ 424:11054d720c21 r21-2-20

Import from CVS: tag r21-2-20
author cvs
date Mon, 13 Aug 2007 11:26:11 +0200
parents 95016f13131a
children
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.
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
2 Copyright (C) 1998, 1999 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);
420
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
41 DEFINE_IMAGE_INSTANTIATOR_FORMAT (combo_box);
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
42 Lisp_Object Qcombo_box;
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
43 DEFINE_IMAGE_INSTANTIATOR_FORMAT (edit_field);
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
44 Lisp_Object Qedit_field;
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);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
48 DEFINE_IMAGE_INSTANTIATOR_FORMAT (label);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
49 Lisp_Object Qlabel;
420
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
50 DEFINE_IMAGE_INSTANTIATOR_FORMAT (progress_gauge);
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
51 Lisp_Object Qprogress_gauge;
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
52 DEFINE_IMAGE_INSTANTIATOR_FORMAT (tree_view);
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
53 Lisp_Object Qtree_view;
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
54 DEFINE_IMAGE_INSTANTIATOR_FORMAT (tab_control);
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
55 Lisp_Object Qtab_control;
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
56 DEFINE_IMAGE_INSTANTIATOR_FORMAT (layout);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
57 Lisp_Object Qlayout;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
58
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
59 Lisp_Object Q_descriptor, Q_height, Q_width, Q_properties, Q_items;
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
60 Lisp_Object Q_image, Q_text, Q_percent, Q_orientation, Q_justify, Q_border;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
61 Lisp_Object Qetched_in, Qetched_out, Qbevel_in, Qbevel_out;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
62
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
63 #define WIDGET_BORDER_HEIGHT 4
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
64 #define WIDGET_BORDER_WIDTH 4
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
65
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
66 #ifdef DEBUG_WIDGETS
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
67 int debug_widget_instances;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
68 #endif
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
69
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
70 /* TODO:
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
71 - more complex controls.
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
72 - tooltips for controls.
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
73 */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
74
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
75 /* In windows normal windows work in pixels, dialog boxes work in
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
76 dialog box units. Why? sigh. We could reuse the metrics for dialogs
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
77 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
78 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
79 buttons in groups. */
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
80 Lisp_Object
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
81 widget_face_font_info (Lisp_Object domain, Lisp_Object face,
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
82 int *height, int *width)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
83 {
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
84 Lisp_Object font_instance = FACE_FONT (face, domain, Vcharset_ascii);
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
85
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
86 if (height)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
87 *height = XFONT_INSTANCE (font_instance)->height;
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
88 if (width)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
89 *width = XFONT_INSTANCE (font_instance)->width;
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 return font_instance;
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
92 }
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
93
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
94 void
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
95 widget_text_to_pixel_conversion (Lisp_Object domain, Lisp_Object face,
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
96 int th, int tw,
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
97 int* height, int* width)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
98 {
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
99 int ch=0, cw=0;
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
100 widget_face_font_info (domain, face, &ch, &cw);
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
101 if (height)
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
102 *height = th * ch + 2 * WIDGET_BORDER_HEIGHT;
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
103 if (width)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
104 *width = tw * cw + 2 * WIDGET_BORDER_WIDTH;
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
105 }
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
106
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
107 static int
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
108 widget_possible_dest_types (void)
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 return IMAGE_WIDGET_MASK;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
111 }
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
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
114 check_valid_glyph_or_instantiator (Lisp_Object data)
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
115 {
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
116 Lisp_Object glyph = data;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
117 if (SYMBOLP (data))
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
118 glyph = XSYMBOL (data)->value;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
119
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
120 if (IMAGE_INSTANCEP (glyph))
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
121 CHECK_IMAGE_INSTANCE (glyph);
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
122 else if (!CONSP (glyph) && !VECTORP (glyph))
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
123 CHECK_BUFFER_GLYPH (glyph);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
124 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
125
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
126 static void
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
127 check_valid_orientation (Lisp_Object data)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
128 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
129 if (!EQ (data, Qhorizontal)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
130 &&
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
131 !EQ (data, Qvertical))
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
132 signal_simple_error ("unknown orientation for layout", data);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
133 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
134
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
135 static void
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
136 check_valid_justification (Lisp_Object data)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
137 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
138 if (!EQ (data, Qleft) && !EQ (data, Qright) && !EQ (data, Qcenter))
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
139 signal_simple_error ("unknown justification for layout", data);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
140 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
141
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
142 static void
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
143 check_valid_border (Lisp_Object data)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
144 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
145 if (!EQ (data, Qt) && !EQ (data, Qetched_in) && !EQ (data, Qetched_out)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
146 && !EQ (data, Qbevel_in) && !EQ (data, Qbevel_out)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
147 && !GLYPHP (data) && !VECTORP (data))
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
148 signal_simple_error ("unknown border style for layout", data);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
149 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
150
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
151 static void
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
152 check_valid_anything (Lisp_Object data)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
153 {
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
154 }
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
155
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
156 static void
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
157 check_valid_callback (Lisp_Object data)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
158 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
159 if (!SYMBOLP (data)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
160 && !COMPILED_FUNCTIONP (data)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
161 && !CONSP (data))
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
162 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
163 signal_simple_error (":callback must be a function or expression", data);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
164 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
165 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
166
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
167 static void
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
168 check_valid_symbol (Lisp_Object data)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
169 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
170 CHECK_SYMBOL (data);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
171 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
172
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
173 static void
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
174 check_valid_string_or_vector (Lisp_Object data)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
175 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
176 if (!STRINGP (data) && !VECTORP (data))
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
177 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
178 }
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
179
422
95016f13131a Import from CVS: tag r21-2-19
cvs
parents: 420
diff changeset
180 void
418
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
181 check_valid_item_list_1 (Lisp_Object items)
384
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 Lisp_Object rest;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
184
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
185 CHECK_LIST (items);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
186 EXTERNAL_LIST_LOOP (rest, items)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
187 {
418
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
188 if (STRINGP (XCAR (rest)))
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
189 CHECK_STRING (XCAR (rest));
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
190 else if (VECTORP (XCAR (rest)))
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
191 gui_parse_item_keywords (XCAR (rest));
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
192 else if (LISTP (XCAR (rest)))
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
193 check_valid_item_list_1 (XCAR (rest));
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
194 else
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
195 signal_simple_error ("Items must be vectors, lists or strings", items);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
196 }
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
418
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
199 static void
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
200 check_valid_item_list (Lisp_Object data)
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
201 {
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
202 Lisp_Object items;
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
203
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
204 Fcheck_valid_plist (data);
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
205 items = Fplist_get (data, Q_items, Qnil);
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
206
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
207 check_valid_item_list_1 (items);
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
208 }
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
209
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
210 static void
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
211 check_valid_glyph_or_instantiator_list (Lisp_Object data)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
212 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
213 Lisp_Object rest;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
214
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
215 CHECK_LIST (data);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
216 EXTERNAL_LIST_LOOP (rest, data)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
217 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
218 check_valid_glyph_or_instantiator (XCAR (rest));
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
219 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
220 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
221
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
222 static Lisp_Object
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
223 glyph_instantiator_to_glyph (Lisp_Object sym)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
224 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
225 /* This function calls lisp. */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
226 Lisp_Object glyph = sym;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
227 struct gcpro gcpro1;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
228
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
229 GCPRO1 (glyph);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
230 /* if we have a symbol get at the actual data */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
231 if (SYMBOLP (glyph))
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
232 glyph = XSYMBOL (glyph)->value;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
233
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
234 if (CONSP (glyph))
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
235 glyph = Feval (glyph);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
236
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
237 /* Be really helpful to the user. */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
238 if (VECTORP (glyph))
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
239 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
240 glyph = call1 (intern ("make-glyph"), glyph);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
241 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
242
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
243 /* substitute the new glyph */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
244 RETURN_UNGCPRO (glyph);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
245 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
246
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
247 static void
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
248 substitute_keyword_value (Lisp_Object inst, Lisp_Object key, Lisp_Object val)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
249 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
250 int i;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
251 /* substitute the new glyph */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
252 for (i = 0; i < XVECTOR_LENGTH (inst); i++)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
253 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
254 if (EQ (key, XVECTOR_DATA (inst)[i]))
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
255 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
256 XVECTOR_DATA (inst)[i+1] = val;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
257 break;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
258 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
259 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
260 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
261
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
262 /* wire widget property invocations to specific widgets ... The
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
263 problem we are solving here is that when instantiators get converted
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
264 to instances they lose some type information (they just become
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
265 subwindows or widgets for example). For widgets we need to preserve
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
266 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
267 the instances. This is encoded in the widget type
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
268 field. widget_property gets invoked by decoding the primary type
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
269 (Qwidget), widget property then invokes based on the secondary type
420
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
270 (Qedit_field for example). It is debatable that we should wire things in this
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
271 generalised way rather than treating widgets specially in
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
272 image_instance_property. */
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
273 static Lisp_Object
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
274 widget_property (Lisp_Object image_instance, Lisp_Object prop)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
275 {
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
276 struct Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
277 struct image_instantiator_methods* meths;
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 /* first see if its a general property ... */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
280 if (!NILP (Fplist_member (IMAGE_INSTANCE_WIDGET_PROPS (ii), prop)))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
281 return Fplist_get (IMAGE_INSTANCE_WIDGET_PROPS (ii), prop, Qnil);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
282
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
283 /* .. then try device specific methods ... */
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
284 meths = decode_device_ii_format (IMAGE_INSTANCE_DEVICE (ii),
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
285 IMAGE_INSTANCE_WIDGET_TYPE (ii),
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
286 ERROR_ME_NOT);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
287 if (meths && HAS_IIFORMAT_METH_P (meths, property))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
288 return IIFORMAT_METH (meths, property, (image_instance, prop));
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
289 /* ... then format specific methods ... */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
290 meths = decode_device_ii_format (Qnil, IMAGE_INSTANCE_WIDGET_TYPE (ii),
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
291 ERROR_ME_NOT);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
292 if (meths && HAS_IIFORMAT_METH_P (meths, property))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
293 return IIFORMAT_METH (meths, property, (image_instance, prop));
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
294 /* ... then fail */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
295 return Qunbound;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
296 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
297
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
298 static Lisp_Object
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
299 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
300 {
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
301 struct Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
302 struct image_instantiator_methods* meths;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
303 Lisp_Object ret;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
304
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
305 /* try device specific methods first ... */
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
306 meths = decode_device_ii_format (IMAGE_INSTANCE_DEVICE (ii),
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
307 IMAGE_INSTANCE_WIDGET_TYPE (ii),
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
308 ERROR_ME_NOT);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
309 if (meths && HAS_IIFORMAT_METH_P (meths, set_property)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
310 &&
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
311 !UNBOUNDP (ret =
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
312 IIFORMAT_METH (meths, set_property, (image_instance, prop, val))))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
313 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
314 return ret;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
315 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
316 /* ... then format specific methods ... */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
317 meths = decode_device_ii_format (Qnil, IMAGE_INSTANCE_WIDGET_TYPE (ii),
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
318 ERROR_ME_NOT);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
319 if (meths && HAS_IIFORMAT_METH_P (meths, set_property)
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 !UNBOUNDP (ret =
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
322 IIFORMAT_METH (meths, set_property, (image_instance, prop, val))))
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 return ret;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
325 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
326 /* 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
327 IMAGE_INSTANCE_WIDGET_PROPS (ii)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
328 = Fplist_put (IMAGE_INSTANCE_WIDGET_PROPS (ii), prop, val);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
329 return val;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
330 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
331
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
332 static void
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
333 widget_validate (Lisp_Object instantiator)
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 Lisp_Object desc = find_keyword_in_vector (instantiator, Q_descriptor);
418
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
336
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
337 if (NILP (desc))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
338 signal_simple_error ("Must supply :descriptor", instantiator);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
339
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
340 if (VECTORP (desc))
418
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
341 gui_parse_item_keywords (desc);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
342
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
343 if (!NILP (find_keyword_in_vector (instantiator, Q_width))
418
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
344 && !NILP (find_keyword_in_vector (instantiator, Q_pixel_width)))
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
345 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
346
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
347 if (!NILP (find_keyword_in_vector (instantiator, Q_height))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
348 && !NILP (find_keyword_in_vector (instantiator, Q_pixel_height)))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
349 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
350 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
351
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
352 static void
420
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
353 combo_box_validate (Lisp_Object instantiator)
384
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 widget_validate (instantiator);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
356 if (NILP (find_keyword_in_vector (instantiator, Q_properties)))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
357 signal_simple_error ("Must supply item list", instantiator);
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
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
360 /* we need to convert things like glyphs to images, eval expressions
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
361 etc.*/
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
362 static Lisp_Object
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
363 widget_normalize (Lisp_Object inst, Lisp_Object console_type)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
364 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
365 /* This function can call lisp */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
366 Lisp_Object glyph = find_keyword_in_vector (inst, Q_image);
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 /* 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
369 same reasons we normalize file to data. */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
370 if (!NILP (glyph))
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
371 {
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
372 substitute_keyword_value (inst, Q_image, glyph_instantiator_to_glyph (glyph));
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
373 }
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
374
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
375 return inst;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
376 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
377
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
378 static void
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
379 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
380 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
381 /* initialize_subwindow_image_instance (ii);*/
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
382 IMAGE_INSTANCE_WIDGET_TYPE (ii) = type;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
383 IMAGE_INSTANCE_WIDGET_PROPS (ii) = Qnil;
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
384 IMAGE_INSTANCE_WIDGET_FACE (ii) = Vwidget_face;
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
385 IMAGE_INSTANCE_WIDGET_ITEMS (ii) = allocate_gui_item ();
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
386 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
387
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
388 /* Instantiate a button widget. Unfortunately instantiated widgets are
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
389 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
390 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
391 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
392 many-to-one relationship with things you see, whereas widgets can
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
393 only be one-to-one (i.e. per frame) */
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
394 void
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
395 widget_instantiate_1 (Lisp_Object image_instance, Lisp_Object instantiator,
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
396 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
397 int dest_mask, Lisp_Object domain, int default_textheight,
418
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
398 int default_pixheight, int default_textwidth)
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
399 {
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
400 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
401 Lisp_Object face = find_keyword_in_vector (instantiator, Q_face);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
402 Lisp_Object height = find_keyword_in_vector (instantiator, Q_height);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
403 Lisp_Object width = find_keyword_in_vector (instantiator, Q_width);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
404 Lisp_Object pixwidth = find_keyword_in_vector (instantiator, Q_pixel_width);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
405 Lisp_Object pixheight = find_keyword_in_vector (instantiator, Q_pixel_height);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
406 Lisp_Object desc = find_keyword_in_vector (instantiator, Q_descriptor);
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
407 Lisp_Object glyph = find_keyword_in_vector (instantiator, Q_image);
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
408 Lisp_Object props = find_keyword_in_vector (instantiator, Q_properties);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
409 int pw=0, ph=0, tw=0, th=0;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
410
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
411 /* this just does pixel type sizing */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
412 subwindow_instantiate (image_instance, instantiator, pointer_fg, pointer_bg,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
413 dest_mask, domain);
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
414
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
415 if (!(dest_mask & IMAGE_WIDGET_MASK))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
416 incompatible_image_types (instantiator, dest_mask, IMAGE_WIDGET_MASK);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
417
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
418 initialize_widget_image_instance (ii, XVECTOR_DATA (instantiator)[0]);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
419
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
420 /* retrieve the fg and bg colors */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
421 if (!NILP (face))
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
422 IMAGE_INSTANCE_WIDGET_FACE (ii) = Fget_face (face);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
423
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
424 /* data items for some widgets */
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
425 IMAGE_INSTANCE_WIDGET_PROPS (ii) = props;
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
426
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
427 /* 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
428 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
429 keywords */
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
430 if (STRINGP (desc) || NILP (desc))
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
431 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
432 /* big cheat - we rely on the fact that a gui item looks like an instantiator */
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
433 IMAGE_INSTANCE_WIDGET_ITEMS (ii) =
418
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
434 gui_parse_item_keywords_no_errors (instantiator);
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
435 IMAGE_INSTANCE_WIDGET_TEXT (ii) = desc;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
436 }
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
437 else
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
438 IMAGE_INSTANCE_WIDGET_ITEMS (ii) =
418
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
439 gui_parse_item_keywords_no_errors (desc);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
440
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
441 /* parse more gui items out of the properties */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
442 if (!NILP (props))
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
443 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
444 Lisp_Object items = Fplist_get (props, Q_items, Qnil);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
445 if (!NILP (items))
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
446 IMAGE_INSTANCE_WIDGET_ITEMS (ii) =
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
447 Fcons (IMAGE_INSTANCE_WIDGET_ITEMS (ii),
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
448 parse_gui_item_tree_children (items));
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
449 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
450
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
451 /* normalize size information */
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
452 if (!NILP (width))
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
453 tw = XINT (width);
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
454 if (!NILP (height))
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
455 th = XINT (height);
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
456 if (!NILP (pixwidth))
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
457 pw = XINT (pixwidth);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
458 if (!NILP (pixheight))
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
459 ph = XINT (pixheight);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
460
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
461 /* 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
462 if (!NILP (glyph))
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
463 {
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
464 if (!pw && !tw)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
465 pw = glyph_width (glyph, Qnil, DEFAULT_INDEX, domain)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
466 + 2 * WIDGET_BORDER_WIDTH;
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
467 if (!ph && !th)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
468 ph = glyph_height (glyph, Qnil, DEFAULT_INDEX, domain)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
469 + 2 * WIDGET_BORDER_HEIGHT;
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
470 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
471
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
472 /* 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
473 if (!tw && !pw)
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
474 {
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
475 if (default_textwidth)
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
476 tw = default_textwidth;
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
477 else if (!NILP (IMAGE_INSTANCE_WIDGET_TEXT (ii)))
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
478 tw = XSTRING_LENGTH (IMAGE_INSTANCE_WIDGET_TEXT (ii));
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
479 }
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
480
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
481 if (!th && !ph)
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
482 {
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
483 if (default_textheight)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
484 th = default_textheight;
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
485 else if (!NILP (IMAGE_INSTANCE_WIDGET_TEXT (ii)))
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
486 th = 1;
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
487 else
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
488 ph = default_pixheight;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
489 }
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
490
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
491 if (tw !=0 || th !=0)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
492 widget_text_to_pixel_conversion (domain,
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
493 IMAGE_INSTANCE_WIDGET_FACE (ii),
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
494 th, tw, th ? &ph : 0, tw ? &pw : 0);
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
495
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
496 IMAGE_INSTANCE_SUBWINDOW_WIDTH (ii) = pw;
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
497 IMAGE_INSTANCE_SUBWINDOW_HEIGHT (ii) = ph;
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
498 #ifdef DEBUG_WIDGETS
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
499 debug_widget_instances++;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
500 stderr_out ("instantiated ");
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
501 debug_print (instantiator);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
502 stderr_out ("%d widgets instantiated\n", debug_widget_instances);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
503 #endif
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
504 }
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
505
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
506 static void
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
507 widget_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
508 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
509 int dest_mask, Lisp_Object domain)
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
510 {
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
511 widget_instantiate_1 (image_instance, instantiator, pointer_fg,
418
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
512 pointer_bg, dest_mask, domain, 1, 0, 0);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
513 }
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
514
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
515 /* tree-view generic instantiation - get the height right */
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
516 static void
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
517 tree_view_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
518 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
519 int dest_mask, Lisp_Object domain)
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
520 {
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
521 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
522 Q_items, Qnil);
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
523 int len;
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
524 GET_LIST_LENGTH (data, len);
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
525 widget_instantiate_1 (image_instance, instantiator, pointer_fg,
418
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
526 pointer_bg, dest_mask, domain, len + 1, 0, 0);
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
527 }
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
528
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
529 static void
420
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
530 tab_control_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
418
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
531 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
532 int dest_mask, Lisp_Object domain)
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
533 {
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
534 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
535 Q_items, Qnil);
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
536 Lisp_Object rest;
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
537 int len = 0;
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
538
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
539 LIST_LOOP (rest, data)
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
540 {
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
541 len += 3; /* some bias */
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
542 if (STRINGP (XCAR (rest)))
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
543 len += XSTRING_LENGTH (XCAR (rest));
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
544 else if (VECTORP (XCAR (rest)))
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
545 {
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
546 Lisp_Object gui = gui_parse_item_keywords (XCAR (rest));
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
547 len += XSTRING_LENGTH (XGUI_ITEM (gui)->name);
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
548 }
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
549 }
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
550
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
551 widget_instantiate_1 (image_instance, instantiator, pointer_fg,
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
552 pointer_bg, dest_mask, domain, 0, 0, len);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
553 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
554
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
555 /* Instantiate a static control */
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
556 static void
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
557 static_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
558 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
559 int dest_mask, Lisp_Object domain)
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
560 {
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
561 widget_instantiate_1 (image_instance, instantiator, pointer_fg,
418
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
562 pointer_bg, dest_mask, domain, 0, 4, 0);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
563 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
564
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
565
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
566 /*****************************************************************************
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
567 * widget layout *
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
568 *****************************************************************************/
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
569 static int
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
570 layout_possible_dest_types (void)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
571 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
572 return IMAGE_LAYOUT_MASK;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
573 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
574
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
575 /* we need to convert things like glyphs to images, eval expressions
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
576 etc.*/
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
577 static Lisp_Object
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
578 layout_normalize (Lisp_Object inst, Lisp_Object console_type)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
579 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
580 /* This function can call lisp */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
581 Lisp_Object items = find_keyword_in_vector (inst, Q_items);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
582 Lisp_Object border = find_keyword_in_vector (inst, Q_border);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
583 /* we need to eval glyph if its an expression, we do this for the
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
584 same reasons we normalize file to data. */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
585 if (!NILP (items))
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
586 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
587 Lisp_Object rest;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
588 LIST_LOOP (rest, items)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
589 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
590 /* substitute the new glyph */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
591 Fsetcar (rest, glyph_instantiator_to_glyph (XCAR (rest)));
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
592 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
593 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
594 /* normalize the border spec. */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
595 if (VECTORP (border) || CONSP (border))
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
596 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
597 substitute_keyword_value (inst, Q_border, glyph_instantiator_to_glyph (border));
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
598 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
599 return inst;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
600 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
601
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
602 /* Instantiate a layout widget. */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
603 static void
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
604 layout_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
605 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
606 int dest_mask, Lisp_Object domain)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
607 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
608 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
609 Lisp_Object rest, device = IMAGE_INSTANCE_DEVICE (ii);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
610 Lisp_Object frame = FW_FRAME (domain);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
611 Lisp_Object items = find_keyword_in_vector (instantiator, Q_items);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
612 Lisp_Object width = find_keyword_in_vector (instantiator, Q_pixel_width);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
613 Lisp_Object height = find_keyword_in_vector (instantiator, Q_pixel_height);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
614 Lisp_Object orient = find_keyword_in_vector (instantiator, Q_orientation);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
615 Lisp_Object justify = find_keyword_in_vector (instantiator, Q_justify);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
616 Lisp_Object border = find_keyword_in_vector (instantiator, Q_border);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
617 Lisp_Object children = Qnil;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
618 int pw = 0, ph = 0, x, y, maxph = 0, maxpw = 0, nitems = 0,
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
619 horiz_spacing, vert_spacing, ph_adjust = 0;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
620
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
621 if (NILP (frame))
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
622 signal_simple_error ("No selected frame", device);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
623
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
624 if (!(dest_mask & IMAGE_LAYOUT_MASK))
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
625 incompatible_image_types (instantiator, dest_mask, IMAGE_LAYOUT_MASK);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
626
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
627 if (NILP (orient))
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
628 orient = Qvertical;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
629
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
630 if (EQ (border, Qt))
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
631 border = Qetched_in;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
632
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
633 ii->data = 0;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
634 IMAGE_INSTANCE_TYPE (ii) = IMAGE_LAYOUT;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
635 IMAGE_INSTANCE_SUBWINDOW_ID (ii) = 0;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
636 IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (ii) = 0;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
637 IMAGE_INSTANCE_SUBWINDOW_FRAME (ii) = frame;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
638 IMAGE_INSTANCE_LAYOUT_BORDER (ii) = border;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
639
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
640 /* normalize size information */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
641 if (!NILP (width))
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
642 pw = XINT (width);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
643 if (!NILP (height))
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
644 ph = XINT (height);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
645
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
646 /* flip through the items to work out how much stuff we have to display */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
647 LIST_LOOP (rest, items)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
648 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
649 Lisp_Object glyph = XCAR (rest);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
650 int gheight = glyph_height (glyph, Qnil, DEFAULT_INDEX, domain);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
651 int gwidth = glyph_width (glyph, Qnil, DEFAULT_INDEX, domain);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
652 nitems ++;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
653 if (EQ (orient, Qhorizontal))
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
654 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
655 maxph = max (maxph, gheight);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
656 maxpw += gwidth;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
657 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
658 else if (EQ (orient, Qvertical))
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
659 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
660 maxpw = max (maxpw, gwidth);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
661 maxph += gheight;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
662 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
663 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
664
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
665 /* work out spacing between items and bounds of the layout */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
666 if (!pw)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
667 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
668 /* No user provided width so we just do default spacing. */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
669 horiz_spacing = WIDGET_BORDER_WIDTH * 2;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
670 if (EQ (orient, Qhorizontal))
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
671 pw = maxpw + (nitems + 1) * horiz_spacing;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
672 else
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
673 pw = maxpw + 2 * horiz_spacing;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
674 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
675 else if (pw < maxpw)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
676 /* The user wants a smaller space than the largest item, so we
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
677 just provide default spacing and will let the output routines
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
678 clip.. */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
679 horiz_spacing = WIDGET_BORDER_WIDTH * 2;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
680 else if (EQ (orient, Qhorizontal))
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
681 /* We have a larger area to display in so distribute the space
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
682 evenly. */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
683 horiz_spacing = (pw - maxpw) / (nitems + 1);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
684 else
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
685 horiz_spacing = (pw - maxpw) / 2;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
686
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
687 /* Do the border now so that we can adjust the layout. */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
688 if (GLYPHP (border))
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
689 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
690 /* We are going to be sneaky here and add the border text as
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
691 just another child, the layout and output routines don't know
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
692 this and will just display at the offsets we prescribe. */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
693 Lisp_Object bglyph = glyph_image_instance (border, domain, ERROR_ME, 1);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
694
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
695 children = Fcons (bglyph, children);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
696 XIMAGE_INSTANCE_XOFFSET (bglyph) = 10; /* Really, what should this be? */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
697 XIMAGE_INSTANCE_YOFFSET (bglyph) = 0;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
698
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
699 ph_adjust = (glyph_height (border, Qnil, DEFAULT_INDEX, domain) / 2);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
700 IMAGE_INSTANCE_LAYOUT_BORDER (ii) = make_int (ph_adjust);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
701 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
702
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
703 /* Work out vertical spacings. */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
704 if (!ph)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
705 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
706 vert_spacing = WIDGET_BORDER_HEIGHT * 2;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
707 if (EQ (orient, Qvertical))
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
708 ph = maxph + (nitems + 1) * vert_spacing + ph_adjust;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
709 else
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
710 ph = maxph + 2 * vert_spacing + ph_adjust;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
711 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
712 else if (ph < maxph)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
713 vert_spacing = WIDGET_BORDER_HEIGHT * 2;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
714 else if (EQ (orient, Qvertical))
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
715 vert_spacing = (ph - (maxph + ph_adjust)) / (nitems + 1);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
716 else
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
717 vert_spacing = (ph - (maxph + ph_adjust)) / 2;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
718
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
719 y = vert_spacing + ph_adjust;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
720 x = horiz_spacing;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
721
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
722 /* Now flip through putting items where we want them, paying
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
723 attention to justification. */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
724 LIST_LOOP (rest, items)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
725 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
726 /* make sure the image is instantiated */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
727 Lisp_Object glyph = XCAR (rest);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
728 Lisp_Object gii = glyph_image_instance (glyph, domain, ERROR_ME, 1);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
729 int gwidth = glyph_width (glyph, Qnil, DEFAULT_INDEX, domain);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
730 int gheight = glyph_height (glyph, Qnil, DEFAULT_INDEX, domain);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
731
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
732 children = Fcons (gii, children);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
733
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
734 if (EQ (orient, Qhorizontal))
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
735 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
736 if (EQ (justify, Qright))
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
737 y = ph - (gheight + vert_spacing);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
738 else if (EQ (justify, Qcenter))
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
739 y = (ph - gheight) / 2;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
740 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
741 else if (EQ (orient, Qvertical))
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
742 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
743 if (EQ (justify, Qright))
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
744 x = pw - (gwidth + horiz_spacing);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
745 else if (EQ (justify, Qcenter))
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
746 x = (pw - gwidth) / 2;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
747 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
748
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
749 XIMAGE_INSTANCE_XOFFSET (gii) = x;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
750 XIMAGE_INSTANCE_YOFFSET (gii) = y;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
751
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
752 if (EQ (orient, Qhorizontal))
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
753 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
754 x += (gwidth + horiz_spacing);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
755 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
756 else if (EQ (orient, Qvertical))
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
757 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
758 y += (gheight + vert_spacing);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
759 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
760 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
761
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
762 IMAGE_INSTANCE_LAYOUT_CHILDREN (ii) = children;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
763 assert (pw && ph);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
764 IMAGE_INSTANCE_SUBWINDOW_WIDTH (ii) = pw;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
765 IMAGE_INSTANCE_SUBWINDOW_HEIGHT (ii) = ph;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
766 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
767
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
768
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
769 /************************************************************************/
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
770 /* initialization */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
771 /************************************************************************/
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
772
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
773 void
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
774 syms_of_glyphs_widget (void)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
775 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
776 defkeyword (&Q_descriptor, ":descriptor");
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
777 defkeyword (&Q_height, ":height");
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
778 defkeyword (&Q_width, ":width");
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
779 defkeyword (&Q_properties, ":properties");
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
780 defkeyword (&Q_items, ":items");
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
781 defkeyword (&Q_image, ":image");
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
782 defkeyword (&Q_percent, ":percent");
418
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
783 defkeyword (&Q_text, ":text");
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
784 defkeyword (&Q_orientation, ":orientation");
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
785 defkeyword (&Q_justify, ":justify");
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
786 defkeyword (&Q_border, ":border");
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
787
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
788 defsymbol (&Qetched_in, "etched-in");
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
789 defsymbol (&Qetched_out, "etched-out");
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
790 defsymbol (&Qbevel_in, "bevel-in");
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
791 defsymbol (&Qbevel_out, "bevel-out");
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
792 }
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
793
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
794 void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
795 image_instantiator_format_create_glyphs_widget (void)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
796 {
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
797 #define VALID_GUI_KEYWORDS(type) \
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
798 IIFORMAT_VALID_KEYWORD (type, Q_active, check_valid_anything); \
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
799 IIFORMAT_VALID_KEYWORD (type, Q_suffix, check_valid_anything); \
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
800 IIFORMAT_VALID_KEYWORD (type, Q_keys, check_valid_string); \
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
801 IIFORMAT_VALID_KEYWORD (type, Q_style, check_valid_symbol); \
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
802 IIFORMAT_VALID_KEYWORD (type, Q_selected, check_valid_anything); \
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
803 IIFORMAT_VALID_KEYWORD (type, Q_filter, check_valid_anything); \
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
804 IIFORMAT_VALID_KEYWORD (type, Q_config, check_valid_symbol); \
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
805 IIFORMAT_VALID_KEYWORD (type, Q_included, check_valid_anything); \
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
806 IIFORMAT_VALID_KEYWORD (type, Q_key_sequence, check_valid_string); \
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
807 IIFORMAT_VALID_KEYWORD (type, Q_accelerator, check_valid_string); \
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
808 IIFORMAT_VALID_KEYWORD (type, Q_label, check_valid_anything); \
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
809 IIFORMAT_VALID_KEYWORD (type, Q_callback, check_valid_callback); \
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
810 IIFORMAT_VALID_KEYWORD (type, Q_descriptor, check_valid_string_or_vector)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
811
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
812 #define VALID_WIDGET_KEYWORDS(type) \
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
813 IIFORMAT_VALID_KEYWORD (type, Q_width, check_valid_int); \
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
814 IIFORMAT_VALID_KEYWORD (type, Q_height, check_valid_int); \
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
815 IIFORMAT_VALID_KEYWORD (type, Q_pixel_width, check_valid_int); \
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
816 IIFORMAT_VALID_KEYWORD (type, Q_pixel_height, check_valid_int); \
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
817 IIFORMAT_VALID_KEYWORD (type, Q_face, check_valid_face)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
818
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
819 /* we only do this for properties */
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
820 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT_NO_SYM (widget, "widget");
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
821 IIFORMAT_HAS_METHOD (widget, property);
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
822 IIFORMAT_HAS_METHOD (widget, set_property);
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
823
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
824 /* widget image-instantiator types - buttons */
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
825 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (button, "button");
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
826 IIFORMAT_HAS_SHARED_METHOD (button, validate, widget);
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
827 IIFORMAT_HAS_SHARED_METHOD (button, possible_dest_types, widget);
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
828 IIFORMAT_HAS_SHARED_METHOD (button, instantiate, widget);
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
829 IIFORMAT_HAS_SHARED_METHOD (button, normalize, widget);
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
830 IIFORMAT_VALID_KEYWORD (button,
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
831 Q_image, check_valid_glyph_or_instantiator);
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
832 VALID_WIDGET_KEYWORDS (button);
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
833 VALID_GUI_KEYWORDS (button);
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
834
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
835 /* edit fields */
420
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
836 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (edit_field, "edit-field");
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
837 IIFORMAT_HAS_SHARED_METHOD (edit_field, validate, widget);
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
838 IIFORMAT_HAS_SHARED_METHOD (edit_field, possible_dest_types, widget);
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
839 IIFORMAT_HAS_SHARED_METHOD (edit_field, instantiate, widget);
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
840 VALID_WIDGET_KEYWORDS (edit_field);
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
841 VALID_GUI_KEYWORDS (edit_field);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
842
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
843 /* combo box */
420
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
844 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (combo_box, "combo-box");
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
845 IIFORMAT_HAS_METHOD (combo_box, validate);
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
846 IIFORMAT_HAS_SHARED_METHOD (combo_box, possible_dest_types, widget);
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
847 VALID_GUI_KEYWORDS (combo_box);
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
848
420
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
849 IIFORMAT_VALID_KEYWORD (combo_box, Q_width, check_valid_int);
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
850 IIFORMAT_VALID_KEYWORD (combo_box, Q_height, check_valid_int);
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
851 IIFORMAT_VALID_KEYWORD (combo_box, Q_pixel_width, check_valid_int);
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
852 IIFORMAT_VALID_KEYWORD (combo_box, Q_face, check_valid_face);
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
853 IIFORMAT_VALID_KEYWORD (combo_box, Q_properties, check_valid_item_list);
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
854
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
855 /* scrollbar */
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
856 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (scrollbar, "scrollbar");
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
857 IIFORMAT_HAS_SHARED_METHOD (scrollbar, validate, widget);
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
858 IIFORMAT_HAS_SHARED_METHOD (scrollbar, possible_dest_types, widget);
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
859 IIFORMAT_HAS_SHARED_METHOD (scrollbar, instantiate, widget);
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
860 VALID_GUI_KEYWORDS (scrollbar);
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
861
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
862 IIFORMAT_VALID_KEYWORD (scrollbar, Q_pixel_width, check_valid_int);
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
863 IIFORMAT_VALID_KEYWORD (scrollbar, Q_pixel_height, check_valid_int);
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
864 IIFORMAT_VALID_KEYWORD (scrollbar, Q_face, check_valid_face);
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
865
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
866 /* progress guage */
420
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
867 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (progress_gauge, "progress-gauge");
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
868 IIFORMAT_HAS_SHARED_METHOD (progress_gauge, validate, widget);
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
869 IIFORMAT_HAS_SHARED_METHOD (progress_gauge, possible_dest_types, widget);
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
870 IIFORMAT_HAS_SHARED_METHOD (progress_gauge, instantiate, widget);
420
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
871 VALID_WIDGET_KEYWORDS (progress_gauge);
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
872 VALID_GUI_KEYWORDS (progress_gauge);
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
873
418
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
874 /* tree view */
420
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
875 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (tree_view, "tree-view");
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
876 IIFORMAT_HAS_SHARED_METHOD (tree_view, validate, combo_box);
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
877 IIFORMAT_HAS_SHARED_METHOD (tree_view, possible_dest_types, widget);
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
878 IIFORMAT_HAS_METHOD (tree_view, instantiate);
420
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
879 VALID_WIDGET_KEYWORDS (tree_view);
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
880 VALID_GUI_KEYWORDS (tree_view);
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
881 IIFORMAT_VALID_KEYWORD (tree_view, Q_properties, check_valid_item_list);
418
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
882
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
883 /* tab control */
420
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
884 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (tab_control, "tab-control");
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
885 IIFORMAT_HAS_SHARED_METHOD (tab_control, validate, combo_box);
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
886 IIFORMAT_HAS_SHARED_METHOD (tab_control, possible_dest_types, widget);
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
887 IIFORMAT_HAS_METHOD (tab_control, instantiate);
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
888 VALID_WIDGET_KEYWORDS (tab_control);
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
889 VALID_GUI_KEYWORDS (tab_control);
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
890 IIFORMAT_VALID_KEYWORD (tab_control, Q_properties, check_valid_item_list);
418
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
891
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
892 /* labels */
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
893 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (label, "label");
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
894 IIFORMAT_HAS_SHARED_METHOD (label, possible_dest_types, widget);
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
895 IIFORMAT_HAS_SHARED_METHOD (label, instantiate, static);
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
896 VALID_WIDGET_KEYWORDS (label);
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
897 IIFORMAT_VALID_KEYWORD (label, Q_descriptor, check_valid_string);
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
898
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
899 /* layout */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
900 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (layout, "layout");
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
901 IIFORMAT_HAS_METHOD (layout, possible_dest_types);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
902 IIFORMAT_HAS_METHOD (layout, instantiate);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
903 IIFORMAT_HAS_METHOD (layout, normalize);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
904 IIFORMAT_VALID_KEYWORD (layout, Q_pixel_width, check_valid_int);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
905 IIFORMAT_VALID_KEYWORD (layout, Q_pixel_height, check_valid_int);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
906 IIFORMAT_VALID_KEYWORD (layout, Q_orientation, check_valid_orientation);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
907 IIFORMAT_VALID_KEYWORD (layout, Q_justify, check_valid_justification);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
908 IIFORMAT_VALID_KEYWORD (layout, Q_border, check_valid_border);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
909 IIFORMAT_VALID_KEYWORD (layout, Q_items,
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
910 check_valid_glyph_or_instantiator_list);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
911 }
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
912
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
913 void
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
914 reinit_vars_of_glyphs_widget (void)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
915 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
916 #ifdef DEBUG_WIDGETS
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
917 debug_widget_instances = 0;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
918 #endif
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
919 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
920
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
921 void
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
922 vars_of_glyphs_widget (void)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
923 {
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 422
diff changeset
924 reinit_vars_of_glyphs_widget ();
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
925 }