Copyright | (c) 2018 Francisco Vallarino |
---|---|
License | BSD-3-Clause (see the LICENSE file) |
Maintainer | fjvallarino@gmail.com |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Container which generates user provided events when combinations of keys occur. Using these event makes sense at the application or Composite level. If you are implementing a widget from scratch, keyboard events are directly available.
The shortcut definitions are provided as a list of tuples of Text
, containing
the key combination and associated event. The widget handles unordered
combinations of multiple keys at the same time, but does not support ordered
sequences (pressing "a", releasing, then "b" and "c"). The available keys are:
- Mod keys: A, Alt, C, Ctrl, Cmd, O, Option, S, Shift
- Action keys: Caps, Delete, Enter, Esc, Return, Space, Tab
- Arrows: Up, Down, Left, Right
- Function keys: F1-F12
- Lowercase letters (uppercase keys are reserved for mod and action keys)
- Numbers
These can be combined, for example:
- Copy: "Ctrl-c" or "C-c"
- App config: "Ctrl-Shift-p" or "C-S-p"
Synopsis
- data KeystrokeCfg
- keystroke :: WidgetEvent e => [(Text, e)] -> WidgetNode s e -> WidgetNode s e
- keystroke_ :: WidgetEvent e => [(Text, e)] -> [KeystrokeCfg] -> WidgetNode s e -> WidgetNode s e
Configuration
data KeystrokeCfg Source #
Configuration options for keystroke:
ignoreChildrenEvts
: If True, when a shortcut is detected, the KeyAction event will not be passed down to children.
Instances
Semigroup KeystrokeCfg Source # | |
Defined in Monomer.Widgets.Containers.Keystroke (<>) :: KeystrokeCfg -> KeystrokeCfg -> KeystrokeCfg # sconcat :: NonEmpty KeystrokeCfg -> KeystrokeCfg # stimes :: Integral b => b -> KeystrokeCfg -> KeystrokeCfg # | |
Monoid KeystrokeCfg Source # | |
Defined in Monomer.Widgets.Containers.Keystroke mempty :: KeystrokeCfg # mappend :: KeystrokeCfg -> KeystrokeCfg -> KeystrokeCfg # mconcat :: [KeystrokeCfg] -> KeystrokeCfg # | |
Default KeystrokeCfg Source # | |
Defined in Monomer.Widgets.Containers.Keystroke def :: KeystrokeCfg # | |
CmbIgnoreChildrenEvts KeystrokeCfg Source # | |
Constructors
keystroke :: WidgetEvent e => [(Text, e)] -> WidgetNode s e -> WidgetNode s e Source #
Creates a keystroke container with a single node as child.
keystroke_ :: WidgetEvent e => [(Text, e)] -> [KeystrokeCfg] -> WidgetNode s e -> WidgetNode s e Source #
Creates a keystroke container with a single node as child. Accepts config,