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 |
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
- data ButtonCfg s e
- mainButton :: WidgetEvent e => Text -> e -> WidgetNode s e
- mainButton_ :: WidgetEvent e => Text -> e -> [ButtonCfg s e] -> WidgetNode s e
- mainButtonD_ :: WidgetEvent e => Text -> [ButtonCfg s e] -> WidgetNode s e
- button :: WidgetEvent e => Text -> e -> WidgetNode s e
- button_ :: WidgetEvent e => Text -> e -> [ButtonCfg s e] -> WidgetNode s e
- buttonD_ :: WidgetEvent e => Text -> [ButtonCfg s e] -> WidgetNode s e
Configuration
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
Constructors
:: 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.
:: 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.
:: 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_
.
:: WidgetEvent e | |
=> Text | The caption. |
-> e | The event to raise on click. |
-> WidgetNode s e | The created button. |
Creates a button with normal styling.
:: 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.
:: 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
.