#include <YShortcut.h>
Helper class for shortcut management: This class holds data about the shortcut for one single widget.
Notice that there is also a derived class YItemShortcut for item-based widgets that may have multiple shortcuts like YDumbTab, YMenuBar, YItemSelector.
◆ anonymous enum
◆ YShortcut()
YShortcut::YShortcut |
( |
YWidget * | shortcut_widget | ) |
|
Constructor
- Parameters
-
shortcut_widget | (not owned, not nullptr) |
◆ ~YShortcut()
YShortcut::~YShortcut |
( |
| ) |
|
|
virtual |
◆ cleanShortcutString() [1/2]
string YShortcut::cleanShortcutString |
( |
| ) |
|
Returns the shortcut string ( from the widget's shortcut property ) without any "&" markers.
But an escaped "&&" is preserved.
◆ cleanShortcutString() [2/2]
static std::string YShortcut::cleanShortcutString |
( |
std::string | shortcutString | ) |
|
|
static |
Static version of the above for general use: Returns the specified string without any "&" markers. But an escaped "&&" is preserved.
◆ clearShortcut()
void YShortcut::clearShortcut |
( |
| ) |
|
Clear the shortcut: Override the shortcut character with nothing. This may happen if a conflict cannot be resolved.
◆ conflict()
bool YShortcut::conflict |
( |
| ) |
|
|
inline |
Query the internal 'conflict' marker. This class doesn't care about that flag, it just stores it for the convenience of higher-level classes.
◆ debugLabel()
virtual std::string YShortcut::debugLabel |
( |
| ) |
const |
|
inlinevirtual |
Label of this shortcut suitable for debugging
Reimplemented in YItemShortcut.
◆ distinctShortcutChars()
int YShortcut::distinctShortcutChars |
( |
| ) |
|
Obtain the number of distinct valid shortcut characters in the shortcut string, i.e. how many different shortcuts that widget could get.
◆ findShortcut()
char YShortcut::findShortcut |
( |
const std::string & | str, |
|
|
std::string::size_type | start_pos = 0 ) |
|
static |
Static function: Find the next shortcut marker in a string, beginning at starting position start_pos.
Returns the shortcut character or 0 if none found.
◆ findShortcutPos()
string::size_type YShortcut::findShortcutPos |
( |
const std::string & | str, |
|
|
std::string::size_type | start_pos = 0 ) |
|
static |
Static function: Find the next occurrence of the shortcut marker ('&') in a string, beginning at starting position start_pos.
An escaped "&&" does not count.
Returns string::npos if not found or the position of the shortcut marker (not the shortcut character!) if found.
◆ getShortcutString() [1/2]
string YShortcut::getShortcutString |
( |
| ) |
|
|
protectedvirtual |
Obtain the the shortcut property of this shortcut's widget - the string that contains "&" to designate a shortcut.
Reimplemented in YItemShortcut.
◆ getShortcutString() [2/2]
string YShortcut::getShortcutString |
( |
const YWidget * | widget | ) |
|
|
static |
Obtain a widget's shortcut property - the string that contains "&" to designate a shortcut.
◆ hasValidShortcutChar()
bool YShortcut::hasValidShortcutChar |
( |
| ) |
|
Return true if this shortcut contains any character that would be valid as a shortcut character.
◆ isButton()
bool YShortcut::isButton |
( |
| ) |
const |
|
inline |
Returns 'true' if the widget that is associated with this shortcut is a button (derived from YPushButton).
◆ isMenuItem()
virtual bool YShortcut::isMenuItem |
( |
| ) |
const |
|
inlinevirtual |
Returns 'true' if this is a shortcut for a (toplevel) menu item.
This default implementation always returns 'false'. Derived classes like YItemShortcut can choose to overwrite this.
Reimplemented in YItemShortcut.
◆ isValid()
bool YShortcut::isValid |
( |
char | c | ) |
|
|
static |
Returns 'true' if 'c' is a valid shortcut character, i.e. [a-zA-Z0-9], 'false' otherwise.
◆ isWizardButton()
bool YShortcut::isWizardButton |
( |
| ) |
const |
|
inline |
Returns 'true' if the widget that is associated with this shortcut is a wizard button (one of the navigation buttons of a wizard).
◆ normalized()
char YShortcut::normalized |
( |
char | c | ) |
|
|
static |
Return the normalized version of shortcut character 'c', i.e. a lowercase letter or a digit [a-z0-9]. Returns 0 if 'c' is invalid.
◆ preferred()
char YShortcut::preferred |
( |
| ) |
|
The preferred shortcut character, i.e. the character that had been preceded by "&" before checking / resolving conflicts began. 0 if none.
◆ setConflict()
void YShortcut::setConflict |
( |
bool | newConflictState = true | ) |
|
|
inline |
Set or unset the internal 'conflict' marker.
◆ setShortcut()
void YShortcut::setShortcut |
( |
char | newShortcut | ) |
|
|
virtual |
Set (override) the shortcut character.
Reimplemented in YItemShortcut.
◆ shortcut()
char YShortcut::shortcut |
( |
| ) |
|
The actual shortcut character. 0 if none.
This may be different from preferred() if it is overridden.
◆ shortcutMarker()
static char YShortcut::shortcutMarker |
( |
| ) |
|
|
inlinestatic |
Static function: Returns the character used for marking keyboard shortcuts.
◆ shortcutString()
string YShortcut::shortcutString |
( |
| ) |
|
Returns the complete shortcut string (which may or may not contain "&"), i.e. the value of the widget's shortcut property. For PushButtons, this is the label on the button ( e.g., "&Details..." ), for other widgets usually the caption above it.
This value is chached, i.e. this isn't a too expensive operation.
◆ widget()
YWidget * YShortcut::widget |
( |
| ) |
const |
|
inline |
Returns the YWidget this shortcut data belong to.
◆ widgetClass()
const char * YShortcut::widgetClass |
( |
| ) |
const |
|
inline |
Returns the textual representation of the widget class of the widget this shortcut data belongs to.
◆ _conflict
bool YShortcut::_conflict |
|
protected |
◆ _distinctShortcutChars
int YShortcut::_distinctShortcutChars |
|
protected |
◆ _isButton
bool YShortcut::_isButton |
|
protected |
◆ _isWizardButton
bool YShortcut::_isWizardButton |
|
protected |
◆ _preferred
int YShortcut::_preferred |
|
protected |
char or 0 (none found) or -1 (not initialized yet)
- See also
- preferred
◆ _shortcut
char or 0 (none found) or -1 (not initialized yet)
- See also
- shortcut
◆ _shortcutString
std::string YShortcut::_shortcutString |
|
protected |
The documentation for this class was generated from the following files:
- /__w/libyui/libyui/libyui/src/YShortcut.h
- /__w/libyui/libyui/libyui/src/YShortcut.cc