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

kdecore

  • kdecore
kaccelbase.h
1 /* This file is part of the KDE libraries
2  Copyright (C) 2001 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 _KACCELBASE_H
21 #define _KACCELBASE_H
22 
23 #include <tqmap.h>
24 #include <tqptrvector.h>
25 #include <tqstring.h>
26 #include <tqvaluevector.h>
27 #include <tqvaluelist.h>
28 
29 #include "kaccelaction.h"
30 #include "kkeyserver.h"
31 
32 class TQPopupMenu;
33 class TQWidget;
34 
35 //----------------------------------------------------
36 
121 class KDECORE_EXPORT KAccelBase
122 {
123  public:
125  enum Init { QT_KEYS = 0x00, NATIVE_KEYS = 0x01 };
126 
128  enum Signal { KEYCODE_CHANGED };
129 
133  KAccelBase( int fInitCode );
134  virtual ~KAccelBase();
135 
137  uint actionCount() const;
139  KAccelActions& actions();
141  bool isEnabled() const;
142 
144  KAccelAction* actionPtr( const TQString& sAction );
146  const KAccelAction* actionPtr( const TQString& sAction ) const;
154  KAccelAction* actionPtr( const KKey& key );
158  KAccelAction* actionPtr( const KKeyServer::Key& key );
159 
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 );
180 
181 // Procedures for manipulating Actions.
182  //void clearActions();
183 
184  KAccelAction* insert( const TQString& sName, const TQString& sDesc );
185  KAccelAction* insert(
186  const TQString& sAction, const TQString& sDesc, const TQString& sHelp,
187  const KShortcut& rgCutDefaults3, const KShortcut& rgCutDefaults4,
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 );
192 
193  bool updateConnections();
194 
195  bool setShortcut( const TQString& sAction, const KShortcut& cut );
196 
197 // Modify individual Action sub-items
198  bool setActionEnabled( const TQString& sAction, bool bEnable );
199 
208  void readSettings( KConfigBase* pConfig = 0 );
209 
215  void writeSettings( KConfigBase* pConfig = 0 ) const;
216 
217  TQPopupMenu* createPopupMenu( TQWidget* pParent, const KKeySequence& );
218 
219  // Protected methods
220  protected:
221  void slotRemoveAction( KAccelAction* );
222 
223  struct X;
224 
228  void createKeyList( TQValueVector<struct X>& rgKeys );
229  bool insertConnection( KAccelAction* );
230  bool removeConnection( KAccelAction* );
231 
235  virtual bool emitSignal( Signal signal ) = 0;
240  virtual bool connectKey( KAccelAction& action, const KKeyServer::Key& key ) = 0;
244  virtual bool connectKey( const KKeyServer::Key& key) = 0;
247  virtual bool disconnectKey( KAccelAction&, const KKeyServer::Key& ) = 0;
250  virtual bool disconnectKey( const KKeyServer::Key& ) = 0;
251 
252  protected:
253  virtual bool isEnabledInternal() const;
254  struct ActionInfo
255  {
256  KAccelAction* pAction;
257  uint iSeq, iVariation;
258  //ActionInfo* pInfoNext; // nil if only one action uses this key.
259 
260  ActionInfo() { pAction = 0; iSeq = 0xffff; iVariation = 0xffff; }
261  ActionInfo( KAccelAction* _pAction, uint _iSeq, uint _iVariation )
262  { pAction = _pAction; iSeq = _iSeq; iVariation = _iVariation; }
263  };
264  typedef TQMap<KKeyServer::Key, ActionInfo> KKeyToActionMap;
265 
266  KAccelActions m_rgActions;
267  KKeyToActionMap m_mapKeyToAction;
268  TQValueList<KAccelAction*> m_rgActionsNonUnique;
269  bool m_bNativeKeys; // Use native key codes instead of Qt codes
270  bool m_bEnabled;
271  bool m_bConfigIsGlobal;
272  TQString m_sConfigGroup;
273  bool m_bAutoUpdate;
274  KAccelAction* mtemp_pActionRemoving;
275 
276  private:
277  KAccelBase& operator =( const KAccelBase& );
278 
279  friend class KAccelActions;
280 };
281 
282 #endif // _KACCELBASE_H

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.8.1.2
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |