483 } |
483 } |
484 } |
484 } |
485 return FALSE; |
485 return FALSE; |
486 } |
486 } |
487 |
487 |
488 void ui_contextmenu(UiObject *obj) { |
488 UIMENU ui_contextmenu(UiObject *obj) { |
489 UiContainer *ct = uic_get_current_container(obj); |
489 UiContainer *ct = uic_get_current_container(obj); |
490 ui_contextmenu_w(obj, ct->current); |
490 return ui_contextmenu_w(obj, ct->current); |
491 } |
491 } |
492 |
492 |
493 void ui_contextmenu_w(UiObject *obj, UIWIDGET widget) { |
493 UIMENU ui_contextmenu_w(UiObject *obj, UIWIDGET widget) { |
494 UiContainer *ct = uic_get_current_container(obj); |
494 UiContainer *ct = uic_get_current_container(obj); |
495 |
495 |
496 GtkMenu *menu = GTK_MENU(gtk_menu_new()); |
496 GtkMenu *menu = GTK_MENU(gtk_menu_new()); |
497 g_signal_connect(widget, "button-press-event", (GCallback) ui_button_press_event, menu); |
497 g_signal_connect(widget, "button-press-event", (GCallback) ui_button_press_event, menu); |
498 |
498 |
499 ct->menu = menu; |
499 ct->menu = menu; |
|
500 return menu; |
|
501 } |
|
502 |
|
503 void ui_contextmenu_popup(UIMENU menu) { |
|
504 gtk_menu_popup(menu, NULL, NULL, 0, 0, 0, gtk_get_current_event_time()); |
500 } |
505 } |
501 |
506 |
502 void ui_widget_menuitem(UiObject *obj, char *label, ui_callback f, void *userdata) { |
507 void ui_widget_menuitem(UiObject *obj, char *label, ui_callback f, void *userdata) { |
503 ui_widget_menuitem_gr(obj, label, f, userdata, -1); |
508 ui_widget_menuitem_gr(obj, label, f, userdata, -1); |
504 } |
509 } |