Copyright | (c) 2018 Francisco Vallarino |
---|---|
License | BSD-3-Clause (see the LICENSE file) |
Maintainer | fjvallarino@gmail.com |
Stability | experimental |
Portability | non-portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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
- data SelectListCfg s e a
- type SelectListItem a = (Eq a, Show a, Typeable a)
- data SelectListMessage
- type SelectListMakeRow s e a = a -> WidgetNode s e
- selectList :: (WidgetModel s, WidgetEvent e, Traversable t, SelectListItem a) => ALens' s a -> t a -> SelectListMakeRow s e a -> WidgetNode s e
- selectList_ :: (WidgetModel s, WidgetEvent e, Traversable t, SelectListItem a) => ALens' s a -> t a -> SelectListMakeRow s e a -> [SelectListCfg s e a] -> WidgetNode s e
- selectListV :: (WidgetModel s, WidgetEvent e, Traversable t, SelectListItem a) => a -> (Int -> a -> e) -> t a -> SelectListMakeRow s e a -> WidgetNode s e
- selectListV_ :: (WidgetModel s, WidgetEvent e, Traversable t, SelectListItem a) => a -> (Int -> a -> e) -> t a -> SelectListMakeRow s e a -> [SelectListCfg s e a] -> WidgetNode s e
- selectListD_ :: forall s e t a. (WidgetModel s, WidgetEvent e, Traversable t, SelectListItem a) => WidgetData s a -> t a -> SelectListMakeRow s e a -> [SelectListCfg s e a] -> WidgetNode s e
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 theEq
instance of the item type is correct.
Instances
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.
Instances
Show SelectListMessage Source # | |
Defined in Monomer.Widgets.Containers.SelectList showsPrec :: Int -> SelectListMessage -> ShowS # show :: SelectListMessage -> String # showList :: [SelectListMessage] -> ShowS # | |
Eq SelectListMessage Source # | |
Defined in Monomer.Widgets.Containers.SelectList (==) :: SelectListMessage -> SelectListMessage -> Bool # (/=) :: SelectListMessage -> SelectListMessage -> Bool # |
type SelectListMakeRow s e a = a -> WidgetNode s e Source #
Creates a row from an item.
Constructors
:: (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.
:: (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.
:: (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.
:: (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.
:: forall s e t a. (WidgetModel s, WidgetEvent e, Traversable t, SelectListItem a) | |
=> WidgetData s a | The |
-> 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.