W Wrapl, The Programming Language

Libraries:Gtk:Gtk:ComboBox

Types

T

Inherits from:

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 Windows-style combo box.

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 Gtk.Gtk.CellLayout.T 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.

To allow the user to enter values not in the model, the 'has-entry' property allows the GtkComboBox to contain a Gtk.Gtk.Entry.T. This entry can be accessed by calling Gtk.Gtk.Bin.GetChild on the combo box.

For a simple list of textual choices, the model-view API of GtkComboBox can be a bit overwhelming. In this case, Gtk.Gtk.ComboBoxText.T offers a simple alternative. Both GtkComboBox and Gtk.Gtk.ComboBoxText.T can contain an entry.

A T is a widget that allows the user to choose from a list of valid choices. The T displays the selected choice. When activated, the T 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 Gtk.Gtk.OptionMenu.T, or similar to a Windows-style combo box.

Unlike its predecessors Gtk.Gtk.Combo.T and Gtk.Gtk.OptionMenu.T, the T 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 T implements the Gtk.Gtk.CellLayout.T 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, T 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 gtk_combo_box_new_text(), AppendText, InsertText, PrependText, RemoveText and GetActiveText.



Constants

Nil : T

Functions

GetType() : Gtk.GObject.Type.T



New() : Gtk.Gtk.ComboBox.T

Creates a new empty T.

Returns A new T.


NewText() : Gtk.Gtk.ComboBox.T

Warning

gtk_combo_box_new_text has been deprecated since version 2.24 and should not be used in newly-written code. Use Gtk.Gtk.ComboBoxText.T



NewWithModel(model @ Gtk.Gtk.TreeModel.T) : Gtk.Gtk.ComboBox.T

Creates a new T with the model initialized to model.

model A Gtk.Gtk.TreeModel.T.
Returns A new T.


Methods

:AppendText(self @ T, text @ Std.String.T) : Std.Object.T

Warning

AppendText has been deprecated since version 2.24 and should not be used in newly-written code. Use Gtk.Gtk.ComboBoxText.T



:GetActive(self @ T) : Std.Integer.SmallT

Returns the index of the currently active item, or -1 if there's no active item. If the model is a non-flat treemodel, and the active item is not an immediate child of the root of the tree, this function returns gtk_tree_path_get_indices (path)[0], where path is the Gtk.Gtk.TreePath.T of the active item.

combo_box A T
Returns An integer which is the index of the currently active item, or -1 if there's no active item.


:GetActiveIter(self @ T, iter @ Gtk.Gtk.TreeIter.T) : Std.Symbol.T

Sets iter to point to the current active item, if it exists.

combo_box A T
iter The uninitialized Gtk.Gtk.TreeIter.T. [out]
Returns TRUE, if iter was set


:GetActiveText(self @ T) : Std.String.T

Warning

GetActiveText has been deprecated since version 2.24 and should not be used in newly-written code. If you used this with a T constructed with gtk_combo_box_new_text() then you should now use Gtk.Gtk.ComboBoxText.T and Gtk.Gtk.ComboBoxText.GetActiveText instead. Or if you used this with a Gtk.Gtk.ComboBoxEntry.T then you should now use T with "has-entry" as TRUE and use gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (combobox))).



:GetAddTearoffs(self @ T) : Std.Symbol.T

Gets the current value of the :add-tearoffs property.

combo_box a T
Returns the current value of the :add-tearoffs property.


:GetButtonSensitivity(self @ T) : Gtk.Gtk.SensitivityType.T

Returns whether the combo box sets the dropdown button sensitive or not when there are no items in the model.

combo_box a T
Returns Gtk.Gtk.SensitivityType.On if the dropdown button is sensitive when the model is empty, Gtk.Gtk.SensitivityType.Off if the button is always insensitive or Gtk.Gtk.SensitivityType.Auto if it is only sensitive as long as the model has one item to be selected.


:GetColumnSpanColumn(self @ T) : Std.Integer.SmallT

Returns the column with column span information for combo_box.

combo_box A T
Returns the column span column.


:GetFocusOnClick(self @ T) : Std.Symbol.T

Returns whether the combo box grabs focus when it is clicked with the mouse. See SetFocusOnClick.

combo a T
Returns TRUE if the combo box grabs focus when it is clicked with the mouse.


:GetModel(self @ T) : Gtk.Gtk.TreeModel.T

Returns the Gtk.Gtk.TreeModel.T which is acting as data source for combo_box.

combo_box A T
Returns A Gtk.Gtk.TreeModel.T which was passed during construction. [transfer none]


:GetPopupAccessible(self @ T) : Gtk.Atk.Object.T

Gets the accessible object corresponding to the combo box's popup.

This function is mostly intended for use by accessibility technologies; applications should have little use for it.

combo_box a T
Returns the accessible object corresponding to the combo box's popup. [transfer none]


:GetRowSeparatorFunc(self @ T) : Std.Function.T

Returns the current row separator function.

combo_box a T
Returns the current row separator function.


:GetRowSpanColumn(self @ T) : Std.Integer.SmallT

