Gtk.TreeListRow

g GObject.Object GObject.Object Gtk.TreeListRow Gtk.TreeListRow GObject.Object->Gtk.TreeListRow

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

get_child_row (position)

get_children ()

get_depth ()

get_expanded ()

get_item ()

get_parent ()

get_position ()

is_expandable ()

set_expanded (expanded)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

children

Gio.ListModel

r

depth

int

r

expandable

bool

r

expanded

bool

r/w/en

item

GObject.Object

r

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Class Details

class Gtk.TreeListRow(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Gtk.TreeListRowClass

GtkTreeListRow is used by GtkTreeListModel to represent items.

It allows navigating the model as a tree and modify the state of rows.

GtkTreeListRow instances are created by a GtkTreeListModel only when the [property`Gtk`.TreeListModel:passthrough] property is not set.

There are various support objects that can make use of GtkTreeListRow objects, such as the [class`Gtk`.TreeExpander] widget that allows displaying an icon to expand or collapse a row or [class`Gtk`.TreeListRowSorter] that makes it possible to sort trees properly.

get_child_row(position)[source]
Parameters:

position (int) – position of the child to get

Returns:

the child in position

Return type:

Gtk.TreeListRow or None

If self is not expanded or position is greater than the number of children, None is returned.

get_children()[source]
Returns:

The model containing the children

Return type:

Gio.ListModel or None

If the row is expanded, gets the model holding the children of self.

This model is the model created by the [callback`Gtk`.TreeListModelCreateModelFunc] and contains the original items, no matter what value [property`Gtk`.TreeListModel:passthrough] is set to.

get_depth()[source]
Returns:

The depth of this row

Return type:

int

Gets the depth of this row.

Rows that correspond to items in the root model have a depth of zero, rows corresponding to items of models of direct children of the root model have a depth of 1 and so on.

The depth of a row never changes until the row is removed from its model at which point it will forever return 0.

get_expanded()[source]
Returns:

True if the row is expanded

Return type:

bool

Gets if a row is currently expanded.

get_item()[source]
Returns:

The item of this row. This function is only marked as nullable for backwards compatibility reasons.

Return type:

GObject.Object or None

Gets the item corresponding to this row,

get_parent()[source]
Returns:

The parent of self

Return type:

Gtk.TreeListRow or None

Gets the row representing the parent for self.

That is the row that would need to be collapsed to make this row disappear.

If self is a row corresponding to the root model, None is returned.

The value returned by this function never changes until the row is removed from its model at which point it will forever return None.

get_position()[source]
Returns:

The position in the model

Return type:

int

Returns the position in the GtkTreeListModel that self occupies at the moment.

is_expandable()[source]
Returns:

True if the row is expandable

Return type:

bool

Checks if a row can be expanded.

This does not mean that the row is actually expanded, this can be checked with [method`Gtk`.TreeListRow.get_expanded].

If a row is expandable never changes until the row is removed from its model at which point it will forever return False.

set_expanded(expanded)[source]
Parameters:

expanded (bool) – True if the row should be expanded

Expands or collapses a row.

If a row is expanded, the model of calling the [callback`Gtk`.TreeListModelCreateModelFunc] for the row’s item will be inserted after this row. If a row is collapsed, those items will be removed from the model.

If the row is not expandable, this function does nothing.

Property Details

Gtk.TreeListRow.props.children
Name:

children

Type:

Gio.ListModel

Default Value:

None

Flags:

READABLE

The model holding the row’s children.

Gtk.TreeListRow.props.depth
Name:

depth

Type:

int

Default Value:

0

Flags:

READABLE

The depth in the tree of this row.

Gtk.TreeListRow.props.expandable
Name:

expandable

Type:

bool

Default Value:

False

Flags:

READABLE

If this row can ever be expanded.

Gtk.TreeListRow.props.expanded
Name:

expanded

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

If this row is currently expanded.

Gtk.TreeListRow.props.item
Name:

item

Type:

GObject.Object

Default Value:

None

Flags:

READABLE

The item held in this row.