Class ListItem
- All Implemented Interfaces:
Proxy
- Direct Known Subclasses:
ColumnViewCell
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 setChild(org.gnome.gtk.Widget).
GtkListItem 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 Gtk.ListItem:item
property is set to NULL.
2. The bound stage where the listitem references an item from the list.
The Gtk.ListItem:item property is not NULL.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classListItem.Builder<B extends ListItem.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static classNested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionListItem()Creates a new ListItem.ListItem(MemorySegment address) Create a ListItem proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected ListItemasParent()Returns this instance as if it were its parent type.static ListItem.Builder<? extends ListItem.Builder> builder()AListItem.Builderobject constructs aListItemwith the specified properties.Gets the accessible description ofself.Gets the accessible label ofself.booleanChecks if a listitem has been set to be activatable viasetActivatable(boolean).@Nullable WidgetgetChild()Gets the child previously set viasetChild(org.gnome.gtk.Widget)orNULLif none was set.booleanChecks if a listitem has been set to be focusable viasetFocusable(boolean).@Nullable GObjectgetItem()Gets the model item that associated withself.intGets the position in the model that this ListItem currently displays.booleanChecks if a listitem has been set to be selectable viasetSelectable(boolean).booleanChecks if the item is displayed as selected.static @Nullable TypegetType()Get the GType of the ListItem classvoidsetAccessibleDescription(String description) Sets the accessible description for the listitem.voidsetAccessibleLabel(String label) Sets the accessible label for the listitem.voidsetActivatable(boolean activatable) Sets this ListItem to be activatable.voidSets the child to be used for this listitem.voidsetFocusable(boolean focusable) Sets this ListItem to be focusable.voidsetSelectable(boolean selectable) Sets this ListItem to be selectable.Methods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getMemoryLayout, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newv, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withPropertiesMethods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
ListItem
Create a ListItem proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
ListItem
public ListItem()Creates a new ListItem.
-
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuperkeyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName(). This will call the native function pointer of this virtual method in the typeclass of the parent type. -
getAccessibleDescription
Gets the accessible description ofself.- Returns:
- the accessible description
- Since:
- 4.12
-
getAccessibleLabel
Gets the accessible label ofself.- Returns:
- the accessible label
- Since:
- 4.12
-
getActivatable
public boolean getActivatable()Checks if a listitem has been set to be activatable viasetActivatable(boolean).- Returns:
- true if the item is activatable
-
getChild
Gets the child previously set viasetChild(org.gnome.gtk.Widget)orNULLif none was set.- Returns:
- The child
-
getFocusable
public boolean getFocusable()Checks if a listitem has been set to be focusable viasetFocusable(boolean).- Returns:
- true if the item is focusable
- Since:
- 4.12
-
getItem
Gets the model item that associated withself.If this ListItem is unbound, this function returns
NULL.- Returns:
- The item displayed
-
getPosition
public int getPosition()Gets the position in the model that this ListItem currently displays.If this ListItem is unbound,
GTK_INVALID_LIST_POSITIONis returned.- Returns:
- The position of this item
-
getSelectable
public boolean getSelectable()Checks if a listitem has been set to be selectable viasetSelectable(boolean).Do not confuse this function with
getSelected().- Returns:
- true if the item is selectable
-
getSelected
public boolean getSelected()Checks if the item is displayed as selected.The selected state is maintained by the list widget and its model and cannot be set otherwise.
- Returns:
- true if the item is selected.
-
setAccessibleDescription
Sets the accessible description for the listitem.The accessible description may be used by e.g. screen readers.
- Parameters:
description- the description- Since:
- 4.12
-
setAccessibleLabel
Sets the accessible label for the listitem.The accessible label may be used by e.g. screen readers.
- Parameters:
label- the label- Since:
- 4.12
-
setActivatable
public void setActivatable(boolean activatable) Sets this ListItem to be activatable.If an item is activatable, double-clicking on the item, using the Return key or calling
Widget#activatewill activate the item. Activating instructs the containing view to handle activation.GtkListViewfor example will be emitting theGtk.ListView::activatesignal.By default, listitems are activatable.
- Parameters:
activatable- if the item should be activatable
-
setChild
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.
- Parameters:
child- The listitem's child orNULLto unset
-
setFocusable
public void setFocusable(boolean focusable) Sets this ListItem to be focusable.If an item is focusable, it can be focused using the keyboard. This works similar to
Widget.setFocusable(boolean).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, listitems are focusable.
- Parameters:
focusable- if the item should be focusable- Since:
- 4.12
-
setSelectable
public void setSelectable(boolean selectable) Sets this ListItem 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, listitems are selectable. When rebinding them to a new item, they will also be reset to be selectable by GTK.
- Parameters:
selectable- if the item should be selectable
-
builder
AListItem.Builderobject constructs aListItemwith the specified properties. Use the variousset...()methods to set properties, and finish construction withListItem.Builder.build().- Returns:
- the builder object
-