libyui
|
00001 /************************************************************************** 00002 Copyright (C) 2000 - 2010 Novell, Inc. 00003 All Rights Reserved. 00004 00005 This program is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License along 00016 with this program; if not, write to the Free Software Foundation, Inc., 00017 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00018 00019 **************************************************************************/ 00020 00021 00022 /*---------------------------------------------------------------------\ 00023 | | 00024 | __ __ ____ _____ ____ | 00025 | \ \ / /_ _/ ___|_ _|___ \ | 00026 | \ V / _` \___ \ | | __) | | 00027 | | | (_| |___) || | / __/ | 00028 | |_|\__,_|____/ |_| |_____| | 00029 | | 00030 | core system | 00031 | (C) SuSE GmbH | 00032 \----------------------------------------------------------------------/ 00033 00034 File: YShortcutManager.h 00035 00036 Author: Stefan Hundhammer <sh@suse.de> 00037 00038 /-*/ 00039 00040 00041 #ifndef YShortcutManager_h 00042 #define YShortcutManager_h 00043 00044 #include "YWidget.h" 00045 #include "YShortcut.h" 00046 00047 class YDialog; 00048 00053 class YShortcutManager 00054 { 00055 public: 00059 YShortcutManager( YDialog *dialog ); 00060 00064 virtual ~YShortcutManager(); 00065 00072 void checkShortcuts( bool autoResolve = true ); 00073 00078 int conflictCount() { return _conflictCount; } 00079 00114 void resolveAllConflicts(); 00115 00119 YDialog *dialog() { return _dialog; } 00120 00121 protected: 00122 00126 void clearShortcutList(); 00127 00133 void findShortcutWidgets( YWidgetListConstIterator begin, 00134 YWidgetListConstIterator end ); 00135 00140 void resolveConflict( YShortcut * shortcut ); 00141 00146 int findShortestWizardButton( const YShortcutList & conflictList ); 00147 00154 unsigned findShortestWidget( const YShortcutList & conflictList ); 00155 00159 YDialog *_dialog; 00160 00164 YShortcutList _shortcutList; 00165 00169 int _wanted[ sizeof( char ) << 8 ]; 00170 00171 00175 bool _used[ sizeof( char ) << 8 ]; 00176 00177 00181 int _conflictCount; 00182 00183 00184 private: 00185 00186 bool _didCheck; 00187 }; 00188 00189 00190 #endif // YShortcutManager_h