monomer-1.5.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 HaskellSafe-Inferred
LanguageHaskell2010

Monomer.Widgets.Containers.SelectList

Description

Select list widget, allowing selection of a single item. List content (rows) is customizable, and so is its styling. This widget is used by Monomer.Widgets.Containers.Dropdown when in its open state.

makeRow username = hstack [
    label "User: ",
    label username
  ]

customSelect = selectList userLens usernames makeRow

Note: the content of the list will only be updated when the provided items change, based on their Eq instance. In case data external to the items is used for building the row nodes, mergeRequired may be needed to avoid stale content.

Synopsis

Configuration

data SelectListCfg s e a Source #

Configuration options for selectList:

  • onFocus: event to raise when focus is received.
  • onFocusReq: WidgetRequest to generate when focus is received.
  • onBlur: event to raise when focus is lost.
  • onBlurReq: WidgetRequest to generate when focus is lost.
  • onChange: event to raise when selected item changes.
  • onChangeReq: WidgetRequest to generate when selected item changes.
  • onChangeIdx: event to raise when selected item changes. Includes index,
  • onChangeIdxReq: WidgetRequest to generate when selected item changes. Includes index.
  • selectOnBlur: whether to select the currently highlighted item when navigating away from the widget with tab key.
  • itemBasicStyle: style of an item in the list when not selected.
  • itemSelectedStyle: style of the selected item in the list.
  • mergeRequired: whether merging children is required. Useful when the content displayed depends on external data, since changes to data outside the provided list cannot be detected. In general it is recommended to only depend on data contained in the list itself, making sure the Eq instance of the item type is correct.

Instances

Instances details
Monoid (SelectListCfg s e a) Source # 
Instance details

Defined in Monomer.Widgets.Containers.SelectList

Methods

mempty :: SelectListCfg s e a #

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

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

Semigroup (SelectListCfg s e a) Source # 
Instance details

Defined in Monomer.Widgets.Containers.SelectList

Methods

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

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

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

Default (SelectListCfg s e a) Source # 
Instance details

Defined in Monomer.Widgets.Containers.SelectList

Methods

def :: SelectListCfg s e a #

CmbSelectOnBlur (SelectListCfg s e a) Source # 
Instance details

Defined in Monomer.Widgets.Containers.SelectList

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

Defined in Monomer.Widgets.Containers.SelectList

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

Defined in Monomer.Widgets.Containers.SelectList

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

Defined in Monomer.Widgets.Containers.SelectList

Methods

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

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

Defined in Monomer.Widgets.Containers.SelectList

Methods

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

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

Defined in Monomer.Widgets.Containers.SelectList

Methods

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

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

Defined in Monomer.Widgets.Containers.SelectList

Methods

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

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

Defined in Monomer.Widgets.Containers.SelectList

Methods

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

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

Defined in Monomer.Widgets.Containers.SelectList

Methods

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

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

Defined in Monomer.Widgets.Containers.SelectList

Methods

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

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

Defined in Monomer.Widgets.Containers.SelectList

Methods

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

CmbMergeRequired (SelectListCfg s e a) (WidgetEnv s e) (Seq a) Source # 
Instance details

Defined in Monomer.Widgets.Containers.SelectList

Methods

mergeRequired :: (WidgetEnv s e -> Seq a -> Seq a -> Bool) -> SelectListCfg s e a Source #

type SelectListItem a = (Eq a, Show a, Typeable a) Source #

Constraints for an item handled by selectList.

data SelectListMessage Source #

Messages received by selectList. In general used internally.

type SelectListMakeRow s e a = a -> WidgetNode s e Source #

Creates a row from an item.

Constructors

selectList Source #

Arguments

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

The lens into the model.

-> t a

The list of selectable items.

-> SelectListMakeRow s e a

Function to create the list items.

-> WidgetNode s e

The created dropdown.

Creates a select list using the given lens.

selectList_ Source #

Arguments

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

The lens into the model.

-> t a

The list of selectable items.

-> SelectListMakeRow s e a

Function to create the list items.

-> [SelectListCfg s e a]

The config options.

-> WidgetNode s e

The created dropdown.

Creates a select list using the given lens. Accepts config.

selectListV Source #

Arguments

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

The event to raise on change.

-> (Int -> a -> e)

The list of selectable items.

-> t a

The list of selectable items.

-> SelectListMakeRow s e a

Function to create the list items.

-> WidgetNode s e

The created dropdown.

Creates a select list using the given value and onChange event handler.

selectListV_ Source #

Arguments

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

The event to raise on change.

-> (Int -> a -> e)

The list of selectable items.

-> t a

The list of selectable items.

-> SelectListMakeRow s e a

Function to create the list items.

-> [SelectListCfg s e a]

The config options.

-> WidgetNode s e

The created dropdown.

Creates a select list using the given value and onChange event handler. Accepts config.

selectListD_ Source #

Arguments

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

The WidgetData to retrieve the value from.

-> t a

The list of selectable items.

-> SelectListMakeRow s e a

Function to create the list items.

-> [SelectListCfg s e a]

The config options.

-> WidgetNode s e

The created dropdown.

Creates a dropdown providing a WidgetData instance and config.