Returns the column with row span information for combo_box.

combo_box A T
Returns the row span column.


:GetTitle(self @ T) : Std.String.T

Gets the current title of the menu in tearoff mode. See SetAddTearoffs.

combo_box a T
Returns the menu's title in tearoff mode. This is an internal copy of the string which must not be freed.


:GetWrapWidth(self @ T) : Std.Integer.SmallT

Returns the wrap width which is used to determine the number of columns for the popup menu. If the wrap width is larger than 1, the combo box is in table mode.

combo_box A T
Returns the wrap width.


:InsertText(self @ T, position @ Std.Integer.SmallT, text @ Std.String.T) : Std.Object.T

Warning

InsertText has been deprecated since version 2.24 and should not be used in newly-written code. Use Gtk.Gtk.ComboBoxText.T



:Popdown(self @ T) : Std.Object.T

Hides the menu or dropdown list of combo_box.

This function is mostly intended for use by accessibility technologies; applications should have little use for it.

combo_box a T


Pops up the menu or dropdown list of combo_box.

This function is mostly intended for use by accessibility technologies; applications should have little use for it.

combo_box a T


:PrependText(self @ T, text @ Std.String.T) : Std.Object.T

Warning

PrependText has been deprecated since version 2.24 and should not be used in newly-written code. Use Gtk.Gtk.ComboBoxText.T



:RemoveText(self @ T, position @ Std.Integer.SmallT) : Std.Object.T

Warning

RemoveText has been deprecated since version 2.24 and should not be used in newly-written code. Use Gtk.Gtk.ComboBoxText.T



:SetActive(self @ T, index_ @ Std.Integer.SmallT) : Std.Object.T

Sets the active item of combo_box to be the item at index.

combo_box A T
index_ An index in the model passed during construction, or -1 to have no active item


:SetActiveIter(self @ T, iter @ Gtk.Gtk.TreeIter.T) : Std.Object.T

Sets the current active item to be the one referenced by iter, or unsets the active item if iter is NULL.

combo_box A T
iter The Gtk.Gtk.TreeIter.T, or NULL. [allow-none]


:SetAddTearoffs(self @ T, add_tearoffs @ Std.Symbol.T) : Std.Object.T

Sets whether the popup menu should have a tearoff menu item.

combo_box a T
add_tearoffs TRUE to add tearoff menu items


:SetButtonSensitivity(self @ T, sensitivity @ Gtk.Gtk.SensitivityType.T) : Std.Object.T

Sets whether the dropdown button of the combo box should be always sensitive (Gtk.Gtk.SensitivityType.On), never sensitive (Gtk.Gtk.SensitivityType.Off) or only if there is at least one item to display (Gtk.Gtk.SensitivityType.Auto).

combo_box a T
sensitivity specify the sensitivity of the dropdown button


:SetColumnSpanColumn(self @ T, column_span @ Std.Integer.SmallT) : Std.Object.T

Sets the column with column span information for combo_box to be column_span. The column span column contains integers which indicate how many columns an item should span.

combo_box A T
column_span A column in the model passed during construction


:SetFocusOnClick(self @ T, focus_on_click @ Std.Symbol.T) : Std.Object.T

Sets whether the combo box will grab focus when it is clicked with the mouse. Making mouse clicks not grab focus is useful in places like toolbars where you don't want the keyboard focus removed from the main area of the application.

combo a T
focus_on_click whether the combo box grabs focus when clicked with the mouse


:SetModel(self @ T, model @ Gtk.Gtk.TreeModel.T) : Std.Object.T

Sets the model used by combo_box to be model. Will unset a previously set model (if applicable). If model is NULL, then it will unset the model.

Note that this function does not clear the cell renderers, you have to call Gtk.Gtk.CellLayout.Clear yourself if you need to set up different cell renderers for the new model.

combo_box A T
model A Gtk.Gtk.TreeModel.T. [allow-none]


:SetRowSeparatorFunc(self @ T, func @ Std.Function.T, data @ Std.Address.T, destroy @ Std.Function.T) : Std.Object.T

Sets the row separator function, which is used to determine whether a row should be drawn as a separator. If the row separator function is NULL, no separators are drawn. This is the default value.

combo_box a T
func a Gtk.Gtk.TreeViewRowSeparatorFunc
data user data to pass to func, or NULL. [allow-none]
destroy destroy notifier for data, or NULL. [allow-none]


:SetRowSpanColumn(self @ T, row_span @ Std.Integer.SmallT) : Std.Object.T

Sets the column with row span information for combo_box to be row_span. The row span column contains integers which indicate how many rows an item should span.

combo_box A T.
row_span A column in the model passed during construction.


:SetTitle(self @ T, title @ Std.String.T) : Std.Object.T

Sets the menu's title in tearoff mode.

combo_box a T
title a title for the menu in tearoff mode


:SetWrapWidth(self @ T, width @ Std.Integer.SmallT) : Std.Object.T

Sets the wrap width of combo_box to be width. The wrap width is basically the preferred number of columns when you want the popup to be layed out in a table.

combo_box A T
width Preferred number of columns