Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Examples

YShortcut.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                                                                      |
00003 |                      __   __    ____ _____ ____                      |
00004 |                      \ \ / /_ _/ ___|_   _|___ \                     |
00005 |                       \ V / _` \___ \ | |   __) |                    |
00006 |                        | | (_| |___) || |  / __/                     |
00007 |                        |_|\__,_|____/ |_| |_____|                    |
00008 |                                                                      |
00009 |                               core system                            |
00010 |                                                        (C) SuSE GmbH |
00011 \----------------------------------------------------------------------/
00012 
00013   File:       YShortcut.h
00014 
00015   Author:     Stefan Hundhammer <sh@suse.de>
00016 
00017 /-*/
00018 
00019 
00020 #ifndef YShortcut_h
00021 #define YShortcut_h
00022 
00023 #include "YWidget.h"
00024 #include <string>
00025 
00026 
00031 class YShortcut
00032 {
00033 public:
00037     YShortcut( YWidget *shortcut_widget );
00038 
00042     virtual ~YShortcut();
00043 
00047     YWidget *   widget() { return _widget; }
00048 
00049     
00054     const char *widgetClass() { return widget()->widgetClass(); }
00055 
00064     string shortcutString();
00065 
00070     string cleanShortcutString();
00071 
00076     static string cleanShortcutString( string shortcutString );
00077 
00082     char preferred();
00083 
00089     char shortcut();
00090 
00094     void setShortcut( char new_shortcut );
00095 
00100     bool conflict() { return _conflict; }
00101 
00105     void setConflict( bool newConflictState = true ) { _conflict = newConflictState; }
00106 
00111     int distinctShortcutChars();
00112     
00116     static char shortcutMarker() { return '&'; }
00117 
00125     static string::size_type findShortcutPos( const string & str, string::size_type start_pos = 0 );
00126 
00133     static char findShortcut( const string & str, string::size_type start_pos = 0 );
00134 
00139     static bool isValid( char c );
00140 
00145     static char normalized( char c );
00146 
00151     static string getShortcutString( YWidget * widget );
00152 
00153     
00154 protected:
00155 
00160     string getShortcutString();
00161     
00162 
00163     // Data members
00164     
00165     YWidget *   _widget;
00166     string      _shortcut_string;
00167     bool        _shortcut_string_chached;
00168     
00169     string      _clean_shortcut_string;
00170     bool        _clean_shortcut_string_chached;
00171     
00172     int         _preferred;     // int to enable initializing with invalid char ( -1 )
00173     int         _shortcut;      // int to enable initializing with invalid char ( -1 )
00174     
00175     bool        _conflict;
00176     int         _distinctShortcutChars;
00177 };
00178 
00179 typedef vector<YShortcut *>             YShortcutList;
00180 typedef YShortcutList::iterator         YShortcutListIterator;
00181 
00182 
00183 #endif // YShortcut_h

Generated on Fri Nov 9 18:15:23 2007 for yast2-core by doxygen 1.3.6