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 |
GtkDropDown is a widget that allows the user to choose an item from a list of options. The GtkDropDown displays the selected choice.
The options are given to GtkDropDown in the form of ListModel
,
and how the individual options are represented is determined by
a ListItemFactory
. The default factory displays simple strings.
GtkDropDown knows how to obtain strings from the items in a
StringList
; for other models, you have to provide an expression
to find the strings via dropDownSetExpression
.
GtkDropDown can optionally allow search in the popup, which is
useful if the list of options is long. To enable the search entry,
use dropDownSetEnableSearch
.
CSS nodes
GtkDropDown has a single CSS node with name dropdown, with the button and popover nodes as children.
Accessibility
GtkDropDown uses the GTK_ACCESSIBLE_ROLE_COMBO_BOX
role.
Synopsis
- newtype DropDown = DropDown (ManagedPtr DropDown)
- class (GObject o, IsDescendantOf DropDown o) => IsDropDown o
- toDropDown :: (MonadIO m, IsDropDown o) => o -> m DropDown
- dropDownGetEnableSearch :: (HasCallStack, MonadIO m, IsDropDown a) => a -> m Bool
- dropDownGetExpression :: (HasCallStack, MonadIO m, IsDropDown a) => a -> m (Maybe Expression)
- dropDownGetFactory :: (HasCallStack, MonadIO m, IsDropDown a) => a -> m (Maybe ListItemFactory)
- dropDownGetListFactory :: (HasCallStack, MonadIO m, IsDropDown a) => a -> m (Maybe ListItemFactory)
- dropDownGetModel :: (HasCallStack, MonadIO m, IsDropDown a) => a -> m (Maybe ListModel)
- dropDownGetSelected :: (HasCallStack, MonadIO m, IsDropDown a) => a -> m Word32
- dropDownGetSelectedItem :: (HasCallStack, MonadIO m, IsDropDown a) => a -> m (Maybe Object)
- dropDownNew :: (HasCallStack, MonadIO m, IsListModel a, IsExpression b) => Maybe a -> Maybe b -> m DropDown
- dropDownNewFromStrings :: (HasCallStack, MonadIO m) => [Text] -> m DropDown
- dropDownSetEnableSearch :: (HasCallStack, MonadIO m, IsDropDown a) => a -> Bool -> m ()
- dropDownSetExpression :: (HasCallStack, MonadIO m, IsDropDown a, IsExpression b) => a -> Maybe b -> m ()
- dropDownSetFactory :: (HasCallStack, MonadIO m, IsDropDown a, IsListItemFactory b) => a -> Maybe b -> m ()
- dropDownSetListFactory :: (HasCallStack, MonadIO m, IsDropDown a, IsListItemFactory b) => a -> Maybe b -> m ()
- dropDownSetModel :: (HasCallStack, MonadIO m, IsDropDown a, IsListModel b) => a -> Maybe b -> m ()
- dropDownSetSelected :: (HasCallStack, MonadIO m, IsDropDown a) => a -> Word32 -> m ()
- constructDropDownEnableSearch :: (IsDropDown o, MonadIO m) => Bool -> m (GValueConstruct o)
- getDropDownEnableSearch :: (MonadIO m, IsDropDown o) => o -> m Bool
- setDropDownEnableSearch :: (MonadIO m, IsDropDown o) => o -> Bool -> m ()
- clearDropDownExpression :: (MonadIO m, IsDropDown o) => o -> m ()
- constructDropDownExpression :: (IsDropDown o, MonadIO m, IsExpression a) => a -> m (GValueConstruct o)
- getDropDownExpression :: (MonadIO m, IsDropDown o) => o -> m (Maybe Expression)
- setDropDownExpression :: (MonadIO m, IsDropDown o, IsExpression a) => o -> a -> m ()
- clearDropDownFactory :: (MonadIO m, IsDropDown o) => o -> m ()
- constructDropDownFactory :: (IsDropDown o, MonadIO m, IsListItemFactory a) => a -> m (GValueConstruct o)
- getDropDownFactory :: (MonadIO m, IsDropDown o) => o -> m (Maybe ListItemFactory)
- setDropDownFactory :: (MonadIO m, IsDropDown o, IsListItemFactory a) => o -> a -> m ()
- clearDropDownListFactory :: (MonadIO m, IsDropDown o) => o -> m ()
- constructDropDownListFactory :: (IsDropDown o, MonadIO m, IsListItemFactory a) => a -> m (GValueConstruct o)
- getDropDownListFactory :: (MonadIO m, IsDropDown o) => o -> m (Maybe ListItemFactory)
- setDropDownListFactory :: (MonadIO m, IsDropDown o, IsListItemFactory a) => o -> a -> m ()
- clearDropDownModel :: (MonadIO m, IsDropDown o) => o -> m ()
- constructDropDownModel :: (IsDropDown o, MonadIO m, IsListModel a) => a -> m (GValueConstruct o)
- getDropDownModel :: (MonadIO m, IsDropDown o) => o -> m (Maybe ListModel)
- setDropDownModel :: (MonadIO m, IsDropDown o, IsListModel a) => o -> a -> m ()
- constructDropDownSelected :: (IsDropDown o, MonadIO m) => Word32 -> m (GValueConstruct o)
- getDropDownSelected :: (MonadIO m, IsDropDown o) => o -> m Word32
- setDropDownSelected :: (MonadIO m, IsDropDown o) => o -> Word32 -> m ()
- getDropDownSelectedItem :: (MonadIO m, IsDropDown o) => o -> m (Maybe Object)
Exported types
Memory-managed wrapper type.
Instances
Eq DropDown Source # | |
GObject DropDown Source # | |
Defined in GI.Gtk.Objects.DropDown | |
ManagedPtrNewtype DropDown Source # | |
Defined in GI.Gtk.Objects.DropDown toManagedPtr :: DropDown -> ManagedPtr DropDown | |
TypedObject DropDown Source # | |
Defined in GI.Gtk.Objects.DropDown | |
HasParentTypes DropDown Source # | |
Defined in GI.Gtk.Objects.DropDown | |
IsGValue (Maybe DropDown) Source # | Convert |
Defined in GI.Gtk.Objects.DropDown gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe DropDown -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe DropDown) | |
type ParentTypes DropDown Source # | |
Defined in GI.Gtk.Objects.DropDown |
class (GObject o, IsDescendantOf DropDown o) => IsDropDown o Source #
Type class for types which can be safely cast to DropDown
, for instance with toDropDown
.
Instances
(GObject o, IsDescendantOf DropDown o) => IsDropDown o Source # | |
Defined in GI.Gtk.Objects.DropDown |
toDropDown :: (MonadIO m, IsDropDown o) => o -> m DropDown Source #
Methods
Click to display all available methods, including inherited ones
Methods
actionSetEnabled, activate, activateAction, activateDefault, addController, addCssClass, addMnemonicLabel, addTickCallback, allocate, bindProperty, bindPropertyFull, childFocus, computeBounds, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, dragCheckThreshold, 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, pick, queueAllocate, queueDraw, queueResize, realize, ref, refSink, removeController, removeCssClass, removeMnemonicLabel, removeTickCallback, resetProperty, resetRelation, resetState, runDispose, shouldLayout, show, sizeAllocate, snapshotChild, stealData, stealQdata, thawNotify, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unref, unsetStateFlags, updateProperty, updateRelation, updateState, watchClosure.
Getters
getAccessibleRole, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getBuildableId, getCanFocus, getCanTarget, getChildVisible, getClipboard, getCssClasses, getCssName, getCursor, getData, getDirection, getDisplay, getEnableSearch, getExpression, getFactory, getFirstChild, getFocusChild, getFocusOnClick, getFocusable, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getLastChild, getLayoutManager, getListFactory, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getModel, getName, getNative, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPreferredSize, getPrevSibling, getPrimaryClipboard, getProperty, getQdata, getRealized, getReceivesDefault, getRequestMode, getRoot, getScaleFactor, getSelected, getSelectedItem, getSensitive, getSettings, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTooltipMarkup, getTooltipText, getValign, getVexpand, getVexpandSet, getVisible, getWidth.
Setters
setCanFocus, setCanTarget, setChildVisible, setCssClasses, setCursor, setCursorFromName, setData, setDataFull, setDirection, setEnableSearch, setExpression, setFactory, setFocusChild, setFocusOnClick, setFocusable, setFontMap, setFontOptions, setHalign, setHasTooltip, setHexpand, setHexpandSet, setLayoutManager, setListFactory, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setModel, setName, setOpacity, setOverflow, setParent, setProperty, setReceivesDefault, setSelected, setSensitive, setSizeRequest, setStateFlags, setTooltipMarkup, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible.
getEnableSearch
dropDownGetEnableSearch Source #
:: (HasCallStack, MonadIO m, IsDropDown a) | |
=> a |
|
-> m Bool | Returns: |
Returns whether search is enabled.
getExpression
dropDownGetExpression Source #
:: (HasCallStack, MonadIO m, IsDropDown a) | |
=> a |
|
-> m (Maybe Expression) | Returns: a |
Gets the expression set with dropDownSetExpression
.
getFactory
:: (HasCallStack, MonadIO m, IsDropDown a) | |
=> a |
|
-> m (Maybe ListItemFactory) | Returns: The factory in use |
Gets the factory that's currently used to populate list items.
The factory returned by this function is always used for the
item in the button. It is also used for items in the popup
if DropDown
:list-factory
is not set.
getListFactory
dropDownGetListFactory Source #
:: (HasCallStack, MonadIO m, IsDropDown a) | |
=> a |
|
-> m (Maybe ListItemFactory) | Returns: The factory in use |
Gets the factory that's currently used to populate list items in the popup.
getModel
:: (HasCallStack, MonadIO m, IsDropDown a) | |
=> a |
|
-> m (Maybe ListModel) | Returns: The model in use |
Gets the model that provides the displayed items.
getSelected
:: (HasCallStack, MonadIO m, IsDropDown a) | |
=> a |
|
-> m Word32 | Returns: the position of the selected item, or |
Gets the position of the selected item.
getSelectedItem
dropDownGetSelectedItem Source #
:: (HasCallStack, MonadIO m, IsDropDown a) | |
=> a |
|
-> m (Maybe Object) | Returns: The selected item |
Gets the selected item. If no item is selected, Nothing
is returned.
new
:: (HasCallStack, MonadIO m, IsListModel a, IsExpression b) | |
=> Maybe a |
|
-> Maybe b |
|
-> m DropDown | Returns: a new |
Creates a new DropDown
.
You may want to call dropDownSetFactory
to set up a way to map its items to widgets.
newFromStrings
dropDownNewFromStrings Source #
:: (HasCallStack, MonadIO m) | |
=> [Text] |
|
-> m DropDown | Returns: a new |
Creates a new DropDown
that is populated with
the strings in strings
.
setEnableSearch
dropDownSetEnableSearch Source #
:: (HasCallStack, MonadIO m, IsDropDown a) | |
=> a |
|
-> Bool |
|
-> m () |
Sets whether a search entry will be shown in the popup that allows to search for items in the list.
Note that DropDown
:expression
must be set for search to work.
setExpression
dropDownSetExpression Source #
:: (HasCallStack, MonadIO m, IsDropDown a, IsExpression b) | |
=> a |
|
-> Maybe b |
|
-> m () |
Sets the expression that gets evaluated to obtain strings from items
when searching in the popup. The expression must have a value type of
G_TYPE_STRING
.
setFactory
:: (HasCallStack, MonadIO m, IsDropDown a, IsListItemFactory b) | |
=> a |
|
-> Maybe b |
|
-> m () |
Sets the ListItemFactory
to use for populating list items.
setListFactory
dropDownSetListFactory Source #
:: (HasCallStack, MonadIO m, IsDropDown a, IsListItemFactory b) | |
=> a |
|
-> Maybe b |
|
-> m () |
Sets the ListItemFactory
to use for populating list items in the popup.
setModel
:: (HasCallStack, MonadIO m, IsDropDown a, IsListModel b) | |
=> a |
|
-> Maybe b |
|
-> m () |
Sets the ListModel
to use.
setSelected
:: (HasCallStack, MonadIO m, IsDropDown a) | |
=> a |
|
-> Word32 |
|
-> m () |
Selects the item at the given position.
Properties
enableSearch
Whether to show a search entry in the popup.
Note that search requires DropDown
:expression
to be set.
constructDropDownEnableSearch :: (IsDropDown o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “enable-search
” property. This is rarely needed directly, but it is used by new
.
getDropDownEnableSearch :: (MonadIO m, IsDropDown o) => o -> m Bool Source #
Get the value of the “enable-search
” property.
When overloading is enabled, this is equivalent to
get
dropDown #enableSearch
setDropDownEnableSearch :: (MonadIO m, IsDropDown o) => o -> Bool -> m () Source #
Set the value of the “enable-search
” property.
When overloading is enabled, this is equivalent to
set
dropDown [ #enableSearch:=
value ]
expression
An expression to evaluate to obtain strings to match against the search
term (see DropDown
:enable-search
). If DropDown
:factory
is not set,
the expression is also used to bind strings to labels produced by a
default factory.
clearDropDownExpression :: (MonadIO m, IsDropDown o) => o -> m () Source #
Set the value of the “expression
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#expression
constructDropDownExpression :: (IsDropDown o, MonadIO m, IsExpression a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “expression
” property. This is rarely needed directly, but it is used by new
.
getDropDownExpression :: (MonadIO m, IsDropDown o) => o -> m (Maybe Expression) Source #
Get the value of the “expression
” property.
When overloading is enabled, this is equivalent to
get
dropDown #expression
setDropDownExpression :: (MonadIO m, IsDropDown o, IsExpression a) => o -> a -> m () Source #
Set the value of the “expression
” property.
When overloading is enabled, this is equivalent to
set
dropDown [ #expression:=
value ]
factory
Factory for populating list items.
clearDropDownFactory :: (MonadIO m, IsDropDown o) => o -> m () Source #
Set the value of the “factory
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#factory
constructDropDownFactory :: (IsDropDown o, MonadIO m, IsListItemFactory a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “factory
” property. This is rarely needed directly, but it is used by new
.
getDropDownFactory :: (MonadIO m, IsDropDown o) => o -> m (Maybe ListItemFactory) Source #
Get the value of the “factory
” property.
When overloading is enabled, this is equivalent to
get
dropDown #factory
setDropDownFactory :: (MonadIO m, IsDropDown o, IsListItemFactory a) => o -> a -> m () Source #
Set the value of the “factory
” property.
When overloading is enabled, this is equivalent to
set
dropDown [ #factory:=
value ]
listFactory
The factory for populating list items in the popup.
If this is not set, DropDown
:factory
is used.
clearDropDownListFactory :: (MonadIO m, IsDropDown o) => o -> m () Source #
Set the value of the “list-factory
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#listFactory
constructDropDownListFactory :: (IsDropDown o, MonadIO m, IsListItemFactory a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “list-factory
” property. This is rarely needed directly, but it is used by new
.
getDropDownListFactory :: (MonadIO m, IsDropDown o) => o -> m (Maybe ListItemFactory) Source #
Get the value of the “list-factory
” property.
When overloading is enabled, this is equivalent to
get
dropDown #listFactory
setDropDownListFactory :: (MonadIO m, IsDropDown o, IsListItemFactory a) => o -> a -> m () Source #
Set the value of the “list-factory
” property.
When overloading is enabled, this is equivalent to
set
dropDown [ #listFactory:=
value ]
model
Model for the displayed items.
clearDropDownModel :: (MonadIO m, IsDropDown o) => o -> m () Source #
Set the value of the “model
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#model
constructDropDownModel :: (IsDropDown o, MonadIO m, IsListModel 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
.
getDropDownModel :: (MonadIO m, IsDropDown o) => o -> m (Maybe ListModel) Source #
Get the value of the “model
” property.
When overloading is enabled, this is equivalent to
get
dropDown #model
setDropDownModel :: (MonadIO m, IsDropDown o, IsListModel a) => o -> a -> m () Source #
Set the value of the “model
” property.
When overloading is enabled, this is equivalent to
set
dropDown [ #model:=
value ]
selected
The position of the selected item in DropDown
:model
,
or GTK_INVALID_LIST_POSITION
if no item is selected.
constructDropDownSelected :: (IsDropDown o, MonadIO m) => Word32 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “selected
” property. This is rarely needed directly, but it is used by new
.
getDropDownSelected :: (MonadIO m, IsDropDown o) => o -> m Word32 Source #
Get the value of the “selected
” property.
When overloading is enabled, this is equivalent to
get
dropDown #selected
setDropDownSelected :: (MonadIO m, IsDropDown o) => o -> Word32 -> m () Source #
Set the value of the “selected
” property.
When overloading is enabled, this is equivalent to
set
dropDown [ #selected:=
value ]
selectedItem
The selected item.
getDropDownSelectedItem :: (MonadIO m, IsDropDown o) => o -> m (Maybe Object) Source #
Get the value of the “selected-item
” property.
When overloading is enabled, this is equivalent to
get
dropDown #selectedItem