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

kdecore

  • kdecore
kshortcutlist.h
1 /* This file is part of the KDE libraries
2  Copyright (C) 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 __KSHORTCUTLIST_H
21 #define __KSHORTCUTLIST_H
22 
23 #include <tqglobal.h> // For uint
24 #include <tqstring.h>
25 #include "kdelibs_export.h"
26 
27 class TQVariant;
28 class KConfigBase;
29 class KInstance;
30 class KKeySequence;
31 class KShortcut;
32 
33 /**********************************************************************
34 * This is a wrapper class which allows a function to use one interface
35 * to KActionCollection, KAccelActions, and KActionPtrList.
36 **********************************************************************/
37 
48 class KDECORE_EXPORT KShortcutList
49 {
50  public:
54  KShortcutList();
55  virtual ~KShortcutList();
56 
61  virtual uint count() const = 0;
62 
68  virtual TQString name( uint index ) const = 0;
69 
75  virtual TQString label( uint index ) const = 0;
76 
82  virtual TQString whatsThis( uint index ) const = 0;
83 
84  // TODO KDE4: add virtual TQString toolTip( uint index ) const = 0
85  // Will then be used by the listview in kkeydialog
86 
93  virtual const KShortcut& shortcut( uint index ) const = 0;
94 
101  virtual const KShortcut& shortcutDefault( uint index ) const = 0;
102 
108  virtual bool isConfigurable( uint index ) const = 0;
109 
115  virtual bool setShortcut( uint index, const KShortcut &shortcut ) = 0;
116 
123  virtual bool isGlobal( uint index ) const;
124 
130  virtual int index( const TQString& sName ) const;
131 
137  virtual int index( const KKeySequence& keySeq ) const;
138 
143  virtual const KInstance* instance() const;
144 
145  // These are here in order to handle expansion.
146  enum Other { };
148  virtual TQVariant getOther( Other, uint index ) const = 0;
150  virtual bool setOther( Other, uint index, TQVariant ) = 0;
151 
156  virtual bool save() const = 0;
157 
165  virtual bool readSettings( const TQString& sConfigGroup = TQString::null, KConfigBase* pConfig = 0 );
166 
176  virtual bool writeSettings( const TQString& sConfigGroup = TQString::null, KConfigBase* pConfig = 0,
177  bool bWriteAll = false, bool bGlobal = false ) const;
178 
179  protected:
181  virtual void virtual_hook( int id, void* data );
182  private:
183  class KShortcutListPrivate* d;
184 };
185 
186 //---------------------------------------------------------------------
187 // KAccelShortcutList
188 //---------------------------------------------------------------------
189 
190 class KAccel;
191 class KAccelActions;
192 class KGlobalAccel;
193 
198 class KDECORE_EXPORT KAccelShortcutList : public KShortcutList
199 {
200  public:
205  KAccelShortcutList( KAccel* accel );
206 
212  KAccelShortcutList( KGlobalAccel* accel );
213 
222  KAccelShortcutList( KAccelActions &actions, bool bGlobal );
223  virtual ~KAccelShortcutList();
224 
225  virtual uint count() const;
226  virtual TQString name( uint index ) const;
227  virtual TQString label( uint index ) const;
228  virtual TQString whatsThis( uint index ) const;
229  virtual const KShortcut& shortcut( uint index ) const;
230  virtual const KShortcut& shortcutDefault( uint index ) const;
231  virtual bool isConfigurable( uint index ) const;
232  virtual bool setShortcut( uint index , const KShortcut& shortcut );
233  virtual bool isGlobal( uint index ) const;
234 
236  virtual TQVariant getOther( Other, uint index ) const;
238  virtual bool setOther( Other, uint index, TQVariant );
239 
240  virtual bool save() const;
241 
242  protected:
244  KAccelActions& m_actions;
246  bool m_bGlobal;
247 
248  protected:
249  virtual void virtual_hook( int id, void* data );
250  private:
251  class KAccelShortcutListPrivate* d;
252 };
253 
254 namespace KStdAccel {
255 //---------------------------------------------------------------------
256 // ShortcutList
257 //---------------------------------------------------------------------
258 
263 class KDECORE_EXPORT ShortcutList : public KShortcutList
264 {
265  public:
269  ShortcutList();
270  virtual ~ShortcutList();
271 
272  virtual uint count() const;
273  virtual TQString name( uint index ) const;
274  virtual TQString label( uint index ) const;
275  virtual TQString whatsThis( uint index ) const;
276  virtual const KShortcut& shortcut( uint index ) const;
277  virtual const KShortcut& shortcutDefault( uint index ) const;
278  virtual bool isConfigurable( uint index ) const;
279  virtual bool setShortcut( uint index , const KShortcut& shortcut );
280 
282  virtual TQVariant getOther( Other, uint index ) const;
284  virtual bool setOther( Other, uint index, TQVariant );
285 
286  virtual bool save() const;
287 
288  protected:
289  virtual void virtual_hook( int id, void* data );
290  private:
291  class ShortcutListPrivate* d;
292 };
293 }
294 
295 #endif // __KSHORTCUTLIST_H
KAccel
Handle shortcuts.
Definition: kaccel.h:93
KStdAccel::shortcut
const KShortcut & shortcut(StdAccel id)
Returns the keybinding for accel.
Definition: kstdaccel.cpp:174
KStdAccel::shortcutDefault
KShortcut shortcutDefault(StdAccel id)
Returns the hardcoded default shortcut for id.
Definition: kstdaccel.cpp:202
KShortcutList::count
virtual uint count() const =0
Returns the number of entries.
KShortcutList::shortcutDefault
virtual const KShortcut & shortcutDefault(uint index) const =0
Returns default shortcut with the given index.
KShortcutList::save
virtual bool save() const =0
Save the shortcut list.
KStdAccel::label
TQString label(StdAccel id)
Returns a localized label for user-visible display.
Definition: kstdaccel.cpp:156
KShortcutList::virtual_hook
virtual void virtual_hook(int id, void *data)
used to extend the interface with virtuals without breaking binary compatibility
Definition: kshortcutlist.cpp:212
KShortcutList::isGlobal
virtual bool isGlobal(uint index) const
Checks whether the shortcut with the given index is saved in the global configuration.
Definition: kshortcutlist.cpp:26
KShortcutList::shortcut
virtual const KShortcut & shortcut(uint index) const =0
Returns the shortcut with the given index.
KShortcutList::whatsThis
virtual TQString whatsThis(uint index) const =0
Returns the (i18n&#39;d) What&#39;s This text of the shortcut with the given index.
KShortcut
The KShortcut class is used to represent a keyboard shortcut to an action.
Definition: kshortcut.h:543
KKeySequence
A KKeySequence object holds a sequence of up to 4 keys.
Definition: kshortcut.h:288
KShortcutList::label
virtual TQString label(uint index) const =0
Returns the (i18n&#39;d) label of the shortcut with the given index.
KAccelShortcutList
KShortcutList implementation to access KAccel and KGlobalAccel lists.
Definition: kshortcutlist.h:198
KShortcutList
KShortcutList is an abstract base class for KAccelShortcutList and KStdAccel::ShortcutList.
Definition: kshortcutlist.h:48
KAccelShortcutList::m_actions
KAccelActions & m_actions
Actions (collection) for this shortcut list.
Definition: kshortcutlist.h:244
KInstance
Access to KDE global objects for use in shared libraries.
Definition: kinstance.h:43
KConfigBase
KDE Configuration Management abstract base class.
Definition: kconfigbase.h:70
KStdAccel::ShortcutList
KShortcutList implementation that accesses KStdAccel actions.
Definition: kshortcutlist.h:263
KAccelShortcutList::m_bGlobal
bool m_bGlobal
Is this shortcut list global? Access through isGlobal()
Definition: kshortcutlist.h:246
KShortcutList::isConfigurable
virtual bool isConfigurable(uint index) const =0
Checks whether the shortcut with the given index is configurable.
KShortcutList::setShortcut
virtual bool setShortcut(uint index, const KShortcut &shortcut)=0
Sets the shortcut of the given entry.
KShortcutList::name
virtual TQString name(uint index) const =0
Returns the name of the shortcut with the given index.
KStdAccel
Convenient methods for access to the common accelerator keys in the key configuration.
Definition: kshortcutlist.h:254
KGlobalAccel
KGlobalAccel allows you to have global accelerators that are independent of the focused window...
Definition: kglobalaccel.h:45

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