aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Moellmann2000-01-17 09:09:08 +0000
committerGerd Moellmann2000-01-17 09:09:08 +0000
commitd3065ce277122a6cc45bcc07227abee3fcd3fb60 (patch)
tree088f13ccd2d16f002c847787d93766a1aa3b71fe
parent05aea71425a1bba8c22b2dfc2ebc1e3510e1cbcd (diff)
downloademacs-d3065ce277122a6cc45bcc07227abee3fcd3fb60.tar.gz
emacs-d3065ce277122a6cc45bcc07227abee3fcd3fb60.zip
(xm_arm_callback): New function.
(make_menu_in_widget): Set xm_arm_callback as XmNarmCallback and XmNdisarmCallback for buttons (not supported for other widgets).
-rw-r--r--lwlib/lwlib-Xm.c55
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));
129void xm_set_main_areas P_ ((Widget, Widget, Widget)); 129void xm_set_main_areas P_ ((Widget, Widget, Widget));
130static void xm_internal_update_other_instances P_ ((Widget, XtPointer, 130static void xm_internal_update_other_instances P_ ((Widget, XtPointer,
131 XtPointer)); 131 XtPointer));
132static void xm_arm_callback P_ ((Widget, XtPointer, XtPointer));
132 133
133#if 0 134#if 0
134void xm_update_one_widget P_ ((widget_instance *, Widget, widget_value *, 135void 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
141static destroyed_instance* 142static destroyed_instance *all_destroyed_instances = NULL;
142all_destroyed_instances = NULL;
143 143
144static destroyed_instance* 144static destroyed_instance*
145make_destroyed_instance (name, type, widget, parent, pop_up_p) 145make_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
258static void
259xm_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