GtkListItem — Object used to represent items of a list model
gpointer | gtk_list_item_get_item () |
guint | gtk_list_item_get_position () |
GtkWidget * | gtk_list_item_get_child () |
void | gtk_list_item_set_child () |
gboolean | gtk_list_item_get_selected () |
gboolean | gtk_list_item_get_selectable () |
void | gtk_list_item_set_selectable () |
gboolean | gtk_list_item_get_activatable () |
void | gtk_list_item_set_activatable () |
gboolean | activatable | Read / Write |
GtkWidget * | child | Read / Write |
GObject * | item | Read |
guint | position | Read |
gboolean | selectable | Read / Write |
gboolean | selected | Read |
GObject ╰── GtkListItem
#include <gtk/gtk.h>
GtkListItem is the object that list-handling containers such as GtkListView use to represent items in a GListModel. They are managed by the container and cannot be created by application code.
GtkListItems need to be populated by application code. This is done by calling gtk_list_item_set_child()
.
GtkListItems exist in 2 stages:
gpointer
gtk_list_item_get_item (GtkListItem *self
);
Gets the item that is currently displayed in model that self
is currently bound to or NULL
if self
is unbound.
self |
The item displayed.
[nullable][transfer none][type GObject]
guint
gtk_list_item_get_position (GtkListItem *self
);
Gets the position in the model that self
currently displays. If self
is unbound, GTK_INVALID_LIST_POSITION
is returned.
self |
The position of this item
GtkWidget *
gtk_list_item_get_child (GtkListItem *self
);
Gets the child previously set via gtk_list_item_set_child()
or NULL
if none was set.
self |
The child.
[transfer none][nullable]
void gtk_list_item_set_child (GtkListItem *self
,GtkWidget *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.
self | ||
child | The list item's child or | [nullable] |
gboolean
gtk_list_item_get_selected (GtkListItem *self
);
Checks if the item is displayed as selected. The selected state is maintained by the container and its list model and cannot be set otherwise.
self |
TRUE
if the item is selected.
gboolean
gtk_list_item_get_selectable (GtkListItem *self
);
Checks if a list item has been set to be selectable via gtk_list_item_set_selectable()
.
Do not confuse this function with gtk_list_item_get_selected()
.
self |
TRUE
if the item is selectable
void gtk_list_item_set_selectable (GtkListItem *self
,gboolean 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.
self | ||
selectable | if the item should be selectable |
gboolean
gtk_list_item_get_activatable (GtkListItem *self
);
Checks if a list item has been set to be activatable via gtk_list_item_set_activatable()
.
self |
TRUE
if the item is activatable
void gtk_list_item_set_activatable (GtkListItem *self
,gboolean 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 “activate” signal.
By default, list items are activatable
self | ||
activatable | if the item should be activatable |
typedef struct _GtkListItem GtkListItem;
“activatable”
property“activatable” gboolean
If the item can be activated by the user
Owner: GtkListItem
Flags: Read / Write
Default value: TRUE
“child”
property“child” GtkWidget *
Widget used for display
Owner: GtkListItem
Flags: Read / Write
“item”
property“item” GObject *
Displayed item
Owner: GtkListItem
Flags: Read
“position”
property“position” guint
Position of the item
Owner: GtkListItem
Flags: Read
Default value: 4294967295
“selectable”
property“selectable” gboolean
If the item can be selected by the user
Owner: GtkListItem
Flags: Read / Write
Default value: TRUE
“selected”
property“selected” gboolean
If the item is currently selected
Owner: GtkListItem
Flags: Read
Default value: FALSE
GtkListView, GListModel
© 2005–2020 The GNOME Project
Licensed under the GNU Lesser General Public License version 2.1 or later.
https://developer.gnome.org/gtk4/4.0/GtkListItem.html