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.Button

Description

Button widget, with support for multiline text. At the most basic level, a button consists of a caption and an event to raise when clicked.

button "Increase count" AppIncrease
Synopsis

Configuration

data ButtonCfg s e Source #

Configuration options for button:

  • ignoreParentEvts: whether to ignore all other responses to the click or keypress that triggered the button, and only keep this button's response. Useful when the button is child of a _keystroke_ widget.
  • 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.
  • ignoreTheme: whether to load default style from theme or start empty.
  • 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 button is clicked.
  • onClickReq: WidgetRequest to generate when button is clicked.

Instances

Instances details
Monoid (ButtonCfg s e) Source # 
Instance details

Defined in Monomer.Widgets.Singles.Button

Methods

mempty :: ButtonCfg s e #

mappend :: ButtonCfg s e -> ButtonCfg s e -> ButtonCfg s e #

mconcat :: [ButtonCfg s e] -> ButtonCfg s e #

Semigroup (ButtonCfg s e) Source # 
Instance details

Defined in Monomer.Widgets.Singles.Button

Methods

(<>) :: ButtonCfg s e -> ButtonCfg s e -> ButtonCfg s e #

sconcat :: NonEmpty (ButtonCfg s e) -> ButtonCfg s e #

stimes :: Integral b => b -> ButtonCfg s e -> ButtonCfg s e #

Default (ButtonCfg s e) Source # 
Instance details

Defined in Monomer.Widgets.Singles.Button

Methods

def :: ButtonCfg s e #

CmbEllipsis (ButtonCfg s e) Source # 
Instance details

Defined in Monomer.Widgets.Singles.Button

CmbIgnoreParentEvts (ButtonCfg s e) Source # 
Instance details

Defined in Monomer.Widgets.Singles.Button

CmbIgnoreTheme (ButtonCfg s e) Source # 
Instance details

Defined in Monomer.Widgets.Singles.Button

CmbMaxLines (ButtonCfg s e) Source # 
Instance details

Defined in Monomer.Widgets.Singles.Button

Methods

maxLines :: Int -> ButtonCfg s e Source #

CmbMultiline (ButtonCfg s e) Source # 
Instance details

Defined in Monomer.Widgets.Singles.Button

CmbResizeFactor (ButtonCfg s e) Source # 
Instance details

Defined in Monomer.Widgets.Singles.Button

CmbResizeFactorDim (ButtonCfg s e) Source # 
Instance details

Defined in Monomer.Widgets.Singles.Button

CmbTrimSpaces (ButtonCfg s e) Source # 
Instance details

Defined in Monomer.Widgets.Singles.Button

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

Defined in Monomer.Widgets.Singles.Button

Methods

onClick :: e -> ButtonCfg s e Source #

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

Defined in Monomer.Widgets.Singles.Button

Methods

onBlur :: (Path -> e) -> ButtonCfg s e Source #

CmbOnClickReq (ButtonCfg s e) s e Source # 
Instance details

Defined in Monomer.Widgets.Singles.Button

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

Defined in Monomer.Widgets.Singles.Button

Methods

onFocus :: (Path -> e) -> ButtonCfg s e Source #

CmbOnBlurReq (ButtonCfg s e) s e Path Source # 
Instance details

Defined in Monomer.Widgets.Singles.Button

Methods

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

CmbOnFocusReq (ButtonCfg s e) s e Path Source # 
Instance details

Defined in Monomer.Widgets.Singles.Button

Methods

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

Constructors

mainButton Source #

Arguments

:: WidgetEvent e 
=> Text

The caption.

-> e

The event to raise on click.

-> WidgetNode s e

The created button.

Creates a button with main styling. Useful to highlight an option, such as "Accept", when multiple buttons are available.

mainButton_ Source #

Arguments

:: WidgetEvent e 
=> Text

The caption.

-> e

The event to raise on click.

-> [ButtonCfg s e]

The config options.

-> WidgetNode s e

The created button.

Creates a button with main styling. Useful to highlight an option, such as "Accept", when multiple buttons are available. Accepts config.

mainButtonD_ Source #

Arguments

:: WidgetEvent e 
=> Text

The caption.

-> [ButtonCfg s e]

The config options.

-> WidgetNode s e

The created button.

Creates a button with main styling. Useful to highlight an option, such as "Accept", when multiple buttons are available. Accepts config but does not require an event. See buttonD_.

button Source #

Arguments

:: WidgetEvent e 
=> Text

The caption.

-> e

The event to raise on click.

-> WidgetNode s e

The created button.

Creates a button with normal styling.

button_ Source #

Arguments

:: WidgetEvent e 
=> Text

The caption.

-> e

The event to raise on click.

-> [ButtonCfg s e]

The config options.

-> WidgetNode s e

The created button.

Creates a button with normal styling. Accepts config.

buttonD_ Source #

Arguments

:: WidgetEvent e 
=> Text

The caption.

-> [ButtonCfg s e]

The config options.

-> WidgetNode s e

The created button.

Creates a button without forcing an event to be provided. The other constructors use this version, adding an onClick handler in configs.

Using this constructor directly can be helpful in cases where the event to be raised belongs in a Monomer.Widgets.Composite above in the widget tree, outside the scope of the Composite that contains the button. This parent Composite can be reached by sending a message (SendMessage) to its WidgetId using onClickReq.