Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
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 gtk_bin_get_child()
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.
Synopsis
- newtype ComboBoxText = ComboBoxText (ManagedPtr ComboBoxText)
- class (GObject o, IsDescendantOf ComboBoxText o) => IsComboBoxText o
- toComboBoxText :: (MonadIO m, IsComboBoxText o) => o -> m ComboBoxText
- comboBoxTextAppend :: (HasCallStack, MonadIO m, IsComboBoxText a) => a -> Maybe Text -> Text -> m ()
- comboBoxTextAppendText :: (HasCallStack, MonadIO m, IsComboBoxText a) => a -> Text -> m ()
- comboBoxTextGetActiveText :: (HasCallStack, MonadIO m, IsComboBoxText a) => a -> m (Maybe Text)
- comboBoxTextInsert :: (HasCallStack, MonadIO m, IsComboBoxText a) => a -> Int32 -> Maybe Text -> Text -> m ()
- comboBoxTextInsertText :: (HasCallStack, MonadIO m, IsComboBoxText a) => a -> Int32 -> Text -> m ()
- comboBoxTextNew :: (HasCallStack, MonadIO m) => m ComboBoxText
- comboBoxTextNewWithEntry :: (HasCallStack, MonadIO m) => m ComboBoxText
- comboBoxTextPrepend :: (HasCallStack, MonadIO m, IsComboBoxText a) => a -> Maybe Text -> Text -> m ()
- comboBoxTextPrependText :: (HasCallStack, MonadIO m, IsComboBoxText a) => a -> Text -> m ()
- comboBoxTextRemove :: (HasCallStack, MonadIO m, IsComboBoxText a) => a -> Int32 -> m ()
- comboBoxTextRemoveAll :: (HasCallStack, MonadIO m, IsComboBoxText a) => a -> m ()
Exported types
newtype ComboBoxText Source #
Memory-managed wrapper type.
ComboBoxText (ManagedPtr ComboBoxText) |
Instances
Eq ComboBoxText Source # | |
Defined in GI.Gtk.Objects.ComboBoxText (==) :: ComboBoxText -> ComboBoxText -> Bool # (/=) :: ComboBoxText -> ComboBoxText -> Bool # | |
GObject ComboBoxText Source # | |
Defined in GI.Gtk.Objects.ComboBoxText | |
ManagedPtrNewtype ComboBoxText Source # | |
Defined in GI.Gtk.Objects.ComboBoxText toManagedPtr :: ComboBoxText -> ManagedPtr ComboBoxText | |
TypedObject ComboBoxText Source # | |
Defined in GI.Gtk.Objects.ComboBoxText | |
HasParentTypes ComboBoxText Source # | |
Defined in GI.Gtk.Objects.ComboBoxText | |
IsGValue (Maybe ComboBoxText) Source # | Convert |
Defined in GI.Gtk.Objects.ComboBoxText gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe ComboBoxText -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe ComboBoxText) | |
type ParentTypes ComboBoxText Source # | |
Defined in GI.Gtk.Objects.ComboBoxText type ParentTypes ComboBoxText = '[ComboBox, Widget, Object, Accessible, Buildable, CellEditable, CellLayout, ConstraintTarget] |
class (GObject o, IsDescendantOf ComboBoxText o) => IsComboBoxText o Source #
Type class for types which can be safely cast to ComboBoxText
, for instance with toComboBoxText
.
Instances
(GObject o, IsDescendantOf ComboBoxText o) => IsComboBoxText o Source # | |
Defined in GI.Gtk.Objects.ComboBoxText |
toComboBoxText :: (MonadIO m, IsComboBoxText o) => o -> m ComboBoxText Source #
Cast to ComboBoxText
, for types for which this is known to be safe. For general casts, use castTo
.
Methods
Click to display all available methods, including inherited ones
Methods
actionSetEnabled, activate, activateAction, activateDefault, addAttribute, addController, addCssClass, addMnemonicLabel, addTickCallback, allocate, append, appendText, bindProperty, bindPropertyFull, childFocus, clear, clearAttributes, computeBounds, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, dragCheckThreshold, editingDone, errorBell, forceFloating, freezeNotify, getv, grabFocus, hasCssClass, hasDefault, hasFocus, hasVisibleFocus, hide, inDestruction, initTemplate, insert, insertActionGroup, insertAfter, insertBefore, insertText, isAncestor, isDrawable, isFloating, isFocus, isSensitive, isVisible, keynavFailed, listMnemonicLabels, map, measure, mnemonicActivate, notify, notifyByPspec, observeChildren, observeControllers, packEnd, packStart, pick, popdown, popup, popupForDevice, prepend, prependText, queueAllocate, queueDraw, queueResize, realize, ref, refSink, remove, removeAll, removeController, removeCssClass, removeMnemonicLabel, removeTickCallback, removeWidget, reorder, resetProperty, resetRelation, resetState, runDispose, shouldLayout, show, sizeAllocate, snapshotChild, startEditing, stealData, stealQdata, thawNotify, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unref, unsetStateFlags, updateProperty, updateRelation, updateState, watchClosure.
Getters
getAccessibleRole, getActive, getActiveId, getActiveIter, getActiveText, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getArea, getBuildableId, getButtonSensitivity, getCanFocus, getCanTarget, getCells, getChild, getChildVisible, getClipboard, getCssClasses, getCssName, getCursor, getData, getDirection, getDisplay, getEntryTextColumn, getFirstChild, getFocusChild, getFocusOnClick, getFocusable, getFontMap, getFontOptions, getFrameClock, getHalign, getHasEntry, getHasTooltip, getHeight, getHexpand, getHexpandSet, getIdColumn, getLastChild, getLayoutManager, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getModel, getName, getNative, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPopupFixedWidth, getPreferredSize, getPrevSibling, getPrimaryClipboard, getProperty, getQdata, getRealized, getReceivesDefault, getRequestMode, getRoot, getScaleFactor, getSensitive, getSettings, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTooltipMarkup, getTooltipText, getValign, getVexpand, getVexpandSet, getVisible, getWidth.
Setters
setActive, setActiveId, setActiveIter, setButtonSensitivity, setCanFocus, setCanTarget, setCellDataFunc, setChild, setChildVisible, setCssClasses, setCursor, setCursorFromName, setData, setDataFull, setDirection, setEntryTextColumn, setFocusChild, setFocusOnClick, setFocusable, setFontMap, setFontOptions, setHalign, setHasTooltip, setHexpand, setHexpandSet, setIdColumn, setLayoutManager, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setModel, setName, setOpacity, setOverflow, setParent, setPopupFixedWidth, setProperty, setReceivesDefault, setRowSeparatorFunc, setSensitive, setSizeRequest, setStateFlags, setTooltipMarkup, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible.
append
:: (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.
appendText
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.
getActiveText
comboBoxTextGetActiveText Source #
:: (HasCallStack, MonadIO m, IsComboBoxText a) | |
=> a |
|
-> m (Maybe 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).
insert
:: (HasCallStack, MonadIO m, IsComboBoxText a) | |
=> a |
|
-> Int32 |
|
-> Maybe Text |
|
-> Text |
|
-> m () |
insertText
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.
new
:: (HasCallStack, MonadIO m) | |
=> m ComboBoxText | Returns: A new |
Creates a new ComboBoxText
, which is a ComboBox
just displaying
strings.
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.
prepend
:: (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.
prependText
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.
remove
:: (HasCallStack, MonadIO m, IsComboBoxText a) | |
=> a |
|
-> Int32 |
|
-> m () |
Removes the string at position
from comboBox
.
removeAll
comboBoxTextRemoveAll Source #
:: (HasCallStack, MonadIO m, IsComboBoxText a) | |
=> a |
|
-> m () |
Removes all the text entries from the combo box.