--- a/ui/ui/menu.h Sun Nov 17 15:19:32 2024 +0100 +++ b/ui/ui/menu.h Tue Nov 26 10:40:45 2024 +0100 @@ -86,35 +86,18 @@ UIEXPORT void ui_menu_toggleitemlist_create(UiMenuItemListArgs args); UIEXPORT void ui_menu_radioitemlist_create(UiMenuItemListArgs args); -UIEXPORT void ui_menu_deprecated(char *label); -UIEXPORT void ui_submenu_deprecated(char *label); // deprecated -UIEXPORT void ui_submenu_end_deprecated(); // deprecated - -UIEXPORT void ui_menuitem_deprecated(char *label, ui_callback f, void *userdata); -UIEXPORT void ui_menuitem_st(char *stockid, ui_callback f, void *userdata); -UIEXPORT void ui_menuitem_gr(char *label, ui_callback f, void *userdata, ...); -UIEXPORT void ui_menuitem_stgr(char *stockid, ui_callback f, void *userdata, ...); - - -UIEXPORT void ui_checkitem_deprecated(char *label, ui_callback f, void *userdata); -UIEXPORT void ui_checkitem_nv_deprecated(char *label, char *vname); - -UIEXPORT void ui_menuitem_list_deprecated(UiList *items, ui_callback f, void *userdata); - UIEXPORT void ui_menu_end(void); // TODO: private /* * widget menu functions */ -UIEXPORT UIMENU ui_contextmenu(UiObject *obj); -UIEXPORT UIMENU ui_contextmenu_w(UiObject *obj, UIWIDGET widget); -UIEXPORT void ui_contextmenu_popup(UIMENU menu); + +#define ui_contextmenu(builder) for(ui_contextmenu_builder(builder);ui_menu_is_open();ui_menu_close()) -UIEXPORT void ui_widget_menuitem(UiObject *obj, char *label, ui_callback f, void *userdata); -UIEXPORT void ui_widget_menuitem_st(UiObject *obj, char *stockid, ui_callback f, void *userdata); -UIEXPORT void ui_widget_menuitem_gr(UiObject *obj, char *label, ui_callback f, void *userdata, ...); -UIEXPORT void ui_widget_menuitem_stgr(UiObject *obj, char *stockid, ui_callback f, void *userdata, ...); - +UIEXPORT void ui_contextmenu_builder(UiMenuBuilder **out_builder); +UIEXPORT void ui_menubuilder_free(UiMenuBuilder *builder); +UIEXPORT UIMENU ui_contextmenu_create(UiMenuBuilder *builder, UiObject *obj, UIWIDGET widget); +UIEXPORT void ui_contextmenu_popup(UIMENU menu, UIWIDGET widget, int x, int y); // used for macro UIEXPORT void ui_menu_close(void);