gi-gtk4-4.0.12: Gtk 4.x 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.ComboBox

Contents

- Exported types
- Methods
  - getActive
  - getActiveId
  - getActiveIter
  - getButtonSensitivity
  - getChild
  - getEntryTextColumn
  - getHasEntry
  - getIdColumn
  - getModel
  - getPopupFixedWidth
  - new
  - newWithEntry
  - newWithModel
  - newWithModelAndEntry
  - popdown
  - popup
  - popupForDevice
  - setActive
  - setActiveId
  - setActiveIter
  - setButtonSensitivity
  - setChild
  - setEntryTextColumn
  - setIdColumn
  - setModel
  - setPopupFixedWidth
  - setRowSeparatorFunc
- Properties
  - active
  - activeId
  - buttonSensitivity
  - child
  - entryTextColumn
  - hasEntry
  - hasFrame
  - idColumn
  - model
  - popupFixedWidth
  - popupShown
- Signals
  - activate
  - changed
  - formatEntryText
  - moveActive
  - popdown
  - popup

Description

A `GtkComboBox` is a widget that allows the user to choose from a list of valid choices.

<picture> <source srcset="combo-box-dark.png" media="(prefers-color-scheme: dark)"> <img alt="An example GtkComboBox" src="combo-box.png"> </picture>

The `GtkComboBox` displays the selected choice; when activated, the `GtkComboBox` displays a popup which allows the user to make a new choice.

The `GtkComboBox` 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 `GtkComboBox` 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.

To allow the user to enter values not in the model, the ComboBox:hasEntry property allows the `GtkComboBox` to contain a `Entry`. This entry can be accessed by calling `comboBoxGetChild` on the combo box.

For a simple list of textual choices, the model-view API of `GtkComboBox` can be a bit overwhelming. In this case, `ComboBoxText` offers a simple alternative. Both `GtkComboBox` and `GtkComboBoxText` can contain an entry.

## CSS nodes

    combobox
    ├── box.linked
    │   ╰── button.combo
    │       ╰── box
    │           ├── cellview
    │           ╰── arrow
    ╰── window.popup

A normal combobox contains a box with the .linked class, a button with the .combo class and inside those buttons, there are a cellview and an arrow.

    combobox
    ├── box.linked
    │   ├── entry.combo
    │   ╰── button.combo
    │       ╰── box
    │           ╰── arrow
    ╰── window.popup

A `GtkComboBox` with an entry has a single CSS node with name combobox. It contains a box with the .linked class. That box contains an entry and a button, both with the .combo class added. The button also contains another node with name arrow.

## Accessibility

`GtkComboBox` uses the `AccessibleRoleComboBox` role.

Synopsis

