Copyright | Will Thompson, Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
Language | Haskell2010 |
A GtkComboBoxText is a simple variant of ComboBox
that hides
the model-view complexity for simple text-only use cases.
To create a GtkComboBoxText, use comboBoxTextNew
or
comboBoxTextNewWithEntry
.
You can add items to a GtkComboBoxText with
comboBoxTextAppendText
, comboBoxTextInsertText
or comboBoxTextPrependText
and remove options with
comboBoxTextRemove
.
If the GtkComboBoxText contains an entry (via the “has-entry” property),
its contents can be retrieved using comboBoxTextGetActiveText
.
The entry itself can be accessed by calling binGetChild
on the
combo box.
You should not call comboBoxSetModel
or attempt to pack more cells
into this combo box via its GtkCellLayout interface.
GtkComboBoxText as GtkBuildable
The GtkComboBoxText implementation of the GtkBuildable interface supports adding items directly using the <items> element and specifying <item> elements for each item. Each <item> element can specify the “id” corresponding to the appended text and also supports the regular translation attributes “translatable”, “context” and “comments”.
Here is a UI definition fragment specifying GtkComboBoxText items: > >class="GtkComboBoxText" > items > translatable="yes" id="factory"Factory/item > translatable="yes" id="home"Home/item > translatable="yes" id="subway"Subway/item > /items >/object
CSS nodes
plain code
combobox ╰── box.linked ├── entry.combo ├── button.combo ╰── window.popup
GtkComboBoxText has a single CSS node with name combobox. It adds the style class .combo to the main CSS nodes of its entry and button children, and the .linked class to the node of its internal box.
- newtype ComboBoxText = ComboBoxText (ManagedPtr ComboBoxText)
- class GObject o => IsComboBoxText o
- toComboBoxText :: IsComboBoxText o => o -> IO ComboBoxText
- noComboBoxText :: Maybe ComboBoxText
- data ComboBoxTextAppendMethodInfo
- comboBoxTextAppend :: (HasCallStack, MonadIO m, IsComboBoxText a) => a -> Maybe Text -> Text -> m ()
- data ComboBoxTextAppendTextMethodInfo
- comboBoxTextAppendText :: (HasCallStack, MonadIO m, IsComboBoxText a) => a -> Text -> m ()
- data ComboBoxTextGetActiveTextMethodInfo
- comboBoxTextGetActiveText :: (HasCallStack, MonadIO m, IsComboBoxText a) => a -> m Text
- data ComboBoxTextInsertMethodInfo
- comboBoxTextInsert :: (HasCallStack, MonadIO m, IsComboBoxText a) => a -> Int32 -> Maybe Text -> Text -> m ()
- data ComboBoxTextInsertTextMethodInfo
- comboBoxTextInsertText :: (HasCallStack, MonadIO m, IsComboBoxText a) => a -> Int32 -> Text -> m ()
- comboBoxTextNew :: (HasCallStack, MonadIO m) => m ComboBoxText
- comboBoxTextNewWithEntry :: (HasCallStack, MonadIO m) => m ComboBoxText
- data ComboBoxTextPrependMethodInfo
- comboBoxTextPrepend :: (HasCallStack, MonadIO m, IsComboBoxText a) => a -> Maybe Text -> Text -> m ()
- data ComboBoxTextPrependTextMethodInfo
- comboBoxTextPrependText :: (HasCallStack, MonadIO m, IsComboBoxText a) => a -> Text -> m ()
- data ComboBoxTextRemoveMethodInfo
- comboBoxTextRemove :: (HasCallStack, MonadIO m, IsComboBoxText a) => a -> Int32 -> m ()
- data ComboBoxTextRemoveAllMethodInfo
- comboBoxTextRemoveAll :: (HasCallStack, MonadIO m, IsComboBoxText a) => a -> m ()
Exported types
newtype ComboBoxText Source #
GObject ComboBoxText Source # | |
IsImplementorIface ComboBoxText Source # | |
IsObject ComboBoxText Source # | |
IsWidget ComboBoxText Source # | |
IsContainer ComboBoxText Source # | |
IsComboBox ComboBoxText Source # | |
IsBin ComboBoxText Source # | |
IsCellLayout ComboBoxText Source # | |
IsCellEditable ComboBoxText Source # | |
IsBuildable ComboBoxText Source # | |
IsComboBoxText ComboBoxText Source # | |
((~) * info (ResolveComboBoxTextMethod t ComboBoxText), MethodInfo * info ComboBoxText p) => IsLabel t (ComboBoxText -> p) Source # | |
((~) * info (ResolveComboBoxTextMethod t ComboBoxText), MethodInfo * info ComboBoxText p) => IsLabelProxy t (ComboBoxText -> p) Source # | |
HasAttributeList * ComboBoxText Source # | |
type AttributeList ComboBoxText Source # | |
type SignalList ComboBoxText Source # | |
class GObject o => IsComboBoxText o Source #
toComboBoxText :: IsComboBoxText o => o -> IO ComboBoxText Source #
Methods
append
data ComboBoxTextAppendMethodInfo Source #
((~) * signature (Maybe Text -> Text -> m ()), MonadIO m, IsComboBoxText a) => MethodInfo * ComboBoxTextAppendMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsComboBoxText a) | |
=> a |
|
-> Maybe Text |
|
-> Text |
|
-> m () |
Appends text
to the list of strings stored in comboBox
.
If id
is non-Nothing
then it is used as the ID of the row.
This is the same as calling comboBoxTextInsert
with a
position of -1.
Since: 2.24
appendText
data ComboBoxTextAppendTextMethodInfo Source #
((~) * signature (Text -> m ()), MonadIO m, IsComboBoxText a) => MethodInfo * ComboBoxTextAppendTextMethodInfo a signature Source # | |
comboBoxTextAppendText Source #
:: (HasCallStack, MonadIO m, IsComboBoxText a) | |
=> a |
|
-> Text |
|
-> m () |
Appends text
to the list of strings stored in comboBox
.
This is the same as calling comboBoxTextInsertText
with a
position of -1.
Since: 2.24
getActiveText
data ComboBoxTextGetActiveTextMethodInfo Source #
((~) * signature (m Text), MonadIO m, IsComboBoxText a) => MethodInfo * ComboBoxTextGetActiveTextMethodInfo a signature Source # | |
comboBoxTextGetActiveText Source #
:: (HasCallStack, MonadIO m, IsComboBoxText a) | |
=> a |
|
-> m Text | Returns: a newly allocated string containing the
currently active text. Must be freed with |
Returns the currently active string in comboBox
, or Nothing
if none is selected. If comboBox
contains an entry, this
function will return its contents (which will not necessarily
be an item from the list).
Since: 2.24
insert
data ComboBoxTextInsertMethodInfo Source #
((~) * signature (Int32 -> Maybe Text -> Text -> m ()), MonadIO m, IsComboBoxText a) => MethodInfo * ComboBoxTextInsertMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsComboBoxText a) | |
=> a |
|
-> Int32 |
|
-> Maybe Text |
|
-> Text |
|
-> m () |
insertText
data ComboBoxTextInsertTextMethodInfo Source #
((~) * signature (Int32 -> Text -> m ()), MonadIO m, IsComboBoxText a) => MethodInfo * ComboBoxTextInsertTextMethodInfo a signature Source # | |
comboBoxTextInsertText Source #
:: (HasCallStack, MonadIO m, IsComboBoxText a) | |
=> a |
|
-> Int32 |
|
-> Text |
|
-> m () |
Inserts text
at position
in the list of strings stored in comboBox
.
If position
is negative then text
is appended.
This is the same as calling comboBoxTextInsert
with a Nothing
ID string.
Since: 2.24
new
:: (HasCallStack, MonadIO m) | |
=> m ComboBoxText | Returns: A new |
Creates a new ComboBoxText
, which is a ComboBox
just displaying
strings.
Since: 2.24
newWithEntry
comboBoxTextNewWithEntry Source #
:: (HasCallStack, MonadIO m) | |
=> m ComboBoxText | Returns: a new |
Creates a new ComboBoxText
, which is a ComboBox
just displaying
strings. The combo box created by this function has an entry.
Since: 2.24
prepend
data ComboBoxTextPrependMethodInfo Source #
((~) * signature (Maybe Text -> Text -> m ()), MonadIO m, IsComboBoxText a) => MethodInfo * ComboBoxTextPrependMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsComboBoxText a) | |
=> a |
|
-> Maybe Text |
|
-> Text |
|
-> m () |
Prepends text
to the list of strings stored in comboBox
.
If id
is non-Nothing
then it is used as the ID of the row.
This is the same as calling comboBoxTextInsert
with a
position of 0.
Since: 2.24
prependText
data ComboBoxTextPrependTextMethodInfo Source #
((~) * signature (Text -> m ()), MonadIO m, IsComboBoxText a) => MethodInfo * ComboBoxTextPrependTextMethodInfo a signature Source # | |
comboBoxTextPrependText Source #
:: (HasCallStack, MonadIO m, IsComboBoxText a) | |
=> a |
|
-> Text |
|
-> m () |
Prepends text
to the list of strings stored in comboBox
.
This is the same as calling comboBoxTextInsertText
with a
position of 0.
Since: 2.24
remove
data ComboBoxTextRemoveMethodInfo Source #
((~) * signature (Int32 -> m ()), MonadIO m, IsComboBoxText a) => MethodInfo * ComboBoxTextRemoveMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsComboBoxText a) | |
=> a |
|
-> Int32 |
|
-> m () |
Removes the string at position
from comboBox
.
Since: 2.24
removeAll
data ComboBoxTextRemoveAllMethodInfo Source #
((~) * signature (m ()), MonadIO m, IsComboBoxText a) => MethodInfo * ComboBoxTextRemoveAllMethodInfo a signature Source # | |
comboBoxTextRemoveAll Source #
:: (HasCallStack, MonadIO m, IsComboBoxText a) | |
=> a |
|
-> m () |
Removes all the text entries from the combo box.
Since: 3.0