• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kdecore
 

kdecore

  • kdecore
kaccelaction.h
1 /* This file is part of the KDE libraries
2  Copyright (C) 2001,2002 Ellis Whitehead <ellis@kde.org>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License as published by the Free Software Foundation; either
7  version 2 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #ifndef _KACCELACTION_H
21 #define _KACCELACTION_H
22 
23 #include <tqmap.h>
24 #include <tqptrvector.h>
25 #include <tqstring.h>
26 #include <tqvaluevector.h>
27 
28 #include <kshortcut.h>
29 
30 class KAccelBase;
31 
32 class TQObject;
33 class KConfig;
34 class KConfigBase;
35 
72 class KDECORE_EXPORT KAccelAction
73 {
74  public:
79  KAccelAction();
80 
84  KAccelAction( const KAccelAction& );
85 
100  KAccelAction( const TQString& sName, const TQString& sLabel, const TQString& sWhatsThis,
101  const KShortcut& cutDef3, const KShortcut& cutDef4,
102  const TQObject* pObjSlot, const char* psMethodSlot,
103  bool bConfigurable, bool bEnabled );
104  ~KAccelAction();
105 
109  void clear();
110 
126  bool init( const TQString& sName, const TQString& sLabel, const TQString& sWhatsThis,
127  const KShortcut& cutDef3, const KShortcut& cutDef4,
128  const TQObject* pObjSlot, const char* psMethodSlot,
129  bool bConfigurable, bool bEnabled );
130 
134  KAccelAction& operator=( const KAccelAction& );
135 
141  const TQString& name() const { return m_sName; }
142 
148  const TQString& label() const { return m_sLabel; }
149 
155  const TQString& whatsThis() const { return m_sWhatsThis; }
156 
162  const KShortcut& shortcut() const { return m_cut; }
163 
171  const KShortcut& shortcutDefault() const;
172 
181  const KShortcut& shortcutDefault3() const { return m_cutDefault3; }
182 
191  const KShortcut& shortcutDefault4() const { return m_cutDefault4; }
192 
197  const TQObject* objSlotPtr() const { return m_pObjSlot; }
198 
203  const char* methodSlotPtr() const { return m_psMethodSlot; }
204 
209  bool isConfigurable() const { return m_bConfigurable; }
210 
215  bool isEnabled() const { return m_bEnabled; }
216 
221  void setName( const TQString& name );
222 
227  void setLabel( const TQString& label );
228 
233  void setWhatsThis( const TQString& whatsThis );
234 
240  bool setShortcut( const KShortcut& rgCuts );
241 
247  void setSlot( const TQObject* pObjSlot, const char* psMethodSlot );
248 
253  void setConfigurable( bool configurable );
254 
259  void setEnabled( bool enable );
260 
265  int getID() const { return m_nIDAccel; }
266 
274  void setID( int n ) { m_nIDAccel = n; }
275 
280  bool isConnected() const;
281 
289  bool setKeySequence( uint i, const KKeySequence &keySeq );
290 
296  void clearShortcut();
297 
304  bool contains( const KKeySequence &keySeq );
305 
311  TQString toString() const;
312 
316  TQString toStringInternal() const;
317 
322  static bool useFourModifierKeys();
323 
329  static void useFourModifierKeys( bool use );
330 
331  protected:
332  TQString m_sName ,
333  m_sLabel ,
334  m_sWhatsThis ;
335  KShortcut m_cut ;
336  KShortcut m_cutDefault3 ,
337  m_cutDefault4 ;
338  const TQObject* m_pObjSlot ;
339  const char* m_psMethodSlot ;
340  bool m_bConfigurable ,
341  m_bEnabled ;
342  int m_nIDAccel ;
343  uint m_nConnections ;
344 
346  void incConnections();
348  void decConnections();
349 
350  private:
351  static int g_bUseFourModifierKeys;
352  class KAccelActionPrivate* d;
353 
354  friend class KAccelActions;
355  friend class KAccelBase;
356 };
357 
358 //---------------------------------------------------------------------
359 // KAccelActions
360 //---------------------------------------------------------------------
361 
369 class KDECORE_EXPORT KAccelActions
370 {
371  public:
375  KAccelActions();
376 
380  KAccelActions( const KAccelActions& );
381  virtual ~KAccelActions();
382 
386  void clear();
387 
394  bool init( const KAccelActions &actions );
395 
403  bool init( KConfigBase& config, const TQString& sGroup );
404 
411  void updateShortcuts( KAccelActions &shortcuts );
412 
418  int actionIndex( const TQString& sAction ) const;
419 
427  KAccelAction* actionPtr( uint index );
428 
436  const KAccelAction* actionPtr( uint index ) const;
437 
444  KAccelAction* actionPtr( const TQString& sAction );
445 
452  const KAccelAction* actionPtr( const TQString& sAction ) const;
453 
460  KAccelAction* actionPtr( KKeySequence cut );
461 
470  KAccelAction& operator []( uint index );
471 
480  const KAccelAction& operator []( uint index ) const;
481 
497  KAccelAction* insert( const TQString& sAction, const TQString& sLabel, const TQString& sWhatsThis,
498  const KShortcut& rgCutDefaults3, const KShortcut& rgCutDefaults4,
499  const TQObject* pObjSlot = 0, const char* psMethodSlot = 0,
500  bool bConfigurable = true, bool bEnabled = true );
501 
508  KAccelAction* insert( const TQString& sName, const TQString& sLabel );
509 
515  bool remove( const TQString& sAction );
516 
524  bool readActions( const TQString& sConfigGroup = "Shortcuts", KConfigBase* pConfig = 0 );
525 
535  bool writeActions( const TQString& sConfigGroup = "Shortcuts", KConfigBase* pConfig = 0,
536  bool bWriteAll = false, bool bGlobal = false ) const;
537 
541  void emitKeycodeChanged();
542 
547  uint count() const;
548 
549  protected:
551  KAccelBase* m_pKAccelBase;
553  KAccelAction** m_prgActions;
554  uint m_nSizeAllocated ,
555  m_nSize ;
556 
562  void resize( uint new_size );
564  void insertPtr( KAccelAction* );
565 
566  private:
567  class KAccelActionsPrivate* d;
568 
569  KAccelActions( KAccelBase* );
570  void initPrivate( KAccelBase* );
571  KAccelActions& operator =( KAccelActions& );
572 
573  friend class KAccelBase;
574 };
575 
576 #endif // _KACCELACTION_H
KConfigBase
KDE Configuration Management abstract base class.
Definition: kconfigbase.h:71
KConfig
Access KDE Configuration entries.
Definition: kconfig.h:44
KKeySequence
A KKeySequence object holds a sequence of up to 4 keys.
Definition: kshortcut.h:289
KShortcut
The KShortcut class is used to represent a keyboard shortcut to an action.
Definition: kshortcut.h:544
KStdAccel::insert
const KShortcut & insert()
Toggle insert/overwrite (with visual feedback, e.g.
KStdAccel::shortcutDefault4
KShortcut shortcutDefault4(StdAccel id)
Returns the hardcoded default 4 modifier shortcut for id.
Definition: kstdaccel.cpp:225
KStdAccel::shortcutDefault3
KShortcut shortcutDefault3(StdAccel id)
Returns the hardcoded default 3 modifier shortcut for id.
Definition: kstdaccel.cpp:208
KStdAccel::shortcutDefault
KShortcut shortcutDefault(StdAccel id)
Returns the hardcoded default shortcut for id.
Definition: kstdaccel.cpp:202
KStdAccel::label
TQString label(StdAccel id)
Returns a localized label for user-visible display.
Definition: kstdaccel.cpp:156
KStdAccel::shortcut
const KShortcut & shortcut(StdAccel id)
Returns the keybinding for accel.
Definition: kstdaccel.cpp:174
KStdAction::clear
KAction * clear(const TQObject *recvr, const char *slot, KActionCollection *parent, const char *name=0)
KStdAction::whatsThis
KAction * whatsThis(const TQObject *recvr, const char *slot, KActionCollection *parent, const char *name=0)
KStdAction::name
const char * name(StdAction id)

kdecore

Skip menu "kdecore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdecore

Skip menu "kdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kdecore by doxygen 1.9.1
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |