Mercurial > emacs
comparison lwlib/lwlib-Xm.c @ 14931:0706926a11cb
(destroy_all_children): When freeing a cascade button, free its submenu too.
(make_menu_in_widget): Use a cascade button gadget, not a widget.
Include Xm/CascadeBG.h.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 03 Apr 1996 17:22:57 +0000 |
parents | 62fc4d7a846f |
children | 1beabd8b78a1 |
comparison
equal
deleted
inserted
replaced
14930:382c7659273e | 14931:0706926a11cb |
---|---|
32 #include "lwlib-Xm.h" | 32 #include "lwlib-Xm.h" |
33 #include "lwlib-utils.h" | 33 #include "lwlib-utils.h" |
34 | 34 |
35 #include <Xm/BulletinB.h> | 35 #include <Xm/BulletinB.h> |
36 #include <Xm/CascadeB.h> | 36 #include <Xm/CascadeB.h> |
37 #include <Xm/CascadeBG.h> | |
37 #include <Xm/DrawingA.h> | 38 #include <Xm/DrawingA.h> |
38 #include <Xm/FileSB.h> | 39 #include <Xm/FileSB.h> |
39 #include <Xm/Label.h> | 40 #include <Xm/Label.h> |
40 #include <Xm/List.h> | 41 #include <Xm/List.h> |
41 #include <Xm/MainW.h> | 42 #include <Xm/MainW.h> |
166 number - first_child_to_destroy); | 167 number - first_child_to_destroy); |
167 | 168 |
168 /* Unmanage all children and destroy them. They will only be | 169 /* Unmanage all children and destroy them. They will only be |
169 really destroyed when we get out of DispatchEvent. */ | 170 really destroyed when we get out of DispatchEvent. */ |
170 for (i = first_child_to_destroy; i < number; i++) | 171 for (i = first_child_to_destroy; i < number; i++) |
171 XtDestroyWidget (children[i]); | 172 { |
173 Arg al[2]; | |
174 Widget submenu = 0; | |
175 /* Cascade buttons have submenus,and these submenus | |
176 need to be freed. But they are not included in | |
177 XtCompositeChildren. So get it out of the cascade button | |
178 and free it. If this child is not a cascade button, | |
179 then submenu should remain unchanged. */ | |
180 XtSetArg (al[0], XmNsubMenuId, &submenu); | |
181 XtGetValues (children[i], al, 1); | |
182 if (submenu) | |
183 XtDestroyWidget (submenu); | |
184 XtDestroyWidget (children[i]); | |
185 } | |
172 | 186 |
173 XtFree ((char *) children); | 187 XtFree ((char *) children); |
174 } | 188 } |
175 } | 189 } |
176 | 190 |
425 else | 439 else |
426 { | 440 { |
427 menu = XmCreatePulldownMenu (widget, cur->name, NULL, 0); | 441 menu = XmCreatePulldownMenu (widget, cur->name, NULL, 0); |
428 make_menu_in_widget (instance, menu, cur->contents, 0); | 442 make_menu_in_widget (instance, menu, cur->contents, 0); |
429 XtSetArg (al [ac], XmNsubMenuId, menu); ac++; | 443 XtSetArg (al [ac], XmNsubMenuId, menu); ac++; |
430 button = XmCreateCascadeButton (widget, cur->name, al, ac); | 444 button = XmCreateCascadeButtonGadget (widget, cur->name, al, ac); |
431 | 445 |
432 xm_update_label (instance, button, cur); | 446 xm_update_label (instance, button, cur); |
433 | 447 |
434 XtAddCallback (button, XmNcascadingCallback, xm_pull_down_callback, | 448 XtAddCallback (button, XmNcascadingCallback, xm_pull_down_callback, |
435 (XtPointer)instance); | 449 (XtPointer)instance); |