YShortcut Class Reference

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

#include <YShortcut.h>

List of all members.

Public Member Functions

 YShortcut (YWidget *shortcut_widget)
virtual ~YShortcut ()
YWidgetwidget ()
const char * widgetClass ()
string shortcutString ()
string cleanShortcutString ()
char preferred ()
char shortcut ()
void setShortcut (char new_shortcut)
bool conflict ()
void setConflict (bool newConflictState=true)
int distinctShortcutChars ()

Static Public Member Functions

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

Protected Member Functions

string getShortcutString ()

Protected Attributes

YWidget_widget
string _shortcut_string
bool _shortcut_string_chached
string _clean_shortcut_string
bool _clean_shortcut_string_chached
int _preferred
int _shortcut
bool _conflict
int _distinctShortcutChars


Detailed Description

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


Constructor & Destructor Documentation

YShortcut::YShortcut ( YWidget shortcut_widget  ) 

Constructor

YShortcut::~YShortcut (  )  [virtual]

Destructor


Member Function Documentation

YWidget* YShortcut::widget (  )  [inline]

Returns the YWidget this shortcut data belong to.

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

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

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.

string YShortcut::cleanShortcutString (  ) 

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

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

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

char YShortcut::preferred (  ) 

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

char YShortcut::shortcut (  ) 

The actual shortcut character.

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

void YShortcut::setShortcut ( char  new_shortcut  ) 

Set ( override ) the shortcut character.

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.

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

Set or unset the internal 'conflict' marker.

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.

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

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

string::size_type YShortcut::findShortcutPos ( const string &  str,
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 ( ! ) if found.

char YShortcut::findShortcut ( const string &  str,
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.

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

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

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.

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

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

string YShortcut::getShortcutString (  )  [protected]

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


Member Data Documentation

YWidget* YShortcut::_widget [protected]

string YShortcut::_shortcut_string [protected]

bool YShortcut::_shortcut_string_chached [protected]

string YShortcut::_clean_shortcut_string [protected]

bool YShortcut::_clean_shortcut_string_chached [protected]

int YShortcut::_preferred [protected]

int YShortcut::_shortcut [protected]

bool YShortcut::_conflict [protected]

int YShortcut::_distinctShortcutChars [protected]


The documentation for this class was generated from the following files:
Generated on Tue Nov 6 01:20:23 2007 for yast2-core by  doxygen 1.5.0