ui/gtk/menu.c

branch
newapi
changeset 275
132c7bcc6997
parent 263
a0ea718ab1d8
child 278
a8faf8757450
equal deleted inserted replaced
274:9e2aee097b69 275:132c7bcc6997
72 } 72 }
73 73
74 return mb; 74 return mb;
75 } 75 }
76 76
77 void ui_add_menu_items(GtkWidget *parent, int i, UiMenu *menu, UiObject *obj) {
78 UiMenuItemI *it = menu->items_begin;
79 int index = 0;
80 while(it) {
81 createMenuItem[it->type](parent, index, it, obj);
82 it = it->next;
83 index++;
84 }
85 }
86
77 void add_menu_widget(GtkWidget *parent, int i, UiMenuItemI *item, UiObject *obj) { 87 void add_menu_widget(GtkWidget *parent, int i, UiMenuItemI *item, UiObject *obj) {
78 UiMenu *menu = (UiMenu*)item; 88 UiMenu *menu = (UiMenu*)item;
79 89
80 GtkWidget *menu_widget = gtk_menu_new(); 90 GtkWidget *menu_widget = gtk_menu_new();
81 GtkWidget *menu_item = gtk_menu_item_new_with_mnemonic(menu->label); 91 GtkWidget *menu_item = gtk_menu_item_new_with_mnemonic(menu->label);
82 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), menu_widget); 92 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), menu_widget);
83 93
84 UiMenuItemI *it = menu->items_begin; 94 ui_add_menu_items(menu_widget, i, menu, obj);
85 int index = 0; 95
86 while(it) {
87 createMenuItem[it->type](menu_widget, index, it, obj);
88
89 it = it->next;
90 index++;
91 }
92 96
93 gtk_menu_shell_append(GTK_MENU_SHELL(parent), menu_item); 97 gtk_menu_shell_append(GTK_MENU_SHELL(parent), menu_item);
94 } 98 }
95 99
96 void add_menuitem_widget(GtkWidget *parent, int index, UiMenuItemI *item, UiObject *obj) { 100 void add_menuitem_widget(GtkWidget *parent, int index, UiMenuItemI *item, UiObject *obj) {

mercurial