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

tdecore

  • tdecore
tdeaccelbase.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 _TDEACCELBASE_H
21 #define _TDEACCELBASE_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 "tdeaccelaction.h"
30 #include "kkeyserver.h"
31 
32 class TQPopupMenu;
33 class TQWidget;
34 
35 //----------------------------------------------------
36 
121 class TDECORE_EXPORT TDEAccelBase
122 {
123  public:
125  enum Init { QT_KEYS = 0x00, NATIVE_KEYS = 0x01 };
126 
128  enum Signal { KEYCODE_CHANGED };
129 
133  TDEAccelBase( int fInitCode );
134  virtual ~TDEAccelBase();
135 
137  uint actionCount() const;
139  TDEAccelActions& actions();
141  bool isEnabled() const;
142 
144  TDEAccelAction* actionPtr( const TQString& sAction );
146  const TDEAccelAction* actionPtr( const TQString& sAction ) const;
154  TDEAccelAction* actionPtr( const KKey& key );
158  TDEAccelAction* 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  TDEAccelAction* insert( const TQString& sName, const TQString& sDesc );
185  TDEAccelAction* insert(
186  const TQString& sAction, const TQString& sDesc, const TQString& sHelp,
187  const TDEShortcut& rgCutDefaults3, const TDEShortcut& 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 TDEShortcut& cut );
196 
197 // Modify individual Action sub-items
198  bool setActionEnabled( const TQString& sAction, bool bEnable );
199 
208  void readSettings( TDEConfigBase* pConfig = 0 );
209 
215  void writeSettings( TDEConfigBase* pConfig = 0 ) const;
216 
217  TQPopupMenu* createPopupMenu( TQWidget* pParent, const KKeySequence& );
218 
219  // Protected methods
220  protected:
221  void slotRemoveAction( TDEAccelAction* );
222 
223  struct X;
224 
228  void createKeyList( TQValueVector<struct X>& rgKeys );
229  bool insertConnection( TDEAccelAction* );
230  bool removeConnection( TDEAccelAction* );
231 
235  virtual bool emitSignal( Signal signal ) = 0;
240  virtual bool connectKey( TDEAccelAction& action, const KKeyServer::Key& key ) = 0;
244  virtual bool connectKey( const KKeyServer::Key& key) = 0;
247  virtual bool disconnectKey( TDEAccelAction&, 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  TDEAccelAction* 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( TDEAccelAction* _pAction, uint _iSeq, uint _iVariation )
262  { pAction = _pAction; iSeq = _iSeq; iVariation = _iVariation; }
263  };
264  typedef TQMap<KKeyServer::Key, ActionInfo> KKeyToActionMap;
265 
266  TDEAccelActions m_rgActions;
267  KKeyToActionMap m_mapKeyToAction;
268  TQValueList<TDEAccelAction*> 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  TDEAccelAction* mtemp_pActionRemoving;
275 
276  private:
277  TDEAccelBase& operator =( const TDEAccelBase& );
278 
279  friend class TDEAccelActions;
280 };
281 
282 #endif // _TDEACCELBASE_H
KKeySequence
A KKeySequence object holds a sequence of up to 4 keys.
Definition: tdeshortcut.h:288
TDEConfigBase
KDE Configuration Management abstract base class.
Definition: tdeconfigbase.h:70
KKey
A KKey object represents a single key with possible modifiers (Shift, Ctrl, Alt, Win).
Definition: tdeshortcut.h:40
TDEShortcut
The TDEShortcut class is used to represent a keyboard shortcut to an action.
Definition: tdeshortcut.h:543
X
Definition: fixx11h.h:31
KKeyServer::Key
Represents a key press.
Definition: kkeyserver_x11.h:137
TDEStdAccel::insert
const TDEShortcut & insert()
Toggle insert/overwrite (with visual feedback, e.g.

tdecore

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

tdecore

Skip menu "tdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.8.8
This website is maintained by Timothy Pearson.