- newtype ComboBox = ComboBox (ManagedPtr ComboBox)
- class (GObject o, IsDescendantOf ComboBox o) => IsComboBox o
- toComboBox :: (MonadIO m, IsComboBox o) => o -> m ComboBox
- comboBoxGetActive :: (HasCallStack, MonadIO m, IsComboBox a) => a -> m Int32
- comboBoxGetActiveId :: (HasCallStack, MonadIO m, IsComboBox a) => a -> m (Maybe Text)
- comboBoxGetActiveIter :: (HasCallStack, MonadIO m, IsComboBox a) => a -> m (Bool, TreeIter)
- comboBoxGetButtonSensitivity :: (HasCallStack, MonadIO m, IsComboBox a) => a -> m SensitivityType
- comboBoxGetChild :: (HasCallStack, MonadIO m, IsComboBox a) => a -> m (Maybe Widget)
- comboBoxGetEntryTextColumn :: (HasCallStack, MonadIO m, IsComboBox a) => a -> m Int32
- comboBoxGetHasEntry :: (HasCallStack, MonadIO m, IsComboBox a) => a -> m Bool
- comboBoxGetIdColumn :: (HasCallStack, MonadIO m, IsComboBox a) => a -> m Int32
- comboBoxGetModel :: (HasCallStack, MonadIO m, IsComboBox a) => a -> m (Maybe TreeModel)
- comboBoxGetPopupFixedWidth :: (HasCallStack, MonadIO m, IsComboBox a) => a -> m Bool
- comboBoxNew :: (HasCallStack, MonadIO m) => m ComboBox
- comboBoxNewWithEntry :: (HasCallStack, MonadIO m) => m ComboBox
- comboBoxNewWithModel :: (HasCallStack, MonadIO m, IsTreeModel a) => a -> m ComboBox
- comboBoxNewWithModelAndEntry :: (HasCallStack, MonadIO m, IsTreeModel a) => a -> m ComboBox
- comboBoxPopdown :: (HasCallStack, MonadIO m, IsComboBox a) => a -> m ()
- comboBoxPopup :: (HasCallStack, MonadIO m, IsComboBox a) => a -> m ()
- comboBoxPopupForDevice :: (HasCallStack, MonadIO m, IsComboBox a, IsDevice b) => a -> b -> m ()
- comboBoxSetActive :: (HasCallStack, MonadIO m, IsComboBox a) => a -> Int32 -> m ()
- comboBoxSetActiveId :: (HasCallStack, MonadIO m, IsComboBox a) => a -> Maybe Text -> m Bool
- comboBoxSetActiveIter :: (HasCallStack, MonadIO m, IsComboBox a) => a -> Maybe TreeIter -> m ()
- comboBoxSetButtonSensitivity :: (HasCallStack, MonadIO m, IsComboBox a) => a -> SensitivityType -> m ()
- comboBoxSetChild :: (HasCallStack, MonadIO m, IsComboBox a, IsWidget b) => a -> Maybe b -> m ()
- comboBoxSetEntryTextColumn :: (HasCallStack, MonadIO m, IsComboBox a) => a -> Int32 -> m ()
- comboBoxSetIdColumn :: (HasCallStack, MonadIO m, IsComboBox a) => a -> Int32 -> m ()
- comboBoxSetModel :: (HasCallStack, MonadIO m, IsComboBox a, IsTreeModel b) => a -> Maybe b -> m ()
- comboBoxSetPopupFixedWidth :: (HasCallStack, MonadIO m, IsComboBox a) => a -> Bool -> m ()
- comboBoxSetRowSeparatorFunc :: (HasCallStack, MonadIO m, IsComboBox a) => a -> Maybe TreeViewRowSeparatorFunc -> m ()
- constructComboBoxActive :: (IsComboBox o, MonadIO m) => Int32 -> m (GValueConstruct o)
- getComboBoxActive :: (MonadIO m, IsComboBox o) => o -> m Int32
- setComboBoxActive :: (MonadIO m, IsComboBox o) => o -> Int32 -> m ()
- clearComboBoxActiveId :: (MonadIO m, IsComboBox o) => o -> m ()
- constructComboBoxActiveId :: (IsComboBox o, MonadIO m) => Text -> m (GValueConstruct o)
- getComboBoxActiveId :: (MonadIO m, IsComboBox o) => o -> m (Maybe Text)
- setComboBoxActiveId :: (MonadIO m, IsComboBox o) => o -> Text -> m ()
- constructComboBoxButtonSensitivity :: (IsComboBox o, MonadIO m) => SensitivityType -> m (GValueConstruct o)
- getComboBoxButtonSensitivity :: (MonadIO m, IsComboBox o) => o -> m SensitivityType
- setComboBoxButtonSensitivity :: (MonadIO m, IsComboBox o) => o -> SensitivityType -> m ()
- clearComboBoxChild :: (MonadIO m, IsComboBox o) => o -> m ()
- constructComboBoxChild :: (IsComboBox o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o)
- getComboBoxChild :: (MonadIO m, IsComboBox o) => o -> m (Maybe Widget)
- setComboBoxChild :: (MonadIO m, IsComboBox o, IsWidget a) => o -> a -> m ()
- constructComboBoxEntryTextColumn :: (IsComboBox o, MonadIO m) => Int32 -> m (GValueConstruct o)
- getComboBoxEntryTextColumn :: (MonadIO m, IsComboBox o) => o -> m Int32
- setComboBoxEntryTextColumn :: (MonadIO m, IsComboBox o) => o -> Int32 -> m ()
- constructComboBoxHasEntry :: (IsComboBox o, MonadIO m) => Bool -> m (GValueConstruct o)
- getComboBoxHasEntry :: (MonadIO m, IsComboBox o) => o -> m Bool
- constructComboBoxHasFrame :: (IsComboBox o, MonadIO m) => Bool -> m (GValueConstruct o)
- getComboBoxHasFrame :: (MonadIO m, IsComboBox o) => o -> m Bool
- setComboBoxHasFrame :: (MonadIO m, IsComboBox o) => o -> Bool -> m ()
- constructComboBoxIdColumn :: (IsComboBox o, MonadIO m) => Int32 -> m (GValueConstruct o)
- getComboBoxIdColumn :: (MonadIO m, IsComboBox o) => o -> m Int32
- setComboBoxIdColumn :: (MonadIO m, IsComboBox o) => o -> Int32 -> m ()
- clearComboBoxModel :: (MonadIO m, IsComboBox o) => o -> m ()
- constructComboBoxModel :: (IsComboBox o, MonadIO m, IsTreeModel a) => a -> m (GValueConstruct o)
- getComboBoxModel :: (MonadIO m, IsComboBox o) => o -> m (Maybe TreeModel)
- setComboBoxModel :: (MonadIO m, IsComboBox o, IsTreeModel a) => o -> a -> m ()
- constructComboBoxPopupFixedWidth :: (IsComboBox o, MonadIO m) => Bool -> m (GValueConstruct o)
- getComboBoxPopupFixedWidth :: (MonadIO m, IsComboBox o) => o -> m Bool
- setComboBoxPopupFixedWidth :: (MonadIO m, IsComboBox o) => o -> Bool -> m ()
- getComboBoxPopupShown :: (MonadIO m, IsComboBox o) => o -> m Bool
- type ComboBoxActivateCallback = IO ()
- afterComboBoxActivate :: (IsComboBox a, MonadIO m) => a -> ((?self :: a) => ComboBoxActivateCallback) -> m SignalHandlerId
- onComboBoxActivate :: (IsComboBox a, MonadIO m) => a -> ((?self :: a) => ComboBoxActivateCallback) -> m SignalHandlerId
- type ComboBoxChangedCallback = IO ()
- afterComboBoxChanged :: (IsComboBox a, MonadIO m) => a -> ((?self :: a) => ComboBoxChangedCallback) -> m SignalHandlerId
- onComboBoxChanged :: (IsComboBox a, MonadIO m) => a -> ((?self :: a) => ComboBoxChangedCallback) -> m SignalHandlerId
- type ComboBoxFormatEntryTextCallback = Text -> IO Text
- afterComboBoxFormatEntryText :: (IsComboBox a, MonadIO m) => a -> ((?self :: a) => ComboBoxFormatEntryTextCallback) -> m SignalHandlerId
- onComboBoxFormatEntryText :: (IsComboBox a, MonadIO m) => a -> ((?self :: a) => ComboBoxFormatEntryTextCallback) -> m SignalHandlerId
- type ComboBoxMoveActiveCallback = ScrollType -> IO ()
- afterComboBoxMoveActive :: (IsComboBox a, MonadIO m) => a -> ((?self :: a) => ComboBoxMoveActiveCallback) -> m SignalHandlerId
- onComboBoxMoveActive :: (IsComboBox a, MonadIO m) => a -> ((?self :: a) => ComboBoxMoveActiveCallback) -> m SignalHandlerId
- type ComboBoxPopdownCallback = IO Bool
- afterComboBoxPopdown :: (IsComboBox a, MonadIO m) => a -> ((?self :: a) => ComboBoxPopdownCallback) -> m SignalHandlerId
- onComboBoxPopdown :: (IsComboBox a, MonadIO m) => a -> ((?self :: a) => ComboBoxPopdownCallback) -> m SignalHandlerId
- type ComboBoxPopupCallback = IO ()
- afterComboBoxPopup :: (IsComboBox a, MonadIO m) => a -> ((?self :: a) => ComboBoxPopupCallback) -> m SignalHandlerId
- onComboBoxPopup :: (IsComboBox a, MonadIO m) => a -> ((?self :: a) => ComboBoxPopupCallback) -> m SignalHandlerId

