• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

KDECore

kaccelaction.h

Go to the documentation of this file.
00001 /* This file is part of the KDE libraries
00002     Copyright (C) 2001,2002 Ellis Whitehead <ellis@kde.org>
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Library General Public
00006     License as published by the Free Software Foundation; either
00007     version 2 of the License, or (at your option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Library General Public License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public License
00015     along with this library; see the file COPYING.LIB.  If not, write to
00016     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017     Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef _KACCELACTION_H
00021 #define _KACCELACTION_H
00022 
00023 #include <qmap.h>
00024 #include <qptrvector.h>
00025 #include <qstring.h>
00026 #include <qvaluevector.h>
00027 
00028 #include <kshortcut.h>
00029 
00030 class KAccelBase;
00031 
00032 class QObject;
00033 class KConfig;
00034 class KConfigBase;
00035 
00072 class KDECORE_EXPORT KAccelAction
00073 {
00074  public:
00079     KAccelAction();
00080 
00084     KAccelAction( const KAccelAction& );
00085 
00100     KAccelAction( const QString& sName, const QString& sLabel, const QString& sWhatsThis,
00101             const KShortcut& cutDef3, const KShortcut& cutDef4,
00102             const QObject* pObjSlot, const char* psMethodSlot,
00103             bool bConfigurable, bool bEnabled );
00104     ~KAccelAction();
00105 
00109     void clear();
00110 
00126     bool init( const QString& sName, const QString& sLabel, const QString& sWhatsThis,
00127             const KShortcut& cutDef3, const KShortcut& cutDef4,
00128             const QObject* pObjSlot, const char* psMethodSlot,
00129             bool bConfigurable, bool bEnabled );
00130 
00134     KAccelAction& operator=( const KAccelAction& );
00135 
00141     const QString& name() const                { return m_sName; }
00142 
00148     const QString& label() const               { return m_sLabel; }
00149 
00155     const QString& whatsThis() const           { return m_sWhatsThis; }
00156     
00162     const KShortcut& shortcut() const          { return m_cut; }
00163 
00171     const KShortcut& shortcutDefault() const;
00172 
00181     const KShortcut& shortcutDefault3() const  { return m_cutDefault3; }
00182 
00191     const KShortcut& shortcutDefault4() const  { return m_cutDefault4; }
00192 
00197     const QObject* objSlotPtr() const          { return m_pObjSlot; }
00198 
00203     const char* methodSlotPtr() const          { return m_psMethodSlot; }
00204 
00209     bool isConfigurable() const                { return m_bConfigurable; }
00210 
00215     bool isEnabled() const                     { return m_bEnabled; }
00216 
00221     void setName( const QString& name );
00222 
00227     void setLabel( const QString& label );
00228 
00233     void setWhatsThis( const QString& whatsThis );
00234 
00240     bool setShortcut( const KShortcut& rgCuts );
00241 
00247     void setSlot( const QObject* pObjSlot, const char* psMethodSlot );
00248 
00253     void setConfigurable( bool configurable );
00254 
00259     void setEnabled( bool enable );
00260 
00265     int getID() const   { return m_nIDAccel; }
00266 
00274     void setID( int n ) { m_nIDAccel = n; }
00275 
00280     bool isConnected() const;
00281 
00289     bool setKeySequence( uint i, const KKeySequence &keySeq );
00290     
00296     void clearShortcut();
00297     
00304     bool contains( const KKeySequence &keySeq );
00305 
00311     QString toString() const;
00312 
00316     QString toStringInternal() const;
00317 
00322     static bool useFourModifierKeys();
00323 
00329     static void useFourModifierKeys( bool use );
00330 
00331  protected:
00332     QString m_sName ,
00333             m_sLabel ,
00334             m_sWhatsThis ;
00335     KShortcut m_cut ;
00336     KShortcut m_cutDefault3 , 
00337           m_cutDefault4 ;
00338     const QObject* m_pObjSlot ;
00339     const char* m_psMethodSlot ;
00340     bool m_bConfigurable ,
00341          m_bEnabled ;
00342     int m_nIDAccel ;
00343     uint m_nConnections  ;
00344 
00346     void incConnections();
00348     void decConnections();
00349 
00350  private:
00351     static int g_bUseFourModifierKeys;
00352     class KAccelActionPrivate* d;
00353 
00354     friend class KAccelActions;
00355     friend class KAccelBase;
00356 };
00357 
00358 //---------------------------------------------------------------------
00359 // KAccelActions
00360 //---------------------------------------------------------------------
00361 
00369 class KDECORE_EXPORT KAccelActions
00370 {
00371  public:
00375     KAccelActions();
00376 
00380     KAccelActions( const KAccelActions& );
00381     virtual ~KAccelActions();
00382 
00386     void clear();
00387 
00394     bool init( const KAccelActions &actions );
00395 
00403     bool init( KConfigBase& config, const QString& sGroup );
00404 
00411     void updateShortcuts( KAccelActions &shortcuts );
00412 
00418     int actionIndex( const QString& sAction ) const;
00419 
00427     KAccelAction* actionPtr( uint index );
00428 
00436     const KAccelAction* actionPtr( uint index ) const;
00437 
00444     KAccelAction* actionPtr( const QString& sAction );
00445 
00452     const KAccelAction* actionPtr( const QString& sAction ) const;
00453 
00460     KAccelAction* actionPtr( KKeySequence cut );
00461 
00470     KAccelAction& operator []( uint index );
00471 
00480     const KAccelAction& operator []( uint index ) const;
00481 
00497     KAccelAction* insert( const QString& sAction, const QString& sLabel, const QString& sWhatsThis,
00498             const KShortcut& rgCutDefaults3, const KShortcut& rgCutDefaults4,
00499             const QObject* pObjSlot = 0, const char* psMethodSlot = 0,
00500             bool bConfigurable = true, bool bEnabled = true );
00501 
00508     KAccelAction* insert( const QString& sName, const QString& sLabel );
00509 
00515     bool remove( const QString& sAction );
00516 
00524     bool readActions( const QString& sConfigGroup = "Shortcuts", KConfigBase* pConfig = 0 );
00525 
00535     bool writeActions( const QString& sConfigGroup = "Shortcuts", KConfigBase* pConfig = 0,
00536             bool bWriteAll = false, bool bGlobal = false ) const;
00537 
00541     void emitKeycodeChanged();
00542 
00547     uint count() const;
00548 
00549  protected:
00551     KAccelBase* m_pKAccelBase;
00553     KAccelAction** m_prgActions;
00554     uint m_nSizeAllocated , 
00555          m_nSize  ;
00556 
00562     void resize( uint new_size );
00564     void insertPtr( KAccelAction* );
00565 
00566  private:
00567     class KAccelActionsPrivate* d;
00568 
00569     KAccelActions( KAccelBase* );
00570     void initPrivate( KAccelBase* );
00571     KAccelActions& operator =( KAccelActions& );
00572 
00573     friend class KAccelBase;
00574 };
00575 
00576 #endif // _KACCELACTION_H

KDECore

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

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal