GtkTreeExpander — An indenting expander button for use in a tree list
GtkWidget * | gtk_tree_expander_new () |
GtkWidget * | gtk_tree_expander_get_child () |
void | gtk_tree_expander_set_child () |
gpointer | gtk_tree_expander_get_item () |
GtkTreeListRow * | gtk_tree_expander_get_list_row () |
void | gtk_tree_expander_set_list_row () |
GtkWidget * | child | Read / Write |
GObject * | item | Read |
GtkTreeListRow * | list-row | Read / Write |
listitem.toggle-expand | ||
listitem.collapse | ||
listitem.expand |
GObject ╰── GInitiallyUnowned ╰── GtkWidget ╰── GtkTreeExpander
GtkTreeExpander implements GtkAccessible, GtkBuildable and GtkConstraintTarget.
#include <gtk/gtk.h>
GtkTreeExpander is a widget that provides an expander for a list.
It is typically placed as a bottommost child into a GtkListView to allow users to expand and collapse children in a list with a GtkTreeListModel. It will provide the common UI elements, gestures and keybindings for this purpose.
On top of this, the "listitem.expand", "listitem.collapse" and "listitem.toggle-expand" actions are provided to allow adding custom UI for managing expanded state.
The GtkTreeListModel must be set to not be passthrough. Then it will provide GtkTreeListRow items which can be set via gtk_tree_expander_set_list_row()
on the expander. The expander will then watch that row item automatically. gtk_tree_expander_set_child()
sets the widget that displays the actual row contents.
GtkTreeExpander has zero or one CSS nodes with the name "expander" that should display the expander icon. The node will be :checked
when it is expanded. If the node is not expandable, an "indent" node will be displayed instead.
For every level of depth, another "indent" node is prepended.
GtkTreeExpander uses the GTK_ACCESSIBLE_ROLE_GROUP
role. The expander icon is represented as a GTK_ACCESSIBLE_ROLE_BUTTON
, labelled by the expander's child, and toggling it will change the GTK_ACCESSIBLE_STATE_EXPANDED
state.
GtkWidget *
gtk_tree_expander_new (void
);
Creates a new GtkTreeExpander
a new GtkTreeExpander
GtkWidget *
gtk_tree_expander_get_child (GtkTreeExpander *self
);
Gets the child widget displayed by self
.
self |
The child displayed by self
.
[nullable][transfer none]
void gtk_tree_expander_set_child (GtkTreeExpander *self
,GtkWidget *child
);
Sets the content widget to display.
self | a GtkTreeExpander widget | |
child | a GtkWidget, or | [nullable] |
gpointer
gtk_tree_expander_get_item (GtkTreeExpander *self
);
Forwards the item set on the GtkTreeListRow that self
is managing.
This call is essentially equivalent to calling:
treeexpander ├── [indent]* ├── [expander] ╰── <child>
self |
The item of the row.
[nullable][transfer full][type GObject]
GtkTreeListRow *
gtk_tree_expander_get_list_row (GtkTreeExpander *self
);
Gets the list row managed by self
.
self |
The list row displayed by self
.
[nullable][transfer none]
void gtk_tree_expander_set_list_row (GtkTreeExpander *self
,GtkTreeListRow *list_row
);
Sets the tree list row that this expander should manage.
self | a GtkTreeExpander widget | |
list_row | a GtkTreeListRow, or | [nullable] |
typedef struct _GtkTreeExpander GtkTreeExpander;
“child”
property“child” GtkWidget *
The child widget with the actual contents
Owner: GtkTreeExpander
Flags: Read / Write
“item”
property“item” GObject *
The item held by this expander's row
Owner: GtkTreeExpander
Flags: Read
“list-row”
property“list-row” GtkTreeListRow *
The list row to track for expander state
Owner: GtkTreeExpander
Flags: Read / Write
“listitem.toggle-expand”
actionTries to expand the expander if it was collapsed or collapses it if it was expanded.
“listitem.collapse”
actionCollapses the expander.
“listitem.expand”
actionExpands the expander if it can be expanded.
© 2005–2020 The GNOME Project
Licensed under the GNU Lesser General Public License version 2.1 or later.
https://developer.gnome.org/gtk4/4.0/GtkTreeExpander.html