monomer-1.0.0.3: 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.Containers.Keystroke

Description

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

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.

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,