20 #ifndef _TDEACCELBASE_H
21 #define _TDEACCELBASE_H
24 #include <tqptrvector.h>
26 #include <tqvaluevector.h>
27 #include <tqvaluelist.h>
29 #include "tdeaccelaction.h"
30 #include "kkeyserver.h"
121 class TDECORE_EXPORT TDEAccelBase
125 enum Init { QT_KEYS = 0x00, NATIVE_KEYS = 0x01 };
128 enum Signal { KEYCODE_CHANGED };
133 TDEAccelBase(
int fInitCode );
134 virtual ~TDEAccelBase();
137 uint actionCount()
const;
139 TDEAccelActions& actions();
141 bool isEnabled()
const;
144 TDEAccelAction* actionPtr(
const TQString& sAction );
146 const TDEAccelAction* actionPtr(
const TQString& sAction )
const;
154 TDEAccelAction* actionPtr(
const KKey& key );
163 const TQString& configGroup()
const {
return m_sConfigGroup; }
167 void setConfigGroup(
const TQString& group );
168 void setConfigGlobal(
bool global );
173 virtual void setEnabled(
bool bEnabled ) = 0;
175 bool getAutoUpdate() {
return m_bAutoUpdate; }
179 bool setAutoUpdate(
bool bAuto );
184 TDEAccelAction*
insert(
const TQString& sName,
const TQString& sDesc );
186 const TQString& sAction,
const TQString& sDesc,
const TQString& sHelp,
188 const TQObject* pObjSlot,
const char* psMethodSlot,
189 bool bConfigurable =
true,
bool bEnabled =
true );
190 bool remove(
const TQString& sAction );
191 bool setActionSlot(
const TQString& sAction,
const TQObject* pObjSlot,
const char* psMethodSlot );
193 bool updateConnections();
195 bool setShortcut(
const TQString& sAction,
const TDEShortcut& cut );
198 bool setActionEnabled(
const TQString& sAction,
bool bEnable );
217 TQPopupMenu* createPopupMenu( TQWidget* pParent,
const KKeySequence& );
221 void slotRemoveAction( TDEAccelAction* );
228 void createKeyList( TQValueVector<struct X>& rgKeys );
229 bool insertConnection( TDEAccelAction* );
230 bool removeConnection( TDEAccelAction* );
235 virtual bool emitSignal( Signal signal ) = 0;
240 virtual bool connectKey( TDEAccelAction& action,
const KKeyServer::Key& key ) = 0;
247 virtual bool disconnectKey( TDEAccelAction&,
const KKeyServer::Key& ) = 0;
253 virtual bool isEnabledInternal()
const;
256 TDEAccelAction* pAction;
257 uint iSeq, iVariation;
260 ActionInfo() { pAction = 0; iSeq = 0xffff; iVariation = 0xffff; }
261 ActionInfo( TDEAccelAction* _pAction, uint _iSeq, uint _iVariation )
262 { pAction = _pAction; iSeq = _iSeq; iVariation = _iVariation; }
264 typedef TQMap<KKeyServer::Key, ActionInfo> KKeyToActionMap;
266 TDEAccelActions m_rgActions;
267 KKeyToActionMap m_mapKeyToAction;
268 TQValueList<TDEAccelAction*> m_rgActionsNonUnique;
271 bool m_bConfigIsGlobal;
272 TQString m_sConfigGroup;
274 TDEAccelAction* mtemp_pActionRemoving;
277 TDEAccelBase& operator =(
const TDEAccelBase& );
279 friend class TDEAccelActions;
A KKeySequence object holds a sequence of up to 4 keys.
A KKey object represents a single key with possible modifiers (Shift, Ctrl, Alt, Win).
KDE Configuration Management abstract base class.
The TDEShortcut class is used to represent a keyboard shortcut to an action.
const TDEShortcut & insert()
Toggle insert/overwrite (with visual feedback, e.g.