Skip to content

Gtk.ListHeader

class — extends GObject.Object

Used by list widgets to represent the headers they display.

GtkListHeader objects are managed just like ListItem objects via their factory, but provide a different set of properties suitable for managing the header instead of individual items.

Methods

get_child

def get_child(self) -> Widget | None

Gets the child previously set via ListHeader.set_child or None if none was set.

get_end

def get_end(self) -> int

Gets the end position in the model of the section that self is currently the header for.

If self is unbound, INVALID_LIST_POSITION is returned.

get_item

def get_item(self) -> GObject.Object | None

Gets the model item at the start of the section. This is the item that occupies the list model at position ListHeader.start.

If self is unbound, this function returns None.

get_n_items

def get_n_items(self) -> int

Gets the the number of items in the section.

If self is unbound, 0 is returned.

get_start

def get_start(self) -> int

Gets the start position in the model of the section that self is currently the header for.

If self is unbound, INVALID_LIST_POSITION is returned.

set_child

def set_child(self, child: Widget | None = ...) -> None

Sets the child to be used for this listitem.

This function is typically called by applications when setting up a header so that the widget can be reused when binding it multiple times.

Parameters:

  • child — The list item's child or None to unset

Properties

child

child: Widget  # read/write

Widget used for display.

end

end: int  # read-only

The first position no longer part of this section.

item

item: GObject.Object  # read-only

The item at the start of the section.

n_items

n_items: int  # read-only

Number of items in this section.

start

start: int  # read-only

First position of items in this section.