# Gtk::WidgetPath Class Reference

This represents a widget hierarchy from the topmost widget, typically a toplevel, to any child. More...

List of all members.

## Public Member Functions

| WidgetPath ()
| WidgetPath (GtkWidgetPath* gobject, bool make_a_copy=true)
| WidgetPath (const WidgetPath& other)
WidgetPath& | operator= (const WidgetPath& other)
| ~WidgetPath ()
void | swap (WidgetPath& other)
GtkWidgetPath* | gobj ()
| Provides access to the underlying C instance.
const GtkWidgetPath* | gobj () const
| Provides access to the underlying C instance.
GtkWidgetPath* | gobj_copy () const
| Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.
int | path_length () const
| Returns the number of Gtk::Widget Types between the represented widget and its topmost container.
int | path_append_type (GType type)
| Appends a widget type to the widget hierarchy represented by path.
void | prepend_type (GType type)
| Prepends a widget type to the widget hierachy represented by path.
GType | iter_get_object_type (int pos) const
| Returns the object Type that is at position pos in the widget hierarchy defined in path.
void | iter_set_object_type (int pos, GType type)
| Sets the object type for a given position in the widget hierarchy defined by path.
Glib::ustring | iter_get_name (int pos) const
| Returns the name corresponding to the widget found at the position pos in the widget hierarchy defined by path.
void | iter_set_name (int pos, const Glib::ustring& name)
| Sets the widget name for the widget found at position pos in the widget hierarchy defined by path.
bool | iter_has_name (int pos, const Glib::ustring& name) const
| Returns `true` if the widget at position pos has the name name, `false` otherwise.
void | iter_add_class (int pos, const Glib::ustring& name)
| Adds the class name to the widget at position pos in the hierarchy defined in path.
void | iter_remove_class (int pos, const Glib::ustring& name)
| Removes the class name from the widget at position pos in the hierarchy defined in path.
void | iter_clear_classes (int pos)
| Removes all classes from the widget at position pos in the hierarchy defined in path.
bool | iter_has_class (int pos, const Glib::ustring& name) const
| Returns `true` if the widget at position pos has the class name defined, `false` otherwise.
void | iter_add_region (int pos, const Glib::ustring& name, RegionFlags flags)
| Adds the region name to the widget at position pos in the hierarchy defined in path.
void | iter_remove_region (int pos, const Glib::ustring& name)
| Removes the region name from the widget at position pos in the hierarchy defined in path.
void | iter_clear_regions (int pos)
| Removes all regions from the widget at position pos in the hierarchy defined in path.
bool | iter_has_region (int pos, const Glib::ustring& name, RegionFlags& flags) const
| Returns `true` if the widget at position pos has the class name defined, `false` otherwise.
GType | get_object_type () const
| Returns the topmost object type, that is, the object type this path is representing.
bool | is_type (GType type) const
| Returns `true` if the widget type represented by this path is type, or a subtype of it.
bool | has_parent (GType type) const
| Returns `true` if any of the parents of the widget represented in path is of type type, or any subtype of it.

## Protected Attributes

GtkWidgetPath* | gobject_

## Related Functions

