32 #include "../ui/menu.h" |
32 #include "../ui/menu.h" |
33 #include "../common/menu.h" |
33 #include "../common/menu.h" |
34 #include <cx/list.h> |
34 #include <cx/list.h> |
35 #include "toolkit.h" |
35 #include "toolkit.h" |
36 |
36 |
37 #if UI_GTK2 || UI_GTK3 |
|
38 |
37 |
39 #ifdef __cplusplus |
38 #ifdef __cplusplus |
40 extern "C" { |
39 extern "C" { |
41 #endif |
40 #endif |
42 |
41 |
|
42 #if GTK_MAJOR_VERSION <= 3 |
43 |
43 |
44 typedef struct UiActiveMenuItemList UiActiveMenuItemList; |
44 typedef struct UiActiveMenuItemList UiActiveMenuItemList; |
45 |
45 |
46 typedef void(*ui_menu_add_f)(GtkWidget *, int, UiMenuItemI*, UiObject*); |
46 typedef void(*ui_menu_add_f)(GtkWidget *, int, UiMenuItemI*, UiObject*); |
47 |
47 |
73 void ui_menu_event_wrapper(GtkMenuItem *item, UiEventData *event); |
73 void ui_menu_event_wrapper(GtkMenuItem *item, UiEventData *event); |
74 void ui_menu_event_toggled(GtkCheckMenuItem *ci, UiEventData *event); |
74 void ui_menu_event_toggled(GtkCheckMenuItem *ci, UiEventData *event); |
75 int64_t ui_checkitem_get(UiInteger *i); |
75 int64_t ui_checkitem_get(UiInteger *i); |
76 void ui_checkitem_set(UiInteger *i, int64_t value); |
76 void ui_checkitem_set(UiInteger *i, int64_t value); |
77 |
77 |
|
78 #endif /* GTK_MAJOR_VERSION <= 3 */ |
|
79 |
|
80 #if GTK_MAJOR_VERSION >= 4 |
|
81 |
|
82 typedef void(*ui_gmenu_add_f)(GMenu *, int, UiMenuItemI*, UiObject*); |
|
83 |
|
84 typedef struct UiActiveGMenuItemList UiActiveGMenuItemList; |
|
85 struct UiActiveGMenuItemList { |
|
86 UiObject *object; |
|
87 GMenu *menu; |
|
88 char action[32]; |
|
89 int index; |
|
90 int oldcount; |
|
91 UiList *list; |
|
92 ui_getvaluefunc getvalue; |
|
93 ui_callback callback; |
|
94 void *userdata; |
|
95 }; |
|
96 |
|
97 void ui_gmenu_add_menu_items(GMenu *parent, int i, UiMenu *menu, UiObject *obj); |
|
98 |
|
99 void ui_gmenu_add_menu(GMenu *parent, int index, UiMenuItemI *item, UiObject *obj); |
|
100 void ui_gmenu_add_menuitem(GMenu *parent, int index, UiMenuItemI *item, UiObject *obj); |
|
101 void ui_gmenu_add_menuseparator(GMenu *p, int index, UiMenuItemI *item, UiObject *obj); |
|
102 void ui_gmenu_add_checkitem(GMenu *p, int index, UiMenuItemI *item, UiObject *obj); |
|
103 void ui_gmenu_add_radioitem(GMenu *p, int index, UiMenuItemI *item, UiObject *obj); |
|
104 void ui_gmenu_add_menuitem_list(GMenu *p, int index, UiMenuItemI *item, UiObject *obj); |
|
105 |
|
106 void ui_activate_event_wrapper(GSimpleAction* self, GVariant* parameter, UiEventData *event); |
|
107 void ui_update_gmenu_item_list(UiEvent *event, UiActiveGMenuItemList *list); |
|
108 |
|
109 #endif |
|
110 |
|
111 |
78 #ifdef __cplusplus |
112 #ifdef __cplusplus |
79 } |
113 } |
80 #endif |
114 #endif |
81 |
115 |
82 #endif /* UI_GTK2 || UI_GTK3 */ |
|
83 |
|
84 #endif /* MENU_H */ |
116 #endif /* MENU_H */ |
85 |
117 |