gi-gtk-4.0.6: Gtk bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Gtk.Objects.DropDown

Description

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 GListModel 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.

Here is a UI definition example for GtkDropDown with a simple model:

xml code

<object class="GtkDropDown">
  <property name="model">
    <object class="GtkStringList">
      <items>
        <item translatable="yes">Factory</item>
        <item translatable="yes">Home</item>
        <item translatable="yes">Subway</item>
      </items>
    </object>
  </property>
</object>

CSS nodes

GtkDropDown has a single CSS node with name dropdown, with the button and popover nodes as children.

Accessibility

GtkDropDown uses the AccessibleRoleComboBox role.

Synopsis

Exported types

newtype DropDown Source #

Memory-managed wrapper type.

Constructors

DropDown (ManagedPtr DropDown) 

Instances

Instances details
Eq DropDown Source # 
Instance details

Defined in GI.Gtk.Objects.DropDown

GObject DropDown Source # 
Instance details

Defined in GI.Gtk.Objects.DropDown

ManagedPtrNewtype DropDown Source # 
Instance details

Defined in GI.Gtk.Objects.DropDown

Methods

toManagedPtr :: DropDown -> ManagedPtr DropDown

TypedObject DropDown Source # 
Instance details

Defined in GI.Gtk.Objects.DropDown

Methods

glibType :: IO GType

HasParentTypes DropDown Source # 
Instance details

Defined in GI.Gtk.Objects.DropDown

IsGValue (Maybe DropDown) Source #

Convert DropDown to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Gtk.Objects.DropDown

Methods

gvalueGType_ :: IO GType

gvalueSet_ :: Ptr GValue -> Maybe DropDown -> IO ()

gvalueGet_ :: Ptr GValue -> IO (Maybe DropDown)

type ParentTypes DropDown Source # 
Instance details

Defined in GI.Gtk.Objects.DropDown

type ParentTypes DropDown = '[Widget, Object, Accessible, Buildable, ConstraintTarget]

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

Instances details
(GObject o, IsDescendantOf DropDown o) => IsDropDown o Source # 
Instance details

Defined in GI.Gtk.Objects.DropDown

toDropDown :: (MonadIO m, IsDropDown o) => o -> m DropDown Source #

Cast to DropDown, 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, addController, addCssClass, addMnemonicLabel, addTickCallback, allocate, bindProperty, bindPropertyFull, childFocus, computeBounds, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, disposeTemplate, 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, getShowArrow, 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, setShowArrow, setSizeRequest, setStateFlags, setTooltipMarkup, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible.

getEnableSearch

dropDownGetEnableSearch Source #

Arguments

:: (HasCallStack, MonadIO m, IsDropDown a) 
=> a

self: a GtkDropDown

-> m Bool

Returns: True if the popup includes a search entry

Returns whether search is enabled.

getExpression

dropDownGetExpression Source #

Arguments

:: (HasCallStack, MonadIO m, IsDropDown a) 
=> a

self: a GtkDropDown

-> m (Maybe Expression)

Returns: a GtkExpression

Gets the expression set that is used to obtain strings from items.

See dropDownSetExpression.

getFactory

dropDownGetFactory Source #

Arguments

:: (HasCallStack, MonadIO m, IsDropDown a) 
=> a

self: a GtkDropDown

-> 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:listFactory is not set.

getListFactory

dropDownGetListFactory Source #

Arguments

:: (HasCallStack, MonadIO m, IsDropDown a) 
=> a

self: a GtkDropDown

-> m (Maybe ListItemFactory)

Returns: The factory in use

Gets the factory that's currently used to populate list items in the popup.

getModel

dropDownGetModel Source #

Arguments

:: (HasCallStack, MonadIO m, IsDropDown a) 
=> a

self: a GtkDropDown

-> m (Maybe ListModel)

Returns: The model in use

Gets the model that provides the displayed items.

getSelected

dropDownGetSelected Source #

Arguments

:: (HasCallStack, MonadIO m, IsDropDown a) 
=> a

self: a GtkDropDown

-> m Word32

Returns: the position of the selected item, or INVALID_LIST_POSITION if not item is selected

Gets the position of the selected item.

getSelectedItem

dropDownGetSelectedItem Source #

Arguments

:: (HasCallStack, MonadIO m, IsDropDown a) 
=> a

