monomer-1.4.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 HaskellNone
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.
  • resizeFactor: flexibility to have more or less spaced assigned.
  • resizeFactorW: flexibility to have more or less horizontal spaced assigned.
  • resizeFactorH: flexibility to have more or less vertical spaced 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
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 #

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 #

Default (ButtonCfg s e) Source # 
Instance details

Defined in Monomer.Widgets.Singles.Button

Methods

def :: ButtonCfg s e #

CmbIgnoreTheme (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

CmbResizeFactor (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

CmbTrimSpaces (ButtonCfg s e) Source # 
Instance details

Defined in Monomer.Widgets.Singles.Button

CmbEllipsis (ButtonCfg s e) Source # 
Instance details

Defined in Monomer.Widgets.Singles.Button

CmbMultiline (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 #

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

Defined in Monomer.Widgets.Singles.Button

Methods

onClick :: e -> ButtonCfg s e Source #

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

Defined in Monomer.Widgets.Singles.Button

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 #

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 :: WidgetEvent e => Text -> e -> WidgetNode s e Source #

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

mainButton_ :: WidgetEvent e => Text -> e -> [ButtonCfg s e] -> WidgetNode s e Source #

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

mainButtonD_ :: WidgetEvent e => Text -> [ButtonCfg s e] -> WidgetNode s e Source #

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 :: WidgetEvent e => Text -> e -> WidgetNode s e Source #

Creates a button with normal styling.

button_ :: WidgetEvent e => Text -> e -> [ButtonCfg s e] -> WidgetNode s e Source #

Creates a button with normal styling. Accepts config.

buttonD_ :: WidgetEvent e => Text -> [ButtonCfg s e] -> WidgetNode s e Source #

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.