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 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_get_path(), and the style context returned by gtk_widget_get_style_context() will be automatically updated on widget hierarchy changes.

The widget path generation is generally simple:

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:

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

Constructors

this
this(GtkWidgetPath* gtkWidgetPath)

Sets our main struct and passes it to the parent class

this
this()

Returns an empty widget path.

Destructor

~this
~this()
Undocumented in source.

Members

Functions

appendForWidget
int appendForWidget(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 the style classes from widget.

appendType
int appendType(GType type)

Appends a widget type to the widget hierarchy represented by path.

appendWithSiblings
int appendWithSiblings(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_append_type() will allow the CSS theming to use sibling matches in selectors and apply :nth-child() pseudo classes. In turn, it requires a lot more care in widget implementations as widgets need to make sure to call gtk_widget_reset_style() on all involved widgets when the siblings path changes.

copy
WidgetPath copy()

Returns a copy of path

doref
WidgetPath doref()

Increments the reference count on path.

free
void free()

Decrements the reference count on path, freeing the structure if the reference count reaches 0.

getObjectType
GType getObjectType()

Returns the topmost object type, that is, the object type this path is representing.

getStruct
void* getStruct()

the main Gtk struct as a void*

getWidgetPathStruct
GtkWidgetPath* getWidgetPathStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
hasParent
int hasParent(GType type)

Returns TRUE if any of the parents of the widget represented in path is of type type, or any subtype of it.

isType
int isType(GType type)

Returns TRUE if the widget type represented by this path is type, or a subtype of it.

iterAddClass
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_add_class().

iterAddRegion
void iterAddRegion(int pos, string name, GtkRegionFlags flags)

Adds the region name to the widget at position pos in the hierarchy defined in path. See gtk_style_context_add_region(). Note Region names must only contain lowercase letters and '-', starting always with a lowercase letter.

iterClearClasses
void iterClearClasses(int pos)

Removes all classes from the widget at position pos in the hierarchy defined in path.

iterClearRegions
void iterClearRegions(int pos)

Removes all regions from the widget at position pos in the hierarchy defined in path.

iterGetName
string iterGetName(int pos)

Returns the name corresponding to the widget found at the position pos in the widget hierarchy defined by path

iterGetObjectType
GType iterGetObjectType(int pos)

Returns the object GType that is at position pos in the widget hierarchy defined in path.

iterGetSiblingIndex
uint iterGetSiblingIndex(int pos)

Returns the index into the list of siblings for the element at pos as returned by gtk_widget_path_iter_get_siblings(). If that function would return NULL because the element at pos has no siblings, this function will return 0.

iterGetSiblings
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.

iterHasClass
int iterHasClass(int pos, string name)

Returns TRUE if the widget at position pos has the class name defined, FALSE otherwise.

iterHasName
int iterHasName(int pos, string name)

Returns TRUE if the widget at position pos has the name name, FALSE otherwise.

iterHasQclass
int iterHasQclass(int pos, GQuark qname)

See gtk_widget_path_iter_has_class(). This is a version that operates with GQuarks.

iterHasQname
int iterHasQname(int pos, GQuark qname)

See gtk_widget_path_iter_has_name(). This is a version that operates on GQuarks.

iterHasQregion
int iterHasQregion(int pos, GQuark qname, GtkRegionFlags flags)

See gtk_widget_path_iter_has_region(). This is a version that operates with GQuarks.

iterHasRegion
int iterHasRegion(int pos, string name, GtkRegionFlags flags)

Returns TRUE if the widget at position pos has the class name defined, FALSE otherwise.

iterListClasses
ListSG iterListClasses(int pos)

Returns a list with all the class names defined for the widget at position pos in the hierarchy defined in path.

iterListRegions
ListSG iterListRegions(int pos)

Returns a list with all the region names defined for the widget at position pos in the hierarchy defined in path.

iterRemoveClass
void iterRemoveClass(int pos, string name)

Removes the class name from the widget at position pos in the hierarchy defined in path.

iterRemoveRegion
void iterRemoveRegion(int pos, string name)

Removes the region name from the widget at position pos in the hierarchy defined in path.

iterSetName
void iterSetName(int pos, string name)

Sets the widget name for the widget found at position pos in the widget hierarchy defined by path.

iterSetObjectType
void iterSetObjectType(int pos, GType type)

Sets the object type for a given position in the widget hierarchy defined by path.

length
int length()

Returns the number of GtkWidget GTypes between the represented widget and its topmost container.

prependType
void prependType(GType type)

Prepends a widget type to the widget hierachy represented by path.

toString
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). The main use of this code is for debugging purposes, so that you can g_print() the path or dump it in a gdb session.

unref
void unref()

Decrements the reference count on path, freeing the structure if the reference count reaches 0.

Variables

gtkWidgetPath
GtkWidgetPath* gtkWidgetPath;

the main Gtk struct

Meta