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.
Content:
Creation methods:
Methods:
public unowned WidgetPath @ref ()
Increments the reference count on this .
public int append_for_widget (Widget widget)
Appends the data from widget
to the widget hierarchy
represented by this .
public int append_type (Type type)
Appends a widget type to the widget hierarchy represented by
this .
public int append_with_siblings (WidgetPath siblings, uint sibling_index)
Appends a widget type with all its siblings to the widget hierarchy
represented by this .
public WidgetPath copy ()
Returns a copy of this
public void free ()
Decrements the reference count on this ,
freeing the structure if the reference count reaches 0.
public Type get_object_type ()
Returns the topmost object type, that is, the object type this path is
representing.
public bool has_parent (Type type)
Returns true if any of the parents of the
widget represented in this is of type type
, or any subtype of it.
public bool is_type (Type type)
Returns true if the widget type
represented by this path is type
, or a subtype of it.
public void iter_add_class (int pos, string name)
Adds the class name
to the widget at position pos
in the hierarchy defined in this .
public void iter_add_region (int pos, string name, RegionFlags flags)
Adds the region name
to the widget at position pos
in the hierarchy defined in this .
public void iter_clear_classes (int pos)
Removes all classes from the widget at position pos
in the
hierarchy defined in this .
public void iter_clear_regions (int pos)
Removes all regions from the widget at position pos
in the
hierarchy defined in this .
public unowned string ? iter_get_name (int pos)
Returns the name corresponding to the widget found at the position pos
in the widget hierarchy defined by this
public unowned string ? iter_get_object_name (int pos)
Returns the object name that is at position pos
in the widget
hierarchy defined in this .
public Type iter_get_object_type (int pos)
Returns the object Type
that is at position pos
in the widget hierarchy defined in this .
public uint iter_get_sibling_index (int pos)
Returns the index into the list of siblings for the element at pos
as returned by iter_get_siblings .
public unowned WidgetPath iter_get_siblings (int pos)
Returns the list of siblings for the element at pos
.
public StateFlags iter_get_state (int pos)
Returns the state flags corresponding to the widget found at the position
pos
in the widget hierarchy defined by this
public bool iter_has_class (int pos, string name)
Returns true if the widget at position
pos
has the class name
defined, false otherwise.
public bool iter_has_name (int pos, string name)
Returns true if the widget at position
pos
has the name name
, false otherwise.
public bool iter_has_qclass (int pos, Quark qname)
public bool iter_has_qname (int pos, Quark qname)
public bool iter_has_qregion (int pos, Quark qname, out RegionFlags flags)
public bool iter_has_region (int pos, string name, out RegionFlags flags)
Returns true if the widget at position
pos
has the class name
defined, false otherwise.
public SList <unowned string > iter_list_classes (int pos)
Returns a list with all the class names defined for the widget at position
pos
in the hierarchy defined in this .
public SList <unowned string > iter_list_regions (int pos)
Returns a list with all the region names defined for the widget at position
pos
in the hierarchy defined in this .
public void iter_remove_class (int pos, string name)
Removes the class name
from the widget at position pos
in the hierarchy defined in this .
public void iter_remove_region (int pos, string name)
Removes the region name
from the widget at position pos
in the hierarchy defined in this .
public void iter_set_name (int pos, string name)
Sets the widget name for the widget found at position pos
in
the widget hierarchy defined by this .
public void iter_set_object_name (int pos, string ? name)
Sets the object name for a given position in the widget hierarchy defined by
this .
public void iter_set_object_type (int pos, Type type)
Sets the object type for a given position in the widget hierarchy defined by
this .
public void iter_set_state (int pos, StateFlags state)
Sets the widget name for the widget found at position pos
in
the widget hierarchy defined by this .
public int length ()
Returns the number of
Widget Type s between the represented widget and its topmost container.
public void prepend_type (Type type)
Prepends a widget type to the widget hierachy represented by
this .
public string to_string ()
Dumps the widget path into a string representation.
public void unref ()
Decrements the reference count on this ,
freeing the structure if the reference count reaches 0.