kdeui Library API Documentation

kactioncollection.h

00001 /* This file is part of the KDE libraries 00002 Copyright (C) 1999 Reginald Stadlbauer <reggie@kde.org> 00003 (C) 1999 Simon Hausmann <hausmann@kde.org> 00004 (C) 2000 Nicolas Hadacek <haadcek@kde.org> 00005 (C) 2000 Kurt Granroth <granroth@kde.org> 00006 (C) 2000 Michael Koch <koch@kde.org> 00007 (C) 2001 Holger Freyther <freyther@kde.org> 00008 (C) 2002 Ellis Whitehead <ellis@kde.org> 00009 00010 This library is free software; you can redistribute it and/or 00011 modify it under the terms of the GNU Library General Public 00012 License version 2 as published by the Free Software Foundation. 00013 00014 This library is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 Library General Public License for more details. 00018 00019 You should have received a copy of the GNU Library General Public License 00020 along with this library; see the file COPYING.LIB. If not, write to 00021 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00022 Boston, MA 02111-1307, USA. 00023 */ 00024 //$Id: kactioncollection.h,v 1.179 2004/02/26 21:14:59 ogoffart Exp $ 00025 00026 #ifndef __kactioncollection_h__ 00027 #define __kactioncollection_h__ 00028 00029 #include <kaction.h> 00030 00031 #include <qkeysequence.h> 00032 #include <qobject.h> 00033 #include <qvaluelist.h> 00034 #include <qguardedptr.h> 00035 #include <kguiitem.h> 00036 #include <kshortcut.h> 00037 #include <kstdaction.h> 00038 #include <kicontheme.h> 00039 00040 class QMenuBar; 00041 class QPopupMenu; 00042 class QComboBox; 00043 class QPoint; 00044 class QIconSet; 00045 class QString; 00046 class KToolBar; 00047 00048 class KAccel; 00049 class KAccelActions; 00050 class KConfig; 00051 class KConfigBase; 00052 class KURL; 00053 class KInstance; 00054 class KToolBar; 00055 class KActionCollection; 00056 class KPopupMenu; 00057 class KMainWindow; 00058 00059 typedef QValueList<KAction *> KActionPtrList; 00060 00064 class KActionCollection : public QObject 00065 { 00066 friend class KAction; 00067 friend class KXMLGUIClient; 00068 00069 Q_OBJECT 00070 00071 public: 00072 KActionCollection( QWidget *parent, const char *name = 0, KInstance *instance = 0 ); 00078 KActionCollection( QWidget *watch, QObject* parent, const char *name = 0, KInstance *instance = 0 ); 00079 KActionCollection( const KActionCollection &copy ); 00080 virtual ~KActionCollection(); 00081 00086 virtual void setWidget( QWidget *widget ); 00087 00095 void setAutoConnectShortcuts( bool ); 00096 00103 bool isAutoConnectShortcuts(); 00104 00111 //void setDefaultScope( KAction::Scope ); 00112 00117 bool addDocCollection( KActionCollection* pDoc ); 00118 00120 //uint widgetCount() const; 00121 00127 //bool ownsKAccel() const; 00128 00130 virtual KAccel* accel() KDE_DEPRECATED; 00132 virtual const KAccel* accel() const KDE_DEPRECATED; 00133 00135 KAccel* kaccel(); 00137 const KAccel* kaccel() const; 00138 00140 KAccel* builderKAccel() const; 00142 //KAccel* widgetKAccel( uint i ); 00143 //const KAccel* widgetKAccel( uint i ) const; 00144 00146 virtual uint count() const; 00147 bool isEmpty() const { return count() == 0; } 00152 virtual KAction* action( int index ) const; 00160 virtual KAction* action( const char* name, const char* classname = 0 ) const; 00161 00166 virtual QStringList groups() const; 00171 virtual KActionPtrList actions( const QString& group ) const; 00173 virtual KActionPtrList actions() const; 00174 00178 bool readShortcutSettings( const QString& sConfigGroup = QString::null, KConfigBase* pConfig = 0 ); 00182 bool writeShortcutSettings( const QString& sConfigGroup = QString::null, KConfigBase* pConfig = 0 ) const; 00183 00184 void setInstance( KInstance *instance ); 00186 KInstance *instance() const; 00187 00191 void setXMLFile( const QString& ); 00195 const QString& xmlFile() const; 00196 00205 void setHighlightingEnabled( bool enable ); 00214 bool highlightingEnabled() const; 00215 00226 void connectHighlight( QWidget *container, KAction *action ); 00237 void disconnectHighlight( QWidget *container, KAction *action ); 00238 00242 const KXMLGUIClient *parentGUIClient() const; 00243 00244 signals: 00245 void inserted( KAction* ); 00246 void removed( KAction* ); 00247 00255 void actionHighlighted( KAction *action ); 00263 void actionHighlighted( KAction *action, bool highlight ); 00264 00265 void actionStatusText( const QString &text ); 00266 void clearStatusText(); 00267 00268 private: 00275 void beginXMLPlug( QWidget *widget ); 00276 void endXMLPlug(); 00278 void prepareXMLUnplug(); 00279 void unplugShortcuts( KAccel* kaccel ); 00280 00281 void _clear(); 00282 void _insert( KAction* ); 00283 void _remove( KAction* ); 00284 KAction* _take( KAction* ); 00285 00286 private slots: 00287 void slotMenuItemHighlighted( int id ); 00288 void slotToolBarButtonHighlighted( int id, bool highlight ); 00289 void slotMenuAboutToHide(); 00290 void slotDestroyed(); 00291 00292 private: 00293 KAction *findAction( QWidget *container, int id ); 00294 00295 #ifndef KDE_NO_COMPAT 00296 public: 00297 KActionCollection( QObject *parent, const char *name = 0, KInstance *instance = 0 ); 00298 #endif 00299 00300 public: 00311 void insert( KAction* action); 00312 00319 void remove( KAction* action ); 00320 00328 KAction* take( KAction* action ); 00329 00330 #ifndef KDE_NO_COMPAT 00331 KActionCollection operator+ ( const KActionCollection& ) const; 00332 KActionCollection& operator= ( const KActionCollection& ); 00333 KActionCollection& operator+= ( const KActionCollection& ); 00334 00335 public slots: 00340 void clear(); 00341 #endif // !KDE_NO_COMPAT 00342 protected: 00343 virtual void virtual_hook( int id, void* data ); 00344 private: 00345 KActionCollection( const char* name, const KXMLGUIClient* parent ); 00346 class KActionCollectionPrivate; 00347 KActionCollectionPrivate *d; 00348 }; 00349 00350 #endif
KDE Logo
This file is part of the documentation for kdeui Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Sep 29 09:40:31 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003