diff options
-rw-r--r-- | docs/reference/gtk/gtk4-sections.txt | 1 | ||||
-rw-r--r-- | gtk/gtkwidget.c | 18 | ||||
-rw-r--r-- | gtk/gtkwidget.h | 2 |
3 files changed, 21 insertions, 0 deletions
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt index 73bba8e78c..76f703ec42 100644 --- a/docs/reference/gtk/gtk4-sections.txt +++ b/docs/reference/gtk/gtk4-sections.txt @@ -4189,6 +4189,7 @@ gtk_widget_insert_after gtk_widget_set_layout_manager gtk_widget_get_layout_manager gtk_widget_should_layout +gtk_widget_get_css_name gtk_widget_add_css_class gtk_widget_remove_css_class gtk_widget_has_css_class diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 36baa66c3d..5ea1f97613 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -13103,6 +13103,24 @@ gtk_widget_class_query_action (GtkWidgetClass *widget_class, } /** + * gtk_widget_get_css_name: + * @self: a #GtkWidget + * + * Returns the CSS name that is used for @self. + * + * Returns: the CSS name + **/ +const char * +gtk_widget_get_css_name (GtkWidget *self) +{ + GtkWidgetPrivate *priv = gtk_widget_get_instance_private (self); + + g_return_val_if_fail (GTK_IS_WIDGET (self), NULL); + + return g_quark_to_string (gtk_css_node_get_name (priv->cssnode)); +} + +/** * gtk_widget_add_css_class: * @widget: a #GtkWidget * @css_class: The style class to add to @widget, without diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h index 5cbea4b35f..718b3be13b 100644 --- a/gtk/gtkwidget.h +++ b/gtk/gtkwidget.h @@ -971,6 +971,8 @@ void gtk_widget_snapshot_child (GtkWidget *widget, GDK_AVAILABLE_IN_ALL gboolean gtk_widget_should_layout (GtkWidget *widget); GDK_AVAILABLE_IN_ALL +const char * gtk_widget_get_css_name (GtkWidget *self) G_GNUC_PURE; +GDK_AVAILABLE_IN_ALL void gtk_widget_add_css_class (GtkWidget *widget, const char *css_class); GDK_AVAILABLE_IN_ALL |