428
|
1 /* The lwlib interface to "xlwmenu" menus.
|
|
2 Copyright (C) 1992, 1994 Lucid, Inc.
|
|
3
|
|
4 This file is part of the Lucid Widget Library.
|
|
5
|
|
6 The Lucid Widget Library is free software; you can redistribute it and/or
|
|
7 modify it under the terms of the GNU General Public License as published by
|
|
8 the Free Software Foundation; either version 2, or (at your option)
|
|
9 any later version.
|
|
10
|
|
11 The Lucid Widget Library is distributed in the hope that it will be useful,
|
|
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14 GNU General Public License for more details.
|
|
15
|
|
16 You should have received a copy of the GNU General Public License
|
|
17 along with XEmacs; see the file COPYING. If not, write to
|
|
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
19 Boston, MA 02111-1307, USA. */
|
|
20
|
|
21 #include <config.h>
|
|
22 #include <stdlib.h> /* for abort () */
|
|
23 #include <stdio.h> /* for abort () */
|
|
24 #include <limits.h>
|
|
25
|
|
26 #include "lwlib-Xlw.h"
|
|
27 #include "lwlib-utils.h"
|
|
28 #include <X11/StringDefs.h>
|
|
29 #include <X11/IntrinsicP.h>
|
|
30 #include <X11/ObjectP.h>
|
|
31 #include <X11/CompositeP.h>
|
|
32 #include <X11/Shell.h>
|
771
|
33 #ifdef HAVE_X_WIDGETS
|
428
|
34 #include "../src/EmacsManager.h"
|
|
35 #endif
|
|
36 #ifdef LWLIB_MENUBARS_LUCID
|
|
37 #include "xlwmenu.h"
|
|
38 #endif
|
|
39 #ifdef LWLIB_SCROLLBARS_LUCID
|
|
40 #include "xlwscrollbar.h"
|
|
41 #endif
|
|
42 #ifdef LWLIB_TABS_LUCID
|
|
43 #ifdef NEED_MOTIF
|
|
44 #include "lwlib-Xm.h"
|
|
45 #endif
|
|
46 #ifdef NEED_ATHENA
|
|
47 #include "lwlib-Xaw.h"
|
|
48 #endif
|
|
49 #include "../src/xmu.h"
|
|
50 #include "xlwtabs.h"
|
|
51 #endif
|
|
52
|
|
53
|
|
54
|
|
55 #ifdef LWLIB_MENUBARS_LUCID
|
|
56
|
|
57 /* Menu callbacks */
|
|
58
|
|
59 static void
|
|
60 pre_hook (Widget w, XtPointer client_data, XtPointer call_data)
|
|
61 {
|
|
62 widget_instance* instance = (widget_instance*)client_data;
|
|
63 widget_value* val;
|
|
64
|
|
65 if (w->core.being_destroyed)
|
|
66 return;
|
|
67
|
|
68 val = lw_get_widget_value_for_widget (instance, w);
|
|
69 #if 0
|
|
70 /* #### - this code used to (for some random back_asswards reason) pass
|
|
71 the expression below in the call_data slot. For incremental menu
|
|
72 construction, this needs to go. I can't even figure out why it was done
|
|
73 this way in the first place...it's just a historical weirdism. --Stig */
|
|
74 call_data = (val ? val->call_data : NULL);
|
|
75 #endif
|
|
76 if (val && val->call_data)
|
|
77 abort(); /* #### - the call_data for the top_level
|
|
78 "menubar" widget_value used to be passed
|
|
79 back to the pre_hook. */
|
|
80
|
|
81 if (instance->info->pre_activate_cb)
|
|
82 instance->info->pre_activate_cb (w, instance->info->id, call_data);
|
|
83 }
|
|
84
|
|
85 static void
|
|
86 pick_hook (Widget w, XtPointer client_data, XtPointer call_data)
|
|
87 {
|
|
88 widget_instance* instance = (widget_instance*)client_data;
|
|
89 widget_value* contents_val = (widget_value*)call_data;
|
|
90 widget_value* widget_val;
|
|
91 XtPointer widget_arg;
|
|
92 LWLIB_ID id;
|
|
93 lw_callback post_activate_cb;
|
|
94
|
|
95 if (w->core.being_destroyed)
|
|
96 return;
|
|
97
|
|
98 /* Grab these values before running any functions, in case running
|
|
99 the selection_cb causes the widget to be destroyed. */
|
|
100 id = instance->info->id;
|
|
101 post_activate_cb = instance->info->post_activate_cb;
|
|
102
|
|
103 widget_val = lw_get_widget_value_for_widget (instance, w);
|
|
104 widget_arg = widget_val ? widget_val->call_data : NULL;
|
|
105
|
|
106 if (instance->info->selection_cb &&
|
|
107 contents_val &&
|
|
108 contents_val->enabled &&
|
|
109 !contents_val->contents)
|
|
110 instance->info->selection_cb (w, id, contents_val->call_data);
|
|
111
|
|
112 if (post_activate_cb)
|
|
113 post_activate_cb (w, id, widget_arg);
|
|
114 }
|
|
115
|
|
116
|
|
117
|
|
118 /* creation functions */
|
|
119 static Widget
|
|
120 xlw_create_menubar (widget_instance* instance)
|
|
121 {
|
|
122 Arg al [1];
|
|
123 Widget widget;
|
|
124
|
|
125 XtSetArg (al [0], XtNmenu, instance->info->val);
|
|
126 widget = XtCreateWidget (instance->info->name, xlwMenuWidgetClass,
|
|
127 instance->parent, al, 1);
|
|
128 XtAddCallback (widget, XtNopen, pre_hook, (XtPointer)instance);
|
|
129 XtAddCallback (widget, XtNselect, pick_hook, (XtPointer)instance);
|
|
130 return widget;
|
|
131 }
|
|
132
|
|
133 static Widget
|
|
134 xlw_create_popup_menu (widget_instance* instance)
|
|
135 {
|
|
136 Arg al [2];
|
|
137 Widget popup_shell, widget;
|
|
138
|
|
139 popup_shell = XtCreatePopupShell (instance->info->name,
|
|
140 overrideShellWidgetClass,
|
|
141 instance->parent, NULL, 0);
|
|
142 XtSetArg (al [0], XtNmenu, instance->info->val);
|
|
143 XtSetArg (al [1], XtNhorizontal, False);
|
|
144 widget = XtCreateManagedWidget ("popup", xlwMenuWidgetClass,
|
|
145 popup_shell, al, 2);
|
|
146 XtAddCallback (widget, XtNselect, pick_hook, (XtPointer)instance);
|
|
147
|
|
148 return popup_shell;
|
|
149 }
|
|
150 #endif /* LWLIB_MENUBARS_LUCID */
|
|
151
|
|
152 #ifdef LWLIB_SCROLLBARS_LUCID
|
|
153 static void
|
|
154 xlw_scrollbar_callback (Widget widget, XtPointer closure, XtPointer call_data)
|
|
155 {
|
|
156 widget_instance *instance = (widget_instance *) closure;
|
|
157 LWLIB_ID id;
|
|
158 XlwScrollBarCallbackStruct *data =
|
|
159 (XlwScrollBarCallbackStruct *) call_data;
|
|
160 scroll_event event_data;
|
|
161 scrollbar_values *val =
|
|
162 (scrollbar_values *) instance->info->val->scrollbar_data;
|
|
163 double percent;
|
|
164
|
|
165 if (!instance || widget->core.being_destroyed)
|
|
166 return;
|
|
167
|
|
168 id = instance->info->id;
|
|
169
|
|
170 percent = (double) (data->value - 1) / (double) (INT_MAX - 1);
|
|
171 event_data.slider_value =
|
|
172 (int) (percent * (double) (val->maximum - val->minimum)) + val->minimum;
|
|
173
|
|
174 if (event_data.slider_value > val->maximum - val->slider_size)
|
|
175 event_data.slider_value = val->maximum - val->slider_size;
|
|
176 else if (event_data.slider_value < val->minimum)
|
|
177 event_data.slider_value = val->minimum;
|
|
178
|
|
179 if (data->event)
|
|
180 {
|
|
181 switch (data->event->type)
|
|
182 {
|
|
183 case KeyPress:
|
|
184 case KeyRelease:
|
|
185 event_data.time = data->event->xkey.time;
|
|
186 break;
|
|
187 case ButtonPress:
|
|
188 case ButtonRelease:
|
|
189 event_data.time = data->event->xbutton.time;
|
|
190 break;
|
|
191 case MotionNotify:
|
|
192 event_data.time = data->event->xmotion.time;
|
|
193 break;
|
|
194 case EnterNotify:
|
|
195 case LeaveNotify:
|
|
196 event_data.time = data->event->xcrossing.time;
|
|
197 break;
|
|
198 default:
|
|
199 event_data.time = 0;
|
|
200 break;
|
|
201 }
|
|
202 }
|
|
203 else
|
|
204 event_data.time = 0;
|
|
205
|
|
206 switch (data->reason)
|
|
207 {
|
|
208 case XmCR_DECREMENT: event_data.action = SCROLLBAR_LINE_UP; break;
|
|
209 case XmCR_INCREMENT: event_data.action = SCROLLBAR_LINE_DOWN; break;
|
|
210 case XmCR_PAGE_DECREMENT: event_data.action = SCROLLBAR_PAGE_UP; break;
|
|
211 case XmCR_PAGE_INCREMENT: event_data.action = SCROLLBAR_PAGE_DOWN; break;
|
|
212 case XmCR_TO_TOP: event_data.action = SCROLLBAR_TOP; break;
|
|
213 case XmCR_TO_BOTTOM: event_data.action = SCROLLBAR_BOTTOM; break;
|
|
214 case XmCR_DRAG: event_data.action = SCROLLBAR_DRAG; break;
|
|
215 case XmCR_VALUE_CHANGED: event_data.action = SCROLLBAR_CHANGE; break;
|
|
216 default: event_data.action = SCROLLBAR_CHANGE; break;
|
|
217 }
|
|
218
|
|
219 if (instance->info->pre_activate_cb)
|
|
220 instance->info->pre_activate_cb (widget, id, (XtPointer) &event_data);
|
|
221 }
|
|
222
|
|
223 #define add_scrollbar_callback(resource) \
|
|
224 XtAddCallback (scrollbar, resource, xlw_scrollbar_callback, (XtPointer) instance)
|
|
225
|
|
226 /* #### Does not yet support horizontal scrollbars. */
|
|
227 static Widget
|
|
228 xlw_create_scrollbar (widget_instance *instance, int vertical)
|
|
229 {
|
|
230 Arg al[20];
|
|
231 int ac = 0;
|
|
232 static XtCallbackRec callbacks[2] =
|
|
233 { {xlw_scrollbar_callback, NULL}, {NULL, NULL} };
|
|
234
|
|
235 callbacks[0].closure = (XtPointer) instance;
|
|
236
|
|
237 XtSetArg (al[ac], XmNminimum, 1); ac++;
|
|
238 XtSetArg (al[ac], XmNmaximum, INT_MAX); ac++;
|
|
239 XtSetArg (al[ac], XmNincrement, 1); ac++;
|
|
240 XtSetArg (al[ac], XmNpageIncrement, 1); ac++;
|
|
241 XtSetArg (al[ac], XmNorientation, (vertical ? XmVERTICAL : XmHORIZONTAL)); ac++;
|
|
242
|
|
243 XtSetArg (al[ac], XmNdecrementCallback, callbacks); ac++;
|
|
244 XtSetArg (al[ac], XmNdragCallback, callbacks); ac++;
|
|
245 XtSetArg (al[ac], XmNincrementCallback, callbacks); ac++;
|
|
246 XtSetArg (al[ac], XmNpageDecrementCallback, callbacks); ac++;
|
|
247 XtSetArg (al[ac], XmNpageIncrementCallback, callbacks); ac++;
|
|
248 XtSetArg (al[ac], XmNtoBottomCallback, callbacks); ac++;
|
|
249 XtSetArg (al[ac], XmNtoTopCallback, callbacks); ac++;
|
|
250 XtSetArg (al[ac], XmNvalueChangedCallback, callbacks); ac++;
|
|
251
|
|
252 return XtCreateWidget (instance->info->name, xlwScrollBarWidgetClass,
|
|
253 instance->parent, al, ac);
|
|
254 }
|
|
255
|
|
256 static Widget
|
|
257 xlw_create_vertical_scrollbar (widget_instance *instance)
|
|
258 {
|
|
259 return xlw_create_scrollbar (instance, 1);
|
|
260 }
|
|
261
|
|
262 static Widget
|
|
263 xlw_create_horizontal_scrollbar (widget_instance *instance)
|
|
264 {
|
|
265 return xlw_create_scrollbar (instance, 0);
|
|
266 }
|
|
267
|
|
268 static void
|
2286
|
269 xlw_update_scrollbar (widget_instance *UNUSED (instance), Widget widget,
|
428
|
270 widget_value *val)
|
|
271 {
|
|
272 if (val->scrollbar_data)
|
|
273 {
|
|
274 scrollbar_values *data = val->scrollbar_data;
|
|
275 int widget_sliderSize, widget_val;
|
|
276 int new_sliderSize, new_value;
|
|
277 double percent;
|
|
278 Arg al [4];
|
|
279
|
|
280 /* First size and position the scrollbar widget. */
|
|
281 XtSetArg (al [0], XtNx, data->scrollbar_x);
|
|
282 XtSetArg (al [1], XtNy, data->scrollbar_y);
|
|
283 XtSetArg (al [2], XtNwidth, data->scrollbar_width);
|
|
284 XtSetArg (al [3], XtNheight, data->scrollbar_height);
|
|
285 XtSetValues (widget, al, 4);
|
|
286
|
|
287 /* Now size the scrollbar's slider. */
|
|
288 XtSetArg (al [0], XmNsliderSize, &widget_sliderSize);
|
|
289 XtSetArg (al [1], XmNvalue, &widget_val);
|
|
290 XtGetValues (widget, al, 2);
|
|
291
|
|
292 percent = (double) data->slider_size /
|
|
293 (double) (data->maximum - data->minimum);
|
|
294 percent = (percent > 1.0 ? 1.0 : percent);
|
|
295 new_sliderSize = (int) ((double) (INT_MAX - 1) * percent);
|
|
296
|
|
297 percent = (double) (data->slider_position - data->minimum) /
|
|
298 (double) (data->maximum - data->minimum);
|
|
299 percent = (percent > 1.0 ? 1.0 : percent);
|
|
300 new_value = (int) ((double) (INT_MAX - 1) * percent);
|
|
301
|
|
302 if (new_sliderSize > INT_MAX - 1)
|
|
303 new_sliderSize = INT_MAX - 1;
|
|
304 else if (new_sliderSize < 1)
|
|
305 new_sliderSize = 1;
|
|
306
|
|
307 if (new_value > (INT_MAX - new_sliderSize))
|
|
308 new_value = INT_MAX - new_sliderSize;
|
|
309 else if (new_value < 1)
|
|
310 new_value = 1;
|
|
311
|
|
312 if (new_sliderSize != widget_sliderSize || new_value != widget_val)
|
|
313 XlwScrollBarSetValues (widget, new_value, new_sliderSize, 1, 1, False);
|
|
314 }
|
|
315 }
|
|
316
|
|
317 #endif /* LWLIB_SCROLLBARS_LUCID */
|
|
318
|
|
319 #ifdef LWLIB_TABS_LUCID
|
|
320 /* tab control
|
|
321
|
2641
|
322 [[ lwlib is such an incredible hairy crock. I just cannot believe
|
428
|
323 it! There are random dependencies between functions, there is a
|
|
324 total lack of genericity, even though it initially appears to be
|
|
325 generic. It should all be junked and begun again. Building tabs are
|
|
326 an example - in theory we should be able to reuse a lot of the
|
|
327 general stuff because we want to put labels of whatever toolkit we
|
2641
|
328 are using in the tab. Instead we have to hack it by hand. ]]
|
|
329 While lwlib is a hairy crock, whoever wrote that seems to misunderstand
|
|
330 Falk's tab control widget. The tab control widget has *two* kinds of
|
|
331 children: *widgets*, which all occupy a *single* pane below the row of
|
|
332 tabs---this is where the labels created in build_tabs_in_widget go, and
|
|
333 *gadgets*, the tabs themselves, which do *not* draw themselves, but
|
|
334 rather are drawn by the control. In fact, in XEmacs the true widget
|
|
335 children are *never* visible! So this case is not a problem in the
|
|
336 design of lwlib, but rather of Falk's widget. -- sjt */
|
428
|
337 static void
|
|
338 xlw_tab_control_callback (Widget w, XtPointer client_data, XtPointer call_data)
|
|
339 {
|
|
340 /* call data is the topmost widget */
|
|
341 widget_instance* instance = (widget_instance*)client_data;
|
|
342 Widget top = (Widget)call_data;
|
|
343 char *name = XtName (top);
|
|
344 widget_value* widget_val;
|
|
345 XtPointer widget_arg;
|
|
346 LWLIB_ID id;
|
|
347 lw_callback post_activate_cb;
|
|
348
|
|
349 if (w->core.being_destroyed)
|
|
350 return;
|
|
351
|
|
352 /* Grab these values before running any functions, in case running
|
|
353 the selection_cb causes the widget to be destroyed. */
|
|
354 id = instance->info->id;
|
|
355 post_activate_cb = instance->info->post_activate_cb;
|
|
356
|
|
357 /* search for the widget_val for the selected tab */
|
|
358 for (widget_val = instance->info->val->contents; widget_val;
|
|
359 widget_val = widget_val->next)
|
|
360 {
|
|
361 if (!strcmp (widget_val->name, name))
|
|
362 break;
|
|
363 }
|
|
364
|
|
365 widget_arg = widget_val ? widget_val->call_data : NULL;
|
|
366
|
|
367 if (instance->info->selection_cb &&
|
|
368 widget_val &&
|
|
369 widget_val->enabled &&
|
|
370 !widget_val->contents)
|
|
371 instance->info->selection_cb (w, id, widget_arg);
|
|
372
|
|
373 if (post_activate_cb)
|
|
374 post_activate_cb (w, id, widget_arg);
|
|
375 }
|
|
376
|
|
377 static Widget
|
|
378 xlw_create_tab_control (widget_instance *instance)
|
|
379 {
|
|
380 Arg al[20];
|
|
381 int ac = 0;
|
|
382 Widget tab = 0;
|
|
383 widget_value* val = instance->info->val;
|
|
384
|
|
385 XtSetArg (al [ac], XtNsensitive, val->enabled); ac++;
|
2641
|
386 XtSetArg (al [ac], XtNmappedWhenManaged, False); ac++;
|
428
|
387 XtSetArg (al [ac], XtNorientation, XtorientHorizontal); ac++;
|
|
388
|
|
389 /* add any args the user supplied for creation time */
|
|
390 lw_add_value_args_to_args (val, al, &ac);
|
|
391
|
|
392 tab = XtCreateManagedWidget (val->name, tabsWidgetClass,
|
|
393 instance->parent, al, ac);
|
|
394 XtRemoveAllCallbacks (tab, XtNcallback);
|
|
395 XtAddCallback (tab, XtNcallback, xlw_tab_control_callback, (XtPointer)instance);
|
|
396
|
|
397 XtManageChild (tab);
|
|
398
|
|
399 return tab;
|
|
400 }
|
|
401
|
2286
|
402 static void build_tabs_in_widget (widget_instance* UNUSED (instance),
|
|
403 Widget widget, widget_value* val)
|
428
|
404 {
|
|
405 widget_value* cur = val;
|
2641
|
406 Arg al[1];
|
|
407
|
|
408 /* Children are always invisible, don't permit resizing. */
|
|
409 XtSetArg (al[0], XtNresizable, False);
|
|
410
|
428
|
411 for (cur = val; cur; cur = cur->next)
|
|
412 {
|
|
413 if (cur->value)
|
|
414 {
|
2641
|
415 Widget w;
|
428
|
416 #ifdef LWLIB_WIDGETS_MOTIF
|
2641
|
417 w = xm_create_label (widget, cur);
|
428
|
418 #else
|
2641
|
419 w = xaw_create_label (widget, cur);
|
428
|
420 #endif
|
2641
|
421 XtSetValues (w, al, 1);
|
428
|
422 }
|
|
423 cur->change = NO_CHANGE;
|
|
424 }
|
|
425 }
|
|
426
|
|
427 static void
|
|
428 xlw_update_tab_control (widget_instance* instance, Widget widget, widget_value* val)
|
|
429 {
|
|
430 Widget* children;
|
|
431 unsigned int num_children;
|
639
|
432 Dimension i;
|
428
|
433 widget_value *cur = 0;
|
|
434
|
|
435 XtRemoveAllCallbacks (widget, XtNcallback);
|
|
436 XtAddCallback (widget, XtNcallback, xlw_tab_control_callback, (XtPointer)instance);
|
|
437
|
|
438 if (val->change == STRUCTURAL_CHANGE
|
|
439 ||
|
|
440 (val->contents && val->contents->change == STRUCTURAL_CHANGE))
|
|
441 {
|
|
442 destroy_all_children (widget);
|
|
443 build_tabs_in_widget (instance, widget, val->contents);
|
|
444 }
|
|
445
|
|
446 children = XtCompositeChildren (widget, &num_children);
|
|
447 if (children)
|
|
448 {
|
647
|
449 for (i = 0, cur = val->contents; i < (int) num_children; i++)
|
428
|
450 {
|
|
451 if (!cur)
|
|
452 abort ();
|
|
453 if (children [i]->core.being_destroyed
|
|
454 || strcmp (XtName (children [i]), cur->name))
|
|
455 continue;
|
|
456 #ifdef NEED_MOTIF
|
|
457 if (lw_motif_widget_p (children [i]))
|
|
458 xm_update_one_widget (instance, children [i], cur, False);
|
|
459 #endif
|
|
460 #ifdef NEED_ATHENA
|
|
461 if (lw_xaw_widget_p (children [i]))
|
|
462 xaw_update_one_widget (instance, children [i], cur, False);
|
|
463 #endif
|
|
464 cur = cur->next;
|
|
465 }
|
|
466 XtFree ((char *) children);
|
|
467 }
|
|
468 if (cur)
|
|
469 abort ();
|
|
470 }
|
|
471 #endif /* LWLIB_TABS_LUCID */
|
|
472
|
771
|
473 #ifdef HAVE_X_WIDGETS
|
428
|
474 static Widget
|
|
475 xlw_create_clip_window (widget_instance *instance)
|
|
476 {
|
|
477 Arg al[20];
|
|
478 int ac = 0;
|
|
479 Widget clip = 0;
|
|
480 widget_value* val = instance->info->val;
|
|
481
|
|
482 XtSetArg (al [ac], XtNmappedWhenManaged, FALSE); ac++;
|
|
483 XtSetArg (al [ac], XtNsensitive, TRUE); ac++;
|
|
484 /* add any args the user supplied for creation time */
|
|
485 lw_add_value_args_to_args (val, al, &ac);
|
|
486
|
|
487 /* Create a clip window to contain the subwidget. Incredibly the
|
|
488 XEmacs manager seems to be the most appropriate widget for
|
|
489 this. Nothing else is simple enough and yet does what is
|
|
490 required. */
|
|
491 clip = XtCreateManagedWidget (val->name,
|
|
492 emacsManagerWidgetClass,
|
|
493 instance->parent, al, ac);
|
|
494
|
|
495 return clip;
|
|
496 }
|
|
497 #endif
|
|
498
|
450
|
499 const widget_creation_entry
|
428
|
500 xlw_creation_table [] =
|
|
501 {
|
|
502 #ifdef LWLIB_MENUBARS_LUCID
|
|
503 {"menubar", xlw_create_menubar},
|
|
504 {"popup", xlw_create_popup_menu},
|
|
505 #endif
|
|
506 #ifdef LWLIB_SCROLLBARS_LUCID
|
|
507 {"vertical-scrollbar", xlw_create_vertical_scrollbar},
|
|
508 {"horizontal-scrollbar", xlw_create_horizontal_scrollbar},
|
|
509 #endif
|
|
510 #ifdef LWLIB_TABS_LUCID
|
|
511 {"tab-control", xlw_create_tab_control},
|
|
512 #endif
|
771
|
513 #ifdef HAVE_X_WIDGETS
|
428
|
514 {"clip-window", xlw_create_clip_window},
|
|
515 #endif
|
|
516 {NULL, NULL}
|
|
517 };
|
|
518
|
|
519 Boolean
|
|
520 lw_lucid_widget_p (Widget widget)
|
|
521 {
|
|
522 WidgetClass the_class = XtClass (widget);
|
|
523 #ifdef LWLIB_MENUBARS_LUCID
|
|
524 if (the_class == xlwMenuWidgetClass)
|
|
525 return True;
|
|
526 #endif
|
|
527 #ifdef LWLIB_SCROLLBARS_LUCID
|
|
528 if (the_class == xlwScrollBarWidgetClass)
|
|
529 return True;
|
|
530 #endif
|
|
531 #ifdef LWLIB_TABS_LUCID
|
|
532 if (the_class == tabsWidgetClass)
|
|
533 return True;
|
|
534 #endif
|
|
535 #ifdef LWLIB_MENUBARS_LUCID
|
|
536 if (the_class == overrideShellWidgetClass)
|
|
537 return
|
|
538 XtClass (((CompositeWidget)widget)->composite.children [0])
|
|
539 == xlwMenuWidgetClass;
|
|
540 #endif
|
771
|
541 #ifdef HAVE_X_WIDGETS
|
432
|
542 if (the_class == emacsManagerWidgetClass)
|
|
543 return True;
|
|
544 #endif
|
428
|
545 return False;
|
|
546 }
|
|
547
|
|
548 void
|
|
549 xlw_update_one_widget (widget_instance* instance, Widget widget,
|
2286
|
550 widget_value* val, Boolean UNUSED (deep_p))
|
428
|
551 {
|
1201
|
552 WidgetClass class_ = XtClass (widget);
|
428
|
553
|
|
554 if (0)
|
|
555 ;
|
|
556 #ifdef LWLIB_MENUBARS_LUCID
|
1201
|
557 else if (class_ == xlwMenuWidgetClass)
|
428
|
558 {
|
|
559 XlwMenuWidget mw;
|
|
560 Arg al [1];
|
|
561 if (XtIsShell (widget))
|
|
562 mw = (XlwMenuWidget)((CompositeWidget)widget)->composite.children [0];
|
|
563 else
|
|
564 mw = (XlwMenuWidget)widget;
|
|
565 XtSetArg (al [0], XtNmenu, val);
|
446
|
566 XtSetValues (widget, al, 1); /* #### mw unused! */
|
428
|
567 }
|
|
568 #endif
|
|
569 #ifdef LWLIB_SCROLLBARS_LUCID
|
1201
|
570 else if (class_ == xlwScrollBarWidgetClass)
|
428
|
571 {
|
|
572 xlw_update_scrollbar (instance, widget, val);
|
|
573 }
|
|
574 #endif
|
|
575 #ifdef LWLIB_TABS_LUCID
|
1201
|
576 else if (class_ == tabsWidgetClass)
|
428
|
577 {
|
|
578 xlw_update_tab_control (instance, widget, val);
|
|
579 }
|
|
580 #endif
|
442
|
581 /* Lastly update our global arg values. */
|
|
582 if (val->args && val->args->nargs)
|
|
583 XtSetValues (widget, val->args->args, val->args->nargs);
|
428
|
584 }
|
|
585
|
|
586 void
|
2286
|
587 xlw_update_one_value (widget_instance* UNUSED (instance),
|
|
588 Widget UNUSED (widget), widget_value* UNUSED (val))
|
428
|
589 {
|
|
590 }
|
|
591
|
|
592 void
|
2286
|
593 xlw_pop_instance (widget_instance* UNUSED (instance), Boolean UNUSED (up))
|
428
|
594 {
|
|
595 }
|
|
596
|
|
597 #ifdef LWLIB_MENUBARS_LUCID
|
|
598 void
|
|
599 xlw_popup_menu (Widget widget, XEvent *event)
|
|
600 {
|
|
601 XlwMenuWidget mw;
|
|
602
|
|
603 if (!XtIsShell (widget))
|
|
604 return;
|
|
605
|
|
606 if (event->type == ButtonPress || event->type == ButtonRelease)
|
|
607 {
|
|
608 mw = (XlwMenuWidget)((CompositeWidget)widget)->composite.children [0];
|
|
609 xlw_pop_up_menu (mw, (XButtonPressedEvent *)event);
|
|
610 }
|
|
611 else
|
|
612 abort ();
|
|
613 }
|
|
614 #endif /* LWLIB_MENUBARS_LUCID */
|
|
615
|
|
616 /* Destruction of instances */
|
|
617 void
|
|
618 xlw_destroy_instance (widget_instance* instance)
|
|
619 {
|
|
620 if (instance->widget)
|
|
621 XtDestroyWidget (instance->widget);
|
|
622 }
|