Gtk.ListItem¶
- Subclasses:
Methods¶
- Inherited:
- Structs:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/en |
|||
r/en |
|||
r/w/en |
|||
r/en |
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class Gtk.ListItem(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
GtkListItem
is used by list widgets to represent items in a [iface`Gio`.ListModel].GtkListItem
objects are managed by the list widget (with its factory) and cannot be created by applications, but they need to be populated by application code. This is done by calling [method`Gtk`.ListItem.set_child].GtkListItem
objects exist in 2 stages:The unbound stage where the listitem is not currently connected to an item in the list. In that case, the [property`Gtk`.ListItem:item] property is set to
None
.The bound stage where the listitem references an item from the list. The [property`Gtk`.ListItem:item] property is not
None
.- get_accessible_description()[source]¶
- Returns:
the accessible description
- Return type:
Gets the accessible description of self.
New in version 4.12.
- get_accessible_label()[source]¶
- Returns:
the accessible label
- Return type:
Gets the accessible label of self.
New in version 4.12.
- get_activatable()[source]¶
-
Checks if a list item has been set to be activatable via
Gtk.ListItem.set_activatable
().
- get_child()[source]¶
- Returns:
The child
- Return type:
Gtk.Widget
orNone
Gets the child previously set via
Gtk.ListItem.set_child
() orNone
if none was set.
- get_focusable()[source]¶
-
Checks if a list item has been set to be focusable via
Gtk.ListItem.set_focusable
().New in version 4.12.
- get_item()[source]¶
- Returns:
The item displayed
- Return type:
Gets the model item that associated with self.
If self is unbound, this function returns
None
.
- get_position()[source]¶
- Returns:
The position of this item
- Return type:
Gets the position in the model that self currently displays.
If self is unbound,
Gtk.INVALID_LIST_POSITION
is returned.
- get_selectable()[source]¶
-
Checks if a list item has been set to be selectable via
Gtk.ListItem.set_selectable
().Do not confuse this function with [method`Gtk`.ListItem.get_selected].
- get_selected()[source]¶
-
Checks if the item is displayed as selected.
The selected state is maintained by the liste widget and its model and cannot be set otherwise.
- set_accessible_description(description)[source]¶
- Parameters:
description (
str
) – the description
Sets the accessible description for the list item, which may be used by e.g. screen readers.
New in version 4.12.
- set_accessible_label(label)[source]¶
- Parameters:
label (
str
) – the label
Sets the accessible label for the list item, which may be used by e.g. screen readers.
New in version 4.12.
- set_activatable(activatable)[source]¶
- Parameters:
activatable (
bool
) – if the item should be activatable
Sets self to be activatable.
If an item is activatable, double-clicking on the item, using the Return key or calling
Gtk.Widget.activate
() will activate the item. Activating instructs the containing view to handle activation.GtkListView
for example will be emitting the [signal`Gtk`.ListView::activate] signal.By default, list items are activatable.
- set_child(child)[source]¶
- Parameters:
child (
Gtk.Widget
orNone
) – The list item’s child orNone
to unset
Sets the child to be used for this listitem.
This function is typically called by applications when setting up a listitem so that the widget can be reused when binding it multiple times.
- set_focusable(focusable)[source]¶
- Parameters:
focusable (
bool
) – if the item should be focusable
Sets self to be focusable.
If an item is focusable, it can be focused using the keyboard. This works similar to [method`Gtk`.Widget.set_focusable].
Note that if items are not focusable, the keyboard cannot be used to activate them and selecting only works if one of the listitem’s children is focusable.
By default, list items are focusable.
New in version 4.12.
- set_selectable(selectable)[source]¶
- Parameters:
selectable (
bool
) – if the item should be selectable
Sets self to be selectable.
If an item is selectable, clicking on the item or using the keyboard will try to select or unselect the item. If this succeeds is up to the model to determine, as it is managing the selected state.
Note that this means that making an item non-selectable has no influence on the selected state at all. A non-selectable item may still be selected.
By default, list items are selectable. When rebinding them to a new item, they will also be reset to be selectable by GTK.
Property Details¶
- Gtk.ListItem.props.accessible_description¶
- Name:
accessible-description
- Type:
- Default Value:
- Flags:
The accessible description to set on the list item.
New in version 4.12.
- Gtk.ListItem.props.accessible_label¶
- Name:
accessible-label
- Type:
- Default Value:
- Flags:
The accessible label to set on the list item.
New in version 4.12.
- Gtk.ListItem.props.activatable¶
- Name:
activatable
- Type:
- Default Value:
- Flags:
If the item can be activated by the user.
- Gtk.ListItem.props.child¶
- Name:
child
- Type:
- Default Value:
- Flags:
Widget used for display.
- Gtk.ListItem.props.focusable¶
- Name:
focusable
- Type:
- Default Value:
- Flags:
If the item can be focused with the keyboard.
New in version 4.12.
- Gtk.ListItem.props.item¶
- Name:
item
- Type:
- Default Value:
- Flags:
Displayed item.
- Gtk.ListItem.props.position¶
- Name:
position
- Type:
- Default Value:
4294967295
- Flags:
Position of the item.
- Gtk.ListItem.props.selectable¶
- Name:
selectable
- Type:
- Default Value:
- Flags:
If the item can be selected by the user.
- Gtk.ListItem.props.selected¶
- Name:
selected
- Type:
- Default Value:
- Flags:
If the item is currently selected.