Class ComboRow
- All Implemented Interfaces:
Accessible,Actionable,Buildable,ConstraintTarget,Proxy
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
Nested ClassesModifier and TypeClassDescriptionstatic classComboRow.Builder<B extends ComboRow.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static classNested classes/interfaces inherited from class org.gnome.adw.ActionRow
ActionRow.ActionRowClass, ActionRow.ActivatedCallbackNested classes/interfaces inherited from class org.gnome.adw.PreferencesRow
PreferencesRow.PreferencesRowClassNested classes/interfaces inherited from class org.gnome.gtk.ListBoxRow
ListBoxRow.ActivateCallback, ListBoxRow.ListBoxRowClassNested 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.Widget$Impl, Widget.WidgetClassNested classes/interfaces inherited from class org.gnome.gobject.InitiallyUnowned
InitiallyUnowned.InitiallyUnownedClassNested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClassNested classes/interfaces inherited from interface org.gnome.gtk.Accessible
Accessible.Accessible$Impl, Accessible.AccessibleInterfaceNested classes/interfaces inherited from interface org.gnome.gtk.Actionable
Actionable.Actionable$Impl, Actionable.ActionableInterfaceNested classes/interfaces inherited from interface org.gnome.gtk.Buildable
Buildable.Buildable$Impl, Buildable.BuildableIfaceNested classes/interfaces inherited from interface org.gnome.gtk.ConstraintTarget
ConstraintTarget.ConstraintTarget$Impl, ConstraintTarget.ConstraintTargetInterface -
Constructor Summary
ConstructorsConstructorDescriptionComboRow()Creates a new ComboRow.ComboRow(MemorySegment address) Create a ComboRow proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected ComboRowasParent()Returns this instance as if it were its parent type.static ComboRow.Builder<? extends ComboRow.Builder> builder()AComboRow.Builderobject constructs aComboRowwith the specified properties.booleanGets whether search is enabled.@Nullable ExpressionGets the expression used to obtain strings from items.@Nullable ListItemFactoryGets the factory for populating list items.@Nullable ListItemFactoryGets the factory that's currently used to create header widgets for the popup.@Nullable ListItemFactoryGets the factory for populating list items in the popup.static MemoryLayoutThe memory layout of the native struct.@Nullable ListModelgetModel()Gets the model that provides the displayed items.Returns the match mode that the search filter is using.intGets the position of the selected item.@Nullable GObjectGets the selected item.static @Nullable TypegetType()Get the GType of the ComboRow classbooleanGets whether to use the current value as the subtitle.voidsetEnableSearch(boolean enableSearch) Sets whether to enable search.voidsetExpression(@Nullable Expression expression) Sets the expression used to obtain strings from items.voidsetFactory(@Nullable ListItemFactory factory) Sets the factory for populating list items.voidsetHeaderFactory(@Nullable ListItemFactory factory) Sets the factory to use for creating header widgets for the popup.voidsetListFactory(@Nullable ListItemFactory factory) Sets the factory for populating list items in the popup.voidSets the model that provides the displayed items.voidsetSearchMatchMode(StringFilterMatchMode searchMatchMode) Sets the match mode for the search filter.voidsetSelected(int position) Selects the item at the given position.voidsetUseSubtitle(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, setTitleLinesMethods inherited from class org.gnome.adw.PreferencesRow
getTitle, getTitleSelectable, getUseMarkup, getUseUnderline, setTitle, setTitleSelectable, setUseMarkup, setUseUnderlineMethods inherited from class org.gnome.gtk.ListBoxRow
changed, emitActivate, getActivatable, getChild, getHeader, getIndex, getSelectable, isSelected, onActivate, setActivatable, setChild, setHeader, setSelectableMethods 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, getLimitEvents, 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, setLimitEvents, 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, unsetStateFlagsMethods 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, 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, hashCodeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.gnome.gtk.Accessible
announce, getAccessibleParent, getAccessibleRole, getAtContext, getBounds, getFirstAccessibleChild, getNextAccessibleSibling, getPlatformState, resetProperty, resetRelation, resetState, setAccessibleParent, updateNextAccessibleSibling, updatePlatformState, updateProperty, updateRelation, updateStateMethods inherited from interface org.gnome.gtk.Actionable
getActionName, getActionTargetValue, setActionName, setActionTarget, setActionTargetValue, setDetailedActionNameMethods 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 new ComboRow.
-
-
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 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. -
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:expressionto be set.- Returns:
- whether the popup includes a search entry
- Since:
- 1.4
-
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
- Since:
- 1.6
-
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
- Since:
- 1.6
-
getSelected
public int getSelected()Gets the position of the selected item.- Returns:
- the position of the selected item, or
Gtk.INVALID_LIST_POSITIONif 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:expressionto be set.- Parameters:
enableSearch- whether to enable search- Since:
- 1.4
-
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:factoryis not set, or whenComboRow:use-subtitleis 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-factoryis 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- Since:
- 1.6
-
setListFactory
Sets the factory for populating list items in the popup.If this is not set,
ComboRow:factoryis 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- Since:
- 1.6
-
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-markupis set toTRUE.- Parameters:
useSubtitle- whether to use the current value as the subtitle
-
builder
AComboRow.Builderobject constructs aComboRowwith the specified properties. Use the variousset...()methods to set properties, and finish construction withComboRow.Builder.build().- Returns:
- the builder object
-