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 |
Toggle button widget, used for boolean values.
toggleButton "Toggle" booleanLens
Its behavior is equivalent to Monomer.Widgets.Singles.Checkbox and Monomer.Widgets.Singles.LabeledCheckbox, with a different visual representation.
See Monomer.Widgets.Singles.OptionButton for detailed notes.
Synopsis
- type ToggleButtonCfg s e = OptionButtonCfg s e Bool
- toggleButtonOffStyle :: Style -> ToggleButtonCfg s e
- toggleButton :: Text -> ALens' s Bool -> WidgetNode s e
- toggleButton_ :: Text -> ALens' s Bool -> [ToggleButtonCfg s e] -> WidgetNode s e
- toggleButtonV :: WidgetEvent e => Text -> Bool -> (Bool -> e) -> WidgetNode s e
- toggleButtonV_ :: WidgetEvent e => Text -> Bool -> (Bool -> e) -> [ToggleButtonCfg s e] -> WidgetNode s e
- toggleButtonD_ :: Text -> WidgetData s Bool -> [ToggleButtonCfg s e] -> WidgetNode s e
Configuration
type ToggleButtonCfg s e = OptionButtonCfg s e Bool Source #
Configuration options for toggleButton:
ignoreTheme
: whether to load default style from theme or start empty.toggleButtonOffStyle
: style to use when the option is not active.trimSpaces
: whether to remove leading/trailing spaces in the caption.ellipsis
: if ellipsis should be used for overflown text.multiline
: if text may be split in multiple lines.maxLines
: maximum number of text lines to show.resizeFactor
: flexibility to have more or less space assigned.resizeFactorW
: flexibility to have more or less horizontal space assigned.resizeFactorH
: flexibility to have more or less vertical space assigned.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.onClick
: event to raise when the value is clicked.onClickReq
:WidgetRequest
to generate when the value is clicked.onChange
: event to raise when the value changes.onChangeReq
:WidgetRequest
to generate when the value changes.
toggleButtonOffStyle :: Style -> ToggleButtonCfg s e Source #
Sets the style for the Off state of the toggle button.
Constructors
:: Text | The caption. |
-> ALens' s Bool | The lens into the model. |
-> WidgetNode s e | The created toggle button. |
Creates a toggleButton using the given lens.
:: Text | The caption. |
-> ALens' s Bool | The lens into the model. |
-> [ToggleButtonCfg s e] | The config options. |
-> WidgetNode s e | The created toggle button. |
Creates a toggleButton using the given lens. Accepts config.
:: WidgetEvent e | |
=> Text | The caption. |
-> Bool | The current value. |
-> (Bool -> e) | The event to raise on change. |
-> WidgetNode s e | The created toggle button. |
Creates a toggleButton using the given value and onChange
event handler.
:: WidgetEvent e | |
=> Text | The caption. |
-> Bool | The current value. |
-> (Bool -> e) | The event to raise on change. |
-> [ToggleButtonCfg s e] | The config options. |
-> WidgetNode s e | The created toggle button. |
Creates a toggleButton using the given value and onChange
event handler.
Accepts config.
:: Text | The caption. |
-> WidgetData s Bool | The |
-> [ToggleButtonCfg s e] | The config options. |
-> WidgetNode s e | The created toggle button. |
Creates a toggleButton providing a WidgetData
instance and config.