GtkTreeExpander

GtkTreeExpander — An indenting expander button for use in a tree list

Includes

#include <gtk/gtk.h>

Description

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.

CSS nodes

1
2
3
4
treeexpander
├── [indent]*
├── [expander]
╰── <child>

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.

Functions

gtk_tree_expander_new ()

GtkWidget *
gtk_tree_expander_new (void);

Creates a new GtkTreeExpander

Returns

a new GtkTreeExpander


gtk_tree_expander_get_child ()

GtkWidget *
gtk_tree_expander_get_child (GtkTreeExpander *self);

Gets the child widget displayed by self .

Parameters

self

a GtkTreeExpander

 

Returns

The child displayed by self .

[nullable][transfer none]


gtk_tree_expander_set_child ()

void
gtk_tree_expander_set_child (GtkTreeExpander *self,
                             GtkWidget *child);

Sets the content widget to display.

Parameters

self

a GtkTreeExpander widget

 

child

a GtkWidget, or NULL.

[nullable]

gtk_tree_expander_get_item ()

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 gtk_tree_list_row_get_item (gtk_tree_expander_get_list_row (@self)).

Parameters

self

a GtkTreeExpander

 

Returns

The item of the row.

[nullable][transfer none]


gtk_tree_expander_get_list_row ()

GtkTreeListRow *
gtk_tree_expander_get_list_row (GtkTreeExpander *self);

Gets the list row managed by self .

Parameters

self

a GtkTreeExpander

 

Returns

The list row displayed by self .

[nullable][transfer none]


gtk_tree_expander_set_list_row ()

void
gtk_tree_expander_set_list_row (GtkTreeExpander *self,
                                GtkTreeListRow *list_row);

Sets the tree list row that this expander should manage.

Parameters

self

a GtkTreeExpander widget

 

list_row

a GtkTreeListRow, or NULL.

[nullable]

See Also

GtkTreeListModel