tdeaccel.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., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef _TDEACCEL_H 00021 #define _TDEACCEL_H 00022 00023 #include <tqaccel.h> 00024 #include <tdeshortcut.h> 00025 #include <tdestdaccel.h> 00026 #include "tdelibs_export.h" 00027 00028 class TQPopupMenu; // for obsolete insertItem() methods below 00029 class TQWidget; 00030 class TDEAccelAction; 00031 class TDEAccelActions; 00032 class TDEConfigBase; 00033 00034 class TDEAccelPrivate; 00093 class TDECORE_EXPORT TDEAccel : public TQAccel 00094 { 00095 Q_OBJECT 00096 public: 00104 TDEAccel( TQWidget* pParent, const char* psName = 0 ); 00105 00113 TDEAccel( TQWidget* watch, TQObject* parent, const char* psName = 0 ); 00114 virtual ~TDEAccel(); 00115 00121 TDEAccelActions& actions(); 00122 00128 const TDEAccelActions& actions() const; 00129 00134 bool isEnabled(); 00135 00140 void setEnabled( bool bEnabled ); 00141 00152 bool setAutoUpdate( bool bAuto ); 00153 00175 TDEAccelAction* insert( const TQString& sAction, const TQString& sLabel, const TQString& sWhatsThis, 00176 const TDEShortcut& cutDef, 00177 const TQObject* pObjSlot, const char* psMethodSlot, 00178 bool bConfigurable = true, bool bEnabled = true ); 00183 TDEAccelAction* insert( const TQString& sAction, const TQString& sLabel, const TQString& sWhatsThis, 00184 const TDEShortcut& cutDef3, const TDEShortcut& cutDef4, 00185 const TQObject* pObjSlot, const char* psMethodSlot, 00186 bool bConfigurable = true, bool bEnabled = true ); 00204 TDEAccelAction* insert( const char* psAction, const TDEShortcut& cutDef, 00205 const TQObject* pObjSlot, const char* psMethodSlot, 00206 bool bConfigurable = true, bool bEnabled = true ); 00213 TDEAccelAction* insert( TDEStdAccel::StdAccel id, 00214 const TQObject* pObjSlot, const char* psMethodSlot, 00215 bool bConfigurable = true, bool bEnabled = true ); 00216 00223 bool remove( const TQString& sAction ); 00224 00233 bool updateConnections(); 00234 00240 const TDEShortcut& shortcut( const TQString& sAction ) const; 00241 00248 bool setShortcut( const TQString& sAction, const TDEShortcut &shortcut ); 00249 00258 bool setSlot( const TQString& sAction, const TQObject* pObjSlot, const char* psMethodSlot ); 00265 bool setEnabled( const TQString& sAction, bool bEnabled ); 00266 00272 const TQString& configGroup() const; 00273 00279 void setConfigGroup( const TQString &name ); 00280 00292 bool readSettings( TDEConfigBase* pConfig = 0 ); 00301 bool writeSettings( TDEConfigBase* pConfig = 0 ) const; 00302 00306 void emitKeycodeChanged(); 00307 00308 signals: 00312 void keycodeChanged(); 00313 00314 #ifndef KDE_NO_COMPAT 00315 public: 00316 // Source compatibility to KDE 2.x 00320 bool insertItem( const TQString& sLabel, const TQString& sAction, 00321 const char* psKey, 00322 int nIDMenu = 0, TQPopupMenu* pMenu = 0, bool bConfigurable = true ) KDE_DEPRECATED; 00326 bool insertItem( const TQString& sLabel, const TQString& sAction, 00327 int key, 00328 int nIDMenu = 0, TQPopupMenu* pMenu = 0, bool bConfigurable = true ) KDE_DEPRECATED; 00332 bool insertStdItem( TDEStdAccel::StdAccel id, const TQString& descr = TQString::null ) KDE_DEPRECATED; 00336 bool connectItem( const TQString& sAction, const TQObject* pObjSlot, const char* psMethodSlot, bool bActivate = true ) KDE_DEPRECATED; 00341 KDE_DEPRECATED bool connectItem( TDEStdAccel::StdAccel accel, const TQObject* pObjSlot, const char* psMethodSlot ) 00342 { return insert( accel, pObjSlot, psMethodSlot ); } 00346 bool removeItem( const TQString& sAction ) KDE_DEPRECATED; 00350 bool setItemEnabled( const TQString& sAction, bool bEnable ) KDE_DEPRECATED; 00354 void changeMenuAccel( TQPopupMenu *menu, int id, const TQString& action ) KDE_DEPRECATED; 00358 void changeMenuAccel( TQPopupMenu *menu, int id, TDEStdAccel::StdAccel accel ) KDE_DEPRECATED; 00362 static int stringToKey( const TQString& ) KDE_DEPRECATED; 00363 00371 int currentKey( const TQString& action ) const KDE_DEPRECATED; 00372 00379 TQString findKey( int key ) const KDE_DEPRECATED; 00380 #endif // !KDE_NO_COMPAT 00381 00382 protected: 00384 virtual void virtual_hook( int id, void* data ); 00385 private: 00386 class TDEAccelPrivate* d; 00387 friend class TDEAccelPrivate; 00388 }; 00389 00390 #endif // _TDEACCEL_H