annotate lwlib/lwlib.c @ 125:8b0638b347ec

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