|
Graphics.UI.Gtk.MenuComboToolbar.ComboBox | Portability | portable (depends on GHC) | Stability | provisional | Maintainer | gtk2hs-users@lists.sourceforge.net |
|
|
|
|
|
Description |
A widget used to choose from a list of items
- Module available since Gtk+ version 2.4
|
|
Synopsis |
|
|
|
|
Detail
|
|
A ComboBox is a widget that allows the user to choose from a list of
valid choices. The ComboBox displays the selected choice. When activated,
the ComboBox 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
OptionMenu, or similar to a Windows-style combo box.
Unlike its predecessors Combo and OptionMenu, the ComboBox 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 ComboBox implements the CellLayout 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, ComboBox 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 comboBoxNewText,
comboBoxAppendText, comboBoxInsertText, comboBoxPrependText,
comboBoxRemoveText and comboBoxGetActiveText.
|
|
Class Hierarchy
|
|
| GObject
| +----Object
| +----Widget
| +----Container
| +----Bin
| +----ComboBox
| +----ComboBoxEntry
|
|
Types
|
|
data ComboBox |
Instances | |
|
|
class BinClass o => ComboBoxClass o |
| Instances | |
|
|
castToComboBox :: GObjectClass obj => obj -> ComboBox |
|
Constructors
|
|
comboBoxNew :: IO ComboBox |
Creates a new empty ComboBox.
|
|
comboBoxNewText :: IO ComboBox |
Convenience function which constructs a new text combo box, which is a
ComboBox just displaying strings. If you use this function to create a
text combo box, you should only manipulate its data source with the
following convenience functions: comboBoxAppendText, comboBoxInsertText,
comboBoxPrependText and comboBoxRemoveText.
|
|
comboBoxNewWithModel |
|
|
Methods
|
|
comboBoxSetWrapWidth :: ComboBoxClass self => self -> Int -> IO () |
Sets the wrap width of the 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.
|
|
comboBoxSetRowSpanColumn :: ComboBoxClass self => self -> Int -> IO () |
Sets the column with row span information for the combo box to be rowSpan.
The row span column contains integers which indicate how many rows an item
should span.
|
|
comboBoxSetColumnSpanColumn :: ComboBoxClass self => self -> Int -> IO () |
Sets the column with column span information for the combo box to be
columnSpan. The column span column contains integers which indicate how
many columns an item should span.
|
|
comboBoxGetActive |
:: ComboBoxClass self | | => self | | -> IO (Maybe Int) | returns An integer which is the index of the currently
active item, or Nothing if there's no active item.
| Returns the index of the currently active item, or Nothing 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
treePathGetIndices path !! 0, where path is the TreePath of the
active item.
|
|
|
comboBoxSetActive |
:: ComboBoxClass self | | => self | | -> Int | index - An index in the model passed during construction, or
-1 to have no active item.
| -> IO () | | Sets the active item of the combo box to be the item at index.
|
|
|
comboBoxGetActiveIter :: ComboBoxClass self => self -> IO (Maybe TreeIter) |
Returns a TreeIter that points to the current active item, if it exists,
or Nothing if there is no current active item.
|
|
comboBoxSetActiveIter |
:: ComboBoxClass self | | => self | | -> TreeIter | iter - The TreeIter.
| -> IO () | | Sets the current active item to be the one referenced by iter. iter
must correspond to a path of depth one.
|
|
|
comboBoxGetModel |
|
|
comboBoxSetModel :: (ComboBoxClass self, TreeModelClass model) => self -> Maybe model -> IO () |
Sets the model used by comboBox to be model. Will unset a previously
set model (if applicable). If model is Nothing, then it will unset the
model.
Note that this function does not clear the cell renderers, you have to
call comboBoxCellLayoutClear yourself if you need to set up different cell
renderers for the new model.
|
|
comboBoxAppendText :: ComboBoxClass self => self -> String -> IO () |
Appends the given string to the list of strings stored in the combo box.
Note that you can only use this function with combo boxes constructed with
comboBoxNewText.
|
|
comboBoxInsertText |
:: ComboBoxClass self | | => self | | -> Int | position - An index to insert text.
| -> String | text | -> IO () | | Inserts text at position in the list of strings stored in the
combo box. Note that you can only use this function with combo boxes
constructed with comboBoxNewText.
|
|
|
comboBoxPrependText :: ComboBoxClass self => self -> String -> IO () |
Prepends the given string to the list of strings stored in the combo box.
Note that you can only use this function with combo boxes constructed with
comboBoxNewText.
|
|
comboBoxRemoveText |
:: ComboBoxClass self | | => self | | -> Int | position - Index of the item to remove.
| -> IO () | | Removes the string at position from the combo box. Note that you can
only use this function with combo boxes constructed with comboBoxNewText.
|
|
|
comboBoxPopup :: ComboBoxClass self => self -> IO () |
Pops up the menu or dropdown list of the combo box.
This function is mostly intended for use by accessibility technologies;
applications should have little use for it.
|
|
comboBoxPopdown :: ComboBoxClass self => self -> IO () |
Hides the menu or dropdown list of the combo box.
This function is mostly intended for use by accessibility technologies;
applications should have little use for it.
|
|
Attributes
|
|
Signals
|
|
onChanged :: ComboBoxClass self => self -> IO () -> IO (ConnectId self) |
The changed signal gets emitted when the active item is changed. This can
be due to the user selecting a different item from the list, or due to a
call to comboBoxSetActiveIter.
|
|
afterChanged :: ComboBoxClass self => self -> IO () -> IO (ConnectId self) |
|
Produced by Haddock version 0.7 |