Mercurial > hg > xemacs-beta
comparison lwlib/lwlib-Xm.c @ 903:4a27df428c73
[xemacs-hg @ 2002-07-06 05:48:14 by andyp]
sync with 21.4
author | andyp |
---|---|
date | Sat, 06 Jul 2002 05:48:22 +0000 |
parents | e5083672c894 |
children | c2569faae8ed |
comparison
equal
deleted
inserted
replaced
902:2fd2239ea63a | 903:4a27df428c73 |
---|---|
299 | 299 |
300 if (val_string) | 300 if (val_string) |
301 XmStringFree (val_string); | 301 XmStringFree (val_string); |
302 } | 302 } |
303 | 303 |
304 static void | |
305 xm_safe_update_label (widget_instance* instance, Widget widget, widget_value* val) | |
306 { | |
307 /* Don't clobber non-labels. */ | |
308 if (XtIsSubclass (widget, xmLabelWidgetClass)) | |
309 xm_update_label (instance, widget, val); | |
310 } | |
311 | |
304 #endif /* defined (LWLIB_DIALOGS_MOTIF) || defined (LWLIB_MENUBARS_MOTIF) */ | 312 #endif /* defined (LWLIB_DIALOGS_MOTIF) || defined (LWLIB_MENUBARS_MOTIF) */ |
305 | 313 |
306 /* update of list */ | 314 /* update of list */ |
307 static void | 315 static void |
308 xm_update_list (widget_instance* instance, Widget widget, widget_value* val) | 316 xm_update_list (widget_instance* instance, Widget widget, widget_value* val) |
538 menu = XmCreatePulldownMenu (widget, "pulldown", NULL, 0); | 546 menu = XmCreatePulldownMenu (widget, "pulldown", NULL, 0); |
539 make_menu_in_widget (instance, menu, cur->contents); | 547 make_menu_in_widget (instance, menu, cur->contents); |
540 XtSetArg (al [ac], XmNsubMenuId, menu); ac++; | 548 XtSetArg (al [ac], XmNsubMenuId, menu); ac++; |
541 button = XmCreateCascadeButton (widget, cur->name, al, ac); | 549 button = XmCreateCascadeButton (widget, cur->name, al, ac); |
542 | 550 |
543 xm_update_label (instance, button, cur); | 551 xm_safe_update_label (instance, button, cur); |
544 | 552 |
545 XtAddCallback (button, XmNcascadingCallback, xm_pull_down_callback, | 553 XtAddCallback (button, XmNcascadingCallback, xm_pull_down_callback, |
546 (XtPointer)instance); | 554 (XtPointer)instance); |
547 break; | 555 break; |
548 default: | 556 default: |
559 button = XmCreateToggleButtonGadget (widget, cur->name, al, ac); | 567 button = XmCreateToggleButtonGadget (widget, cur->name, al, ac); |
560 } | 568 } |
561 else | 569 else |
562 button = XmCreatePushButtonGadget (widget, cur->name, al, ac); | 570 button = XmCreatePushButtonGadget (widget, cur->name, al, ac); |
563 | 571 |
564 xm_update_label (instance, button, cur); | 572 xm_safe_update_label (instance, button, cur); |
565 | 573 |
566 /* don't add a callback to a simple label */ | 574 /* don't add a callback to a simple label */ |
567 if (cur->type == TOGGLE_TYPE || cur->type == RADIO_TYPE) | 575 if (cur->type == TOGGLE_TYPE || cur->type == RADIO_TYPE) |
568 xm_update_toggle (instance, button, cur); | 576 xm_update_toggle (instance, button, cur); |
569 else if (cur->call_data) | 577 else if (cur->call_data) |
613 XtSetValues (widget, al, 2); | 621 XtSetValues (widget, al, 2); |
614 | 622 |
615 /* update the menu button as a label. */ | 623 /* update the menu button as a label. */ |
616 if (val->change >= VISIBLE_CHANGE) | 624 if (val->change >= VISIBLE_CHANGE) |
617 { | 625 { |
618 xm_update_label (instance, widget, val); | 626 xm_safe_update_label (instance, widget, val); |
627 | |
619 if (XtClass (widget) == xmToggleButtonWidgetClass | 628 if (XtClass (widget) == xmToggleButtonWidgetClass |
620 || XtClass (widget) == xmToggleButtonGadgetClass) | 629 || XtClass (widget) == xmToggleButtonGadgetClass) |
621 { | 630 { |
622 xm_update_toggle (instance, widget, val); | 631 xm_update_toggle (instance, widget, val); |
623 } | 632 } |
827 XtSetArg (al [ac], XmNuserData, val->call_data); ac++; | 836 XtSetArg (al [ac], XmNuserData, val->call_data); ac++; |
828 XtSetValues (widget, al, ac); | 837 XtSetValues (widget, al, ac); |
829 | 838 |
830 #if defined (LWLIB_DIALOGS_MOTIF) || defined (LWLIB_MENUBARS_MOTIF) || defined (LWLIB_WIDGETS_MOTIF) | 839 #if defined (LWLIB_DIALOGS_MOTIF) || defined (LWLIB_MENUBARS_MOTIF) || defined (LWLIB_WIDGETS_MOTIF) |
831 /* Common to all label like widgets */ | 840 /* Common to all label like widgets */ |
832 if (XtIsSubclass (widget, xmLabelWidgetClass)) | 841 xm_safe_update_label (instance, widget, val); |
833 xm_update_label (instance, widget, val); | |
834 #endif | 842 #endif |
835 class = XtClass (widget); | 843 class = XtClass (widget); |
836 /* Class specific things */ | 844 /* Class specific things */ |
837 if (class == xmPushButtonWidgetClass || | 845 if (class == xmPushButtonWidgetClass || |
838 class == xmArrowButtonWidgetClass) | 846 class == xmArrowButtonWidgetClass) |