monomer-1.6.0.1: 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.Singles.OptionButton

Description

Option button widget, used for choosing one value from a fixed set. Each instance of optionButton is associated with a single value.

optionButton "First option" Option1 optionLens

Its behavior is equivalent to Monomer.Widgets.Singles.Radio and Monomer.Widgets.Singles.LabeledRadio, with a different visual representation.

This widget, and the associated Monomer.Widgets.Singles.ToggleButton, uses two separate styles for the On and Off states which can be modified individually for the theme. If you use any of the standard style functions (styleBasic, styleHover, etc) in an optionButton/toggleButton these changes will apply to both On and Off states, except for the color related styles. The reason is that, in general, the font and padding will be the same for both states, but the colors will differ. The optionButtonOffStyle option, which receives a Style instance, can be used to change the colors of the Off state. The values set with this option are higher priority than any inherited style from the theme or node text style.

Style instances can be created this way:

newStyle :: Style = def
  `styleBasic` [textSize 20]
  `styleHover` [textColor white]
Synopsis

Configuration

type OptionButtonValue a = (Eq a, Typeable a) Source #

Constraints for numeric types accepted by the optionButton widget.

data OptionButtonCfg s e a Source #

Configuration options for optionButton:

Instances

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

Defined in Monomer.Widgets.Singles.OptionButton

Semigroup (OptionButtonCfg s e a) Source # 
Instance details

Defined in Monomer.Widgets.Singles.OptionButton

Methods

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

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

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

Default (OptionButtonCfg s e a) Source # 
Instance details

Defined in Monomer.Widgets.Singles.OptionButton

Methods

def :: OptionButtonCfg s e a #

CmbEllipsis (OptionButtonCfg s e a) Source # 
Instance details

Defined in Monomer.Widgets.Singles.OptionButton

CmbIgnoreTheme (OptionButtonCfg s e a) Source # 
Instance details

Defined in Monomer.Widgets.Singles.OptionButton

CmbMaxLines (OptionButtonCfg s e a) Source # 
Instance details

Defined in Monomer.Widgets.Singles.OptionButton

Methods

maxLines :: Int -> OptionButtonCfg s e a Source #

CmbMultiline (OptionButtonCfg s e a) Source # 
Instance details

Defined in Monomer.Widgets.Singles.OptionButton

CmbResizeFactor (OptionButtonCfg s e a) Source # 
Instance details

Defined in Monomer.Widgets.Singles.OptionButton

CmbResizeFactorDim (OptionButtonCfg s e a) Source # 
Instance details

Defined in Monomer.Widgets.Singles.OptionButton

CmbTrimSpaces (OptionButtonCfg s e a) Source # 
Instance details

Defined in Monomer.Widgets.Singles.OptionButton

WidgetEvent e => CmbOnClick (OptionButtonCfg s e a) e Source # 
Instance details

Defined in Monomer.Widgets.Singles.OptionButton

Methods

onClick :: e -> OptionButtonCfg s e a Source #

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

Defined in Monomer.Widgets.Singles.OptionButton

Methods

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

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

Defined in Monomer.Widgets.Singles.OptionButton

Methods

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

CmbOnClickReq (OptionButtonCfg s e a) s e Source # 
Instance details

Defined in Monomer.Widgets.Singles.OptionButton

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

Defined in Monomer.Widgets.Singles.OptionButton

Methods

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

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

Defined in Monomer.Widgets.Singles.OptionButton

Methods

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

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

Defined in Monomer.Widgets.Singles.OptionButton

Methods

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

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

Defined in Monomer.Widgets.Singles.OptionButton

Methods

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

optionButtonOffStyle :: Style -> OptionButtonCfg s e a Source #

Sets the style for the Off state of the option button.

Constructors

optionButton Source #

Arguments

:: OptionButtonValue a 
=> Text

The caption.

-> a

The option value.

-> ALens' s a

The lens into the model.

-> WidgetNode s e

The created option button.

Creates an optionButton using the given lens.

optionButton_ Source #

Arguments

:: OptionButtonValue a 
=> Text

The caption.

-> a

The option value.

-> ALens' s a

The lens into the model.

-> [OptionButtonCfg s e a]

The config options.

-> WidgetNode s e

The created option button.

Creates an optionButton using the given lens. Accepts config.

optionButtonV Source #

Arguments

:: (OptionButtonValue a, WidgetEvent e) 
=> Text

The caption.

-> a

The option value.

-> a

The current value.

-> (a -> e)

The event to raise on change.

-> WidgetNode s e

The created option button.

Creates an optionButton using the given value and onChange event handler.

optionButtonV_ Source #

Arguments

:: (OptionButtonValue a, WidgetEvent e) 
=> Text

The caption.

-> a

The option value.

-> a

The current value.

-> (a -> e)

The event to raise on change.

-> [OptionButtonCfg s e a]

The config options.

-> WidgetNode s e

The created option button.

Creates an optionButton using the given value and onChange event handler. Accepts config.

optionButtonD_ Source #

Arguments

:: OptionButtonValue a 
=> Text

The caption.

-> a

The option value.

-> WidgetData s a

The WidgetData to retrieve the value from.

-> [OptionButtonCfg s e a]

The config options.

-> WidgetNode s e

The created option button.

Creates an optionButton providing a WidgetData instance and config.

Internal

makeOptionButton Source #

Arguments

:: OptionButtonValue a 
=> Lens' ThemeState StyleState

The on style lens.

-> Lens' ThemeState StyleState

The off style lens.

-> WidgetData s a

The WidgetData to retrieve the value from.

-> Text

The caption.

-> (a -> Bool)

Set the on or off state depending on the value.

-> (a -> a)

How to change the value on click.

-> OptionButtonCfg s e a

The config.

-> Widget s e

The created widget.

Helper function for creating a button associated to a value. Used by _optionButton_ and _toggleButton_.