ui/motif/menu.c

changeset 115
102fc0b8fe3e
parent 98
efaae97bd95b
child 153
ee49d1852a5f
equal deleted inserted replaced
114:909fe96e5659 115:102fc0b8fe3e
538 XtManageChild(menu); 538 XtManageChild(menu);
539 539
540 *c = FALSE; 540 *c = FALSE;
541 } 541 }
542 542
543 void ui_contextmenu(UiObject *obj) { 543 UIMENU ui_contextmenu(UiObject *obj) {
544 UiContainer *ct = uic_get_current_container(obj); 544 UiContainer *ct = uic_get_current_container(obj);
545 ui_contextmenu_w(obj, ct->current); 545 if(ct->current) {
546 } 546 return ui_contextmenu_w(obj, ct->current);
547 547 } else {
548 void ui_contextmenu_w(UiObject *obj, UIWIDGET widget) { 548 return NULL; // TODO: warn
549 }
550 }
551
552 UIMENU ui_contextmenu_w(UiObject *obj, UIWIDGET widget) {
549 UiContainer *ct = uic_get_current_container(obj); 553 UiContainer *ct = uic_get_current_container(obj);
550 554
551 Widget menu = XmCreatePopupMenu(ct->current, "popup_menu", NULL, 0); 555 Widget menu = XmCreatePopupMenu(widget, "popup_menu", NULL, 0);
552 ct->menu = menu; 556 ct->menu = menu;
553 557
554 XtAddEventHandler(widget, ButtonPressMask, FALSE, ui_popup_handler, menu); 558 XtAddEventHandler(widget, ButtonPressMask, FALSE, ui_popup_handler, menu);
559
560 return menu;
561 }
562
563 void ui_contextmenu_popup(UIMENU menu) {
564
555 } 565 }
556 566
557 void ui_widget_menuitem(UiObject *obj, char *label, ui_callback f, void *userdata) { 567 void ui_widget_menuitem(UiObject *obj, char *label, ui_callback f, void *userdata) {
558 ui_widget_menuitem_gr(obj, label, f, userdata, -1); 568 ui_widget_menuitem_gr(obj, label, f, userdata, -1);
559 } 569 }

mercurial