annotate lwlib/lwlib.c @ 185:3d6bfa290dbd r20-3b19

Import from CVS: tag r20-3b19
author cvs
date Mon, 13 Aug 2007 09:55:28 +0200
parents e121b013d1f0
children f220cc83d72e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 /* A general interface to the widgets of different toolkits.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 Copyright (C) 1992, 1993, 1994 Lucid, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 Copyright (C) 1995 Tinker Systems and INS Engineering Corp.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 This file is part of the Lucid Widget Library.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
7 The Lucid Widget Library is free software; you can redistribute it and/or
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 modify it under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 The Lucid Widget Library is distributed in the hope that it will be useful,
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 GNU General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
18 along with XEmacs; see the file COPYING. If not, write to
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
20 Boston, MA 02111-1307, USA. */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 #ifdef NeXT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 #undef __STRICT_BSD__ /* ick */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
149
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 136
diff changeset
26 #include <config.h>
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 149
diff changeset
27 #include <stdio.h>
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 #include <stdlib.h>
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 149
diff changeset
29 #include <string.h>
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 #include <sys/types.h>
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 149
diff changeset
31 #ifdef HAVE_UNISTD_H
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 149
diff changeset
32 #include <unistd.h>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 149
diff changeset
33 #endif
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 #include <X11/StringDefs.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 #include "lwlib-internal.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 #include "lwlib-utils.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 #ifdef NEED_LUCID
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 #include "lwlib-Xlw.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 #ifdef NEED_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 #include "lwlib-Xm.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 #ifdef NEED_ATHENA
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 #include "lwlib-Xaw.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 /* #### Does a check need to be put back in here to make sure we have
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 sufficient defines to function properly or are the checks in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 makefile sufficient? */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 /* List of all widgets managed by the library. Note that each "widget"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 listed here may actually be a tree of widgets; for example, a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 single entry here might represent a single menubar or popup menu,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 each of which might be implemented with a tree of widgets.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 static widget_info *all_widget_info = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 165
diff changeset
59 /* boolean flag indicating that the menubar is active */
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 165
diff changeset
60 int lw_menu_active = 0;
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 165
diff changeset
61
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 165
diff changeset
62 /* X11 menubar widget */
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 165
diff changeset
63 Widget lw_menubar_widget = NULL;
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 165
diff changeset
64
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 165
diff changeset
65 /* whether the last menu operation was a keyboard accelerator */
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 165
diff changeset
66 int lw_menu_accelerate = False;
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 165
diff changeset
67
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 /* Forward declarations */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 instantiate_widget_instance (widget_instance *instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 /* utility functions for widget_instance and widget_info */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 static char *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 safe_strdup (CONST char *s)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 char *result;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 if (! s) return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 result = (char *) malloc (strlen (s) + 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 if (! result)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 strcpy (result, s);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 return result;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 safe_free_str (char *s)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 if (s) free (s);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 static widget_value *widget_value_free_list = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 widget_value *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 malloc_widget_value (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 widget_value *wv;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 if (widget_value_free_list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 wv = widget_value_free_list;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 widget_value_free_list = wv->free_list;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 wv->free_list = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 wv = (widget_value *) malloc (sizeof (widget_value));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 if (wv)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 memset (wv, 0, sizeof (widget_value));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 return wv;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 /* this is analogous to free(). It frees only what was allocated
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
117 by malloc_widget_value(), and no substructures.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 free_widget_value (widget_value *wv)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 if (wv->free_list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 wv->free_list = widget_value_free_list;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 widget_value_free_list = wv;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 static void free_widget_value_tree (widget_value *wv);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 free_widget_value_contents (widget_value *wv)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 {
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
133 if (wv->name) free (wv->name);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 if (wv->value) free (wv->value);
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
135 if (wv->key) free (wv->key);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 /* #### - all of this 0xDEADBEEF stuff should be unnecessary
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 in production code... it should be conditionalized. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 wv->name = wv->value = wv->key = (char *) 0xDEADBEEF;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 if (wv->toolkit_data && wv->free_toolkit_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 {
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
143 XtFree ((char *) wv->toolkit_data);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 wv->toolkit_data = (void *) 0xDEADBEEF;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 #ifdef NEED_SCROLLBARS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 if (wv->scrollbar_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 free (wv->scrollbar_data);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 wv->scrollbar_data = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 if (wv->contents && (wv->contents != (widget_value*)1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 free_widget_value_tree (wv->contents);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 wv->contents = (widget_value *) 0xDEADBEEF;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 if (wv->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 free_widget_value_tree (wv->next);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 wv->next = (widget_value *) 0xDEADBEEF;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 free_widget_value_tree (widget_value *wv)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 if (!wv)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 free_widget_value_contents (wv);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 free_widget_value (wv);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 #ifdef NEED_SCROLLBARS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 copy_scrollbar_values (widget_value *val, widget_value *copy)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 if (!copy->scrollbar_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 copy->scrollbar_data =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 (scrollbar_values *) malloc (sizeof (scrollbar_values));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 if (val->scrollbar_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 *copy->scrollbar_data = *val->scrollbar_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 memset (copy->scrollbar_data, 0, sizeof (scrollbar_values));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 * Return true if old->scrollbar_data were not equivalent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 * to new->scrollbar_data.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 static Boolean
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 merge_scrollbar_values (widget_value *old, widget_value *new)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 Boolean changed = False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 if (new->scrollbar_data && !old->scrollbar_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 copy_scrollbar_values (new, old);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 changed = True;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 else if (!new->scrollbar_data && old->scrollbar_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 free (old->scrollbar_data);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 old->scrollbar_data = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 else if (new->scrollbar_data && old->scrollbar_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 scrollbar_values *old_sb = old->scrollbar_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 scrollbar_values *new_sb = new->scrollbar_data;
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 175
diff changeset
213
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 175
diff changeset
214 if ((old_sb->line_increment != new_sb->line_increment) ||
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 175
diff changeset
215 (old_sb->page_increment != new_sb->page_increment) ||
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 175
diff changeset
216 (old_sb->minimum != new_sb->minimum) ||
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 175
diff changeset
217 (old_sb->maximum != new_sb->maximum) ||
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 175
diff changeset
218 (old_sb->slider_size != new_sb->slider_size) ||
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 175
diff changeset
219 (old_sb->slider_position != new_sb->slider_position) ||
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 175
diff changeset
220 (old_sb->scrollbar_width != new_sb->scrollbar_width) ||
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 175
diff changeset
221 (old_sb->scrollbar_height != new_sb->scrollbar_height) ||
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 175
diff changeset
222 (old_sb->scrollbar_x != new_sb->scrollbar_x) ||
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 175
diff changeset
223 (old_sb->scrollbar_y != new_sb->scrollbar_y))
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 175
diff changeset
224 changed = True;
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 175
diff changeset
225
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 *old_sb = *new_sb;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 return changed;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 #endif /* NEED_SCROLLBARS */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 /* Make a complete copy of a widget_value tree. Store CHANGE into
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 the widget_value tree's `change' field. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 static widget_value *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 copy_widget_value_tree (widget_value *val, change_type change)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 widget_value *copy;
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
241
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 if (!val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 return NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 if (val == (widget_value *) 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 return val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 copy = malloc_widget_value ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 if (copy)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 /* #### - don't seg fault *here* if out of memory. Menus will be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 truncated inexplicably. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 copy->type = val->type;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 copy->name = safe_strdup (val->name);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 copy->value = safe_strdup (val->value);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 copy->key = safe_strdup (val->key);
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 165
diff changeset
256 copy->accel = val->accel;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 copy->enabled = val->enabled;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 copy->selected = val->selected;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 copy->edited = False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 copy->change = change;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 copy->contents = copy_widget_value_tree (val->contents, change);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 copy->call_data = val->call_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 copy->next = copy_widget_value_tree (val->next, change);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 copy->toolkit_data = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 copy->free_toolkit_data = False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 #ifdef NEED_SCROLLBARS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 copy_scrollbar_values (val, copy);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 return copy;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 /* This function is used to implement incremental menu construction. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 widget_value *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 replace_widget_value_tree (widget_value *node, widget_value *newtree)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 widget_value *copy;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 if (!node || !newtree)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 copy = copy_widget_value_tree (newtree, STRUCTURAL_CHANGE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 free_widget_value_contents (node);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 *node = *copy;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 free_widget_value (copy); /* free the node, but not its contents. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 return node;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 static widget_info *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 allocate_widget_info (CONST char *type, CONST char *name,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 LWLIB_ID id, widget_value *val,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 lw_callback pre_activate_cb, lw_callback selection_cb,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 lw_callback post_activate_cb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 widget_info *info = (widget_info *) malloc (sizeof (widget_info));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 info->type = safe_strdup (type);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 info->name = safe_strdup (name);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 info->id = id;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 info->val = copy_widget_value_tree (val, STRUCTURAL_CHANGE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 info->busy = False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 info->pre_activate_cb = pre_activate_cb;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 info->selection_cb = selection_cb;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 info->post_activate_cb = post_activate_cb;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 info->instances = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 info->next = all_widget_info;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 all_widget_info = info;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 return info;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 free_widget_info (widget_info *info)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 safe_free_str (info->type);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 safe_free_str (info->name);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 free_widget_value_tree (info->val);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 memset ((void*)info, 0xDEADBEEF, sizeof (widget_info));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 free (info);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 mark_widget_destroyed (Widget widget, XtPointer closure, XtPointer call_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 widget_instance *instance = (widget_instance*)closure;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 /* be very conservative */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 if (instance->widget == widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 instance->widget = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 static widget_instance *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 allocate_widget_instance (widget_info *info, Widget parent, Boolean pop_up_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 widget_instance *instance =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (widget_instance *) malloc (sizeof (widget_instance));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 instance->parent = parent;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 instance->pop_up_p = pop_up_p;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 instance->info = info;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 instance->next = info->instances;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 info->instances = instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 instantiate_widget_instance (instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 XtAddCallback (instance->widget, XtNdestroyCallback,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 mark_widget_destroyed, (XtPointer)instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 return instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 free_widget_instance (widget_instance *instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 memset ((void *) instance, 0xDEADBEEF, sizeof (widget_instance));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 free (instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 static widget_info *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 get_widget_info (LWLIB_ID id, Boolean remove_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 widget_info *info;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 widget_info *prev;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 for (prev = NULL, info = all_widget_info;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 info;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 prev = info, info = info->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 if (info->id == id)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 if (remove_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 if (prev)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 prev->next = info->next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 all_widget_info = info->next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 return info;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 return NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 /* Internal function used by the library dependent implementation to get the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 widget_value for a given widget in an instance */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 widget_info *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 lw_get_widget_info (LWLIB_ID id)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 return get_widget_info (id, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 map_widget_values (widget_value *value, int (*mapfunc) (widget_value *value,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 void *closure),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 void *closure)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 int retval = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 if (value->contents)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 retval = map_widget_values (value->contents, mapfunc, closure);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 if (retval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 return retval;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 if (value->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 retval = map_widget_values (value->next, mapfunc, closure);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 if (retval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 return retval;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 return (mapfunc) (value, closure);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 lw_map_widget_values (LWLIB_ID id, int (*mapfunc) (widget_value *value,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 void *closure),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 void *closure)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 widget_info *info = get_widget_info (id, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 if (!info)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 if (info->val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 return map_widget_values (info->val, mapfunc, closure);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 static widget_instance *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 get_widget_instance (Widget widget, Boolean remove_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 widget_info *info;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 widget_instance *instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 widget_instance *prev;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 for (info = all_widget_info; info; info = info->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 for (prev = NULL, instance = info->instances;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 prev = instance, instance = instance->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 if (instance->widget == widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 if (remove_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 if (prev)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 prev->next = instance->next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 info->instances = instance->next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 return instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 return (widget_instance *) 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 static widget_instance*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 find_instance (LWLIB_ID id, Widget parent, Boolean pop_up_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 widget_info *info = get_widget_info (id, False);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 widget_instance *instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 if (info)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 for (instance = info->instances; instance; instance = instance->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 if (instance->parent == parent && instance->pop_up_p == pop_up_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 return instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 return NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 /* utility function for widget_value */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 static Boolean
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 safe_strcmp (CONST char *s1, CONST char *s2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 if (!!s1 ^ !!s2) return True;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 return (s1 && s2) ? strcmp (s1, s2) : s1 ? False : !!s2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470
118
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 80
diff changeset
471 #ifndef WINDOWSNT
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
472 static change_type
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
473 max (change_type i1, change_type i2)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 {
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
475 return (int)i1 > (int)i2 ? i1 : i2;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 }
118
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 80
diff changeset
477 #endif
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 #if 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 # define EXPLAIN(name, oc, nc, desc, a1, a2) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 printf ("Change: \"%s\"\tmax(%s=%d,%s=%d)\t%s %d %d\n", \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 name, \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 (oc == NO_CHANGE ? "none" : \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 (oc == INVISIBLE_CHANGE ? "invisible" : \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 (oc == VISIBLE_CHANGE ? "visible" : \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 (oc == STRUCTURAL_CHANGE ? "structural" : "???")))), \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 oc, \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 (nc == NO_CHANGE ? "none" : \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 (nc == INVISIBLE_CHANGE ? "invisible" : \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 (nc == VISIBLE_CHANGE ? "visible" : \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 (nc == STRUCTURAL_CHANGE ? "structural" : "???")))), \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 nc, desc, a1, a2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 # define EXPLAIN(name, oc, nc, desc, a1, a2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 static widget_value *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 merge_widget_value (widget_value *val1, widget_value *val2, int level)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 change_type change;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 widget_value *merged_next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 widget_value *merged_contents;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 if (!val1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 if (val2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 return copy_widget_value_tree (val2, STRUCTURAL_CHANGE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 return NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 if (!val2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 free_widget_value_tree (val1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 return NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 }
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
518
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 change = NO_CHANGE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 if (val1->type != val2->type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 EXPLAIN (val1->name, change, STRUCTURAL_CHANGE, "type change",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 val1->type, val2->type);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 change = max (change, STRUCTURAL_CHANGE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 val1->type = val2->type;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 if (safe_strcmp (val1->name, val2->name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 EXPLAIN (val1->name, change, STRUCTURAL_CHANGE, "name change",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 val1->name, val2->name);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 change = max (change, STRUCTURAL_CHANGE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 safe_free_str (val1->name);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 val1->name = safe_strdup (val2->name);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 if (safe_strcmp (val1->value, val2->value))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 EXPLAIN (val1->name, change, VISIBLE_CHANGE, "value change",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 val1->value, val2->value);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 change = max (change, VISIBLE_CHANGE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 safe_free_str (val1->value);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 val1->value = safe_strdup (val2->value);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 if (safe_strcmp (val1->key, val2->key))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 EXPLAIN (val1->name, change, VISIBLE_CHANGE, "key change",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 val1->key, val2->key);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 change = max (change, VISIBLE_CHANGE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 safe_free_str (val1->key);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 val1->key = safe_strdup (val2->key);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 }
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 165
diff changeset
552 if (val1->accel != val2->accel)
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 165
diff changeset
553 {
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 165
diff changeset
554 EXPLAIN (val1->name, change, VISIBLE_CHANGE, "accelerator change",
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 165
diff changeset
555 val1->accel, val2->accel);
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 165
diff changeset
556 change = max (change, VISIBLE_CHANGE);
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 165
diff changeset
557 val1->accel = val2->accel;
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 165
diff changeset
558 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 if (val1->enabled != val2->enabled)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 EXPLAIN (val1->name, change, VISIBLE_CHANGE, "enablement change",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 val1->enabled, val2->enabled);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 change = max (change, VISIBLE_CHANGE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 val1->enabled = val2->enabled;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 if (val1->selected != val2->selected)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 EXPLAIN (val1->name, change, VISIBLE_CHANGE, "selection change",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 val1->selected, val2->selected);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 change = max (change, VISIBLE_CHANGE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 val1->selected = val2->selected;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 if (val1->call_data != val2->call_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 EXPLAIN (val1->name, change, INVISIBLE_CHANGE, "call-data change",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 val1->call_data, val2->call_data);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 change = max (change, INVISIBLE_CHANGE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 val1->call_data = val2->call_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 #ifdef NEED_SCROLLBARS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 if (merge_scrollbar_values (val1, val2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 EXPLAIN (val1->name, change, VISIBLE_CHANGE, "scrollbar change", 0, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 change = max (change, VISIBLE_CHANGE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 if (level > 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 merged_contents =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 merge_widget_value (val1->contents, val2->contents, level - 1);
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
592
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 if (val1->contents && !merged_contents)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 EXPLAIN (val1->name, change, INVISIBLE_CHANGE, "(contents gone)",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 0, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 change = max (change, INVISIBLE_CHANGE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 else if (merged_contents && merged_contents->change != NO_CHANGE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 EXPLAIN (val1->name, change, INVISIBLE_CHANGE, "(contents change)",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 0, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 change = max (change, INVISIBLE_CHANGE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 }
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
605
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 val1->contents = merged_contents;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 merged_next = merge_widget_value (val1->next, val2->next, level);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 if (val1->next && !merged_next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 EXPLAIN (val1->name, change, STRUCTURAL_CHANGE, "(following gone)",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 0, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 change = max (change, STRUCTURAL_CHANGE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 else if (merged_next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 if (merged_next->change)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 EXPLAIN (val1->name, change, merged_next->change, "(following change)",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 0, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 change = max (change, merged_next->change);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 val1->next = merged_next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 val1->change = change;
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
630
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 if (change > NO_CHANGE && val1->toolkit_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 if (val1->free_toolkit_data)
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
634 XtFree ((char *) val1->toolkit_data);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 val1->toolkit_data = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 return val1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 /* modifying the widgets */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 static Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 name_to_widget (widget_instance *instance, CONST char *name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 Widget widget = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 if (!instance->widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 return NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 if (!strcmp (XtName (instance->widget), name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 widget = instance->widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 int length = strlen (name) + 2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 char *real_name = (char *) alloca (length);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 real_name [0] = '*';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 strcpy (real_name + 1, name);
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
659
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 widget = XtNameToWidget (instance->widget, real_name);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 return widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 set_one_value (widget_instance *instance, widget_value *val, Boolean deep_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 Widget widget = name_to_widget (instance, val->name);
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
669
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 if (widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 #ifdef NEED_LUCID
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 if (lw_lucid_widget_p (instance->widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674 xlw_update_one_widget (instance, widget, val, deep_p);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 #ifdef NEED_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 if (lw_motif_widget_p (instance->widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 xm_update_one_widget (instance, widget, val, deep_p);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 #ifdef NEED_ATHENA
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 if (lw_xaw_widget_p (instance->widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 xaw_update_one_widget (instance, widget, val, deep_p);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 update_one_widget_instance (widget_instance *instance, Boolean deep_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690 widget_value *val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692 if (!instance->widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693 /* the widget was destroyed */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 for (val = instance->info->val; val; val = val->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 if (val->change != NO_CHANGE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 set_one_value (instance, val, deep_p);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 update_all_widget_values (widget_info *info, Boolean deep_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 widget_instance *instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 widget_value *val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707 for (instance = info->instances; instance; instance = instance->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 update_one_widget_instance (instance, deep_p);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 for (val = info->val; val; val = val->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 val->change = NO_CHANGE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 lw_modify_all_widgets (LWLIB_ID id, widget_value *val, Boolean deep_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 widget_info *info = get_widget_info (id, False);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 widget_value *new_val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719 widget_value *next_new_val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 widget_value *cur;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 widget_value *prev;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 widget_value *next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 int found;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725 if (!info)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 for (new_val = val; new_val; new_val = new_val->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730 next_new_val = new_val->next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 new_val->next = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732 found = False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 for (prev = NULL, cur = info->val; cur; prev = cur, cur = cur->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734 if (!strcmp (cur->name, new_val->name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736 found = True;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 next = cur->next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 cur->next = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 cur = merge_widget_value (cur, new_val, deep_p ? 1000 : 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 if (prev)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 prev->next = cur ? cur : next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 info->val = cur ? cur : next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 if (cur)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 cur->next = next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748 if (!found)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750 /* Could not find it, add it */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751 if (prev)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 prev->next = copy_widget_value_tree (new_val, STRUCTURAL_CHANGE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754 info->val = copy_widget_value_tree (new_val, STRUCTURAL_CHANGE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756 new_val->next = next_new_val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759 update_all_widget_values (info, deep_p);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763 /* creating the widgets */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766 initialize_widget_instance (widget_instance *instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 widget_value *val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770 for (val = instance->info->val; val; val = val->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771 val->change = STRUCTURAL_CHANGE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773 update_one_widget_instance (instance, True);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775 for (val = instance->info->val; val; val = val->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776 val->change = NO_CHANGE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780 static widget_creation_function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 find_in_table (CONST char *type, widget_creation_entry *table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783 widget_creation_entry *cur;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784 for (cur = table; cur->type; cur++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785 if (!strcasecmp (type, cur->type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786 return cur->function;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787 return NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790 static Boolean
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 dialog_spec_p (CONST char *name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792 {
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
793 /* return True if name matches [EILPQeilpq][1-9][Bb] or
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794 [EILPQeilpq][1-9][Bb][Rr][1-9] */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795 if (!name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796 return False;
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
797
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
798 switch (name [0])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
799 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800 case 'E': case 'I': case 'L': case 'P': case 'Q':
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
801 case 'e': case 'i': case 'l': case 'p': case 'q':
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802 if (name [1] >= '0' && name [1] <= '9')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804 if (name [2] != 'B' && name [2] != 'b')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805 return False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806 if (!name [3])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807 return True;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808 if ((name [3] == 'T' || name [3] == 't') && !name [4])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809 return True;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 if ((name [3] == 'R' || name [3] == 'r')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811 && name [4] >= '0' && name [4] <= '9' && !name [5])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812 return True;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813 return False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816 return False;
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
817
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819 return False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 instantiate_widget_instance (widget_instance *instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 widget_creation_function function = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 #ifdef NEED_LUCID
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 if (!function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830 function = find_in_table (instance->info->type, xlw_creation_table);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832 #ifdef NEED_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833 if (!function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834 function = find_in_table (instance->info->type, xm_creation_table);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836 #ifdef NEED_ATHENA
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837 if (!function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 function = find_in_table (instance->info->type, xaw_creation_table);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841 if (!function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843 if (dialog_spec_p (instance->info->type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 #ifdef DIALOGS_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846 if (!function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 function = xm_create_dialog;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 #ifdef DIALOGS_ATHENA
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 if (!function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 function = xaw_create_dialog;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853 #ifdef DIALOGS_LUCID
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 /* not yet (not ever?) */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857 }
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
858
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859 if (!function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 fprintf (stderr, "No creation function for widget type %s\n",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 instance->info->type);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 instance->widget = (*function) (instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868 if (!instance->widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871 /* XtRealizeWidget (instance->widget);*/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
874 void
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875 lw_register_widget (CONST char *type, CONST char *name,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 LWLIB_ID id, widget_value *val,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 lw_callback pre_activate_cb, lw_callback selection_cb,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 lw_callback post_activate_cb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880 if (!get_widget_info (id, False))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 allocate_widget_info (type, name, id, val, pre_activate_cb, selection_cb,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882 post_activate_cb);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886 lw_get_widget (LWLIB_ID id, Widget parent, Boolean pop_up_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 widget_instance *instance;
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
889
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 instance = find_instance (id, parent, pop_up_p);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891 return instance ? instance->widget : NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 lw_make_widget (LWLIB_ID id, Widget parent, Boolean pop_up_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 widget_instance *instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 widget_info *info;
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
899
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900 instance = find_instance (id, parent, pop_up_p);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 if (!instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 info = get_widget_info (id, False);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904 if (!info)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905 return NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906 instance = allocate_widget_instance (info, parent, pop_up_p);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907 initialize_widget_instance (instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909 if (!instance->widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911 return instance->widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914 Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 lw_create_widget (CONST char *type, CONST char *name,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 LWLIB_ID id, widget_value *val,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917 Widget parent, Boolean pop_up_p, lw_callback pre_activate_cb,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 lw_callback selection_cb, lw_callback post_activate_cb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920 lw_register_widget (type, name, id, val, pre_activate_cb, selection_cb,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921 post_activate_cb);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922 return lw_make_widget (id, parent, pop_up_p);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923 }
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
924
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926 /* destroying the widgets */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928 destroy_one_instance (widget_instance *instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 /* Remove the destroy callback on the widget; that callback will try to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931 dereference the instance object (to set its widget slot to 0, since the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932 widget is dead.) Since the instance is now dead, we don't have to worry
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 about the fact that its widget is dead too.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935 This happens in the Phase2Destroy of the widget, so this callback would
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936 not have been run until arbitrarily long after the instance was freed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938 if (instance->widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939 XtRemoveCallback (instance->widget, XtNdestroyCallback,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940 mark_widget_destroyed, (XtPointer)instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942 if (instance->widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944 /* The else are pretty tricky here, including the empty statement
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945 at the end because it would be very bad to destroy a widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 twice. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947 #ifdef NEED_LUCID
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 if (lw_lucid_widget_p (instance->widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949 xlw_destroy_instance (instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 #ifdef NEED_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 if (lw_motif_widget_p (instance->widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954 xm_destroy_instance (instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957 #ifdef NEED_ATHENA
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958 if (lw_xaw_widget_p (instance->widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959 xaw_destroy_instance (instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
961 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963 /* do not remove the empty statement */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
966 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968 free_widget_instance (instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972 lw_destroy_widget (Widget w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 widget_instance *instance = get_widget_instance (w, True);
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
975
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976 if (instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978 widget_info *info = instance->info;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979 /* instance has already been removed from the list; free it */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980 destroy_one_instance (instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981 /* if there are no instances left, free the info too */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982 if (!info->instances)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983 lw_destroy_all_widgets (info->id);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
984 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988 lw_destroy_all_widgets (LWLIB_ID id)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990 widget_info *info = get_widget_info (id, True);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991 widget_instance *instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992 widget_instance *next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994 if (info)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996 for (instance = info->instances; instance; )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998 next = instance->next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999 destroy_one_instance (instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000 instance = next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1002 free_widget_info (info);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1003 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1004 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007 lw_destroy_everything ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1009 while (all_widget_info)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1010 lw_destroy_all_widgets (all_widget_info->id);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1011 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1012
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1013 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014 lw_destroy_all_pop_ups ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1015 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016 widget_info *info;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017 widget_info *next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018 widget_instance *instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020 for (info = all_widget_info; info; info = next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 next = info->next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023 instance = info->instances;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024 if (instance && instance->pop_up_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025 lw_destroy_all_widgets (info->id);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029 Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 lw_raise_all_pop_up_widgets (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1032 widget_info *info;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1033 widget_instance *instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1034 Widget result = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1035
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1036 for (info = all_widget_info; info; info = info->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1037 for (instance = info->instances; instance; instance = instance->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038 if (instance->pop_up_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040 Widget widget = instance->widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041 if (widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1043 if (XtIsManaged (widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1044 #ifdef NEED_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045 /* What a complete load of crap!!!!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1046 When a dialogShell is on the screen, it is not managed!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1047 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1048 || (lw_motif_widget_p (instance->widget) &&
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1049 XtIsManaged (first_child (widget)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1051 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1052 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1053 if (!result)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1054 result = widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1055 XMapRaised (XtDisplay (widget), XtWindow (widget));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1056 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1057 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1058 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1059 return result;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1060 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1062 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063 lw_pop_all_widgets (LWLIB_ID id, Boolean up)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1064 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1065 widget_info *info = get_widget_info (id, False);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1066 widget_instance *instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1067
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1068 if (info)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1069 for (instance = info->instances; instance; instance = instance->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1070 if (instance->pop_up_p && instance->widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1071 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1072 #ifdef NEED_LUCID
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1073 if (lw_lucid_widget_p (instance->widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1074 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1075 XtRealizeWidget (instance->widget);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1076 xlw_pop_instance (instance, up);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1077 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1078 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1079 #ifdef NEED_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1080 if (lw_motif_widget_p (instance->widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1082 XtRealizeWidget (instance->widget);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1083 xm_pop_instance (instance, up);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1084 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1085 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1086 #ifdef NEED_ATHENA
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1087 if (lw_xaw_widget_p (instance->widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1088 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1089 XtRealizeWidget (XtParent (instance->widget));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090 XtRealizeWidget (instance->widget);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1091 xaw_pop_instance (instance, up);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1092 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1093 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1094 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1095 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1097 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098 lw_pop_up_all_widgets (LWLIB_ID id)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1099 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1100 lw_pop_all_widgets (id, True);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1101 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1102
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1103 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1104 lw_pop_down_all_widgets (LWLIB_ID id)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1105 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1106 lw_pop_all_widgets (id, False);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1107 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1108
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1109 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1110 lw_popup_menu (Widget widget, XEvent *event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1111 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1112 #ifdef MENUBARS_LUCID
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1113 if (lw_lucid_widget_p (widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1114 xlw_popup_menu (widget, event);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1115 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1116 #ifdef MENUBARS_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1117 if (lw_motif_widget_p (widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1118 xm_popup_menu (widget, event);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1119 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1120 #ifdef MENUBARS_ATHENA
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1121 if (lw_xaw_widget_p (widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1122 xaw_popup_menu (widget, event); /* not implemented */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1123 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1124 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1125
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1126 /* get the values back */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1127 static Boolean
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1128 get_one_value (widget_instance *instance, widget_value *val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1129 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1130 Widget widget = name_to_widget (instance, val->name);
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
1131
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1132 if (widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1133 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1134 #ifdef NEED_LUCID
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1135 if (lw_lucid_widget_p (instance->widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1136 xlw_update_one_value (instance, widget, val);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1137 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1138 #ifdef NEED_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1139 if (lw_motif_widget_p (instance->widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1140 xm_update_one_value (instance, widget, val);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1141 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1142 #ifdef NEED_ATHENA
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1143 if (lw_xaw_widget_p (instance->widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1144 xaw_update_one_value (instance, widget, val);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1145 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1146 return True;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1147 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1148 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1149 return False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1150 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1151
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1152 Boolean
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1153 lw_get_some_values (LWLIB_ID id, widget_value *val_out)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1154 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1155 widget_info *info = get_widget_info (id, False);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1156 widget_instance *instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1157 widget_value *val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1158 Boolean result = False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1159
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1160 if (!info)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1161 return False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1162
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1163 instance = info->instances;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1164 if (!instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1165 return False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1166
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1167 for (val = val_out; val; val = val->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1168 if (get_one_value (instance, val))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1169 result = True;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1170
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1171 return result;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1172 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1173
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1174 widget_value*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1175 lw_get_all_values (LWLIB_ID id)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1176 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1177 widget_info *info = get_widget_info (id, False);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1178 widget_value *val = info->val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1179 if (lw_get_some_values (id, val))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1180 return val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1181 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1182 return NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1183 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1184
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1185 /* internal function used by the library dependent implementation to get the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1186 widget_value for a given widget in an instance */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1187 widget_value*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1188 lw_get_widget_value_for_widget (widget_instance *instance, Widget w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1189 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1190 char *name = XtName (w);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1191 widget_value *cur;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1192 for (cur = instance->info->val; cur; cur = cur->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1193 if (!strcmp (cur->name, name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1194 return cur;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1195 return NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1196 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1197
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1198
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1199 /* update other instances value when one thing changed */
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
1200 /* This function can be used as a an XtCallback for the widgets that get
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1201 modified to update other instances of the widgets. Closure should be the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1202 widget_instance. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1203 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1204 lw_internal_update_other_instances (Widget widget, XtPointer closure,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1205 XtPointer call_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1206 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1207 /* To forbid recursive calls */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1208 static Boolean updating;
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
1209
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1210 widget_instance *instance = (widget_instance*)closure;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1211 char *name = XtName (widget);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1212 widget_info *info;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1213 widget_instance *cur;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1214 widget_value *val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1215
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1216 /* never recurse as this could cause infinite recursions. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1217 if (updating)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1218 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1219
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1220 /* protect against the widget being destroyed */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1221 if (XtWidgetBeingDestroyedP (widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1222 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1223
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1224 /* Return immediately if there are no other instances */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1225 info = instance->info;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1226 if (!info->instances->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1227 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1228
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1229 updating = True;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1230
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1231 for (val = info->val; val && strcmp (val->name, name); val = val->next);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1232
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1233 if (val && get_one_value (instance, val))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1234 for (cur = info->instances; cur; cur = cur->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1235 if (cur != instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1236 set_one_value (cur, val, True);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1237
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1238 updating = False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1239 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1240
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1241
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1242
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1243 /* get the id */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1244
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1245 LWLIB_ID
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1246 lw_get_widget_id (Widget w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1247 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1248 widget_instance *instance = get_widget_instance (w, False);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1249
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1250 return instance ? instance->info->id : 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1251 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1252
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1253
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1254 /* set the keyboard focus */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1255 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1256 lw_set_keyboard_focus (Widget parent, Widget w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1257 {
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1258 #if defined(NEED_MOTIF) && !defined(LESSTIF_VERSION)
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1259 /* This loses with Lesstif v0.75a */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1260 xm_set_keyboard_focus (parent, w);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1261 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1262 XtSetKeyboardFocus (parent, w);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1263 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1264 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1265
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1266
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1267 /* Show busy */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1268 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1269 show_one_widget_busy (Widget w, Boolean flag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1270 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1271 Pixel foreground = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1272 Pixel background = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1273 Widget widget_to_invert = XtNameToWidget (w, "*sheet");
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
1274 Arg al [2];
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
1275
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1276 if (!widget_to_invert)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1277 widget_to_invert = w;
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
1278
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
1279 XtSetArg (al [0], XtNforeground, &foreground);
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
1280 XtSetArg (al [1], XtNbackground, &background);
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
1281 XtGetValues (widget_to_invert, al, 2);
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
1282
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
1283 XtSetArg (al [0], XtNforeground, background);
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
1284 XtSetArg (al [1], XtNbackground, foreground);
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
1285 XtSetValues (widget_to_invert, al, 2);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1286 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1287
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1288 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1289 lw_show_busy (Widget w, Boolean busy)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1290 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1291 widget_instance *instance = get_widget_instance (w, False);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1292 widget_info *info;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1293 widget_instance *next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1294
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1295 if (instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1296 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1297 info = instance->info;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1298 if (info->busy != busy)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1299 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1300 for (next = info->instances; next; next = next->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1301 if (next->widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1302 show_one_widget_busy (next->widget, busy);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1303 info->busy = busy;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1304 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1305 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1306 }