24 #include <tqptrvector.h> 26 #include <tqvaluevector.h> 27 #include <tqvaluelist.h> 29 #include "kaccelaction.h" 30 #include "kkeyserver.h" 121 class KDECORE_EXPORT KAccelBase
125 enum Init { QT_KEYS = 0x00, NATIVE_KEYS = 0x01 };
128 enum Signal { KEYCODE_CHANGED };
133 KAccelBase(
int fInitCode );
134 virtual ~KAccelBase();
137 uint actionCount()
const;
139 KAccelActions& actions();
141 bool isEnabled()
const;
144 KAccelAction* actionPtr(
const TQString& sAction );
146 const KAccelAction* actionPtr(
const TQString& sAction )
const;
154 KAccelAction* 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 KAccelAction*
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 KShortcut& cut );
198 bool setActionEnabled(
const TQString& sAction,
bool bEnable );
215 void writeSettings(
KConfigBase* pConfig = 0 )
const;
217 TQPopupMenu* createPopupMenu( TQWidget* pParent,
const KKeySequence& );
221 void slotRemoveAction( KAccelAction* );
228 void createKeyList( TQValueVector<struct X>& rgKeys );
229 bool insertConnection( KAccelAction* );
230 bool removeConnection( KAccelAction* );
235 virtual bool emitSignal( Signal signal ) = 0;
240 virtual bool connectKey( KAccelAction& action,
const KKeyServer::Key& key ) = 0;
247 virtual bool disconnectKey( KAccelAction&,
const KKeyServer::Key& ) = 0;
253 virtual bool isEnabledInternal()
const;
256 KAccelAction* pAction;
257 uint iSeq, iVariation;
260 ActionInfo() { pAction = 0; iSeq = 0xffff; iVariation = 0xffff; }
261 ActionInfo( KAccelAction* _pAction, uint _iSeq, uint _iVariation )
262 { pAction = _pAction; iSeq = _iSeq; iVariation = _iVariation; }
264 typedef TQMap<KKeyServer::Key, ActionInfo> KKeyToActionMap;
266 KAccelActions m_rgActions;
267 KKeyToActionMap m_mapKeyToAction;
268 TQValueList<KAccelAction*> m_rgActionsNonUnique;
271 bool m_bConfigIsGlobal;
272 TQString m_sConfigGroup;
274 KAccelAction* mtemp_pActionRemoving;
277 KAccelBase& operator =(
const KAccelBase& );
279 friend class KAccelActions;
282 #endif // _KACCELBASE_H const KShortcut & insert()
Toggle insert/overwrite (with visual feedback, e.g.
The KShortcut class is used to represent a keyboard shortcut to an action.
A KKeySequence object holds a sequence of up to 4 keys.
KDE Configuration Management abstract base class.
A KKey object represents a single key with possible modifiers (Shift, Ctrl, Alt, Win).