kaccelbase.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _KACCELBASE_H
00021 #define _KACCELBASE_H
00022
00023 #include <qmap.h>
00024 #include <qptrvector.h>
00025 #include <qstring.h>
00026 #include <qvaluevector.h>
00027 #include <qvaluelist.h>
00028
00029 #include "kaccelaction.h"
00030 #include "kkeyserver_x11.h"
00031
00032 class QPopupMenu;
00033 class QWidget;
00034
00035
00036
00122 class KAccelBase
00123 {
00124 public:
00125 enum Init { QT_KEYS = 0x00, NATIVE_KEYS = 0x01 };
00126 enum Signal { KEYCODE_CHANGED };
00127
00128 KAccelBase( int fInitCode );
00129 virtual ~KAccelBase();
00130
00131 uint actionCount() const;
00132 KAccelActions& actions();
00133 bool isEnabled() const;
00134
00135 KAccelAction* actionPtr( const QString& sAction );
00136 const KAccelAction* actionPtr( const QString& sAction ) const;
00137 KAccelAction* actionPtr( const KKey& key );
00138 KAccelAction* actionPtr( const KKeyServer::Key& key );
00139
00140 const QString& configGroup() const { return m_sConfigGroup; }
00141 void setConfigGroup( const QString& group );
00142 void setConfigGlobal( bool global );
00143 virtual void setEnabled( bool bEnabled ) = 0;
00144 bool getAutoUpdate() { return m_bAutoUpdate; }
00145
00146 bool setAutoUpdate( bool bAuto );
00147
00148
00149
00150
00151 KAccelAction* insert( const QString& sName, const QString& sDesc );
00152 KAccelAction* insert(
00153 const QString& sAction, const QString& sDesc, const QString& sHelp,
00154 const KShortcut& rgCutDefaults3, const KShortcut& rgCutDefaults4,
00155 const QObject* pObjSlot, const char* psMethodSlot,
00156 bool bConfigurable = true, bool bEnabled = true );
00157 bool remove( const QString& sAction );
00158 bool setActionSlot( const QString& sAction, const QObject* pObjSlot, const char* psMethodSlot );
00159
00160 bool updateConnections();
00161
00162 bool setShortcut( const QString& sAction, const KShortcut& cut );
00163
00164
00165 bool setActionEnabled( const QString& sAction, bool bEnable );
00166
00175 void readSettings( KConfigBase* pConfig = 0 );
00176
00182 void writeSettings( KConfigBase* pConfig = 0 ) const;
00183
00184 QPopupMenu* createPopupMenu( QWidget* pParent, const KKeySequence& );
00185
00186
00187 protected:
00188 void slotRemoveAction( KAccelAction* );
00189
00190 struct X;
00191 void createKeyList( QValueVector<struct X>& rgKeys );
00192 bool insertConnection( KAccelAction* );
00193 bool removeConnection( KAccelAction* );
00194
00195 virtual bool emitSignal( Signal ) = 0;
00196 virtual bool connectKey( KAccelAction&, const KKeyServer::Key& ) = 0;
00197 virtual bool connectKey( const KKeyServer::Key& ) = 0;
00198 virtual bool disconnectKey( KAccelAction&, const KKeyServer::Key& ) = 0;
00199 virtual bool disconnectKey( const KKeyServer::Key& ) = 0;
00200
00201 protected:
00202 struct ActionInfo
00203 {
00204 KAccelAction* pAction;
00205 uint iSeq, iVariation;
00206
00207
00208 ActionInfo() { pAction = 0; iSeq = 0xffff; iVariation = 0xffff; }
00209 ActionInfo( KAccelAction* _pAction, uint _iSeq, uint _iVariation )
00210 { pAction = _pAction; iSeq = _iSeq; iVariation = _iVariation; }
00211 };
00212 typedef QMap<KKeyServer::Key, ActionInfo> KKeyToActionMap;
00213
00214 KAccelActions m_rgActions;
00215 KKeyToActionMap m_mapKeyToAction;
00216 QValueList<KAccelAction*> m_rgActionsNonUnique;
00217 bool m_bNativeKeys;
00218 bool m_bEnabled;
00219 bool m_bConfigIsGlobal;
00220 QString m_sConfigGroup;
00221 bool m_bAutoUpdate;
00222 KAccelAction* mtemp_pActionRemoving;
00223
00224 private:
00225 KAccelBase& operator =( const KAccelBase& );
00226
00227 friend class KAccelActions;
00228 };
00229
00230 #endif // _KACCELBASE_H
This file is part of the documentation for kdecore Library Version 3.2.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Mar 4 22:43:28 2004 by
doxygen 1.3.6-20040222 written by
Dimitri van Heesch, © 1997-2003