ui/gtk/menu.c

changeset 18
06be29a56f8b
parent 16
a499c8a72c15
child 21
012418e7dc90
equal deleted inserted replaced
17:db95c0104937 18:06be29a56f8b
93 93
94 UiMenu *cm = current->data; 94 UiMenu *cm = current->data;
95 cm->items = ucx_list_append(cm->items, item); 95 cm->items = ucx_list_append(cm->items, item);
96 } 96 }
97 97
98 void ui_menuitem_st(char *stockid, ui_callback f, void *userdata) {
99 if(!current) {
100 return;
101 }
102
103 UiStMenuItem *item = malloc(sizeof(UiStMenuItem));
104 item->item.add_to = (ui_menu_add_f)add_menuitem_st_widget;
105
106 item->stockid = stockid;
107 item->userdata = userdata;
108 item->callback = f;
109
110 UiMenu *cm = current->data;
111 cm->items = ucx_list_append(cm->items, item);
112 }
113
98 void ui_menuseparator() { 114 void ui_menuseparator() {
99 if(!current) { 115 if(!current) {
100 return; 116 return;
101 } 117 }
102 118
219 UiMenuItemI *item, 235 UiMenuItemI *item,
220 UiObject *obj) 236 UiObject *obj)
221 { 237 {
222 UiStMenuItem *i = (UiStMenuItem*)item; 238 UiStMenuItem *i = (UiStMenuItem*)item;
223 239
224 GtkWidget *widget = gtk_image_menu_item_new_from_stock(i->stockid, NULL); 240 GtkWidget *widget = gtk_image_menu_item_new_from_stock(i->stockid, obj->ctx->accel_group);
225 241
226 if(i->callback != NULL) { 242 if(i->callback != NULL) {
227 UiEventData *event = malloc(sizeof(UiEventData)); 243 UiEventData *event = malloc(sizeof(UiEventData));
228 event->obj = obj; 244 event->obj = obj;
229 event->user_data = i->userdata; 245 event->user_data = i->userdata;

mercurial