Mercurial > hg > xemacs-beta
comparison lwlib/lwlib-Xaw.c @ 243:f220cc83d72e r20-5b20
Import from CVS: tag r20-5b20
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:17:07 +0200 |
parents | 41ff10fd062f |
children | 74fd4e045ea6 |
comparison
equal
deleted
inserted
replaced
242:fc816b73a05f | 243:f220cc83d72e |
---|---|
30 #include <X11/StringDefs.h> | 30 #include <X11/StringDefs.h> |
31 #include <X11/IntrinsicP.h> | 31 #include <X11/IntrinsicP.h> |
32 #include <X11/CoreP.h> | 32 #include <X11/CoreP.h> |
33 #include <X11/Shell.h> | 33 #include <X11/Shell.h> |
34 | 34 |
35 #ifdef SCROLLBARS_ATHENA | 35 #ifdef LWLIB_SCROLLBARS_ATHENA |
36 #include <X11/Xaw/Scrollbar.h> | 36 #include <X11/Xaw/Scrollbar.h> |
37 #endif | 37 #endif |
38 #ifdef DIALOGS_ATHENA | 38 #ifdef LWLIB_DIALOGS_ATHENA |
39 #include <X11/Xaw/Dialog.h> | 39 #include <X11/Xaw/Dialog.h> |
40 #include <X11/Xaw/Form.h> | 40 #include <X11/Xaw/Form.h> |
41 #include <X11/Xaw/Command.h> | 41 #include <X11/Xaw/Command.h> |
42 #include <X11/Xaw/Label.h> | 42 #include <X11/Xaw/Label.h> |
43 #endif | 43 #endif |
49 | 49 |
50 Boolean | 50 Boolean |
51 lw_xaw_widget_p (Widget widget) | 51 lw_xaw_widget_p (Widget widget) |
52 { | 52 { |
53 return (0 | 53 return (0 |
54 #ifdef SCROLLBARS_ATHENA | 54 #ifdef LWLIB_SCROLLBARS_ATHENA |
55 || XtIsSubclass (widget, scrollbarWidgetClass) | 55 || XtIsSubclass (widget, scrollbarWidgetClass) |
56 #endif | 56 #endif |
57 #ifdef DIALOGS_ATHENA | 57 #ifdef LWLIB_DIALOGS_ATHENA |
58 || XtIsSubclass (widget, dialogWidgetClass) | 58 || XtIsSubclass (widget, dialogWidgetClass) |
59 #endif | 59 #endif |
60 ); | 60 ); |
61 } | 61 } |
62 | 62 |
63 #ifdef SCROLLBARS_ATHENA | 63 #ifdef LWLIB_SCROLLBARS_ATHENA |
64 static void | 64 static void |
65 xaw_update_scrollbar (widget_instance *instance, Widget widget, | 65 xaw_update_scrollbar (widget_instance *instance, Widget widget, |
66 widget_value *val) | 66 widget_value *val) |
67 { | 67 { |
68 if (val->scrollbar_data) | 68 if (val->scrollbar_data) |
102 | 102 |
103 if (new_shown != widget_shown || new_topOfThumb != widget_topOfThumb) | 103 if (new_shown != widget_shown || new_topOfThumb != widget_topOfThumb) |
104 XawScrollbarSetThumb (widget, new_topOfThumb, new_shown); | 104 XawScrollbarSetThumb (widget, new_topOfThumb, new_shown); |
105 } | 105 } |
106 } | 106 } |
107 #endif /* SCROLLBARS_ATHENA */ | 107 #endif /* LWLIB_SCROLLBARS_ATHENA */ |
108 | 108 |
109 void | 109 void |
110 xaw_update_one_widget (widget_instance *instance, Widget widget, | 110 xaw_update_one_widget (widget_instance *instance, Widget widget, |
111 widget_value *val, Boolean deep_p) | 111 widget_value *val, Boolean deep_p) |
112 { | 112 { |
113 if (0) | 113 if (0) |
114 ; | 114 ; |
115 #ifdef SCROLLBARS_ATHENA | 115 #ifdef LWLIB_SCROLLBARS_ATHENA |
116 else if (XtIsSubclass (widget, scrollbarWidgetClass)) | 116 else if (XtIsSubclass (widget, scrollbarWidgetClass)) |
117 { | 117 { |
118 xaw_update_scrollbar (instance, widget, val); | 118 xaw_update_scrollbar (instance, widget, val); |
119 } | 119 } |
120 #endif | 120 #endif |
121 #ifdef DIALOGS_ATHENA | 121 #ifdef LWLIB_DIALOGS_ATHENA |
122 else if (XtIsSubclass (widget, dialogWidgetClass)) | 122 else if (XtIsSubclass (widget, dialogWidgetClass)) |
123 { | 123 { |
124 Arg al [1]; | 124 Arg al [1]; |
125 XtSetArg (al [0], XtNlabel, val->contents->value); | 125 XtSetArg (al [0], XtNlabel, val->contents->value); |
126 XtSetValues (widget, al, 1); | 126 XtSetValues (widget, al, 1); |
142 */ | 142 */ |
143 { | 143 { |
144 XtSetArg (al [0], XtNborderWidth, 1); | 144 XtSetArg (al [0], XtNborderWidth, 1); |
145 XtSetValues (widget, al, 1); | 145 XtSetValues (widget, al, 1); |
146 } | 146 } |
147 #endif | 147 #endif /* ! LWLIB_DIALOGS_ATHENA3D */ |
148 | 148 |
149 XtSetArg (al [0], XtNlabel, val->value); | 149 XtSetArg (al [0], XtNlabel, val->value); |
150 XtSetArg (al [1], XtNsensitive, val->enabled); | 150 XtSetArg (al [1], XtNsensitive, val->enabled); |
151 /* Force centered button text. See above. */ | 151 /* Force centered button text. See above. */ |
152 XtSetArg (al [2], XtNjustify, XtJustifyCenter); | 152 XtSetArg (al [2], XtNjustify, XtJustifyCenter); |
153 XtSetValues (widget, al, 3); | 153 XtSetValues (widget, al, 3); |
154 | 154 |
155 XtRemoveAllCallbacks (widget, XtNcallback); | 155 XtRemoveAllCallbacks (widget, XtNcallback); |
156 XtAddCallback (widget, XtNcallback, xaw_generic_callback, instance); | 156 XtAddCallback (widget, XtNcallback, xaw_generic_callback, instance); |
157 } | 157 } |
158 #endif | 158 #endif /* LWLIB_DIALOGS_ATHENA */ |
159 } | 159 } |
160 | 160 |
161 void | 161 void |
162 xaw_update_one_value (widget_instance *instance, Widget widget, | 162 xaw_update_one_value (widget_instance *instance, Widget widget, |
163 widget_value *val) | 163 widget_value *val) |
168 } | 168 } |
169 | 169 |
170 void | 170 void |
171 xaw_destroy_instance (widget_instance *instance) | 171 xaw_destroy_instance (widget_instance *instance) |
172 { | 172 { |
173 #ifdef DIALOGS_ATHENA | 173 #ifdef LWLIB_DIALOGS_ATHENA |
174 if (XtIsSubclass (instance->widget, dialogWidgetClass)) | 174 if (XtIsSubclass (instance->widget, dialogWidgetClass)) |
175 /* Need to destroy the Shell too. */ | 175 /* Need to destroy the Shell too. */ |
176 XtDestroyWidget (XtParent (instance->widget)); | 176 XtDestroyWidget (XtParent (instance->widget)); |
177 else | 177 else |
178 #endif | 178 #endif |
191 { | 191 { |
192 Widget widget = instance->widget; | 192 Widget widget = instance->widget; |
193 | 193 |
194 if (up) | 194 if (up) |
195 { | 195 { |
196 #ifdef DIALOGS_ATHENA | 196 #ifdef LWLIB_DIALOGS_ATHENA |
197 if (XtIsSubclass (widget, dialogWidgetClass)) | 197 if (XtIsSubclass (widget, dialogWidgetClass)) |
198 { | 198 { |
199 /* For dialogs, we need to call XtPopup on the parent instead | 199 /* For dialogs, we need to call XtPopup on the parent instead |
200 of calling XtManageChild on the widget. | 200 of calling XtManageChild on the widget. |
201 Also we need to hack the shell's WM_PROTOCOLS to get it to | 201 Also we need to hack the shell's WM_PROTOCOLS to get it to |
235 | 235 |
236 /* Finally, pop it up. */ | 236 /* Finally, pop it up. */ |
237 XtPopup (shell, XtGrabNonexclusive); | 237 XtPopup (shell, XtGrabNonexclusive); |
238 } | 238 } |
239 else | 239 else |
240 #endif /* DIALOGS_ATHENA */ | 240 #endif /* LWLIB_DIALOGS_ATHENA */ |
241 XtManageChild (widget); | 241 XtManageChild (widget); |
242 } | 242 } |
243 else | 243 else |
244 { | 244 { |
245 #ifdef DIALOGS_ATHENA | 245 #ifdef LWLIB_DIALOGS_ATHENA |
246 if (XtIsSubclass (widget, dialogWidgetClass)) | 246 if (XtIsSubclass (widget, dialogWidgetClass)) |
247 XtUnmanageChild (XtParent (widget)); | 247 XtUnmanageChild (XtParent (widget)); |
248 else | 248 else |
249 #endif | 249 #endif |
250 XtUnmanageChild (widget); | 250 XtUnmanageChild (widget); |
251 } | 251 } |
252 } | 252 } |
253 | 253 |
254 | 254 |
255 #ifdef DIALOGS_ATHENA | 255 #ifdef LWLIB_DIALOGS_ATHENA |
256 /* Dialog boxes */ | 256 /* Dialog boxes */ |
257 | 257 |
258 static char overrideTrans[] = | 258 static char overrideTrans[] = |
259 "<Message>WM_PROTOCOLS: lwlib_delete_dialog()"; | 259 "<Message>WM_PROTOCOLS: lwlib_delete_dialog()"; |
260 static XtActionProc wm_delete_window (Widget shell, XtPointer closure, | 260 static XtActionProc wm_delete_window (Widget shell, XtPointer closure, |
428 shell_name, icon_name, text_input_slot, radio_box, | 428 shell_name, icon_name, text_input_slot, radio_box, |
429 list, left_buttons, right_buttons); | 429 list, left_buttons, right_buttons); |
430 | 430 |
431 return widget; | 431 return widget; |
432 } | 432 } |
433 #endif /* DIALOGS_ATHENA */ | 433 #endif /* LWLIB_DIALOGS_ATHENA */ |
434 | 434 |
435 | 435 |
436 static void | 436 static void |
437 xaw_generic_callback (Widget widget, XtPointer closure, XtPointer call_data) | 437 xaw_generic_callback (Widget widget, XtPointer closure, XtPointer call_data) |
438 { | 438 { |
481 | 481 |
482 if (instance->info->selection_cb) | 482 if (instance->info->selection_cb) |
483 instance->info->selection_cb (widget, id, user_data); | 483 instance->info->selection_cb (widget, id, user_data); |
484 } | 484 } |
485 | 485 |
486 #ifdef DIALOGS_ATHENA | 486 #ifdef LWLIB_DIALOGS_ATHENA |
487 | 487 |
488 static XtActionProc | 488 static XtActionProc |
489 wm_delete_window (Widget shell, XtPointer closure, XtPointer call_data) | 489 wm_delete_window (Widget shell, XtPointer closure, XtPointer call_data) |
490 { | 490 { |
491 LWLIB_ID id; | 491 LWLIB_ID id; |
513 | 513 |
514 lw_destroy_all_widgets (id); | 514 lw_destroy_all_widgets (id); |
515 return NULL; | 515 return NULL; |
516 } | 516 } |
517 | 517 |
518 #endif /* DIALOGS_ATHENA */ | 518 #endif /* LWLIB_DIALOGS_ATHENA */ |
519 | 519 |
520 | 520 |
521 /* Scrollbars */ | 521 /* Scrollbars */ |
522 | 522 |
523 #ifdef SCROLLBARS_ATHENA | 523 #ifdef LWLIB_SCROLLBARS_ATHENA |
524 static void | 524 static void |
525 xaw_scrollbar_scroll (Widget widget, XtPointer closure, XtPointer call_data) | 525 xaw_scrollbar_scroll (Widget widget, XtPointer closure, XtPointer call_data) |
526 { | 526 { |
527 widget_instance *instance = (widget_instance *) closure; | 527 widget_instance *instance = (widget_instance *) closure; |
528 LWLIB_ID id; | 528 LWLIB_ID id; |
610 static Widget | 610 static Widget |
611 xaw_create_horizontal_scrollbar (widget_instance *instance) | 611 xaw_create_horizontal_scrollbar (widget_instance *instance) |
612 { | 612 { |
613 return xaw_create_scrollbar (instance, 0); | 613 return xaw_create_scrollbar (instance, 0); |
614 } | 614 } |
615 #endif /* SCROLLBARS_ATHENA */ | 615 #endif /* LWLIB_SCROLLBARS_ATHENA */ |
616 | 616 |
617 widget_creation_entry | 617 widget_creation_entry |
618 xaw_creation_table [] = | 618 xaw_creation_table [] = |
619 { | 619 { |
620 #ifdef SCROLLBARS_ATHENA | 620 #ifdef LWLIB_SCROLLBARS_ATHENA |
621 {"vertical-scrollbar", xaw_create_vertical_scrollbar}, | 621 {"vertical-scrollbar", xaw_create_vertical_scrollbar}, |
622 {"horizontal-scrollbar", xaw_create_horizontal_scrollbar}, | 622 {"horizontal-scrollbar", xaw_create_horizontal_scrollbar}, |
623 #endif | 623 #endif |
624 {NULL, NULL} | 624 {NULL, NULL} |
625 }; | 625 }; |