make headerbar buttons flat (GTK) newapi

Sun, 22 Sep 2024 21:17:15 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 22 Sep 2024 21:17:15 +0200
branch
newapi
changeset 307
301d6c73087a
parent 306
d02e1149cdb9
child 308
4efc7c19e31d

make headerbar buttons flat (GTK)

ui/gtk/headerbar.c file | annotate | diff | comparison | revisions
ui/gtk/toolkit.h file | annotate | diff | comparison | revisions
--- a/ui/gtk/headerbar.c	Sun Sep 22 19:47:26 2024 +0200
+++ b/ui/gtk/headerbar.c	Sun Sep 22 21:17:15 2024 +0200
@@ -118,6 +118,7 @@
 
 void ui_add_headerbar_item(GtkWidget *headerbar, GtkWidget *box, UiToolbarItem *item, UiObject *obj, enum UiToolbarPos pos) {
     GtkWidget *button = gtk_button_new_with_label(item->args.label);
+    WIDGET_ADD_CSS_CLASS(button, "flat");
     headerbar_add(headerbar, box, button, pos);
 }
     
--- a/ui/gtk/toolkit.h	Sun Sep 22 19:47:26 2024 +0200
+++ b/ui/gtk/toolkit.h	Sun Sep 22 21:17:15 2024 +0200
@@ -64,6 +64,7 @@
 #define SCROLLEDWINDOW_NEW() gtk_scrolled_window_new()
 #define SCROLLEDWINDOW_SET_CHILD(sw, child) gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw), child)
 #define SCROLLEDWINDOW_GET_CHILD(sw) gtk_scrolled_window_get_child(GTK_SCROLLED_WINDOW(sw))
+#define WIDGET_ADD_CSS_CLASS(w, cssclass) gtk_widget_add_css_class(w, cssclass)
 #else
 #define WINDOW_SHOW(window) gtk_widget_show_all(window)
 #define WINDOW_DESTROY(window) gtk_widget_destroy(window)
@@ -74,6 +75,7 @@
 #define SCROLLEDWINDOW_NEW() gtk_scrolled_window_new(NULL, NULL)
 #define SCROLLEDWINDOW_SET_CHILD(sw, child) gtk_container_add(GTK_CONTAINER(sw), child)
 #define SCROLLEDWINDOW_GET_CHILD(sw) gtk_bin_get_child(GTK_BIN(sw))
+#define WIDGET_ADD_CSS_CLASS(w, cssclass) gtk_style_context_add_class(gtk_widget_get_style_context(w), cssclass)
 #endif
     
 #ifdef UI_GTK2

mercurial