comparison lwlib/lwlib-Xlw.c @ 243:f220cc83d72e r20-5b20

Import from CVS: tag r20-5b20
author cvs
date Mon, 13 Aug 2007 10:17:07 +0200
parents 5a88923fcbfe
children 74fd4e045ea6
comparison
equal deleted inserted replaced
242:fc816b73a05f 243:f220cc83d72e
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */ 19 Boston, MA 02111-1307, USA. */
20 20
21 #include <config.h> 21 #include <config.h>
22 #include <stdlib.h> /* for abort () */ 22 #include <stdlib.h> /* for abort () */
23 #ifdef HAVE_LIMITS_H
24 #include <limits.h> 23 #include <limits.h>
25 #endif
26 24
27 #include "lwlib-Xlw.h" 25 #include "lwlib-Xlw.h"
28 #include <X11/StringDefs.h> 26 #include <X11/StringDefs.h>
29 #include <X11/IntrinsicP.h> 27 #include <X11/IntrinsicP.h>
30 #include <X11/ObjectP.h> 28 #include <X11/ObjectP.h>
31 #include <X11/CompositeP.h> 29 #include <X11/CompositeP.h>
32 #include <X11/Shell.h> 30 #include <X11/Shell.h>
33 #ifdef MENUBARS_LUCID 31 #ifdef LWLIB_MENUBARS_LUCID
34 #include "xlwmenu.h" 32 #include "xlwmenu.h"
35 #endif 33 #endif
36 #ifdef SCROLLBARS_LUCID 34 #ifdef LWLIB_SCROLLBARS_LUCID
37 #include "xlwscrollbar.h" 35 #include "xlwscrollbar.h"
38 #endif 36 #endif
39 37
40 38
41 39
42 #ifdef MENUBARS_LUCID 40 #ifdef LWLIB_MENUBARS_LUCID
43 41
44 /* Menu callbacks */ 42 /* Menu callbacks */
45 43
46 static void 44 static void
47 pre_hook (Widget w, XtPointer client_data, XtPointer call_data) 45 pre_hook (Widget w, XtPointer client_data, XtPointer call_data)
132 popup_shell, al, 2); 130 popup_shell, al, 2);
133 XtAddCallback (widget, XtNselect, pick_hook, (XtPointer)instance); 131 XtAddCallback (widget, XtNselect, pick_hook, (XtPointer)instance);
134 132
135 return popup_shell; 133 return popup_shell;
136 } 134 }
137 #endif /* MENUBARS_LUCID */ 135 #endif /* LWLIB_MENUBARS_LUCID */
138 136
139 #ifdef SCROLLBARS_LUCID 137 #ifdef LWLIB_SCROLLBARS_LUCID
140 static void 138 static void
141 xlw_scrollbar_callback (Widget widget, XtPointer closure, XtPointer call_data) 139 xlw_scrollbar_callback (Widget widget, XtPointer closure, XtPointer call_data)
142 { 140 {
143 widget_instance *instance = (widget_instance *) closure; 141 widget_instance *instance = (widget_instance *) closure;
144 LWLIB_ID id; 142 LWLIB_ID id;
299 if (new_sliderSize != widget_sliderSize || new_value != widget_val) 297 if (new_sliderSize != widget_sliderSize || new_value != widget_val)
300 XlwScrollBarSetValues (widget, new_value, new_sliderSize, 1, 1, False); 298 XlwScrollBarSetValues (widget, new_value, new_sliderSize, 1, 1, False);
301 } 299 }
302 } 300 }
303 301
304 #endif /* SCROLLBARS_LUCID */ 302 #endif /* LWLIB_SCROLLBARS_LUCID */
305 303
306 widget_creation_entry 304 widget_creation_entry
307 xlw_creation_table [] = 305 xlw_creation_table [] =
308 { 306 {
309 #ifdef MENUBARS_LUCID 307 #ifdef LWLIB_MENUBARS_LUCID
310 {"menubar", xlw_create_menubar}, 308 {"menubar", xlw_create_menubar},
311 {"popup", xlw_create_popup_menu}, 309 {"popup", xlw_create_popup_menu},
312 #endif 310 #endif
313 #ifdef SCROLLBARS_LUCID 311 #ifdef LWLIB_SCROLLBARS_LUCID
314 {"vertical-scrollbar", xlw_create_vertical_scrollbar}, 312 {"vertical-scrollbar", xlw_create_vertical_scrollbar},
315 {"horizontal-scrollbar", xlw_create_horizontal_scrollbar}, 313 {"horizontal-scrollbar", xlw_create_horizontal_scrollbar},
316 #endif 314 #endif
317 {NULL, NULL} 315 {NULL, NULL}
318 }; 316 };
319 317
320 Boolean 318 Boolean
321 lw_lucid_widget_p (Widget widget) 319 lw_lucid_widget_p (Widget widget)
322 { 320 {
323 WidgetClass the_class = XtClass (widget); 321 WidgetClass the_class = XtClass (widget);
324 #ifdef MENUBARS_LUCID 322 #ifdef LWLIB_MENUBARS_LUCID
325 if (the_class == xlwMenuWidgetClass) 323 if (the_class == xlwMenuWidgetClass)
326 return True; 324 return True;
327 #endif 325 #endif
328 #ifdef SCROLLBARS_LUCID 326 #ifdef LWLIB_SCROLLBARS_LUCID
329 if (the_class == xlwScrollBarWidgetClass) 327 if (the_class == xlwScrollBarWidgetClass)
330 return True; 328 return True;
331 #endif 329 #endif
332 #ifdef MENUBARS_LUCID 330 #ifdef LWLIB_MENUBARS_LUCID
333 if (the_class == overrideShellWidgetClass) 331 if (the_class == overrideShellWidgetClass)
334 return 332 return
335 XtClass (((CompositeWidget)widget)->composite.children [0]) 333 XtClass (((CompositeWidget)widget)->composite.children [0])
336 == xlwMenuWidgetClass; 334 == xlwMenuWidgetClass;
337 #endif 335 #endif
346 344
347 class = XtClass (widget); 345 class = XtClass (widget);
348 346
349 if (0) 347 if (0)
350 ; 348 ;
351 #ifdef MENUBARS_LUCID 349 #ifdef LWLIB_MENUBARS_LUCID
352 else if (class == xlwMenuWidgetClass) 350 else if (class == xlwMenuWidgetClass)
353 { 351 {
354 XlwMenuWidget mw; 352 XlwMenuWidget mw;
355 Arg al [1]; 353 Arg al [1];
356 if (XtIsShell (widget)) 354 if (XtIsShell (widget))
359 mw = (XlwMenuWidget)widget; 357 mw = (XlwMenuWidget)widget;
360 XtSetArg (al [0], XtNmenu, val); 358 XtSetArg (al [0], XtNmenu, val);
361 XtSetValues (widget, al, 1); 359 XtSetValues (widget, al, 1);
362 } 360 }
363 #endif 361 #endif
364 #ifdef SCROLLBARS_LUCID 362 #ifdef LWLIB_SCROLLBARS_LUCID
365 else if (class == xlwScrollBarWidgetClass) 363 else if (class == xlwScrollBarWidgetClass)
366 { 364 {
367 xlw_update_scrollbar (instance, widget, val); 365 xlw_update_scrollbar (instance, widget, val);
368 } 366 }
369 #endif 367 #endif
379 void 377 void
380 xlw_pop_instance (widget_instance* instance, Boolean up) 378 xlw_pop_instance (widget_instance* instance, Boolean up)
381 { 379 {
382 } 380 }
383 381
384 #ifdef MENUBARS_LUCID 382 #ifdef LWLIB_MENUBARS_LUCID
385 void 383 void
386 xlw_popup_menu (Widget widget, XEvent *event) 384 xlw_popup_menu (Widget widget, XEvent *event)
387 { 385 {
388 XlwMenuWidget mw; 386 XlwMenuWidget mw;
389 387
396 xlw_pop_up_menu (mw, (XButtonPressedEvent *)event); 394 xlw_pop_up_menu (mw, (XButtonPressedEvent *)event);
397 } 395 }
398 else 396 else
399 abort (); 397 abort ();
400 } 398 }
401 #endif 399 #endif /* LWLIB_MENUBARS_LUCID */
402 400
403 /* Destruction of instances */ 401 /* Destruction of instances */
404 void 402 void
405 xlw_destroy_instance (widget_instance* instance) 403 xlw_destroy_instance (widget_instance* instance)
406 { 404 {