WidgetPath


Object Hierarchy:

Gtk.WidgetPath Gtk.WidgetPath Gtk.WidgetPath

Description:

[ CCode ( ref_function = "gtk_widget_path_ref" , type_id = "gtk_widget_path_get_type ()" , unref_function = "gtk_widget_path_unref" ) ]
[ Compact ]
public class WidgetPath

GtkWidgetPath is a boxed type that represents a widget hierarchy from the topmost widget, typically a toplevel, to any child.

This widget path abstraction is used in StyleContext on behalf of the real widget in order to query style information.

If you are using GTK+ widgets, you probably will not need to use this API directly, as there is get_path, and the style context returned by get_style_context will be automatically updated on widget hierarchy changes.

The widget path generation is generally simple:

Defining a button within a window

{
GtkWidgetPath *path;

path = gtk_widget_path_new ();
gtk_widget_path_append_type (path, GTK_TYPE_WINDOW);
gtk_widget_path_append_type (path, GTK_TYPE_BUTTON);
}

Although more complex information, such as widget names, or different classes (property that may be used by other widget types) and intermediate regions may be included:

Defining the first tab widget in a notebook

{
GtkWidgetPath *path;
guint pos;

path = gtk_widget_path_new ();

pos = gtk_widget_path_append_type (path, GTK_TYPE_NOTEBOOK);
gtk_widget_path_iter_add_region (path, pos, "tab", GTK_REGION_EVEN | GTK_REGION_FIRST);

pos = gtk_widget_path_append_type (path, GTK_TYPE_LABEL);
gtk_widget_path_iter_set_name (path, pos, "first tab label");
}

All this information will be used to match the style information that applies to the described widget.


Namespace: Gtk
Package: gtk+-3.0

Content:

Creation methods:

Methods:




2022 vala-language.org