Top |
Functions
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 () |
Properties
gboolean | activatable | Read / Write |
GtkWidget * | child | Read / Write |
GObject * | item | Read |
guint | position | Read |
gboolean | selectable | Read / Write |
gboolean | selected | Read |
Description
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:
Functions
gtk_list_item_get_item ()
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.
gtk_list_item_get_position ()
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.
gtk_list_item_get_child ()
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.
gtk_list_item_set_child ()
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.
gtk_list_item_get_selected ()
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.
gtk_list_item_get_selectable ()
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()
.
gtk_list_item_set_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.
gtk_list_item_get_activatable ()
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()
.
gtk_list_item_set_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
Property Details
The “activatable”
property
“activatable” gboolean
If the item can be activated by the user
Owner: GtkListItem
Flags: Read / Write
Default value: TRUE
The “child”
property
“child” GtkWidget *
Widget used for display
Owner: GtkListItem
Flags: Read / Write
The “position”
property
“position” guint
Position of the item
Owner: GtkListItem
Flags: Read
Default value: 4294967295
The “selectable”
property
“selectable” gboolean
If the item can be selected by the user
Owner: GtkListItem
Flags: Read / Write
Default value: TRUE