# Exported types

newtype ComboBox Source #

Memory-managed wrapper type.

Constructors

ComboBox (ManagedPtr ComboBox) |

#### Instances

Instances details

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

class (GObject o, IsDescendantOf ComboBox o) => IsComboBox o Source #

Type class for types which can be safely cast to `ComboBox`, for instance with `toComboBox`.

#### Instances

Instances details

(GObject o, IsDescendantOf ComboBox o) => IsComboBox o Source # |
Instance details Defined in GI.Gtk.Objects.ComboBox

toComboBox :: (MonadIO m, IsComboBox o) => o -> m ComboBox Source #

Cast to `ComboBox`, 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

actionSetEnabled, activate, activateAction, activateDefault, addAttribute, addController, addCssClass, addMnemonicLabel, addTickCallback, allocate, announce, bindProperty, bindPropertyFull, childFocus, clear, clearAttributes, computeBounds, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, disposeTemplate, dragCheckThreshold, editingDone, errorBell, forceFloating, freezeNotify, getv, grabFocus, hasCssClass, hasDefault, hasFocus, hasVisibleFocus, hide, inDestruction, initTemplate, insertActionGroup, insertAfter, insertBefore, isAncestor, isDrawable, isFloating, isFocus, isSensitive, isVisible, keynavFailed, listMnemonicLabels, map, measure, mnemonicActivate, notify, notifyByPspec, observeChildren, observeControllers, packEnd, packStart, pick, popdown, popup, popupForDevice, queueAllocate, queueDraw, queueResize, realize, ref, refSink, 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, updateNextAccessibleSibling, updatePlatformState, updateProperty, updateRelation, updateState, watchClosure.

#### Getters

getAccessibleId, getAccessibleParent, getAccessibleRole, getActive, getActiveId, getActiveIter, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getArea, getAtContext, getBaseline, getBounds, getBuildableId, getButtonSensitivity, getCanFocus, getCanTarget, getCells, getChild, getChildVisible, getClipboard, getColor, getCssClasses, getCssName, getCursor, getData, getDirection, getDisplay, getEntryTextColumn, getFirstAccessibleChild, getFirstChild, getFocusChild, getFocusOnClick, getFocusable, getFontMap, getFontOptions, getFrameClock, getHalign, getHasEntry, getHasTooltip, getHeight, getHexpand, getHexpandSet, getIdColumn, getLastChild, getLayoutManager, getLimitEvents, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getModel, getName, getNative, getNextAccessibleSibling, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPlatformState, 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

setAccessibleParent, 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, setLimitEvents, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setModel, setName, setOpacity, setOverflow, setParent, setPopupFixedWidth, setProperty, setReceivesDefault, setRowSeparatorFunc, setSensitive, setSizeRequest, setStateFlags, setTooltipMarkup, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible.

## getActive

comboBoxGetActive Source #

Arguments

:: (HasCallStack, MonadIO m, IsComboBox a) |
=> a | `comboBox`: A `GtkComboBox`
-> m Int32 | Returns: An integer which is the index of the currently active item, or -1 if there’s no active item

Deprecated: (Since version 4.10)Use `DropDown`

Returns the index of the currently 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 `gtk_tree_path_get_indices (path)[0]`, where `path` is the `TreePath` of the active item.