self: a GtkDropDown

-> m (Maybe Object)

Returns: The selected item

Gets the selected item. If no item is selected, Nothing is returned.

getShowArrow

dropDownGetShowArrow Source #

Arguments

:: (HasCallStack, MonadIO m, IsDropDown a) 
=> a

self: a GtkDropDown

-> m Bool

Returns: True if an arrow will be shown.

Returns whether to show an arrow within the widget.

Since: 4.6

new

dropDownNew Source #

Arguments

:: (HasCallStack, MonadIO m, IsListModel a, IsExpression b) 
=> Maybe a

model: the model to use

-> Maybe b

expression: the expression to use

-> m DropDown

Returns: a new GtkDropDown

Creates a new GtkDropDown.

You may want to call dropDownSetFactory to set up a way to map its items to widgets.

newFromStrings

dropDownNewFromStrings Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> [Text]

strings: The strings to put in the dropdown

-> m DropDown

Returns: a new GtkDropDown

Creates a new GtkDropDown that is populated with the strings.

setEnableSearch

dropDownSetEnableSearch Source #

Arguments

:: (HasCallStack, MonadIO m, IsDropDown a) 
=> a

self: a GtkDropDown

-> Bool

enableSearch: whether to enable search

-> 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 #

Arguments

:: (HasCallStack, MonadIO m, IsDropDown a, IsExpression b) 
=> a

self: a GtkDropDown

-> Maybe b

expression: a GtkExpression

-> m () 

Sets the expression that gets evaluated to obtain strings from items.

This is used for search in the popup. The expression must have a value type of G_TYPE_STRING.

setFactory

dropDownSetFactory Source #

Arguments

:: (HasCallStack, MonadIO m, IsDropDown a, IsListItemFactory b) 
=> a

self: a GtkDropDown

-> Maybe b

factory: the factory to use

-> m () 

Sets the GtkListItemFactory to use for populating list items.

setListFactory

dropDownSetListFactory Source #

Arguments

:: (HasCallStack, MonadIO m, IsDropDown a, IsListItemFactory b) 
=> a

self: a GtkDropDown

-> Maybe b

factory: the factory to use

-> m () 

Sets the GtkListItemFactory to use for populating list items in the popup.

setModel

dropDownSetModel Source #

Arguments

:: (HasCallStack, MonadIO m, IsDropDown a, IsListModel b) 
=> a

self: a GtkDropDown

-> Maybe b

model: the model to use

-> m () 

Sets the GListModel to use.

setSelected

dropDownSetSelected Source #

Arguments

:: (HasCallStack, MonadIO m, IsDropDown a) 
=> a

self: a GtkDropDown

-> Word32

position: the position of the item to select, or INVALID_LIST_POSITION

-> m () 

Selects the item at the given position.

setShowArrow

dropDownSetShowArrow Source #

Arguments

:: (HasCallStack, MonadIO m, IsDropDown a) 
=> a

self: a GtkDropDown

-> Bool

showArrow: whether to show an arrow within the widget

-> m () 

Sets whether an arrow will be displayed within the widget.

Since: 4.6

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:enableSearch for how to 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.

If no item is selected, the property has the value INVALID_LIST_POSITION.

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

showArrow

Whether to show an arrow within the GtkDropDown widget.

Since: 4.6

constructDropDownShowArrow :: (IsDropDown o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

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

getDropDownShowArrow :: (MonadIO m, IsDropDown o) => o -> m Bool Source #

Get the value of the “show-arrow” property. When overloading is enabled, this is equivalent to

get dropDown #showArrow

setDropDownShowArrow :: (MonadIO m, IsDropDown o) => o -> Bool -> m () Source #

Set the value of the “show-arrow” property. When overloading is enabled, this is equivalent to

set dropDown [ #showArrow := value ]

Signals

activate

type DropDownActivateCallback = IO () Source #

Emitted to when the drop down is activated.

The ::activate signal on GtkDropDown is an action signal and emitting it causes the drop down to pop up its dropdown.

Since: 4.6

afterDropDownActivate :: (IsDropDown a, MonadIO m) => a -> ((?self :: a) => DropDownActivateCallback) -> 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 dropDown #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.

onDropDownActivate :: (IsDropDown a, MonadIO m) => a -> ((?self :: a) => DropDownActivateCallback) -> 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 dropDown #activate callback