libyui  3.0.10
YShortcut Class Reference

#include <YShortcut.h>

Inheritance diagram for YShortcut:
Collaboration diagram for YShortcut:

List of all members.

Public Types

enum  { None = 0 }

Public Member Functions

 YShortcut (YWidget *shortcut_widget)
virtual ~YShortcut ()
YWidgetwidget () const
const char * widgetClass () const
bool isButton () const
bool isWizardButton () const
std::string shortcutString ()
std::string cleanShortcutString ()
char preferred ()
char shortcut ()
virtual void setShortcut (char newShortcut)
void clearShortcut ()
bool conflict ()
void setConflict (bool newConflictState=true)
int distinctShortcutChars ()
bool hasValidShortcutChar ()

Static Public Member Functions

static std::string cleanShortcutString (std::string shortcutString)
static char shortcutMarker ()
static std::string::size_type findShortcutPos (const std::string &str, std::string::size_type start_pos=0)
static char findShortcut (const std::string &str, std::string::size_type start_pos=0)
static bool isValid (char c)
static char normalized (char c)
static std::string getShortcutString (const YWidget *widget)

Protected Member Functions

virtual std::string getShortcutString ()

Protected Attributes

YWidget_widget
std::string _shortcutString
bool _shortcutStringCached
std::string _cleanShortcutString
bool _cleanShortcutStringCached
int _preferred
int _shortcut
bool _conflict
bool _isButton
bool _isWizardButton
int _distinctShortcutChars

Detailed Description

Helper class for shortcut management: This class holds data about the shortcut for one single widget.

Definition at line 40 of file YShortcut.h.


Member Enumeration Documentation

anonymous enum

Marker for "no shortcut"

Definition at line 56 of file YShortcut.h.


Constructor & Destructor Documentation

YShortcut::YShortcut ( YWidget shortcut_widget)

Constructor

Definition at line 41 of file YShortcut.cc.

Here is the call graph for this function:

YShortcut::~YShortcut ( ) [virtual]

Destructor

Definition at line 69 of file YShortcut.cc.


Member Function Documentation

Returns the shortcut string ( from the widget's shortcut property ) without any "&" markers.

Definition at line 91 of file YShortcut.cc.

Here is the call graph for this function:

std::string YShortcut::cleanShortcutString ( std::string  shortcutString) [static]

Static version of the above for general use: Returns the specified string without any "&" markers.

Definition at line 103 of file YShortcut.cc.

Here is the call graph for this function:

Clear the shortcut: Override the shortcut character with nothing. This may happen if a conflict cannot be resolved.

Definition at line 173 of file YShortcut.cc.

Here is the call graph for this function:

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.

Definition at line 131 of file YShortcut.h.

Obtain the number of distinct valid shortcut characters in the shortcut string, i.e. how many different shortcuts that widget could get.

Definition at line 180 of file YShortcut.cc.

Here is the call graph for this function:

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.

Definition at line 280 of file YShortcut.cc.

Here is the call graph for this function:

std::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.

Returns string::npos if not found or the position of the shortcut marker (not the shortcut character!) if found.

Definition at line 254 of file YShortcut.cc.

Here is the call graph for this function:

std::string YShortcut::getShortcutString ( const YWidget widget) [static]

Obtain a widget's shortcut property - the string that contains "&" to designate a shortcut.

Definition at line 244 of file YShortcut.cc.

Here is the call graph for this function:

std::string YShortcut::getShortcutString ( ) [protected, virtual]

Obtain the the shortcut property of this shortcut's widget - the string that contains "&" to designate a shortcut.

Reimplemented in YItemShortcut.

Definition at line 237 of file YShortcut.cc.

Here is the call graph for this function:

Return true if this shortcut contains any character that would be valid as a shortcut character.

Definition at line 222 of file YShortcut.cc.

Here is the call graph for this function:

bool YShortcut::isButton ( ) const [inline]

Returns 'true' if the widget that is associated with this shortcut is a button (derived from YPushButton).

Definition at line 73 of file YShortcut.h.

bool YShortcut::isValid ( char  c) [static]

Returns 'true' if 'c' is a valid shortcut character, i.e. [a-zA-Z0-9], 'false' otherwise.

Definition at line 289 of file YShortcut.cc.

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).

Definition at line 79 of file YShortcut.h.

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.

Definition at line 299 of file YShortcut.cc.

The preferred shortcut character, i.e. the character that had been preceded by "&" before checking / resolving conflicts began.

Definition at line 117 of file YShortcut.cc.

Here is the call graph for this function:

void YShortcut::setConflict ( bool  newConflictState = true) [inline]

Set or unset the internal 'conflict' marker.

Definition at line 136 of file YShortcut.h.

void YShortcut::setShortcut ( char  newShortcut) [virtual]

Set (override) the shortcut character.

Reimplemented in YItemShortcut.

Definition at line 141 of file YShortcut.cc.

Here is the call graph for this function:

The actual shortcut character.

This may be different from preferred() if it is overridden.

Definition at line 129 of file YShortcut.cc.

Here is the call graph for this function:

static char YShortcut::shortcutMarker ( ) [inline, static]

Static function: Returns the character used for marking keyboard shortcuts.

Definition at line 154 of file YShortcut.h.

std::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.

Definition at line 75 of file YShortcut.cc.

Here is the call graph for this function:

YWidget* YShortcut::widget ( ) const [inline]

Returns the YWidget this shortcut data belong to.

Definition at line 61 of file YShortcut.h.

const char* YShortcut::widgetClass ( ) const [inline]

Returns the textual representation of the widget class of the widget this shortcut data belongs to.

Definition at line 67 of file YShortcut.h.

Here is the call graph for this function:


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations Friends