## getActiveId

comboBoxGetActiveId Source #

Arguments

:: (HasCallStack, MonadIO m, IsComboBox a) |
=> a | `comboBox`: a `GtkComboBox`
-> m (Maybe Text) | Returns: the ID of the active row

Deprecated: (Since version 4.10)Use `DropDown`

Returns the ID of the active row of `comboBox`.

This value is taken from the active row and the column specified by the ComboBox:idColumn property of `comboBox` (see `comboBoxSetIdColumn`).

The returned value is an interned string which means that you can compare the pointer by value to other interned strings and that you must not free it.

If the ComboBox:idColumn property of `comboBox` is not set, or if no row is active, or if the active row has a `Nothing` ID value, then `Nothing` is returned.

## getActiveIter

comboBoxGetActiveIter Source #

Arguments

:: (HasCallStack, MonadIO m, IsComboBox a) |
=> a | `comboBox`: A `GtkComboBox`
-> m (Bool, TreeIter) | Returns: `True` if `iter` was set, `False` otherwise

Deprecated: (Since version 4.10)Use `DropDown`

Sets `iter` to point to the currently active item.

If no item is active, `iter` is left unchanged.

## getButtonSensitivity

comboBoxGetButtonSensitivity Source #

Arguments

:: (HasCallStack, MonadIO m, IsComboBox a) |
=> a | `comboBox`: a `GtkComboBox`
-> m SensitivityType | Returns: `SensitivityTypeOn` if the dropdown button is sensitive when the model is empty, `SensitivityTypeOff` if the button is always insensitive or `SensitivityTypeAuto` if it is only sensitive as long as the model has one item to be selected.

Deprecated: (Since version 4.10)Use `DropDown`

Returns whether the combo box sets the dropdown button sensitive or not when there are no items in the model.

## getChild

comboBoxGetChild Source #

Arguments

:: (HasCallStack, MonadIO m, IsComboBox a) |
=> a | `comboBox`: a `GtkComboBox`
-> m (Maybe Widget) | Returns: the child widget of `comboBox`

Deprecated: (Since version 4.10)Use `DropDown`

Gets the child widget of `comboBox`.

## getEntryTextColumn

comboBoxGetEntryTextColumn Source #

Arguments

:: (HasCallStack, MonadIO m, IsComboBox a) |
=> a | `comboBox`: A `GtkComboBox`
-> m Int32 | Returns: A column in the data source model of `comboBox`.

Deprecated: (Since version 4.10)Use `DropDown`

Returns the column which `comboBox` is using to get the strings from to display in the internal entry.

## getHasEntry

comboBoxGetHasEntry Source #

Arguments

:: (HasCallStack, MonadIO m, IsComboBox a) |
=> a | `comboBox`: a `GtkComboBox`
-> m Bool | Returns: whether there is an entry in `comboBox`.

Deprecated: (Since version 4.10)Use `DropDown`

Returns whether the combo box has an entry.

## getIdColumn

comboBoxGetIdColumn Source #

Arguments

:: (HasCallStack, MonadIO m, IsComboBox a) |
=> a | `comboBox`: A `GtkComboBox`
-> m Int32 | Returns: A column in the data source model of `comboBox`.

Deprecated: (Since version 4.10)Use `DropDown`

Returns the column which `comboBox` is using to get string IDs for values from.

## getModel

comboBoxGetModel Source #

Arguments

:: (HasCallStack, MonadIO m, IsComboBox a) |
=> a | `comboBox`: A `GtkComboBox`
-> m (Maybe TreeModel) | Returns: A `GtkTreeModel` which was passed during construction.

Deprecated: (Since version 4.10)Use `DropDown`

Returns the `GtkTreeModel` of `comboBox`.

## getPopupFixedWidth

comboBoxGetPopupFixedWidth Source #

Arguments

:: (HasCallStack, MonadIO m, IsComboBox a) |
=> a | `comboBox`: a `GtkComboBox`
-> m Bool | Returns: `True` if the popup uses a fixed width

Deprecated: (Since version 4.10)Use `DropDown`

Gets whether the popup uses a fixed width.

## new

comboBoxNew Source #

Arguments

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

Deprecated: (Since version 4.10)Use `DropDown`

Creates a new empty `GtkComboBox`.

## newWithEntry

comboBoxNewWithEntry Source #

Arguments

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

Deprecated: (Since version 4.10)Use `DropDown`

Creates a new empty `GtkComboBox` with an entry.

In order to use a combo box with entry, you need to tell it which column of the model contains the text for the entry by calling `comboBoxSetEntryTextColumn`.

## newWithModel

comboBoxNewWithModel Source #

Arguments

:: (HasCallStack, MonadIO m, IsTreeModel a) |
=> a | `model`: a `GtkTreeModel`
-> m ComboBox | Returns: A new `GtkComboBox`

Deprecated: (Since version 4.10)Use `DropDown`

Creates a new `GtkComboBox` with a model.

## newWithModelAndEntry

comboBoxNewWithModelAndEntry Source #

Arguments

:: (HasCallStack, MonadIO m, IsTreeModel a) |
=> a | `model`: A `GtkTreeModel`
-> m ComboBox | Returns: A new `GtkComboBox`

