gi-gtk-3.0.43: Gtk bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.Gtk.Objects.ComboBoxText

Contents

- Exported types
- Methods
  - append
  - appendText
  - getActiveText
  - insert
  - insertText
  - new
  - newWithEntry
  - prepend
  - prependText
  - remove
  - removeAll

Description

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:

### xml code

    <object class="GtkComboBoxText">
      <items>
        <item translatable="yes" id="factory">Factory</item>
        <item translatable="yes" id="home">Home</item>
        <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.

Constructors

ComboBoxText (ManagedPtr ComboBoxText) |

#### Instances

Instances details

Eq ComboBoxText Source # |
Instance details Defined in GI.Gtk.Objects.ComboBoxText Methods (==) :: ComboBoxText -> ComboBoxText -> Bool Source # (/=) :: ComboBoxText -> ComboBoxText -> Bool Source #
GObject ComboBoxText Source # |
Instance details Defined in GI.Gtk.Objects.ComboBoxText
ManagedPtrNewtype ComboBoxText Source # |
Instance details Defined in GI.Gtk.Objects.ComboBoxText Methods toManagedPtr :: ComboBoxText -> ManagedPtr ComboBoxText Source #
TypedObject ComboBoxText Source # |
Instance details Defined in GI.Gtk.Objects.ComboBoxText Methods glibType :: IO GType Source #
HasParentTypes ComboBoxText Source # |
Instance details Defined in GI.Gtk.Objects.ComboBoxText
IsGValue (Maybe ComboBoxText) Source # | Convert `ComboBoxText` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Gtk.Objects.ComboBoxText Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe ComboBoxText -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe ComboBoxText) Source #
type ParentTypes ComboBoxText Source # |
Instance details Defined in GI.Gtk.Objects.ComboBoxText type ParentTypes ComboBoxText = '[ComboBox, Bin, Container, Widget, Object, ImplementorIface, Buildable, CellEditable, CellLayout]

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

Instances details

(GObject o, IsDescendantOf ComboBoxText o) => IsComboBoxText o Source # |
Instance details 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

Expand

#### Methods

activate, add, addAccelerator, addAttribute, addChild, addDeviceEvents, addEvents, addMnemonicLabel, addTickCallback, append, appendText, bindProperty, bindPropertyFull, canActivateAccel, checkResize, childFocus, childGetProperty, childNotify, childNotifyByPspec, childSetProperty, childType, classPath, clear, clearAttributes, computeExpand, constructChild, createPangoContext, createPangoLayout, customFinished, customTagEnd, customTagStart, destroy, destroyed, deviceIsShadowed, dragBegin, dragBeginWithCoordinates, dragCheckThreshold, dragDestAddImageTargets, dragDestAddTextTargets, dragDestAddUriTargets, dragDestFindTarget, dragDestGetTargetList, dragDestGetTrackMotion, dragDestSet, dragDestSetProxy, dragDestSetTargetList, dragDestSetTrackMotion, dragDestUnset, dragGetData, dragHighlight, dragSourceAddImageTargets, dragSourceAddTextTargets, dragSourceAddUriTargets, dragSourceGetTargetList, dragSourceSet, dragSourceSetIconGicon, dragSourceSetIconName, dragSourceSetIconPixbuf, dragSourceSetIconStock, dragSourceSetTargetList, dragSourceUnset, dragUnhighlight, draw, editingDone, ensureStyle, errorBell, event, forall, forceFloating, foreach, freezeChildNotify, freezeNotify, getv, grabAdd, grabDefault, grabFocus, grabRemove, hasDefault, hasFocus, hasGrab, hasRcStyle, hasScreen, hasVisibleFocus, hide, hideOnDelete, inDestruction, initTemplate, inputShapeCombineRegion, insert, insertActionGroup, insertText, intersect, isAncestor, isComposited, isDrawable, isFloating, isFocus, isSensitive, isToplevel, isVisible, keynavFailed, listAccelClosures, listActionPrefixes, listMnemonicLabels, map, mnemonicActivate, modifyBase, modifyBg, modifyCursor, modifyFg, modifyFont, modifyStyle, modifyText, notify, notifyByPspec, overrideBackgroundColor, overrideColor, overrideCursor, overrideFont, overrideSymbolicColor, packEnd, packStart, parserFinished, path, popdown, popup, popupForDevice, prepend, prependText, propagateDraw, queueAllocate, queueComputeExpand, queueDraw, queueDrawArea, queueDrawRegion, queueResize, queueResizeNoRedraw, realize, ref, refSink, regionIntersect, registerWindow, remove, removeAccelerator, removeAll, removeMnemonicLabel, removeTickCallback, removeWidget, renderIcon, renderIconPixbuf, reorder, reparent, resetRcStyles, resetStyle, resizeChildren, runDispose, sendExpose, sendFocusChange, shapeCombineRegion, show, showAll, showNow, sizeAllocate, sizeAllocateWithBaseline, sizeRequest, startEditing, stealData, stealQdata, styleAttach, styleGetProperty, thawChildNotify, thawNotify, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unref, unregisterWindow, unsetFocusChain, unsetStateFlags, watchClosure.

