gtkmm 3.24.7
|
This represents a widget hierarchy from the topmost widget, typically a toplevel, to any child. More...
#include <gtkmm/widgetpath.h>
Public Member Functions | |
WidgetPath () | |
WidgetPath (GtkWidgetPath * gobject, bool make_a_copy=true) | |
WidgetPath (const WidgetPath & other) | |
WidgetPath & | operator= (const WidgetPath & other) |
WidgetPath (WidgetPath && other) noexcept | |
WidgetPath & | operator= (WidgetPath && other) noexcept |
~WidgetPath () noexcept | |
void | swap (WidgetPath & other) noexcept |
GtkWidgetPath * | gobj () |
Provides access to the underlying C instance. More... | |
const GtkWidgetPath * | gobj () const |
Provides access to the underlying C instance. More... | |
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. More... | |
Glib::ustring | to_string () const |
Dumps the widget path into a string representation. More... | |
int | path_length () const |
Returns the number of Gtk::Widget Types between the represented widget and its topmost container. More... | |
int | path_append_type (GType type) |
Appends a widget type to the widget hierarchy represented by path. More... | |
void | prepend_type (GType type) |
Prepends a widget type to the widget hierachy represented by path. More... | |
GType | iter_get_object_type (int pos) const |
Returns the object GType that is at position pos in the widget hierarchy defined in path. More... | |
void | iter_set_object_type (int pos, GType type) |
Sets the object type for a given position in the widget hierarchy defined by path. More... | |
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. More... | |
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. More... | |
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. More... | |
WidgetPath | iter_get_siblings (int pos=-1) const |
Returns the list of siblings for the element at pos. More... | |
guint | get_sibling_index (int pos=-1) |
Returns the index into the list of siblings for the element at pos as returned by iter_get_siblings(). More... | |
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. More... | |
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. More... | |
void | iter_clear_classes (int pos=-1) |
Removes all classes from the widget at position pos in the hierarchy defined in path. More... | |
std::vector< Glib::ustring > | iter_list_classes (int pos=-1) const |
Returns a list with all the class names defined for the widget at position pos in the hierarchy defined in path. More... | |
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. More... | |
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. More... | |
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. More... | |
void | iter_clear_regions (int pos=-1) |
Removes all regions from the widget at position pos in the hierarchy defined in path. More... | |
std::vector< Glib::ustring > | iter_list_regions (int pos=-1) const |
Returns a list with all the region names defined for the widget at position pos in the hierarchy defined in path. More... | |
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. More... | |
GType | get_object_type () const |
Returns the topmost object type, that is, the object type this path is representing. More... | |
bool | is_type (GType type) const |
Returns true if the widget type represented by this path is type, or a subtype of it. More... | |
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. More... | |
Static Public Member Functions | |
static GType | get_type () |
Get the GType for this class, for use with the underlying GObject type system. More... | |
Protected Attributes | |
GtkWidgetPath * | gobject_ |
Related Functions | |
(Note that these are not member functions.) | |
void | swap (WidgetPath & lhs, WidgetPath & rhs) noexcept |
Gtk::WidgetPath | wrap (GtkWidgetPath * object, bool take_copy=false) |
A Glib::wrap() method for this object. More... | |
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.
Gtk::WidgetPath::WidgetPath | ( | ) |
|
explicit |
Gtk::WidgetPath::WidgetPath | ( | const WidgetPath & | other | ) |
|
noexcept |
|
noexcept |
GType Gtk::WidgetPath::get_object_type | ( | ) | const |
Returns the topmost object type, that is, the object type this path is representing.
guint Gtk::WidgetPath::get_sibling_index | ( | int | pos = -1 | ) |
Returns the index into the list of siblings for the element at pos as returned by iter_get_siblings().
If that function would return nullptr
because the element at pos has no siblings, this function will return 0.
pos | Position to get the sibling index for, -1 for the path head. |
|
static |
Get the GType for this class, for use with the underlying GObject type system.
|
inline |
Provides access to the underlying C instance.
|
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.
type | Widget type to check in parents. |
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.
type | Widget type to match. |
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().
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().
Region names must only contain lowercase letters and “-”, starting always with a lowercase letter.
Deprecated: 3.14: The use of regions is deprecated.
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 = -1 | ) |
Removes all classes from the widget at position pos in the hierarchy defined in path.
pos | Position to modify, -1 for the path head. |
void Gtk::WidgetPath::iter_clear_regions | ( | int | pos = -1 | ) |
Removes all regions from the widget at position pos in the hierarchy defined in path.
Deprecated: 3.14: The use of regions is deprecated.
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.
pos | Position to get the widget name for, -1 for the path head. |
nullptr
if none was set. GType Gtk::WidgetPath::iter_get_object_type | ( | int | pos | ) | const |
Returns the object GType that is at position pos in the widget hierarchy defined in path.
pos | Position to get the object type for, -1 for the path head. |
WidgetPath Gtk::WidgetPath::iter_get_siblings | ( | int | pos = -1 | ) | const |
Returns the list of siblings for the element at pos.
If the element was not added with siblings, nullptr
is returned.
pos | Position to get the siblings for, -1 for the path head. |
nullptr
or the list of siblings for the element at pos. 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.
pos | Position to query, -1 for the path head. |
name | Class name. |
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.
pos | Position to query, -1 for the path head. |
name | A widget name. |
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.
Deprecated: 3.14: The use of regions is deprecated.
pos | Position to query, -1 for the path head. |
name | Region name. |
flags | Return location for the region flags. |
true
if the class name is defined for the widget at pos. std::vector< Glib::ustring > Gtk::WidgetPath::iter_list_classes | ( | int | pos = -1 | ) | const |
Returns a list with all the class names defined for the widget at position pos in the hierarchy defined in path.
pos | Position to query, -1 for the path head. |
std::vector< Glib::ustring > Gtk::WidgetPath::iter_list_regions | ( | int | pos = -1 | ) | const |
Returns a list with all the region names defined for the widget at position pos in the hierarchy defined in path.
Deprecated: 3.14: The use of regions is deprecated.
pos | Position to query, -1 for the path head. |
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.
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.
Deprecated: 3.14: The use of regions is deprecated.
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.
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.
pos | Position to modify, -1 for the path head. |
type | Object type to set. |
WidgetPath & Gtk::WidgetPath::operator= | ( | const WidgetPath & | other | ) |
|
noexcept |
int Gtk::WidgetPath::path_append_type | ( | GType | type | ) |
Appends a widget type to the widget hierarchy represented by path.
type | Widget type to append. |
int Gtk::WidgetPath::path_length | ( | ) | const |
Returns the number of Gtk::Widget Types between the represented widget and its topmost container.
void Gtk::WidgetPath::prepend_type | ( | GType | type | ) |
Prepends a widget type to the widget hierachy represented by path.
type | Widget type to prepend. |
|
noexcept |
Glib::ustring Gtk::WidgetPath::to_string | ( | ) | const |
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 Glib::print() the path or dump it in a gdb session.
|
related |
lhs | The left-hand side |
rhs | The right-hand side |
|
related |
A Glib::wrap() method for this object.
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. |
|
protected |