About my projects, examples and tutorials
Gnome::Gtk4::ListItem

Gnome::Gtk4::ListItem

Description§

Gnome::Gtk4::ListItem is used by list widgets to represent items in a /content-docs/api2/reference/Gnome::Gtk4::ListItem.

Gnome::Gtk4::ListItem 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 .set-child().

Gnome::Gtk4::ListItem objects exist in 2 stages:

1. The unbound stage where the listitem is not currently connected to an item in the list. In that case, the item property is set to undefined.

2. The bound stage where the listitem references an item from the list. The item property is defined.

Uml Diagram§

UNKNOWN image§

=for image :class<inline> :src<asset_files/images/plantuml/ListItem.png> :width<70\%>

Class initialization§

new§

:native-object§

Create an object using a native object from an object of the same type found elsewhere. See also Gnome::N::TopLevelSupportClass.

multi method new ( N-Object() :$native-object! )
Code

Methods§

get-accessible-description§

Gets the accessible description of $self.

method get-accessible-description (--> Str )
Code

Return value; the accessible description.

get-accessible-label§

Gets the accessible label of $self.

method get-accessible-label (--> Str )
Code

Return value; the accessible label.

get-activatable§

Checks if a list item has been set to be activatable via .set-activatable().

method get-activatable (--> Bool )
Code

Return value; True if the item is activatable.

get-child§

Gets the child previously set via .set-child() or undefined if none was set.

method get-child (--> N-Object )
Code

Return value; The child.

get-focusable§

Checks if a list item has been set to be focusable via .set-focusable().

method get-focusable (--> Bool )
Code

Return value; True if the item is focusable.

get-item§

Gets the model item that associated with $self.

If $self is unbound, this function returns undefined.

method get-item (--> gpointer )
Code

Return value; The item displayed.

get-position§

Gets the position in the model that $self currently displays.

If $self is unbound, GTK_INVALID_LIST_POSITION is returned.

method get-position (--> UInt )
Code

Return value; The position of this item.

get-selectable§

Checks if a list item has been set to be selectable via .set-selectable().

Do not confuse this function with .get-selected().

method get-selectable (--> Bool )
Code

Return value; True if the item is selectable.

get-selected§

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.

method get-selected (--> Bool )
Code

Return value; True if the item is selected..

set-accessible-description§

Sets the accessible description for the list item, which may be used by e.g. screen readers.

method set-accessible-description ( Str $description )
Code
  • $description; the description.

set-accessible-label§

Sets the accessible label for the list item, which may be used by e.g. screen readers.

method set-accessible-label ( Str $label )
Code
  • $label; the label.

set-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. Gnome::Gtk4::ListView for example will be emitting the activate defined in ListView signal.

By default, list items are activatable.

method set-activatable ( Bool() $activatable )
Code
  • $activatable; if the item should be activatable.

set-child§

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.

method set-child ( N-Object() $child )
Code
  • $child; The list item's child or undefined to unset.

set-focusable§

Sets $self to be focusable.

If an item is focusable, it can be focused using the keyboard. This works similar to .set-focusable() in class Widget.

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.

method set-focusable ( Bool() $focusable )
Code
  • $focusable; if the item should be focusable.

set-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.

method set-selectable ( Bool() $selectable )
Code
  • $selectable; if the item should be selectable.