(Note that these are not member functions.)
void | swap (WidgetPath& lhs, WidgetPath& rhs)
Gtk::WidgetPath | wrap (GtkWidgetPath* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

This 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 gtkmm widgets, you probably will not need to use this API directly, as there is Widget::get_path(), and the style context returned by Widget::get_style_context() will be automatically updated on widget hierarchy changes.

Since gtkmm 3.0:

## Constructor & Destructor Documentation

Gtk::WidgetPath::WidgetPath | ( |  | ) |

Gtk::WidgetPath::WidgetPath | ( | GtkWidgetPath * | gobject,
|  | bool | make_a_copy = `true`
| ) |  | `[explicit]`

Gtk::WidgetPath::WidgetPath | ( | const WidgetPath& | other | ) |

Gtk::WidgetPath::~WidgetPath | ( |  | ) |

## Member Function Documentation

GType Gtk::WidgetPath::get_object_type | ( |  | ) | const

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

Since gtkmm 3.0:

Returns:
  The object type.

GtkWidgetPath* Gtk::WidgetPath::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C instance.

const GtkWidgetPath* Gtk::WidgetPath::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C instance.

GtkWidgetPath* Gtk::WidgetPath::gobj_copy | ( |  | ) | const

Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.

bool Gtk::WidgetPath::has_parent | ( | GType | type | ) | const

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

Since gtkmm 3.0:

Parameters:

  type | Widget type to check in parents.

Returns:
  `true` if any parent is of type type.

bool Gtk::WidgetPath::is_type | ( | GType | type | ) | const

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

Since gtkmm 3.0:

Parameters:

  type | Widget type to match.

Returns:
  `true` if the widget represented by path is of type type.

void Gtk::WidgetPath::iter_add_class | ( | int | pos,
|  | const Glib::ustring & | name
| ) |  |

Adds the class name to the widget at position pos in the hierarchy defined in path.

See Gtk::StyleContext::add_class().

Since gtkmm 3.0:

Parameters:

  pos | Position to modify, -1 for the path head.
  name | A class name.

void Gtk::WidgetPath::iter_add_region | ( | int | pos,
|  | const Glib::ustring & | name,
|  | RegionFlags | flags
| ) |  |

Adds the region name to the widget at position pos in the hierarchy defined in path.

See Gtk::StyleContext::add_region().

<note>Region names must only contain lowercase letters and '-', starting always with a lowercase letter.</note>

Since gtkmm 3.0:

Parameters:

  pos | Position to modify, -1 for the path head.
  name | Region name.
  flags | Flags affecting the region.

void Gtk::WidgetPath::iter_clear_classes | ( | int | pos | ) |

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

Since gtkmm 3.0:

Parameters:

  pos | Position to modify, -1 for the path head.

void Gtk::WidgetPath::iter_clear_regions | ( | int | pos | ) |

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

Since gtkmm 3.0:

Parameters:

  pos | Position to modify, -1 for the path head.

Glib::ustring Gtk::WidgetPath::iter_get_name | ( | int | pos | ) | const

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

Parameters:

  pos | Position to get the widget name for, -1 for the path head.

Returns:
  The widget name, or `0` if none was set.

GType Gtk::WidgetPath::iter_get_object_type | ( | int | pos | ) | const

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

Since gtkmm 3.0:

Parameters:

  pos | Position to get the object type for, -1 for the path head.

Returns:
  A widget type.

bool Gtk::WidgetPath::iter_has_class | ( | int | pos,
|  | const Glib::ustring & | name
| ) |  | const

Returns `true` if the widget at position pos has the class name defined, `false` otherwise.

Since gtkmm 3.0:

Parameters:

  pos | Position to query, -1 for the path head.
  name | Class name.

Returns:
  `true` if the class name is defined for the widget at pos.

bool Gtk::WidgetPath::iter_has_name | ( | int | pos,
|  | const Glib::ustring & | name
| ) |  | const

Returns `true` if the widget at position pos has the name name, `false` otherwise.

Since gtkmm 3.0:

Parameters:

  pos | Position to query, -1 for the path head.
  name | A widget name.

Returns:
  `true` if the widget at pos has this name.

bool Gtk::WidgetPath::iter_has_region | ( | int | pos,
|  | const Glib::ustring & | name,
|  | RegionFlags& | flags
| ) |  | const

Returns `true` if the widget at position pos has the class name defined, `false` otherwise.

Since gtkmm 3.0:

Parameters:

  pos | Position to query, -1 for the path head.
  name | Region name.
  flags | Return location for the region flags.

Returns:
  `true` if the class name is defined for the widget at pos.

void Gtk::WidgetPath::iter_remove_class | ( | int | pos,
|  | const Glib::ustring & | name
| ) |  |

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

Since gtkmm 3.0:

Parameters:

  pos | Position to modify, -1 for the path head.
  name | Class name.

void Gtk::WidgetPath::iter_remove_region | ( | int | pos,
|  | const Glib::ustring & | name
| ) |  |

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

Since gtkmm 3.0:

Parameters:

  pos | Position to modify, -1 for the path head.
  name | Region name.

void Gtk::WidgetPath::iter_set_name | ( | int | pos,
|  | const Glib::ustring & | name
| ) |  |

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

Since gtkmm 3.0:

Parameters:

  pos | Position to modify, -1 for the path head.
  name | Widget name.

void Gtk::WidgetPath::iter_set_object_type | ( | int | pos,
|  | GType | type
| ) |  |

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

Since gtkmm 3.0:

Parameters:

  pos | Position to modify, -1 for the path head.
  type | Object type to set.

WidgetPath& Gtk::WidgetPath::operator= | ( | const WidgetPath& | other | ) |

int Gtk::WidgetPath::path_append_type | ( | GType | type | ) |

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

Since gtkmm 3.0:

Parameters:

  type | Widget type to append.

Returns:
  The position where the element was inserted.

int Gtk::WidgetPath::path_length | ( |  | ) | const

Returns the number of Gtk::Widget Types between the represented widget and its topmost container.

Since gtkmm 3.0:

Returns:
  The number of elements in the path.

void Gtk::WidgetPath::prepend_type | ( | GType | type | ) |

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

Since gtkmm 3.0:

Parameters:

  type | Widget type to prepend.

void Gtk::WidgetPath::swap | ( | WidgetPath& | other | ) |

## Friends And Related Function Documentation

void swap | ( | WidgetPath& | lhs,
|  | WidgetPath& | rhs
| ) |  | `[related]`

Parameters:

  lhs | The left-hand side
  rhs | The right-hand side

Gtk::WidgetPath wrap | ( | GtkWidgetPath * | object,
|  | bool | take_copy = `false`
| ) |  | `[related]`

A Glib::wrap() method for this object.

Parameters:

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns:
  A C++ instance that wraps this C instance.

## Member Data Documentation

GtkWidgetPath* Gtk::WidgetPath::gobject_`[protected]`

The documentation for this class was generated from the following file:

- gtkmm/widgetpath.h