Class ComboBox.Builder<B extends ComboBox.Builder<B>>
- Type Parameters:
B
- the type of the Builder that is returned
- All Implemented Interfaces:
BuilderInterface
,Accessible.Builder<B>
,CellEditable.Builder<B>
- Direct Known Subclasses:
ComboBoxText.Builder
- Enclosing class:
ComboBox
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Finish building theComboBox
object.onActivate
(ComboBox.ActivateCallback handler) Emitted to when the combo box is activated.onChanged
(ComboBox.ChangedCallback handler) Emitted when the active item is changed.Emitted to allow changing how the text in a combo box's entry is displayed.onMoveActive
(ComboBox.MoveActiveCallback handler) Emitted to move the active selection.onPopdown
(ComboBox.PopdownCallback handler) Emitted to popdown the combo box list.onPopup
(ComboBox.PopupCallback handler) Emitted to popup the combo box list.setActive
(int active) The item which is currently active.setActiveId
(String activeId) The value of the ID column of the active row.setButtonSensitivity
(SensitivityType buttonSensitivity) Whether the dropdown button is sensitive when the model is empty.The child widget.setEntryTextColumn
(int entryTextColumn) The model column to associate with strings from the entry.setHasEntry
(boolean hasEntry) Whether the combo box has an entry.setHasFrame
(boolean hasFrame) Thehas-frame
property controls whether a frame is drawn around the entry.setIdColumn
(int idColumn) The model column that provides string IDs for the values in the model, if != -1.The model from which the combo box takes its values.setPopupFixedWidth
(boolean popupFixedWidth) Whether the popup's width should be a fixed width matching the allocated width of the combo box.Methods inherited from class org.gnome.gtk.Widget.Builder
onDestroy, onDirectionChanged, onHide, onKeynavFailed, onMap, onMnemonicActivate, onMoveFocus, onQueryTooltip, onRealize, onShow, onStateFlagsChanged, onUnmap, onUnrealize, setCanFocus, setCanTarget, setCssClasses, setCssName, setCursor, setFocusable, setFocusOnClick, setHalign, setHasTooltip, setHeightRequest, setHexpand, setHexpandSet, setLayoutManager, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setOpacity, setOverflow, setReceivesDefault, setSensitive, setTooltipMarkup, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible, setWidthRequest
Methods inherited from class org.gnome.gobject.GObject.Builder
onNotify
Methods inherited from class io.github.jwharm.javagi.gobject.Builder
addBuilderProperty, connect, connect, connectSignals, getArena, getNames, getValues
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.gnome.gtk.Accessible.Builder
setAccessibleRole
Methods inherited from interface io.github.jwharm.javagi.gobject.BuilderInterface
addBuilderProperty, connect, connect, getArena
Methods inherited from interface org.gnome.gtk.CellEditable.Builder
setEditingCanceled
-
Constructor Details
-
Builder
protected Builder()Default constructor for aBuilder
object.
-
-
Method Details
-
build
Finish building theComboBox
object. This will callGObject.withProperties(org.gnome.glib.Type, java.lang.String[], org.gnome.gobject.Value[])
to create a new GObject instance, which is then cast toComboBox
.- Overrides:
build
in classWidget.Builder<B extends ComboBox.Builder<B>>
- Returns:
- a new instance of
ComboBox
with the properties that were set in the Builder object.
-
setActive
The item which is currently active.If the model is a non-flat treemodel, and the active item is not an immediate child of the root of the tree, this property has the value
gtk_tree_path_get_indices (path)[0]
, wherepath
is theGtk.TreePath
of the active item.- Parameters:
active
- the value for theactive
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setActiveId
-
setButtonSensitivity
Whether the dropdown button is sensitive when the model is empty.- Parameters:
buttonSensitivity
- the value for thebutton-sensitivity
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setChild
-
setEntryTextColumn
The model column to associate with strings from the entry.This is property only relevant if the combo was created with
Gtk.ComboBox:has-entry
istrue
.- Parameters:
entryTextColumn
- the value for theentry-text-column
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setHasEntry
Whether the combo box has an entry.- Parameters:
hasEntry
- the value for thehas-entry
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setHasFrame
Thehas-frame
property controls whether a frame is drawn around the entry.- Parameters:
hasFrame
- the value for thehas-frame
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setIdColumn
The model column that provides string IDs for the values in the model, if != -1.- Parameters:
idColumn
- the value for theid-column
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setModel
-
setPopupFixedWidth
Whether the popup's width should be a fixed width matching the allocated width of the combo box.- Parameters:
popupFixedWidth
- the value for thepopup-fixed-width
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
onActivate
Emitted to when the combo box is activated.The
::activate
signal onGtkComboBox
is an action signal and emitting it causes the combo box to pop up its dropdown.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onChanged
Emitted when the active item is changed.The can be due to the user selecting a different item from the list, or due to a call to
ComboBox.setActiveIter(org.gnome.gtk.TreeIter)
. It will also be emitted while typing into the entry of a combo box with an entry.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onFormatEntryText
Emitted to allow changing how the text in a combo box's entry is displayed.See
Gtk.ComboBox:has-entry
.Connect a signal handler which returns an allocated string representing
path
. That string will then be used to set the text in the combo box's entry. The default signal handler uses the text from theGtk.ComboBox:entry-text-column
model column.Here's an example signal handler which fetches data from the model and displays it in the entry.
static char * format_entry_text_callback (GtkComboBox *combo, const char *path, gpointer user_data) { GtkTreeIter iter; GtkTreeModel model; double value; model = gtk_combo_box_get_model (combo); gtk_tree_model_get_iter_from_string (model, &iter, path); gtk_tree_model_get (model, &iter, THE_DOUBLE_VALUE_COLUMN, &value, -1); return g_strdup_printf ("%g", value); }
- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onMoveActive
Emitted to move the active selection.This is an keybinding signal.
- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onPopdown
Emitted to popdown the combo box list.This is an keybinding signal.
The default bindings for this signal are Alt+Up and Escape.
- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onPopup
Emitted to popup the combo box list.This is an keybinding signal.
The default binding for this signal is Alt+Down.
- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-