Class ComboRow
- All Implemented Interfaces:
Proxy
,Accessible
,Actionable
,Buildable
,ConstraintTarget
ListBoxRow
used to choose from a list of items.
The AdwComboRow
widget allows the user to choose from a list of valid
choices. The row displays the selected choice. When activated, the row
displays a popover which allows the user to make a new choice.
Example of an AdwComboRow
UI definition:
<object class="AdwComboRow">
<property name="title" translatable="yes">Combo Row</property>
<property name="model">
<object class="GtkStringList">
<items>
<item translatable="yes">Foo</item>
<item translatable="yes">Bar</item>
<item translatable="yes">Baz</item>
</items>
</object>
</property>
</object>
The ComboRow:selected
and ComboRow:selected-item
properties can be used to keep track of the selected item and react to their
changes.
AdwComboRow
mirrors DropDown
, see that widget for details.
AdwComboRow
is Gtk.ListBoxRow:activatable
if a model is set.
CSS nodes
AdwComboRow
has a main CSS node with name row
and the .combo
style
class.
Its popover has the node named popover
with the .menu
style class, it
contains a ScrolledWindow
, which in turn contains a
ListView
, both are accessible via their regular nodes.
Accessibility
AdwComboRow
uses the GTK_ACCESSIBLE_ROLE_COMBO_BOX
role.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
ComboRow.Builder<B extends ComboRow.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static class
Nested classes/interfaces inherited from class org.gnome.adw.ActionRow
ActionRow.ActionRowClass, ActionRow.ActivatedCallback
Nested classes/interfaces inherited from class org.gnome.adw.PreferencesRow
PreferencesRow.PreferencesRowClass
Nested classes/interfaces inherited from class org.gnome.gtk.ListBoxRow
ListBoxRow.ActivateCallback, ListBoxRow.ListBoxRowClass
Nested classes/interfaces inherited from class org.gnome.gtk.Widget
Widget.DestroyCallback, Widget.DirectionChangedCallback, Widget.HideCallback, Widget.KeynavFailedCallback, Widget.MapCallback, Widget.MnemonicActivateCallback, Widget.MoveFocusCallback, Widget.QueryTooltipCallback, Widget.RealizeCallback, Widget.ShowCallback, Widget.StateFlagsChangedCallback, Widget.UnmapCallback, Widget.UnrealizeCallback, Widget.WidgetClass, Widget.WidgetImpl
Nested classes/interfaces inherited from class org.gnome.gobject.InitiallyUnowned
InitiallyUnowned.InitiallyUnownedClass
Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
Nested classes/interfaces inherited from interface org.gnome.gtk.Accessible
Accessible.AccessibleImpl, Accessible.AccessibleInterface
Nested classes/interfaces inherited from interface org.gnome.gtk.Actionable
Actionable.ActionableImpl, Actionable.ActionableInterface
Nested classes/interfaces inherited from interface org.gnome.gtk.Buildable
Buildable.BuildableIface, Buildable.BuildableImpl
Nested classes/interfaces inherited from interface org.gnome.gtk.ConstraintTarget
ConstraintTarget.ConstraintTargetImpl, ConstraintTarget.ConstraintTargetInterface
-
Constructor Summary
ConstructorDescriptionComboRow()
Creates a newAdwComboRow
.ComboRow
(MemorySegment address) Create a ComboRow proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected ComboRow
asParent()
Returns this instance as if it were its parent type.static ComboRow.Builder
<? extends ComboRow.Builder> builder()
AComboRow.Builder
object constructs aComboRow
with the specified properties.boolean
Gets whether search is enabled.Gets the expression used to obtain strings from items.Gets the factory for populating list items.Gets the factory that's currently used to create header widgets for the popup.Gets the factory for populating list items in the popup.static MemoryLayout
The memory layout of the native struct.getModel()
Gets the model that provides the displayed items.Returns the match mode that the search filter is using.int
Gets the position of the selected item.Gets the selected item.static Type
getType()
Get the GType of the ComboRow classboolean
Gets whether to use the current value as the subtitle.void
setEnableSearch
(boolean enableSearch) Sets whether to enable search.void
setExpression
(@Nullable Expression expression) Sets the expression used to obtain strings from items.void
setFactory
(@Nullable ListItemFactory factory) Sets the factory for populating list items.void
setHeaderFactory
(@Nullable ListItemFactory factory) Sets the factory to use for creating header widgets for the popup.void
setListFactory
(@Nullable ListItemFactory factory) Sets the factory for populating list items in the popup.void
Sets the model that provides the displayed items.void
setSearchMatchMode
(StringFilterMatchMode searchMatchMode) Sets the match mode for the search filter.void
setSelected
(int position) Selects the item at the given position.void
setUseSubtitle
(boolean useSubtitle) Sets whether to use the current value as the subtitle.Methods inherited from class org.gnome.adw.ActionRow
activate, addPrefix, addSuffix, emitActivated, getActivatableWidget, getIconName, getSubtitle, getSubtitleLines, getSubtitleSelectable, getTitleLines, onActivated, remove, setActivatableWidget, setIconName, setSubtitle, setSubtitleLines, setSubtitleSelectable, setTitleLines
Methods inherited from class org.gnome.adw.PreferencesRow
getTitle, getTitleSelectable, getUseMarkup, getUseUnderline, setTitle, setTitleSelectable, setUseMarkup, setUseUnderline
Methods inherited from class org.gnome.gtk.ListBoxRow
changed, emitActivate, getActivatable, getChild, getHeader, getIndex, getSelectable, isSelected, onActivate, setActivatable, setChild, setHeader, setSelectable
Methods inherited from class org.gnome.gtk.Widget
actionSetEnabled, activateActionIfExists, activateDefault, activateWidget, addController, addCssClass, addMnemonicLabel, addTickCallback, allocate, childFocus, computeBounds, computeExpand, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, cssChanged, directionChanged, disposeTemplate, dragCheckThreshold, emitDestroy, emitDirectionChanged, emitHide, emitKeynavFailed, emitMap, emitMnemonicActivate, emitMoveFocus, emitQueryTooltip, emitRealize, emitShow, emitStateFlagsChanged, emitUnmap, emitUnrealize, errorBell, focus, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getBaseline, getCanFocus, getCanTarget, getChildVisible, getClipboard, getColor, getCssClasses, getCssName, getCursor, getDefaultDirection, getDirection, getDisplay, getFirstChild, getFocusable, getFocusChild, getFocusOnClick, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getLastChild, getLayoutManager, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getName, getNative, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPreferredSize, getPrevSibling, getPrimaryClipboard, getRealized, getReceivesDefault, getRequestMode, getRoot, getScaleFactor, getSensitive, getSettings, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTooltipMarkup, getTooltipText, getValign, getVexpand, getVexpandSet, getVisible, getWidth, grabFocus, hasCssClass, hasDefault, hasFocus, hasVisibleFocus, hide, inDestruction, initTemplate, insertActionGroup, insertAfter, insertBefore, isAncestor, isDrawable, isFocus, isSensitive, isVisible, keynavFailed, listMnemonicLabels, map, measure, mnemonicActivate, moveFocus, observeChildren, observeControllers, onDestroy, onDirectionChanged, onHide, onKeynavFailed, onMap, onMnemonicActivate, onMoveFocus, onQueryTooltip, onRealize, onShow, onStateFlagsChanged, onUnmap, onUnrealize, pick, pick, queryTooltip, queueAllocate, queueDraw, queueResize, realize, removeController, removeCssClass, removeMnemonicLabel, removeTickCallback, root, setCanFocus, setCanTarget, setChildVisible, setCssClasses, setCursor, setCursorFromName, setDefaultDirection, setDirection, setFocusable, setFocusChild, setFocusOnClick, setFontMap, setFontOptions, setHalign, setHasTooltip, setHexpand, setHexpandSet, setLayoutManager, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setOpacity, setOverflow, setParent, setReceivesDefault, setSensitive, setSizeRequest, setStateFlags, setStateFlags, setTooltipMarkup, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible, shouldLayout, show, sizeAllocate, sizeAllocate, snapshot, snapshotChild, stateFlagsChanged, systemSettingChanged, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unroot, unsetStateFlags, unsetStateFlags
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, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, 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, withProperties
Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClass
Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.gnome.gtk.Accessible
announce, getAccessibleParent, getAccessibleRole, getAtContext, getBounds, getFirstAccessibleChild, getNextAccessibleSibling, getPlatformState, resetProperty, resetRelation, resetState, setAccessibleParent, updateNextAccessibleSibling, updateProperty, updateRelation, updateState
Methods inherited from interface org.gnome.gtk.Actionable
getActionName, getActionTargetValue, setActionName, setActionTarget, setActionTargetValue, setDetailedActionName
Methods inherited from interface org.gnome.gtk.Buildable
getBuildableId
-
Constructor Details
-
ComboRow
Create a ComboRow proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
ComboRow
public ComboRow()Creates a newAdwComboRow
.
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuper
keyword, 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. -
getEnableSearch
public boolean getEnableSearch()Gets whether search is enabled.If set to
TRUE
, a search entry will be shown in the popup that allows to search for items in the list.Search requires
ComboRow:expression
to be set.- Returns:
- whether the popup includes a search entry
-
getExpression
Gets the expression used to obtain strings from items.- Returns:
- the expression used to obtain strings from items
-
getFactory
Gets the factory for populating list items.- Returns:
- the factory in use
-
getHeaderFactory
Gets the factory that's currently used to create header widgets for the popup.- Returns:
- The factory in use
-
getListFactory
Gets the factory for populating list items in the popup.- Returns:
- the factory in use
-
getModel
Gets the model that provides the displayed items.- Returns:
- The model in use
-
getSearchMatchMode
Returns the match mode that the search filter is using.- Returns:
- the match mode of the search filter
-
getSelected
public int getSelected()Gets the position of the selected item.- Returns:
- the position of the selected item, or
Gtk.INVALID_LIST_POSITION
if no item is selected
-
getSelectedItem
-
getUseSubtitle
public boolean getUseSubtitle()Gets whether to use the current value as the subtitle.- Returns:
- whether to use the current value as the subtitle
-
setEnableSearch
public void setEnableSearch(boolean enableSearch) Sets whether to enable search.If set to
TRUE
, a search entry will be shown in the popup that allows to search for items in the list.Search requires
ComboRow:expression
to be set.- Parameters:
enableSearch
- whether to enable search
-
setExpression
Sets the expression used to obtain strings from items.The expression must have a value type of
G_TYPE_STRING
.It's used to bind strings to labels produced by the default factory if
ComboRow:factory
is not set, or whenComboRow:use-subtitle
is set toTRUE
.- Parameters:
expression
- an expression
-
setFactory
Sets the factory for populating list items.This factory is always used for the item in the row. It is also used for items in the popup unless
ComboRow:list-factory
is set.- Parameters:
factory
- the factory to use
-
setHeaderFactory
Sets the factory to use for creating header widgets for the popup.- Parameters:
factory
- the factory to use
-
setListFactory
Sets the factory for populating list items in the popup.If this is not set,
ComboRow:factory
is used.- Parameters:
factory
- the factory to use
-
setModel
Sets the model that provides the displayed items.- Parameters:
model
- the model to use
-
setSearchMatchMode
Sets the match mode for the search filter.- Parameters:
searchMatchMode
- the new match mode
-
setSelected
public void setSelected(int position) Selects the item at the given position.- Parameters:
position
- the position of the item to select, orGtk.INVALID_LIST_POSITION
-
setUseSubtitle
public void setUseSubtitle(boolean useSubtitle) Sets whether to use the current value as the subtitle.If you use a custom list item factory, you will need to give the row a name conversion expression with
ComboRow:expression
.If set to
TRUE
, you should not accessActionRow:subtitle
.The subtitle is interpreted as Pango markup if
PreferencesRow:use-markup
is set toTRUE
.- Parameters:
useSubtitle
- whether to use the current value as the subtitle
-
builder
AComboRow.Builder
object constructs aComboRow
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withComboRow.Builder.build()
.
-