Deprecated: (Since version 4.10)Use `DropDown`

Creates a new empty `GtkComboBox` with an entry and a model.

See also `comboBoxNewWithEntry`.

## popdown

comboBoxPopdown Source #

Arguments

:: (HasCallStack, MonadIO m, IsComboBox a) |
=> a | `comboBox`: a `GtkComboBox`
-> m () |

Deprecated: (Since version 4.10)Use `DropDown`

Hides the menu or dropdown list of `comboBox`.

This function is mostly intended for use by accessibility technologies; applications should have little use for it.

## popup

comboBoxPopup Source #

Arguments

:: (HasCallStack, MonadIO m, IsComboBox a) |
=> a | `comboBox`: a `GtkComboBox`
-> m () |

Deprecated: (Since version 4.10)Use `DropDown`

Pops up the menu or dropdown list of `comboBox`.

This function is mostly intended for use by accessibility technologies; applications should have little use for it.

Before calling this, `comboBox` must be mapped, or nothing will happen.

## popupForDevice

comboBoxPopupForDevice Source #

Arguments

:: (HasCallStack, MonadIO m, IsComboBox a, IsDevice b) |
=> a | `comboBox`: a `GtkComboBox`
-> b | `device`: a `GdkDevice`
-> m () |

Deprecated: (Since version 4.10)Use `DropDown`

Pops up the menu of `comboBox`.

Note that currently this does not do anything with the device, as it was previously only used for list-mode combo boxes, and those were removed in GTK 4. However, it is retained in case similar functionality is added back later.

## setActive

comboBoxSetActive Source #

Arguments

:: (HasCallStack, MonadIO m, IsComboBox a) |
=> a | `comboBox`: a `GtkComboBox`
-> Int32 | `index_`: An index in the model passed during construction, or -1 to have no active item
-> m () |

Deprecated: (Since version 4.10)Use `DropDown`

Sets the active item of `comboBox` to be the item at `index`.

## setActiveId

comboBoxSetActiveId Source #

Arguments

:: (HasCallStack, MonadIO m, IsComboBox a) |
=> a | `comboBox`: a `GtkComboBox`
-> Maybe Text | `activeId`: the ID of the row to select
-> m Bool | Returns: `True` if a row with a matching ID was found. If a `Nothing` `activeId` was given to unset the active row, the function always returns `True`.

Deprecated: (Since version 4.10)Use `DropDown`

Changes the active row of `comboBox` to the one that has an ID equal to `activeId`.

If `activeId` is `Nothing`, the active row is unset. Rows having a `Nothing` ID string cannot be made active by this function.

If the ComboBox:idColumn property of `comboBox` is unset or if no row has the given ID then the function does nothing and returns `False`.

## setActiveIter

comboBoxSetActiveIter Source #

Arguments

:: (HasCallStack, MonadIO m, IsComboBox a) |
=> a | `comboBox`: A `GtkComboBox`
-> Maybe TreeIter | `iter`: The `GtkTreeIter`
-> m () |

Deprecated: (Since version 4.10)Use `DropDown`

Sets the current active item to be the one referenced by `iter`.

If `iter` is `Nothing`, the active item is unset.

## setButtonSensitivity

comboBoxSetButtonSensitivity Source #

Arguments

:: (HasCallStack, MonadIO m, IsComboBox a) |
=> a | `comboBox`: a `GtkComboBox`
-> SensitivityType | `sensitivity`: specify the sensitivity of the dropdown button
-> m () |

Deprecated: (Since version 4.10)Use `DropDown`

Sets whether the dropdown button of the combo box should update its sensitivity depending on the model contents.

## setChild

comboBoxSetChild Source #

Arguments

:: (HasCallStack, MonadIO m, IsComboBox a, IsWidget b) |
=> a | `comboBox`: a `GtkComboBox`
-> Maybe b | `child`: the child widget
-> m () |

Deprecated: (Since version 4.10)Use `DropDown`

Sets the child widget of `comboBox`.

## setEntryTextColumn

comboBoxSetEntryTextColumn Source #

Arguments

:: (HasCallStack, MonadIO m, IsComboBox a) |
=> a | `comboBox`: A `GtkComboBox`
-> Int32 | `textColumn`: A column in `model` to get the strings from for the internal entry
-> m () |

Deprecated: (Since version 4.10)Use `DropDown`

Sets the model column which `comboBox` should use to get strings from to be `textColumn`.

For this column no separate `CellRenderer` is needed.

The column `textColumn` in the model of `comboBox` must be of type `G_TYPE_STRING`.

This is only relevant if `comboBox` has been created with ComboBox:hasEntry as `True`.

## setIdColumn

comboBoxSetIdColumn Source #

Arguments

:: (HasCallStack, MonadIO m, IsComboBox a) |
=> a | `comboBox`: A `GtkComboBox`
-> Int32 | `idColumn`: A column in `model` to get string IDs for values from
-> m () |

Deprecated: (Since version 4.10)Use `DropDown`

Sets the model column which `comboBox` should use to get string IDs for values from.

The column `idColumn` in the model of `comboBox` must be of type `G_TYPE_STRING`.

## setModel

comboBoxSetModel Source #

Arguments

