gtk.widget_path

Module for [WidgetPath] class

Types 1

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 #GtkStyleContext 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 [gtk.widget.Widget.getPath], and the style context returned by [gtk.widget.Widget.getStyleContext] 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.

Methods
void * _cPtr(Flag!"Dup" dup = No.Dup)
GType _gType() @property
WidgetPath self()Returns `this`, for use in `with` statements.
int appendForWidget(gtk.widget.Widget widget)Appends the data from widget to the widget hierarchy represented by path. This function is a shortcut for adding information from widget to the given path. This includes setting the name or adding ...
int appendType(gobject.types.GType type)Appends a widget type to the widget hierarchy represented by path.
int appendWithSiblings(gtk.widget_path.WidgetPath siblings, uint siblingIndex)Appends a widget type with all its siblings to the widget hierarchy represented by path. Using this function instead of [gtk.widget_path.WidgetPath.appendType] will allow the CSS theming to use sib...
gtk.widget_path.WidgetPath copy()Returns a copy of path Returns: a copy of path
gobject.types.GType getObjectType()Returns the topmost object type, that is, the object type this path is representing. Returns: The object type
bool hasParent(gobject.types.GType type)Returns true if any of the parents of the widget represented in path is of type type, or any subtype of it.
bool isType(gobject.types.GType type)Returns true if the widget type represented by this path is type, or a subtype of it.
void iterAddClass(int pos, string name)Adds the class name to the widget at position pos in the hierarchy defined in path. See [gtk.style_context.StyleContext.addClass].
void iterAddRegion(int pos, string name, gtk.types.RegionFlags flags)Adds the region name to the widget at position pos in the hierarchy defined in path. See [gtk.style_context.StyleContext.addRegion].
void iterClearClasses(int pos)Removes all classes from the widget at position pos in the hierarchy defined in path.
void iterClearRegions(int pos)Removes all regions from the widget at position pos in the hierarchy defined in path.
string iterGetName(int pos)Returns the name corresponding to the widget found at the position pos in the widget hierarchy defined by path
string iterGetObjectName(int pos)Returns the object name that is at position pos in the widget hierarchy defined in path.
gobject.types.GType iterGetObjectType(int pos)Returns the object #GType that is at position pos in the widget hierarchy defined in path.
uint iterGetSiblingIndex(int pos)Returns the index into the list of siblings for the element at pos as returned by [gtk.widget_path.WidgetPath.iterGetSiblings]. If that function would return null because the element at pos has no ...
gtk.widget_path.WidgetPath iterGetSiblings(int pos)Returns the list of siblings for the element at pos. If the element was not added with siblings, null is returned.
gtk.types.StateFlags iterGetState(int pos)Returns the state flags corresponding to the widget found at the position pos in the widget hierarchy defined by path
bool iterHasClass(int pos, string name)Returns true if the widget at position pos has the class name defined, false otherwise.
bool iterHasName(int pos, string name)Returns true if the widget at position pos has the name name, false otherwise.
bool iterHasQclass(int pos, glib.types.Quark qname)See [gtk.widget_path.WidgetPath.iterHasClass]. This is a version that operates with GQuarks.
bool iterHasQname(int pos, glib.types.Quark qname)See [gtk.widget_path.WidgetPath.iterHasName]. This is a version that operates on #GQuarks.
bool iterHasQregion(int pos, glib.types.Quark qname, out gtk.types.RegionFlags flags)See [gtk.widget_path.WidgetPath.iterHasRegion]. This is a version that operates with GQuarks.
bool iterHasRegion(int pos, string name, out gtk.types.RegionFlags flags)Returns true if the widget at position pos has the class name defined, false otherwise.
string[] iterListClasses(int pos)Returns a list with all the class names defined for the widget at position pos in the hierarchy defined in path.
string[] iterListRegions(int pos)Returns a list with all the region names defined for the widget at position pos in the hierarchy defined in path.
void iterRemoveClass(int pos, string name)Removes the class name from the widget at position pos in the hierarchy defined in path.
void iterRemoveRegion(int pos, string name)Removes the region name from the widget at position pos in the hierarchy defined in path.
void iterSetName(int pos, string name)Sets the widget name for the widget found at position pos in the widget hierarchy defined by path.
void iterSetObjectName(int pos, string name = null)Sets the object name for a given position in the widget hierarchy defined by path.
void iterSetObjectType(int pos, gobject.types.GType type)Sets the object type for a given position in the widget hierarchy defined by path.
void iterSetState(int pos, gtk.types.StateFlags state)Sets the widget name for the widget found at position pos in the widget hierarchy defined by path.
int length()Returns the number of #GtkWidget #GTypes between the represented widget and its topmost container. Returns: the number of elements in the path
void prependType(gobject.types.GType type)Prepends a widget type to the widget hierachy represented by path.
string toString_()Dumps the widget path into a string representation. It tries to match the CSS style as closely as possible (Note that there might be paths that cannot be represented in CSS).
Constructors
this(void * ptr, Flag!"Take" take)
this()Returns an empty widget path. Returns: A newly created, empty, #GtkWidgetPath