diff options
| -rw-r--r-- | lwlib/lwlib-Xm.c | 55 |
1 files changed, 51 insertions, 4 deletions
diff --git a/lwlib/lwlib-Xm.c b/lwlib/lwlib-Xm.c index 460839f8a09..95660d411b5 100644 --- a/lwlib/lwlib-Xm.c +++ b/lwlib/lwlib-Xm.c | |||
| @@ -129,6 +129,7 @@ void xm_set_keyboard_focus P_ ((Widget, Widget)); | |||
| 129 | void xm_set_main_areas P_ ((Widget, Widget, Widget)); | 129 | void xm_set_main_areas P_ ((Widget, Widget, Widget)); |
| 130 | static void xm_internal_update_other_instances P_ ((Widget, XtPointer, | 130 | static void xm_internal_update_other_instances P_ ((Widget, XtPointer, |
| 131 | XtPointer)); | 131 | XtPointer)); |
| 132 | static void xm_arm_callback P_ ((Widget, XtPointer, XtPointer)); | ||
| 132 | 133 | ||
| 133 | #if 0 | 134 | #if 0 |
| 134 | void xm_update_one_widget P_ ((widget_instance *, Widget, widget_value *, | 135 | void xm_update_one_widget P_ ((widget_instance *, Widget, widget_value *, |
| @@ -138,8 +139,7 @@ void xm_manage_resizing P_ ((Widget, Boolean)); | |||
| 138 | #endif | 139 | #endif |
| 139 | 140 | ||
| 140 | 141 | ||
| 141 | static destroyed_instance* | 142 | static destroyed_instance *all_destroyed_instances = NULL; |
| 142 | all_destroyed_instances = NULL; | ||
| 143 | 143 | ||
| 144 | static destroyed_instance* | 144 | static destroyed_instance* |
| 145 | make_destroyed_instance (name, type, widget, parent, pop_up_p) | 145 | make_destroyed_instance (name, type, widget, parent, pop_up_p) |
| @@ -247,6 +247,47 @@ destroy_all_children (widget, first_child_to_destroy) | |||
| 247 | } | 247 | } |
| 248 | } | 248 | } |
| 249 | 249 | ||
| 250 | |||
| 251 | |||
| 252 | /* Callback XmNarmCallback and XmNdisarmCallback for buttons in a | ||
| 253 | menu. CLIENT_DATA contains a pointer to the widget_value | ||
| 254 | corresponding to widget W. CALL_DATA contains a | ||
| 255 | XmPushButtonCallbackStruct containing the reason why the callback | ||
| 256 | is called. */ | ||
| 257 | |||
| 258 | static void | ||
| 259 | xm_arm_callback (w, client_data, call_data) | ||
| 260 | Widget w; | ||
| 261 | XtPointer client_data, call_data; | ||
| 262 | { | ||
| 263 | XmPushButtonCallbackStruct *cbs = (XmPushButtonCallbackStruct *) call_data; | ||
| 264 | widget_value *wv = (widget_value *) client_data; | ||
| 265 | widget_instance *instance; | ||
| 266 | |||
| 267 | /* Get the id of the menu bar or popup menu this widget is in. */ | ||
| 268 | while (1) | ||
| 269 | { | ||
| 270 | if (XmIsRowColumn (w)) | ||
| 271 | { | ||
| 272 | unsigned char type = 0xff; | ||
| 273 | |||
| 274 | XtVaGetValues (w, XmNrowColumnType, &type, NULL); | ||
| 275 | if (type == XmMENU_BAR || type == XmMENU_POPUP) | ||
| 276 | break; | ||
| 277 | } | ||
| 278 | |||
| 279 | w = XtParent (w); | ||
| 280 | } | ||
| 281 | |||
| 282 | instance = lw_get_widget_instance (w); | ||
| 283 | if (instance && instance->info->highlight_cb) | ||
| 284 | { | ||
| 285 | call_data = cbs->reason == XmCR_DISARM ? NULL : wv; | ||
| 286 | instance->info->highlight_cb (w, instance->info->id, call_data); | ||
| 287 | } | ||
| 288 | } | ||
| 289 | |||
| 290 | |||
| 250 | 291 | ||
| 251 | /* Update the label of widget WIDGET. WIDGET must be a Label widget | 292 | /* Update the label of widget WIDGET. WIDGET must be a Label widget |
| 252 | or a subclass of Label. WIDGET_INSTANCE is unused. VAL contains | 293 | or a subclass of Label. WIDGET_INSTANCE is unused. VAL contains |
| @@ -519,10 +560,16 @@ make_menu_in_widget (instance, widget, val, keep_first_children) | |||
| 519 | ? XmN_OF_MANY : XmONE_OF_MANY)); | 560 | ? XmN_OF_MANY : XmONE_OF_MANY)); |
| 520 | ++ac; | 561 | ++ac; |
| 521 | button = XmCreateToggleButton (widget, cur->name, al, ac); | 562 | button = XmCreateToggleButton (widget, cur->name, al, ac); |
| 563 | XtAddCallback (button, XmNarmCallback, xm_arm_callback, cur); | ||
| 564 | XtAddCallback (button, XmNdisarmCallback, xm_arm_callback, cur); | ||
| 522 | } | 565 | } |
| 523 | else | 566 | else |
| 524 | button = XmCreatePushButton (widget, cur->name, al, ac); | 567 | { |
| 525 | 568 | button = XmCreatePushButton (widget, cur->name, al, ac); | |
| 569 | XtAddCallback (button, XmNarmCallback, xm_arm_callback, cur); | ||
| 570 | XtAddCallback (button, XmNdisarmCallback, xm_arm_callback, cur); | ||
| 571 | } | ||
| 572 | |||
| 526 | xm_update_label (instance, button, cur); | 573 | xm_update_label (instance, button, cur); |
| 527 | 574 | ||
| 528 | /* Add a callback that is called when the button is | 575 | /* Add a callback that is called when the button is |