:: (HasCallStack, MonadIO m, IsComboBox a, IsTreeModel b) |
=> a | `comboBox`: A `GtkComboBox`
-> Maybe b | `model`: A `GtkTreeModel`
-> m () |

Deprecated: (Since version 4.10)Use `DropDown`

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 `cellLayoutClear` yourself if you need to set up different cell renderers for the new model.

## setPopupFixedWidth

comboBoxSetPopupFixedWidth Source #

Arguments

:: (HasCallStack, MonadIO m, IsComboBox a) |
=> a | `comboBox`: a `GtkComboBox`
-> Bool | `fixed`: whether to use a fixed popup width
-> m () |

Deprecated: (Since version 4.10)Use `DropDown`

Specifies whether the popup’s width should be a fixed width.

If `fixed` is `True`, the popup's width is set to match the allocated width of the combo box.

## setRowSeparatorFunc

comboBoxSetRowSeparatorFunc Source #

Arguments

:: (HasCallStack, MonadIO m, IsComboBox a) |
=> a | `comboBox`: a `GtkComboBox`
-> Maybe TreeViewRowSeparatorFunc | `func`: a `GtkTreeViewRowSeparatorFunc`
-> m () |

Deprecated: (Since version 4.10)Use `DropDown`

Sets the row separator function, which is used to determine whether a row should be drawn as a separator.

If the row separator function is `Nothing`, no separators are drawn. This is the default value.

# Properties

## active

The item which is currently active.

If the model is a non-flat treemodel, and the active item is not an immediate child of the root of the tree, this property has the value `gtk_tree_path_get_indices (path)[0]`, where `path` is the `TreePath` of the active item.

constructComboBoxActive :: (IsComboBox o, MonadIO m) => Int32 -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`active`” property. This is rarely needed directly, but it is used by `new`.

getComboBoxActive :: (MonadIO m, IsComboBox o) => o -> m Int32 Source #

Get the value of the “`active`” property. When overloading is enabled, this is equivalent to

    get comboBox #active

setComboBoxActive :: (MonadIO m, IsComboBox o) => o -> Int32 -> m () Source #

