20 #ifndef _KACCELACTION_H
21 #define _KACCELACTION_H
24 #include <tqptrvector.h>
26 #include <tqvaluevector.h>
28 #include <kshortcut.h>
72 class KDECORE_EXPORT KAccelAction
84 KAccelAction(
const KAccelAction& );
100 KAccelAction(
const TQString& sName,
const TQString& sLabel,
const TQString& sWhatsThis,
102 const TQObject* pObjSlot,
const char* psMethodSlot,
103 bool bConfigurable,
bool bEnabled );
126 bool init(
const TQString& sName,
const TQString& sLabel,
const TQString& sWhatsThis,
128 const TQObject* pObjSlot,
const char* psMethodSlot,
129 bool bConfigurable,
bool bEnabled );
134 KAccelAction& operator=(
const KAccelAction& );
141 const TQString&
name()
const {
return m_sName; }
148 const TQString&
label()
const {
return m_sLabel; }
155 const TQString&
whatsThis()
const {
return m_sWhatsThis; }
197 const TQObject* objSlotPtr()
const {
return m_pObjSlot; }
203 const char* methodSlotPtr()
const {
return m_psMethodSlot; }
209 bool isConfigurable()
const {
return m_bConfigurable; }
215 bool isEnabled()
const {
return m_bEnabled; }
221 void setName(
const TQString& name );
227 void setLabel(
const TQString& label );
233 void setWhatsThis(
const TQString& whatsThis );
240 bool setShortcut(
const KShortcut& rgCuts );
247 void setSlot(
const TQObject* pObjSlot,
const char* psMethodSlot );
253 void setConfigurable(
bool configurable );
259 void setEnabled(
bool enable );
265 int getID()
const {
return m_nIDAccel; }
274 void setID(
int n ) { m_nIDAccel = n; }
280 bool isConnected()
const;
289 bool setKeySequence( uint i,
const KKeySequence &keySeq );
296 void clearShortcut();
311 TQString toString()
const;
316 TQString toStringInternal()
const;
322 static bool useFourModifierKeys();
329 static void useFourModifierKeys(
bool use );
338 const TQObject* m_pObjSlot ;
339 const char* m_psMethodSlot ;
340 bool m_bConfigurable ,
343 uint m_nConnections ;
346 void incConnections();
348 void decConnections();
351 static int g_bUseFourModifierKeys;
352 class KAccelActionPrivate* d;
354 friend class KAccelActions;
355 friend class KAccelBase;
369 class KDECORE_EXPORT KAccelActions
380 KAccelActions(
const KAccelActions& );
381 virtual ~KAccelActions();
394 bool init(
const KAccelActions &actions );
403 bool init(
KConfigBase& config,
const TQString& sGroup );
411 void updateShortcuts( KAccelActions &shortcuts );
418 int actionIndex(
const TQString& sAction )
const;
427 KAccelAction* actionPtr( uint index );
436 const KAccelAction* actionPtr( uint index )
const;
444 KAccelAction* actionPtr(
const TQString& sAction );
452 const KAccelAction* actionPtr(
const TQString& sAction )
const;
470 KAccelAction& operator []( uint index );
480 const KAccelAction& operator []( uint index )
const;
497 KAccelAction*
insert(
const TQString& sAction,
const TQString& sLabel,
const TQString& sWhatsThis,
499 const TQObject* pObjSlot = 0,
const char* psMethodSlot = 0,
500 bool bConfigurable =
true,
bool bEnabled =
true );
508 KAccelAction*
insert(
const TQString& sName,
const TQString& sLabel );
515 bool remove(
const TQString& sAction );
524 bool readActions(
const TQString& sConfigGroup =
"Shortcuts",
KConfigBase* pConfig = 0 );
535 bool writeActions(
const TQString& sConfigGroup =
"Shortcuts",
KConfigBase* pConfig = 0,
536 bool bWriteAll =
false,
bool bGlobal =
false )
const;
541 void emitKeycodeChanged();
551 KAccelBase* m_pKAccelBase;
553 KAccelAction** m_prgActions;
554 uint m_nSizeAllocated ,
562 void resize( uint new_size );
564 void insertPtr( KAccelAction* );
567 class KAccelActionsPrivate* d;
569 KAccelActions( KAccelBase* );
570 void initPrivate( KAccelBase* );
571 KAccelActions& operator =( KAccelActions& );
573 friend class KAccelBase;
576 #endif // _KACCELACTION_H
const KShortcut & shortcut(StdAccel id)
Returns the keybinding for accel.
KShortcut shortcutDefault(StdAccel id)
Returns the hardcoded default shortcut for id.
KAction * clear(const TQObject *recvr, const char *slot, KActionCollection *parent, const char *name=0)
TQString label(StdAccel id)
Returns a localized label for user-visible display.
KShortcut shortcutDefault4(StdAccel id)
Returns the hardcoded default 4 modifier shortcut for id.
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.
KShortcut shortcutDefault3(StdAccel id)
Returns the hardcoded default 3 modifier shortcut for id.
KDE Configuration Management abstract base class.
const char * name(StdAction id)
Access KDE Configuration entries.
KAction * whatsThis(const TQObject *recvr, const char *slot, KActionCollection *parent, const char *name=0)