Mon, 23 Sep 2024 23:22:27 +0200
add headerbar toggle button (GTK)
ui/gtk/headerbar.c | file | annotate | diff | comparison | revisions | |
ui/gtk/headerbar.h | file | annotate | diff | comparison | revisions |
--- a/ui/gtk/headerbar.c Mon Sep 23 23:17:39 2024 +0200 +++ b/ui/gtk/headerbar.c Mon Sep 23 23:22:27 2024 +0200 @@ -64,7 +64,7 @@ break; } case UI_TOOLBAR_TOGGLEITEM: { - //add_toolitem_toggle_widget(tb, (UiToolbarToggleItem*)i, obj); + ui_add_headerbar_toggleitem(headerbar, box, (UiToolbarToggleItem*)i, obj, pos); break; } case UI_TOOLBAR_MENU: { @@ -121,5 +121,12 @@ WIDGET_ADD_CSS_CLASS(button, "flat"); headerbar_add(headerbar, box, button, pos); } + +void ui_add_headerbar_toggleitem(GtkWidget *headerbar, GtkWidget *box, UiToolbarToggleItem *item, UiObject *obj, enum UiToolbarPos pos) { + GtkWidget *button = gtk_toggle_button_new(); + WIDGET_ADD_CSS_CLASS(button, "flat"); + ui_setup_togglebutton(obj, button, item->args.label, item->args.icon, item->args.varname, NULL, item->args.onchange, item->args.onchangedata); + headerbar_add(headerbar, box, button, pos); +} #endif \ No newline at end of file
--- a/ui/gtk/headerbar.h Mon Sep 23 23:17:39 2024 +0200 +++ b/ui/gtk/headerbar.h Mon Sep 23 23:22:27 2024 +0200 @@ -45,6 +45,8 @@ void ui_headerbar_add_items(UiObject *obj, GtkWidget *headerbar, CxList *items, enum UiToolbarPos pos); void ui_add_headerbar_item(GtkWidget *headerbar, GtkWidget *box, UiToolbarItem *item, UiObject *obj, enum UiToolbarPos pos); + +void ui_add_headerbar_toggleitem(GtkWidget *headerbar, GtkWidget *box, UiToolbarToggleItem *item, UiObject *obj, enum UiToolbarPos pos); #endif