Set the value of the “`active`” property. When overloading is enabled, this is equivalent to

    set comboBox [ #active := value ]

## activeId

The value of the ID column of the active row.

clearComboBoxActiveId :: (MonadIO m, IsComboBox o) => o -> m () Source #

Set the value of the “`active-id`” property to `Nothing`. When overloading is enabled, this is equivalent to

    clear #activeId

constructComboBoxActiveId :: (IsComboBox o, MonadIO m) => Text -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`active-id`” property. This is rarely needed directly, but it is used by `new`.

getComboBoxActiveId :: (MonadIO m, IsComboBox o) => o -> m (Maybe Text) Source #

Get the value of the “`active-id`” property. When overloading is enabled, this is equivalent to

    get comboBox #activeId

setComboBoxActiveId :: (MonadIO m, IsComboBox o) => o -> Text -> m () Source #

Set the value of the “`active-id`” property. When overloading is enabled, this is equivalent to

    set comboBox [ #activeId := value ]

## buttonSensitivity

Whether the dropdown button is sensitive when the model is empty.

constructComboBoxButtonSensitivity :: (IsComboBox o, MonadIO m) => SensitivityType -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`button-sensitivity`” property. This is rarely needed directly, but it is used by `new`.

getComboBoxButtonSensitivity :: (MonadIO m, IsComboBox o) => o -> m SensitivityType Source #

Get the value of the “`button-sensitivity`” property. When overloading is enabled, this is equivalent to

    get comboBox #buttonSensitivity

setComboBoxButtonSensitivity :: (MonadIO m, IsComboBox o) => o -> SensitivityType -> m () Source #

Set the value of the “`button-sensitivity`” property. When overloading is enabled, this is equivalent to

    set comboBox [ #buttonSensitivity := value ]

## child

The child widget.

clearComboBoxChild :: (MonadIO m, IsComboBox o) => o -> m () Source #

Set the value of the “`child`” property to `Nothing`. When overloading is enabled, this is equivalent to

    clear #child

constructComboBoxChild :: (IsComboBox o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`child`” property. This is rarely needed directly, but it is used by `new`.

getComboBoxChild :: (MonadIO m, IsComboBox o) => o -> m (Maybe Widget) Source #

Get the value of the “`child`” property. When overloading is enabled, this is equivalent to

    get comboBox #child

setComboBoxChild :: (MonadIO m, IsComboBox o, IsWidget a) => o -> a -> m () Source #

Set the value of the “`child`” property. When overloading is enabled, this is equivalent to

    set comboBox [ #child := value ]

## entryTextColumn

The model column to associate with strings from the entry.

This is property only relevant if the combo was created with ComboBox:hasEntry is `True`.

constructComboBoxEntryTextColumn :: (IsComboBox o, MonadIO m) => Int32 -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`entry-text-column`” property. This is rarely needed directly, but it is used by `new`.

getComboBoxEntryTextColumn :: (MonadIO m, IsComboBox o) => o -> m Int32 Source #

Get the value of the “`entry-text-column`” property. When overloading is enabled, this is equivalent to

    get comboBox #entryTextColumn

setComboBoxEntryTextColumn :: (MonadIO m, IsComboBox o) => o -> Int32 -> m () Source #

Set the value of the “`entry-text-column`” property. When overloading is enabled, this is equivalent to

    set comboBox [ #entryTextColumn := value ]

## hasEntry

Whether the combo box has an entry.

constructComboBoxHasEntry :: (IsComboBox o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`has-entry`” property. This is rarely needed directly, but it is used by `new`.

getComboBoxHasEntry :: (MonadIO m, IsComboBox o) => o -> m Bool Source #

Get the value of the “`has-entry`” property. When overloading is enabled, this is equivalent to

    get comboBox #hasEntry

## hasFrame

The `has-frame` property controls whether a frame is drawn around the entry.

constructComboBoxHasFrame :: (IsComboBox o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`has-frame`” property. This is rarely needed directly, but it is used by `new`.

getComboBoxHasFrame :: (MonadIO m, IsComboBox o) => o -> m Bool Source #

Get the value of the “`has-frame`” property. When overloading is enabled, this is equivalent to

    get comboBox #hasFrame

setComboBoxHasFrame :: (MonadIO m, IsComboBox o) => o -> Bool -> m () Source #

Set the value of the “`has-frame`” property. When overloading is enabled, this is equivalent to

    set comboBox [ #hasFrame := value ]

## idColumn

The model column that provides string IDs for the values in the model, if != -1.

constructComboBoxIdColumn :: (IsComboBox o, MonadIO m) => Int32 -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`id-column`” property. This is rarely needed directly, but it is used by `new`.

getComboBoxIdColumn :: (MonadIO m, IsComboBox o) => o -> m Int32 Source #

Get the value of the “`id-column`” property. When overloading is enabled, this is equivalent to

    get comboBox #idColumn

setComboBoxIdColumn :: (MonadIO m, IsComboBox o) => o -> Int32 -> m () Source #

Set the value of the “`id-column`” property. When overloading is enabled, this is equivalent to

    set comboBox [ #idColumn := value ]

## model

The model from which the combo box takes its values.

clearComboBoxModel :: (MonadIO m, IsComboBox o) => o -> m () Source #

Set the value of the “`model`” property to `Nothing`. When overloading is enabled, this is equivalent to

    clear #model

constructComboBoxModel :: (IsComboBox o, MonadIO m, IsTreeModel a) => a -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`model`” property. This is rarely needed directly, but it is used by `new`.

getComboBoxModel :: (MonadIO m, IsComboBox o) => o -> m (Maybe TreeModel) Source #

Get the value of the “`model`” property. When overloading is enabled, this is equivalent to

    get comboBox #model

setComboBoxModel :: (MonadIO m, IsComboBox o, IsTreeModel a) => o -> a -> m () Source #

Set the value of the “`model`” property. When overloading is enabled, this is equivalent to

    set comboBox [ #model := value ]

## popupFixedWidth

Whether the popup's width should be a fixed width matching the allocated width of the combo box.

constructComboBoxPopupFixedWidth :: (IsComboBox o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`popup-fixed-width`” property. This is rarely needed directly, but it is used by `new`.

getComboBoxPopupFixedWidth :: (MonadIO m, IsComboBox o) => o -> m Bool Source #

Get the value of the “`popup-fixed-width`” property. When overloading is enabled, this is equivalent to

    get comboBox #popupFixedWidth

setComboBoxPopupFixedWidth :: (MonadIO m, IsComboBox o) => o -> Bool -> m () Source #

Set the value of the “`popup-fixed-width`” property. When overloading is enabled, this is equivalent to

    set comboBox [ #popupFixedWidth := value ]

## popupShown

Whether the combo boxes dropdown is popped up.

Note that this property is mainly useful, because it allows you to connect to notifypopupShown.

getComboBoxPopupShown :: (MonadIO m, IsComboBox o) => o -> m Bool Source #

Get the value of the “`popup-shown`” property. When overloading is enabled, this is equivalent to

    get comboBox #popupShown

# Signals

## activate

type ComboBoxActivateCallback = IO () Source #

Emitted to when the combo box is activated.

The `::activate` signal on `GtkComboBox` is an action signal and emitting it causes the combo box to pop up its dropdown.

Since: 4.6

afterComboBoxActivate :: (IsComboBox a, MonadIO m) => a -> ((?self :: a) => ComboBoxActivateCallback) -> m SignalHandlerId Source #

Connect a signal handler for the activate signal, to be run after the default handler. When overloading is enabled, this is equivalent to

    after comboBox #activate callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit `?self` parameter. Note that this requires activating the `ImplicitParams` GHC extension.

onComboBoxActivate :: (IsComboBox a, MonadIO m) => a -> ((?self :: a) => ComboBoxActivateCallback) -> m SignalHandlerId Source #

Connect a signal handler for the activate signal, to be run before the default handler. When overloading is enabled, this is equivalent to

    on comboBox #activate callback

## changed

type ComboBoxChangedCallback = IO () Source #

Emitted when the active item is changed.

The can be due to the user selecting a different item from the list, or due to a call to `comboBoxSetActiveIter`. It will also be emitted while typing into the entry of a combo box with an entry.

afterComboBoxChanged :: (IsComboBox a, MonadIO m) => a -> ((?self :: a) => ComboBoxChangedCallback) -> m SignalHandlerId Source #

Connect a signal handler for the changed signal, to be run after the default handler. When overloading is enabled, this is equivalent to

    after comboBox #changed callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit `?self` parameter. Note that this requires activating the `ImplicitParams` GHC extension.

onComboBoxChanged :: (IsComboBox a, MonadIO m) => a -> ((?self :: a) => ComboBoxChangedCallback) -> m SignalHandlerId Source #

Connect a signal handler for the changed signal, to be run before the default handler. When overloading is enabled, this is equivalent to

    on comboBox #changed callback

## formatEntryText

type ComboBoxFormatEntryTextCallback Source #

Arguments

= Text | `path`: the `TreePath` string from the combo box's current model to format text for
-> IO Text | Returns: a newly allocated string representing `path` for the current `GtkComboBox` model.

Emitted to allow changing how the text in a combo box's entry is displayed.

See ComboBox:hasEntry.

Connect a signal handler which returns an allocated string representing `path`. That string will then be used to set the text in the combo box's entry. The default signal handler uses the text from the ComboBox:entryTextColumn model column.

Here's an example signal handler which fetches data from the model and displays it in the entry.

### c code

    static char *
    format_entry_text_callback (GtkComboBox *combo,
                                const char *path,
                                gpointer     user_data)
    {
      GtkTreeIter iter;
      GtkTreeModel model;
      double       value;

      model = gtk_combo_box_get_model (combo);

      gtk_tree_model_get_iter_from_string (model, &iter, path);
      gtk_tree_model_get (model, &iter,
                          THE_DOUBLE_VALUE_COLUMN, &value,
                          -1);

      return g_strdup_printf ("%g", value);
    }

afterComboBoxFormatEntryText :: (IsComboBox a, MonadIO m) => a -> ((?self :: a) => ComboBoxFormatEntryTextCallback) -> m SignalHandlerId Source #

Connect a signal handler for the formatEntryText signal, to be run after the default handler. When overloading is enabled, this is equivalent to

    after comboBox #formatEntryText callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit `?self` parameter. Note that this requires activating the `ImplicitParams` GHC extension.

onComboBoxFormatEntryText :: (IsComboBox a, MonadIO m) => a -> ((?self :: a) => ComboBoxFormatEntryTextCallback) -> m SignalHandlerId Source #

Connect a signal handler for the formatEntryText signal, to be run before the default handler. When overloading is enabled, this is equivalent to

    on comboBox #formatEntryText callback

## moveActive

type ComboBoxMoveActiveCallback Source #

Arguments

= ScrollType | `scrollType`: a `GtkScrollType`
-> IO () |

Emitted to move the active selection.

This is an keybinding signal.

afterComboBoxMoveActive :: (IsComboBox a, MonadIO m) => a -> ((?self :: a) => ComboBoxMoveActiveCallback) -> m SignalHandlerId Source #

Connect a signal handler for the moveActive signal, to be run after the default handler. When overloading is enabled, this is equivalent to

    after comboBox #moveActive callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit `?self` parameter. Note that this requires activating the `ImplicitParams` GHC extension.

onComboBoxMoveActive :: (IsComboBox a, MonadIO m) => a -> ((?self :: a) => ComboBoxMoveActiveCallback) -> m SignalHandlerId Source #

Connect a signal handler for the moveActive signal, to be run before the default handler. When overloading is enabled, this is equivalent to

    on comboBox #moveActive callback

## popdown

type ComboBoxPopdownCallback Source #

Arguments

= IO Bool | Returns: whether the combo box was popped down

Emitted to popdown the combo box list.

This is an keybinding signal.

The default bindings for this signal are Alt+Up and Escape.

afterComboBoxPopdown :: (IsComboBox a, MonadIO m) => a -> ((?self :: a) => ComboBoxPopdownCallback) -> m SignalHandlerId Source #

Connect a signal handler for the popdown signal, to be run after the default handler. When overloading is enabled, this is equivalent to

    after comboBox #popdown callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit `?self` parameter. Note that this requires activating the `ImplicitParams` GHC extension.

onComboBoxPopdown :: (IsComboBox a, MonadIO m) => a -> ((?self :: a) => ComboBoxPopdownCallback) -> m SignalHandlerId Source #

Connect a signal handler for the popdown signal, to be run before the default handler. When overloading is enabled, this is equivalent to

    on comboBox #popdown callback

## popup

type ComboBoxPopupCallback = IO () Source #

Emitted to popup the combo box list.

This is an keybinding signal.

The default binding for this signal is Alt+Down.

afterComboBoxPopup :: (IsComboBox a, MonadIO m) => a -> ((?self :: a) => ComboBoxPopupCallback) -> m SignalHandlerId Source #

Connect a signal handler for the popup signal, to be run after the default handler. When overloading is enabled, this is equivalent to

    after comboBox #popup callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit `?self` parameter. Note that this requires activating the `ImplicitParams` GHC extension.

onComboBoxPopup :: (IsComboBox a, MonadIO m) => a -> ((?self :: a) => ComboBoxPopupCallback) -> m SignalHandlerId Source #

Connect a signal handler for the popup signal, to be run before the default handler. When overloading is enabled, this is equivalent to

    on comboBox #popup callback