#### Getters

getAccessible, getActionGroup, getActive, getActiveId, getActiveIter, getActiveText, getAddTearoffs, getAllocatedBaseline, getAllocatedHeight, getAllocatedSize, getAllocatedWidth, getAllocation, getAncestor, getAppPaintable, getArea, getBorderWidth, getButtonSensitivity, getCanDefault, getCanFocus, getCells, getChild, getChildRequisition, getChildVisible, getChildren, getClip, getClipboard, getColumnSpanColumn, getCompositeName, getData, getDeviceEnabled, getDeviceEvents, getDirection, getDisplay, getDoubleBuffered, getEntryTextColumn, getEvents, getFocusChain, getFocusChild, getFocusHadjustment, getFocusOnClick, getFocusVadjustment, getFontMap, getFontOptions, getFrameClock, getHalign, getHasEntry, getHasTooltip, getHasWindow, getHexpand, getHexpandSet, getIdColumn, getInternalChild, getMapped, getMarginBottom, getMarginEnd, getMarginLeft, getMarginRight, getMarginStart, getMarginTop, getModel, getModifierMask, getModifierStyle, getName, getNoShowAll, getOpacity, getPangoContext, getParent, getParentWindow, getPath, getPathForChild, getPointer, getPopupAccessible, getPopupFixedWidth, getPreferredHeight, getPreferredHeightAndBaselineForWidth, getPreferredHeightForWidth, getPreferredSize, getPreferredWidth, getPreferredWidthForHeight, getProperty, getQdata, getRealized, getReceivesDefault, getRequestMode, getRequisition, getResizeMode, getRootWindow, getRowSpanColumn, getScaleFactor, getScreen, getSensitive, getSettings, getSizeRequest, getState, getStateFlags, getStyle, getStyleContext, getSupportMultidevice, getTemplateChild, getTitle, getTooltipMarkup, getTooltipText, getTooltipWindow, getToplevel, getValign, getValignWithBaseline, getVexpand, getVexpandSet, getVisible, getVisual, getWindow, getWrapWidth.

#### Setters

