Tue, 29 Oct 2024 10:43:59 +0100
fix replace close_request signal on gtk3
/* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * * Copyright 2017 Olaf Wintermann. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #ifndef UI_MENU_H #define UI_MENU_H #include "toolkit.h" #ifdef __cplusplus extern "C" { #endif typedef struct UiMenuItemArgs { const char* label; const char* stockid; const char* icon; ui_callback onclick; void* onclickdata; const int* groups; } UiMenuItemArgs; typedef struct UiMenuToggleItemArgs { const char* label; const char* stockid; const char* icon; const char* varname; ui_callback onchange; void* onchangedata; const int* groups; } UiMenuToggleItemArgs; typedef struct UiMenuItemListArgs { const char* varname; ui_getvaluefunc getvalue; ui_callback onselect; void* onselectdata; } UiMenuItemListArgs; #define ui_menu(label) for(ui_menu_create(label);ui_menu_is_open();ui_menu_close()) #define ui_menuitem(...) ui_menuitem_create((UiMenuItemArgs){ __VA_ARGS__ }) #define ui_menu_toggleitem(...) ui_menu_toggleitem_create((UiMenuToggleItemArgs){ __VA_ARGS__ }) #define ui_menu_radioitem(...) ui_menu_radioitem_create((UiMenuToggleItemArgs){ __VA_ARGS__ }) #define ui_menu_itemlist(...) ui_menu_itemlist_create((UiMenuItemListArgs) { __VA_ARGS__ } ) #define ui_menu_togglelist(...) ui_menu_itemlist_create((UiMenuItemListArgs) { __VA_ARGS} ) #define ui_menu_radiolist(...) ui_menu_itemlist_create((UiMenuItemListArgs) { __VA_ARGS} ) UIEXPORT void ui_menu_create(const char* label); UIEXPORT void ui_menuitem_create(UiMenuItemArgs args); UIEXPORT void ui_menu_toggleitem_create(UiMenuToggleItemArgs args); UIEXPORT void ui_menu_radioitem_create(UiMenuToggleItemArgs args); UIEXPORT void ui_menuseparator(); UIEXPORT void ui_menu_itemlist_create(UiMenuItemListArgs args); 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); 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, ...); // used for macro UIEXPORT void ui_menu_close(void); UIEXPORT int ui_menu_is_open(void); #ifdef __cplusplus } #endif #endif /* UI_MENU_H */