kdecore Library API Documentation

kaccel.h

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., 59 Temple Place - Suite 330,
00017     Boston, MA 02111-1307, USA.
00018 */
00019 
00020 #ifndef _KACCEL_H
00021 #define _KACCEL_H
00022 
00023 #include <qaccel.h>
00024 #include <kshortcut.h>
00025 #include <kstdaccel.h>
00026 #include "kdemacros.h"
00027 
00028 class QPopupMenu; // for obsolete insertItem() methods below
00029 class QWidget;
00030 class KAccelAction;
00031 class KAccelActions;
00032 class KConfigBase;
00033 
00034 class KAccelPrivate;
00094 class KAccel : public QAccel
00095 {
00096     Q_OBJECT
00097  public:
00105     KAccel( QWidget* pParent, const char* psName = 0 );
00106 
00114     KAccel( QWidget* watch, QObject* parent, const char* psName = 0 );
00115     virtual ~KAccel();
00116 
00122     KAccelActions& actions();
00123 
00129     const KAccelActions& actions() const;
00130 
00135     bool isEnabled();
00136 
00141     void setEnabled( bool bEnabled );
00142 
00153     bool setAutoUpdate( bool bAuto );
00154 
00176     KAccelAction* insert( const QString& sAction, const QString& sLabel, const QString& sWhatsThis,
00177                      const KShortcut& cutDef,
00178                      const QObject* pObjSlot, const char* psMethodSlot,
00179                      bool bConfigurable = true, bool bEnabled = true );
00184     KAccelAction* insert( const QString& sAction, const QString& sLabel, const QString& sWhatsThis,
00185                      const KShortcut& cutDef3, const KShortcut& cutDef4,
00186                      const QObject* pObjSlot, const char* psMethodSlot,
00187                      bool bConfigurable = true, bool bEnabled = true );
00205     KAccelAction* insert( const char* psAction, const KShortcut& cutDef,
00206                      const QObject* pObjSlot, const char* psMethodSlot,
00207                      bool bConfigurable = true, bool bEnabled = true );
00214     KAccelAction* insert( KStdAccel::StdAccel id,
00215                      const QObject* pObjSlot, const char* psMethodSlot,
00216                      bool bConfigurable = true, bool bEnabled = true );
00217 
00224     bool remove( const QString& sAction );
00225 
00234     bool updateConnections();
00235 
00241     const KShortcut& shortcut( const QString& sAction ) const;
00242 
00249     bool setShortcut( const QString& sAction, const KShortcut &shortcut );
00250 
00259     bool setSlot( const QString& sAction, const QObject* pObjSlot, const char* psMethodSlot );
00266     bool setEnabled( const QString& sAction, bool bEnabled );
00267 
00273     const QString& configGroup() const;
00274 
00280     void setConfigGroup( const QString &name );
00281 
00293     bool readSettings( KConfigBase* pConfig = 0 );
00302     bool writeSettings( KConfigBase* pConfig = 0 ) const;
00303 
00307     void emitKeycodeChanged();
00308 
00309  signals:
00313     void keycodeChanged();
00314 
00315 #ifndef KDE_NO_COMPAT
00316  public:
00317     // Source compatibility to KDE 2.x
00321     bool insertItem( const QString& sLabel, const QString& sAction,
00322                      const char* psKey,
00323                      int nIDMenu = 0, QPopupMenu* pMenu = 0, bool bConfigurable = true ) KDE_DEPRECATED;
00327     bool insertItem( const QString& sLabel, const QString& sAction,
00328                      int key,
00329                      int nIDMenu = 0, QPopupMenu* pMenu = 0, bool bConfigurable = true ) KDE_DEPRECATED;
00333     bool insertStdItem( KStdAccel::StdAccel id, const QString& descr = QString::null ) KDE_DEPRECATED;
00337     bool connectItem( const QString& sAction, const QObject* pObjSlot, const char* psMethodSlot, bool bActivate = true ) KDE_DEPRECATED;
00342     KDE_DEPRECATED bool connectItem( KStdAccel::StdAccel accel, const QObject* pObjSlot, const char* psMethodSlot )
00343         { return insert( accel, pObjSlot, psMethodSlot ); }
00347     bool removeItem( const QString& sAction ) KDE_DEPRECATED;
00351     bool setItemEnabled( const QString& sAction, bool bEnable ) KDE_DEPRECATED;
00355     void changeMenuAccel( QPopupMenu *menu, int id, const QString& action ) KDE_DEPRECATED;
00359     void changeMenuAccel( QPopupMenu *menu, int id, KStdAccel::StdAccel accel ) KDE_DEPRECATED;
00363     static int stringToKey( const QString& ) KDE_DEPRECATED;
00364 
00372     int currentKey( const QString& action ) const KDE_DEPRECATED;
00373 
00380     QString findKey( int key ) const KDE_DEPRECATED;
00381 #endif // !KDE_NO_COMPAT
00382 
00383  protected:
00385     virtual void virtual_hook( int id, void* data );
00386  private:
00387     class KAccelPrivate* d;
00388     friend class KAccelPrivate;
00389 };
00390 
00391 #endif // _KACCEL_H
KDE Logo
This file is part of the documentation for kdecore Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Jul 22 10:16:15 2005 by doxygen 1.3.6 written by Dimitri van Heesch, © 1997-2003