Stability | provisional |
---|---|
Portability | portable (depends on GHC) |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
A widget used to choose from a list of items.
- Module available since Gtk+ version 2.4
Synopsis
- comboBoxNewText :: MonadIO m => m ComboBox
- comboBoxSetModelText :: (MonadIO m, IsComboBox self) => self -> m (SeqStore Text)
- comboBoxGetModelText :: (MonadIO m, IsComboBox self) => self -> m (SeqStore Text)
- comboBoxAppendText :: (MonadIO m, IsComboBox self) => self -> Text -> m Int32
- comboBoxInsertText :: (MonadIO m, IsComboBox self) => self -> Int32 -> Text -> m ()
- comboBoxPrependText :: (Applicative m, MonadIO m, IsComboBox self) => self -> Text -> m ()
- comboBoxRemoveText :: (MonadIO m, IsComboBox self) => self -> Int32 -> m ()
- comboBoxGetActiveText :: (MonadIO m, IsComboBox self) => self -> m (Maybe Text)
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 general model-view API, ComboBox
offers the function
comboBoxNewText
which creates a text-only combo box.
Class Hierarchy
|GObject
| +----Object
| +----Widget
| +----Container
| +----Bin
| +----ComboBox | +----ComboBoxEntry
Simple Text API
comboBoxNewText :: MonadIO m => m ComboBox Source #
Convenience function which constructs a new text combo box that is a
ComboBox
just displaying strings. This function internally calls
comboBoxSetModelText
after creating a new combo box.
comboBoxSetModelText :: (MonadIO m, IsComboBox self) => self -> m (SeqStore Text) Source #
Create a combo box that holds strings.
This function stores a SeqStore
with the
widget and sets the model to the list store. The widget can contain only
strings. The model can be retrieved with comboBoxGetModel
. The list
store can be retrieved with comboBoxGetModelText
.
Any exisiting model or renderers are removed before setting the new text
model.
Note that the functions comboBoxAppendText
, comboBoxInsertText
,
comboBoxPrependText
, comboBoxRemoveText
and comboBoxGetActiveText
can be called on a combo box only once comboBoxSetModelText
is called.
comboBoxGetModelText :: (MonadIO m, IsComboBox self) => self -> m (SeqStore Text) Source #
Retrieve the model that was created with comboBoxSetModelText
.
comboBoxAppendText :: (MonadIO m, IsComboBox self) => self -> Text -> m Int32 Source #
Appends string
to the list of strings stored in comboBox
. Note that
you can only use this function with combo boxes constructed with
comboBoxNewText
. Returns the index of the appended text.
:: (MonadIO m, IsComboBox self) | |
=> self | |
-> Int32 |
|
-> Text |
|
-> m () |
Inserts string
at position
in the list of strings stored in
comboBox
. Note that you can only use this function with combo boxes
constructed with comboBoxNewText
.
comboBoxPrependText :: (Applicative m, MonadIO m, IsComboBox self) => self -> Text -> m () Source #
Prepends string
to the list of strings stored in comboBox
. Note that
you can only use this function with combo boxes constructed with
comboBoxNewText
.
:: (MonadIO m, IsComboBox self) | |
=> self | |
-> Int32 |
|
-> m () |
Removes the string at position
from comboBox
. Note that you can only
use this function with combo boxes constructed with comboBoxNewText
.
comboBoxGetActiveText :: (MonadIO m, IsComboBox self) => self -> m (Maybe Text) Source #
Returns the currently active string in comboBox
or Nothing
if none is
selected. Note that you can only use this function with combo boxes
constructed with comboBoxNewText
.