setAccelPath, setActive, setActiveId, setActiveIter, setAddTearoffs, setAllocation, setAppPaintable, setBorderWidth, setBuildableProperty, setButtonSensitivity, setCanDefault, setCanFocus, setCellDataFunc, setChildVisible, setClip, setColumnSpanColumn, setCompositeName, setData, setDataFull, setDeviceEnabled, setDeviceEvents, setDirection, setDoubleBuffered, setEntryTextColumn, setEvents, setFocusChain, setFocusChild, setFocusHadjustment, setFocusOnClick, setFocusVadjustment, setFontMap, setFontOptions, setHalign, setHasTooltip, setHasWindow, setHexpand, setHexpandSet, setIdColumn, setMapped, setMarginBottom, setMarginEnd, setMarginLeft, setMarginRight, setMarginStart, setMarginTop, setModel, setName, setNoShowAll, setOpacity, setParent, setParentWindow, setPopupFixedWidth, setProperty, setRealized, setReallocateRedraws, setReceivesDefault, setRedrawOnAllocate, setResizeMode, setRowSeparatorFunc, setRowSpanColumn, setSensitive, setSizeRequest, setState, setStateFlags, setStyle, setSupportMultidevice, setTitle, setTooltipMarkup, setTooltipText, setTooltipWindow, setValign, setVexpand, setVexpandSet, setVisible, setVisual, setWindow, setWrapWidth.

## append

comboBoxTextAppend Source #

Arguments

:: (HasCallStack, MonadIO m, IsComboBoxText a) |
=> a | `comboBox`: A `ComboBoxText`
-> Maybe Text | `id`: a string ID for this value, or `Nothing`
-> Text | `text`: A string
-> 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

comboBoxTextAppendText Source #

Arguments

:: (HasCallStack, MonadIO m, IsComboBoxText a) |
=> a | `comboBox`: A `ComboBoxText`
-> Text | `text`: A string
-> 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

comboBoxTextGetActiveText Source #

Arguments

:: (HasCallStack, MonadIO m, IsComboBoxText a) |
=> a | `comboBox`: A `ComboBoxText`
-> m (Maybe Text) | Returns: a newly allocated string containing the currently active text. Must be freed with `free`.

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

comboBoxTextInsert Source #

Arguments

:: (HasCallStack, MonadIO m, IsComboBoxText a) |
=> a | `comboBox`: A `ComboBoxText`
-> Int32 | `position`: An index to insert `text`
-> Maybe Text | `id`: a string ID for this value, or `Nothing`
-> Text | `text`: A string to display
-> m () |

Inserts `text` at `position` in the list of strings stored in `comboBox`. If `id` is non-`Nothing` then it is used as the ID of the row. See ComboBox:idColumn.

If `position` is negative then `text` is appended.

Since: 3.0

## insertText

comboBoxTextInsertText Source #

Arguments

:: (HasCallStack, MonadIO m, IsComboBoxText a) |
=> a | `comboBox`: A `ComboBoxText`
-> Int32 | `position`: An index to insert `text`
-> Text | `text`: A string
-> 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

comboBoxTextNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m ComboBoxText | Returns: A new `ComboBoxText`

Creates a new `ComboBoxText`, which is a `ComboBox` just displaying strings.

Since: 2.24

## newWithEntry

comboBoxTextNewWithEntry Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m ComboBoxText | Returns: a new `ComboBoxText`

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

comboBoxTextPrepend Source #

Arguments

:: (HasCallStack, MonadIO m, IsComboBoxText a) |
=> a | `comboBox`: A `ComboBox`
-> Maybe Text | `id`: a string ID for this value, or `Nothing`
-> Text | `text`: a string
-> 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

comboBoxTextPrependText Source #

Arguments

:: (HasCallStack, MonadIO m, IsComboBoxText a) |
=> a | `comboBox`: A `ComboBox`
-> Text | `text`: A string
-> 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

comboBoxTextRemove Source #

Arguments

:: (HasCallStack, MonadIO m, IsComboBoxText a) |
=> a | `comboBox`: A `ComboBox`
-> Int32 | `position`: Index of the item to remove
-> m () |

Removes the string at `position` from `comboBox`.

Since: 2.24

## removeAll

comboBoxTextRemoveAll Source #

Arguments

:: (HasCallStack, MonadIO m, IsComboBoxText a) |
=> a | `comboBox`: A `ComboBoxText`
-> m () |

Removes all the text entries from the combo box.

Since: 3.0