Class ComboBoxText
- All Implemented Interfaces:
Accessible,Buildable,CellEditable,CellLayout,ConstraintTarget,Proxy
GtkComboBoxText is a simple variant of GtkComboBox for text-only
use cases.
GtkComboBoxText hides the model-view complexity of GtkComboBox.
To create a GtkComboBoxText, use ComboBoxText() or
withEntry().
You can add items to a GtkComboBoxText with
appendText(java.lang.String),
insertText(int, java.lang.String) or
prependText(java.lang.String) and remove options with
remove(int).
If the GtkComboBoxText contains an entry (via the
Gtk.ComboBox:has-entry property), its contents can be retrieved
using getActiveText().
You should not call ComboBox.setModel(org.gnome.gtk.TreeModel) or attempt to pack more
cells into this combo box via its CellLayout interface.
GtkComboBoxText as GtkBuildable
The GtkComboBoxText implementation of the GtkBuildable interface supports
adding items directly using the <items> element and specifying <item>
elements for each item. Each <item> element can specify the “id”
corresponding to the appended text and also supports the regular
translation attributes “translatable”, “context” and “comments”.
Here is a UI definition fragment specifying GtkComboBoxText items:
<object class="GtkComboBoxText">
<items>
<item translatable="yes" id="factory">Factory</item>
<item translatable="yes" id="home">Home</item>
<item translatable="yes" id="subway">Subway</item>
</items>
</object>
CSS nodes
combobox
╰── box.linked
├── entry.combo
├── button.combo
╰── window.popup
GtkComboBoxText has a single CSS node with name combobox. It adds
the style class .combo to the main CSS nodes of its entry and button
children, and the .linked class to the node of its internal box.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classComboBoxText.Builder<B extends ComboBoxText.Builder<B>>Deprecated.Inner class implementing a builder pattern to construct a GObject with properties.Nested classes/interfaces inherited from class org.gnome.gtk.ComboBox
ComboBox.ActivateCallback, ComboBox.ChangedCallback, ComboBox.ComboBoxClass, ComboBox.FormatEntryTextCallback, ComboBox.MoveActiveCallback, ComboBox.PopdownCallback, ComboBox.PopupCallbackNested 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.Buildable
Buildable.Buildable$Impl, Buildable.BuildableIfaceNested classes/interfaces inherited from interface org.gnome.gtk.CellEditable
CellEditable.CellEditable$Impl, CellEditable.CellEditableIface, CellEditable.EditingDoneCallback, CellEditable.RemoveWidgetCallbackNested classes/interfaces inherited from interface org.gnome.gtk.CellLayout
CellLayout.CellLayout$Impl, CellLayout.CellLayoutIfaceNested classes/interfaces inherited from interface org.gnome.gtk.ConstraintTarget
ConstraintTarget.ConstraintTarget$Impl, ConstraintTarget.ConstraintTargetInterface -
Field Summary
Fields inherited from class org.javagi.base.ProxyInstance
address -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.Creates a new ComboBoxText.ComboBoxText(MemorySegment address) Deprecated.Create a ComboBoxText proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionvoidDeprecated.UseDropDownvoidappendText(String text) Deprecated.UseDropDownprotected ComboBoxTextasParent()Deprecated.Returns this instance as if it were its parent type.static ComboBoxText.Builder<? extends ComboBoxText.Builder> builder()Deprecated.AComboBoxText.Builderobject constructs aComboBoxTextwith the specified properties.Deprecated.UseDropDownstatic TypegetType()Deprecated.Get the GType of the ComboBoxText classvoidDeprecated.UseDropDownvoidinsertText(int position, String text) Deprecated.UseDropDownvoidDeprecated.UseDropDownvoidprependText(String text) Deprecated.UseDropDownvoidremove(int position) Deprecated.UseDropDownvoidDeprecated.UseDropDownstatic ComboBoxTextDeprecated.UseDropDownMethods inherited from class org.gnome.gtk.ComboBox
activate, changed, emitActivate, emitChanged, emitFormatEntryText, emitMoveActive, emitPopdown, emitPopup, formatEntryText, getActive, getActiveId, getActiveIter, getButtonSensitivity, getChild, getEntryTextColumn, getHasEntry, getIdColumn, getMemoryLayout, getModel, getPopupFixedWidth, getRowSeparatorFunc, onActivate, onChanged, onFormatEntryText, onMoveActive, onPopdown, onPopup, popdown, popup, popupForDevice, setActive, setActiveId, setActiveIter, setButtonSensitivity, setChild, setEntryTextColumn, setIdColumn, setModel, setPopupFixedWidth, setRowSeparatorFunc, withModel, withModelAndEntryMethods 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, 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.Buildable
getBuildableIdMethods inherited from interface org.gnome.gtk.CellEditable
editingDone, emitEditingDone, emitRemoveWidget, onEditingDone, onRemoveWidget, removeWidget, startEditingMethods inherited from interface org.gnome.gtk.CellLayout
addAttribute, clear, clearAttributes, getArea, getCells, packEnd, packStart, reorder, setAttributes, setCellDataFunc
-
Constructor Details
-
ComboBoxText
Deprecated.Create a ComboBoxText proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
ComboBoxText
public ComboBoxText()Deprecated.Creates a new ComboBoxText.
-
-
Method Details
-
getType
-
asParent
Deprecated.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. -
withEntry
Deprecated.UseDropDownCreates a newGtkComboBoxTextwith an entry.- Returns:
- a new
GtkComboBoxText
-
append
Deprecated.UseDropDownAppendstextto the list of strings stored in this ComboBoxText.If
idis non-nullthen it is used as the ID of the row.This is the same as calling
insert(int, java.lang.String, java.lang.String)with a position of -1.- Parameters:
id- a string ID for this valuetext- A string
-
appendText
Deprecated.UseDropDownAppendstextto the list of strings stored in this ComboBoxText.This is the same as calling
insertText(int, java.lang.String)with a position of -1.- Parameters:
text- A string
-
getActiveText
Deprecated.UseDropDownReturns the currently active string in this ComboBoxText.If no row is currently selected,
nullis returned. If this ComboBoxText contains an entry, this function will return its contents (which will not necessarily be an item from the list).- Returns:
- a newly allocated string containing the currently active text. Must be freed with g_free().
-
insert
Deprecated.UseDropDownInsertstextatpositionin the list of strings stored in this ComboBoxText.If
idis non-nullthen it is used as the ID of the row. SeeGtk.ComboBox:id-column.If
positionis negative thentextis appended.- Parameters:
position- An index to inserttextid- a string ID for this valuetext- A string to display
-
insertText
Deprecated.UseDropDownInsertstextatpositionin the list of strings stored in this ComboBoxText.If
positionis negative thentextis appended.This is the same as calling
insert(int, java.lang.String, java.lang.String)with anullID string.- Parameters:
position- An index to inserttexttext- A string
-
prepend
Deprecated.UseDropDownPrependstextto the list of strings stored in this ComboBoxText.If
idis non-nullthen it is used as the ID of the row.This is the same as calling
insert(int, java.lang.String, java.lang.String)with a position of 0.- Parameters:
id- a string ID for this valuetext- a string
-
prependText
Deprecated.UseDropDownPrependstextto the list of strings stored in this ComboBoxText.This is the same as calling
insertText(int, java.lang.String)with a position of 0.- Parameters:
text- A string
-
remove
Deprecated.UseDropDownRemoves the string atpositionfrom this ComboBoxText.- Parameters:
position- Index of the item to remove
-
removeAll
Deprecated.UseDropDownRemoves all the text entries from the combo box. -
builder
Deprecated.AComboBoxText.Builderobject constructs aComboBoxTextwith the specified properties. Use the variousset...()methods to set properties, and finish construction withComboBoxText.Builder.build().
-
DropDownwith aStringListinstead