Description Methods and Functions Hierarchy Interfaces Detailed Description Structures Convenient Construction Signals Properties Style Properties Author(s) References See Also
A widget used to choose from a list of items
gtkComboBoxNew(show = TRUE)
gtkComboBoxNewWithModel(model, show = TRUE)
gtkComboBoxGetWrapWidth(object)
gtkComboBoxSetWrapWidth(object, width)
gtkComboBoxGetRowSpanColumn(object)
gtkComboBoxSetRowSpanColumn(object, row.span)
gtkComboBoxGetColumnSpanColumn(object)
gtkComboBoxSetColumnSpanColumn(object, column.span)
gtkComboBoxGetActive(object)
gtkComboBoxSetActive(object, index)
gtkComboBoxGetActiveIter(object)
gtkComboBoxSetActiveIter(object, iter)
gtkComboBoxGetModel(object)
gtkComboBoxSetModel(object, model = NULL)
gtkComboBoxNewText(show = TRUE)
gtkComboBoxAppendText(object, text)
gtkComboBoxInsertText(object, position, text)
gtkComboBoxPrependText(object, text)
gtkComboBoxRemoveText(object, position)
gtkComboBoxGetActiveText(object)
gtkComboBoxPopup(object)
gtkComboBoxPopdown(object)
gtkComboBoxGetPopupAccessible(object)
gtkComboBoxGetRowSeparatorFunc(object)
gtkComboBoxSetRowSeparatorFunc(object, func, data = NULL)
gtkComboBoxSetAddTearoffs(object, add.tearoffs)
gtkComboBoxGetAddTearoffs(object)
gtkComboBoxSetTitle(object, title)
gtkComboBoxGetTitle(object)
gtkComboBoxSetFocusOnClick(object, focus.on.click)
gtkComboBoxGetFocusOnClick(object)
gtkComboBoxSetButtonSensitivity(object, sensitivity)
gtkComboBoxGetButtonSensitivity(object)
gtkComboBox(model, show = TRUE)
1 2 3 4 5 6 7 8 | GObject
+----GInitiallyUnowned
+----GtkObject
+----GtkWidget
+----GtkContainer
+----GtkBin
+----GtkComboBox
+----GtkComboBoxEntry
|
GtkComboBox implements
AtkImplementorIface, GtkBuildable
, GtkCellLayout
and GtkCellEditable
.
A GtkComboBox
is a widget that allows the user to choose from a
list of valid choices. The GtkComboBox
displays the selected
choice. When activated, the GtkComboBox
displays a popup
which allows the user to make a new choice. The style in which
the selected value is displayed, and the style of the popup is
determined by the current theme. It may be similar to a GtkOptionMenu
,
or similar to a Windows-style combo box.
Unlike its predecessors GtkCombo
and GtkOptionMenu
, the GtkComboBox
uses the model-view pattern; the list of valid choices is specified in the
form of a tree model, and the display of the choices can be adapted to
the data in the model by using cell renderers, as you would in a tree view.
This is possible since GtkComboBox
implements the GtkCellLayout
interface.
The tree model holding the valid choices is not restricted to a flat list,
it can be a real tree, and the popup will reflect the tree structure.
In addition to the model-view API, GtkComboBox
offers a simple API which
is suitable for text-only combo boxes, and hides the complexity of managing
the data in a model. It consists of the functions gtkComboBoxNewText
,
gtkComboBoxAppendText
, gtkComboBoxInsertText
,
gtkComboBoxPrependText
, gtkComboBoxRemoveText
and
gtkComboBoxGetActiveText
.
GtkComboBox
undocumented
gtkComboBox
is the result of collapsing the constructors of GtkComboBox
(gtkComboBoxNew
, gtkComboBoxNewWithModel
, gtkComboBoxNewText
) and accepts a subset of its arguments matching the required arguments of one of its delegate constructors.
changed(widget, user.data)
The changed signal is 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 gtkComboBoxSetActiveIter
.
It will also be emitted while typing into a GtkComboBoxEntry,
as well as when selecting an item from the GtkComboBoxEntry's list.
Since 2.4
widget
the object which received the signal
user.data
user data set when the signal handler was connected.
move-active(widget, scroll.type, user.data)
The ::move-active signal is a keybinding signal which gets emitted to move the active selection. Since 2.12
widget
the object that received the signal
scroll.type
a GtkScrollType
user.data
user data set when the signal handler was connected.
popdown(button, user.data)
The ::popdown signal is a keybinding signal which gets emitted to popdown the combo box list.
The default bindings for this signal are Alt+Up and Escape. Since 2.12
button
the object which received the signal
user.data
user data set when the signal handler was connected.
popup(widget, user.data)
The ::popup signal is a keybinding signal which gets emitted to popup the combo box list.
The default binding for this signal is Alt+Down. Since 2.12
widget
the object that received the signal
user.data
user data set when the signal handler was connected.
active
[integer : Read / Write]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]
,
where path
is the GtkTreePath
of the active item.
Allowed values: >= -1 Default value: -1 Since 2.4
add-tearoffs
[logical : Read / Write]The add-tearoffs property controls whether generated menus have tearoff menu items.
Note that this only affects menu style combo boxes. Default value: FALSE Since 2.6
button-sensitivity
[GtkSensitivityType
: Read / Write]Whether the dropdown button is sensitive when the model is empty. Default value: GTK_SENSITIVITY_AUTO Since 2.14
column-span-column
[integer : Read / Write]If this is set to a non-negative value, it must be the index of a column
of type G_TYPE_INT
in the model.
The values of that column are used to determine how many columns a value in the list will span. Allowed values: >= -1 Default value: -1 Since 2.4
focus-on-click
[logical : Read / Write]Whether the combo box grabs focus when it is clicked with the mouse. Default value: TRUE
has-frame
[logical : Read / Write]The has-frame property controls whether a frame is drawn around the entry. Default value: TRUE Since 2.6
model
[GtkTreeModel
: * : Read / Write]The model from which the combo box takes the values shown in the list. Since 2.4
popup-shown
[logical : Read]Whether the combo boxes dropdown is popped up. Note that this property is mainly useful, because it allows you to connect to notify::popup-shown. Default value: FALSE Since 2.10
row-span-column
[integer : Read / Write]If this is set to a non-negative value, it must be the index of a column
of type G_TYPE_INT
in the model.
The values of that column are used to determine how many rows a value in the list will span. Therefore, the values in the model column pointed to by this property must be greater than zero and not larger than wrap-width. Allowed values: >= -1 Default value: -1 Since 2.4
tearoff-title
[character : * : Read / Write]A title that may be displayed by the window manager when the popup is torn-off. Default value: NULL Since 2.10
wrap-width
[integer : Read / Write]If wrap-width is set to a positive value, the list will be displayed in multiple columns, the number of columns is determined by wrap-width. Allowed values: >= 0 Default value: 0 Since 2.4
appears-as-list
[logical : Read]Whether dropdowns should look like lists rather than menus. Default value: FALSE
arrow-size
[integer : Read]Sets the minimum size of the arrow in the combo box. Note that the arrow size is coupled to the font size, so in case a larger font is used, the arrow will be larger than set by arrow size. Allowed values: >= 0 Default value: 15 Since 2.12
shadow-type
[GtkShadowType
: Read]Which kind of shadow to draw around the combo box. Default value: GTK_SHADOW_NONE Since 2.12
Derived by RGtkGen from GTK+ documentation
https://developer.gnome.org/gtk2/stable/GtkComboBox.html
GtkComboBoxEntry
GtkTreeModel
GtkCellRenderer
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.