|
LibCXXW 0.32.1
LibCXX Widget Toolkit
|
A keyboard shortcut for a hotspot. More...
#include <shortcut.H>
Classes | |
| struct | shortcut_parse_info |
| Internal helper. More... | |
Public Member Functions | |
| shortcut () | |
| Default constructor. | |
| operator bool () const | |
| Whether the shortcut is specified. | |
| bool | operator! () const |
| Operator. | |
| shortcut (char32_t unicode) | |
| Defines a shortcut comprising of a single key. | |
| shortcut (const std::string_view &modifier, char32_t unicode) | |
| Specify a shortcut comprising of a modifier and a key. | |
| template<typename T , typename = decltype(shortcut_parse_info{std::declval<T>()})> | |
| shortcut (T &&string) | |
| Specify a shortcut as a single string. | |
| bool | matches (const key_event &ke) const |
| Whether a key event matches this shortcut. | |
| std::string | description () const |
| Description of this shortcut, as a string. | |
| std::u32string | label () const |
| Description of this shortcut, as a unicode label. | |
Public Member Functions inherited from x::w::input_mask | |
| bool | notspecial () const |
| None of the special keys are pressed. | |
| input_mask () noexcept | |
| Default constructor. | |
| input_mask (uint16_t SETofKEYBUTMASK, const keysyms &k) noexcept | |
| Construct from SETofKEYBUTMASK protocol value, and keysyms info. | |
| operator std::string () const | |
| Describe the mask. | |
| input_mask (const std::string_view &s) | |
| Construct the mask from a string. | |
| bool | same_shortcut_modifiers (const input_mask &o) const |
| If this input mask has a modifier set, so must the other one. | |
| int | ordinal (bool ignore_toggles=false) const |
| Add up how many modifiers and buttons are set here. | |
| uint16_t | keybuttonmask (const keysyms &k) const |
| Return the protocol SETofKEYBUTMASK value. | |
| uint16_t | keymask (const keysyms &k) const |
| Return the protocol SETofKEYMASK value. | |
Static Public Member Functions | |
| static uint32_t | shortcut_keysym (uint32_t) |
| Standard shortcut keysym. | |
Public Attributes | |
| char32_t | unicode {0} |
| Which key activates a hotspot. | |
| uint32_t | keysym {0} |
| Which key activates a hotspot. | |
Public Attributes inherited from x::w::input_mask | |
| bool | shift =false |
| Indicates that the shift key is pressed. | |
| bool | lock =false |
| Indicates that the lock key is pressed. | |
| bool | ctrl =false |
| Indicates that the control key is pressed. | |
| bool | num_lock =false |
| Indicates that num lock is on. | |
| bool | meta =false |
| Indicates that the "meta" key is pressed. | |
| bool | alt =false |
| Indicates that the "alt" key is pressed. | |
| bool | super =false |
| Indicates that the "super" key is pressed. | |
| bool | hyper =false |
| Indicates that the "hyper" key is pressed. | |
| bool | mode_switch =false |
| Indicates that the "mode switch" key is pressed. | |
| unsigned char | buttons =0 |
| Pointer buttons. | |
Private Member Functions | |
| shortcut (shortcut_parse_info) | |
| Internal constructor. | |
A keyboard shortcut for a hotspot.
Defines a keyboard shortcut for activating a hotspot no matter which widget has keyboard focus.
| x::w::shortcut::shortcut | ( | ) |
Default constructor.
The default constructor does not define any actual shortcut. matches() will never return true.
| x::w::shortcut::shortcut | ( | char32_t | unicode | ) |
Defines a shortcut comprising of a single key.
This is typically done only for \n or Esc. Most shortcuts should have a modifier, like Alt.
| x::w::shortcut::shortcut | ( | const std::string_view & | modifier, |
| char32_t | unicode | ||
| ) |
Specify a shortcut comprising of a modifier and a key.
The first parameter is a string that specifies a modifier. see input_mask's constructor.
|
inline |
Specify a shortcut as a single string.
The constructor's parameter must be one of the following:
This sets the unicode shortcut to the character, or the keysym to the appropriate function key or special key.
The specified string may also have a "modifier-" prefix, example: "shift-F1".
The specified string may also have a leading "${ }" prefix, such as:
"${context:creator}Alt-F"
This prefix gets stripped off, and ignored. This can be used with gettext to provide localization of different shortcut keys that have the same localized value, such as
"${context:file_menu}Alt-F" (for "File")
and
"${context:edit_menu}Alt-F" (for "Find")
Localized "File" and "Find" strings may then have different localized shortcuts.
|
private |
Internal constructor.
| std::string x::w::shortcut::description | ( | ) | const |
Description of this shortcut, as a string.
| std::u32string x::w::shortcut::label | ( | ) | const |
Description of this shortcut, as a unicode label.
This is used to label this shortcut in menus.
| bool x::w::shortcut::matches | ( | const key_event & | ke | ) | const |
Whether a key event matches this shortcut.
|
explicit |
Whether the shortcut is specified.
Return false for a default constructor.
|
inline |
Operator.
|
static |
Standard shortcut keysym.
If the parameter is one of the KP_ keysyms mentioned by the constructor, return the garden-variety keysym. If it's the garden variety keysym, return the KP_ keysym. If there is no KP_ keysym, return the smae keysym.
| uint32_t x::w::shortcut::keysym {0} |
Which key activates a hotspot.
A 0 key and keysym indicates no shortcut.
| char32_t x::w::shortcut::unicode {0} |
Which key activates a hotspot.