monomer-1.4.0.0: A GUI library for writing native Haskell applications.
Copyright(c) 2018 Francisco Vallarino
LicenseBSD-3-Clause (see the LICENSE file)
Maintainerfjvallarino@gmail.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Monomer.Widgets.Containers.Dropdown

Description

Dropdown widget, allowing selection of a single item from a collapsable list. Both header and list content are customizable, and so is their styling.

In case only Text content is needed, Monomer.Widgets.Singles.TextDropdown is easier to use.

makeSelected username = hstack [
    label "Selected: ",
    spacer,
    label username
  ]
makeRow username = label username

customDropdown = dropdown userLens usernames makeSelected makeRow
Synopsis

Configuration

data DropdownCfg s e a Source #

Configuration options for dropdown:

Instances

Instances details
Semigroup (DropdownCfg s e a) Source # 
Instance details

Defined in Monomer.Widgets.Containers.Dropdown

Methods

(<>) :: DropdownCfg s e a -> DropdownCfg s e a -> DropdownCfg s e a #

sconcat :: NonEmpty (DropdownCfg s e a) -> DropdownCfg s e a #

stimes :: Integral b => b -> DropdownCfg s e a -> DropdownCfg s e a #

Monoid (DropdownCfg s e a) Source # 
Instance details

Defined in Monomer.Widgets.Containers.Dropdown

Methods

mempty :: DropdownCfg s e a #

mappend :: DropdownCfg s e a -> DropdownCfg s e a -> DropdownCfg s e a #

mconcat :: [DropdownCfg s e a] -> DropdownCfg s e a #

Default (DropdownCfg s e a) Source # 
Instance details

Defined in Monomer.Widgets.Containers.Dropdown

Methods

def :: DropdownCfg s e a #

CmbMaxHeight (DropdownCfg s e a) Source # 
Instance details

Defined in Monomer.Widgets.Containers.Dropdown

Methods

maxHeight :: Double -> DropdownCfg s e a Source #

CmbItemSelectedStyle (DropdownCfg s e a) Style Source # 
Instance details

Defined in Monomer.Widgets.Containers.Dropdown

CmbItemBasicStyle (DropdownCfg s e a) Style Source # 
Instance details

Defined in Monomer.Widgets.Containers.Dropdown

WidgetEvent e => CmbOnChangeIdx (DropdownCfg s e a) e a Source # 
Instance details

Defined in Monomer.Widgets.Containers.Dropdown

Methods

onChangeIdx :: (Int -> a -> e) -> DropdownCfg s e a Source #

WidgetEvent e => CmbOnChange (DropdownCfg s e a) a e Source # 
Instance details

Defined in Monomer.Widgets.Containers.Dropdown

Methods

onChange :: (a -> e) -> DropdownCfg s e a Source #

WidgetEvent e => CmbOnBlur (DropdownCfg s e a) e Path Source # 
Instance details

Defined in Monomer.Widgets.Containers.Dropdown

Methods

onBlur :: (Path -> e) -> DropdownCfg s e a Source #

WidgetEvent e => CmbOnFocus (DropdownCfg s e a) e Path Source # 
Instance details

Defined in Monomer.Widgets.Containers.Dropdown

Methods

onFocus :: (Path -> e) -> DropdownCfg s e a Source #

CmbOnChangeIdxReq (DropdownCfg s e a) s e a Source # 
Instance details

Defined in Monomer.Widgets.Containers.Dropdown

Methods

onChangeIdxReq :: (Int -> a -> WidgetRequest s e) -> DropdownCfg s e a Source #

CmbOnChangeReq (DropdownCfg s e a) s e a Source # 
Instance details

Defined in Monomer.Widgets.Containers.Dropdown

Methods

onChangeReq :: (a -> WidgetRequest s e) -> DropdownCfg s e a Source #

CmbOnBlurReq (DropdownCfg s e a) s e Path Source # 
Instance details

Defined in Monomer.Widgets.Containers.Dropdown

Methods

onBlurReq :: (Path -> WidgetRequest s e) -> DropdownCfg s e a Source #

CmbOnFocusReq (DropdownCfg s e a) s e Path Source # 
Instance details

Defined in Monomer.Widgets.Containers.Dropdown

Methods

onFocusReq :: (Path -> WidgetRequest s e) -> DropdownCfg s e a Source #

type DropdownItem a = SelectListItem a Source #

Constraints for an item handled by dropdown.

Constructors

dropdown Source #

Arguments

:: (WidgetModel s, WidgetEvent e, Traversable t, DropdownItem a) 
=> ALens' s a

The lens into the model.

-> t a

The list of selectable items.

-> (a -> WidgetNode s e)

Function to create the header (always visible).

-> (a -> WidgetNode s e)

Function to create the list (collapsable).

-> WidgetNode s e

The created dropdown.

Creates a dropdown using the given lens.

dropdown_ Source #

Arguments

:: (WidgetModel s, WidgetEvent e, Traversable t, DropdownItem a) 
=> ALens' s a

The lens into the model.

-> t a

The list of selectable items.

-> (a -> WidgetNode s e)

Function to create the header (always visible).

-> (a -> WidgetNode s e)

Function to create the list (collapsable).

-> [DropdownCfg s e a]

The config options.

-> WidgetNode s e

The created dropdown.

Creates a dropdown using the given lens. Accepts config.

dropdownV Source #

Arguments

:: (WidgetModel s, WidgetEvent e, Traversable t, DropdownItem a) 
=> a

The current value.

-> (Int -> a -> e)

The event to raise on change.

-> t a

The list of selectable items.

-> (a -> WidgetNode s e)

Function to create the header (always visible).

-> (a -> WidgetNode s e)

Function to create the list (collapsable).

-> WidgetNode s e

The created dropdown.

Creates a dropdown using the given value and onChange event handler.

dropdownV_ Source #

Arguments

:: (WidgetModel s, WidgetEvent e, Traversable t, DropdownItem a) 
=> a

The current value.

-> (Int -> a -> e)

The event to raise on change.

-> t a

The list of selectable items.

-> (a -> WidgetNode s e)

Function to create the header (always visible).

-> (a -> WidgetNode s e)

Function to create the list (collapsable).

-> [DropdownCfg s e a]

The config options.

-> WidgetNode s e

The created dropdown.

Creates a dropdown using the given value and onChange event handler. | Accepts config.

dropdownD_ Source #

Arguments

:: forall s e t a. (WidgetModel s, WidgetEvent e, Traversable t, DropdownItem a) 
=> WidgetData s a

The WidgetData to retrieve the value from.

-> t a

The list of selectable items.

-> (a -> WidgetNode s e)

Function to create the header (always visible).

-> (a -> WidgetNode s e)

Function to create the list (collapsable).

-> [DropdownCfg s e a]

The config options.

-> WidgetNode s e

The created dropdown.

Creates a dropdown providing a WidgetData instance and config.