62 case UI_TOOLBAR_ITEM: { |
62 case UI_TOOLBAR_ITEM: { |
63 ui_add_headerbar_item(headerbar, box, (UiToolbarItem*)i, obj, pos); |
63 ui_add_headerbar_item(headerbar, box, (UiToolbarItem*)i, obj, pos); |
64 break; |
64 break; |
65 } |
65 } |
66 case UI_TOOLBAR_TOGGLEITEM: { |
66 case UI_TOOLBAR_TOGGLEITEM: { |
67 //add_toolitem_toggle_widget(tb, (UiToolbarToggleItem*)i, obj); |
67 ui_add_headerbar_toggleitem(headerbar, box, (UiToolbarToggleItem*)i, obj, pos); |
68 break; |
68 break; |
69 } |
69 } |
70 case UI_TOOLBAR_MENU: { |
70 case UI_TOOLBAR_MENU: { |
71 //add_toolitem_menu_widget(tb, (UiToolbarMenuItem*)i, obj); |
71 //add_toolitem_menu_widget(tb, (UiToolbarMenuItem*)i, obj); |
72 break; |
72 break; |
119 void ui_add_headerbar_item(GtkWidget *headerbar, GtkWidget *box, UiToolbarItem *item, UiObject *obj, enum UiToolbarPos pos) { |
119 void ui_add_headerbar_item(GtkWidget *headerbar, GtkWidget *box, UiToolbarItem *item, UiObject *obj, enum UiToolbarPos pos) { |
120 GtkWidget *button = ui_create_button(obj, item->args.label, item->args.icon, item->args.onclick, item->args.onclickdata); |
120 GtkWidget *button = ui_create_button(obj, item->args.label, item->args.icon, item->args.onclick, item->args.onclickdata); |
121 WIDGET_ADD_CSS_CLASS(button, "flat"); |
121 WIDGET_ADD_CSS_CLASS(button, "flat"); |
122 headerbar_add(headerbar, box, button, pos); |
122 headerbar_add(headerbar, box, button, pos); |
123 } |
123 } |
|
124 |
|
125 void ui_add_headerbar_toggleitem(GtkWidget *headerbar, GtkWidget *box, UiToolbarToggleItem *item, UiObject *obj, enum UiToolbarPos pos) { |
|
126 GtkWidget *button = gtk_toggle_button_new(); |
|
127 WIDGET_ADD_CSS_CLASS(button, "flat"); |
|
128 ui_setup_togglebutton(obj, button, item->args.label, item->args.icon, item->args.varname, NULL, item->args.onchange, item->args.onchangedata); |
|
129 headerbar_add(headerbar, box, button, pos); |
|
130 } |
124 |
131 |
125 #endif |
132 #endif |