kdeui
kactioncollection.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef __kactioncollection_h__
00026 #define __kactioncollection_h__
00027
00028 #include <kaction.h>
00029
00030 #include <qkeysequence.h>
00031 #include <qobject.h>
00032 #include <qvaluelist.h>
00033 #include <qguardedptr.h>
00034 #include <kguiitem.h>
00035 #include <kshortcut.h>
00036 #include <kstdaction.h>
00037 #include <kicontheme.h>
00038
00039 class QMenuBar;
00040 class QPopupMenu;
00041 class QComboBox;
00042 class QPoint;
00043 class QIconSet;
00044 class QString;
00045 class KToolBar;
00046
00047 class KAccel;
00048 class KAccelActions;
00049 class KConfig;
00050 class KConfigBase;
00051 class KURL;
00052 class KInstance;
00053 class KToolBar;
00054 class KActionCollection;
00055 class KPopupMenu;
00056 class KMainWindow;
00057 class KXMLGUIClient;
00058
00059 typedef QValueList<KAction *> KActionPtrList;
00060
00078 class KDEUI_EXPORT KActionCollection : public QObject
00079 {
00080 friend class KAction;
00081 friend class KXMLGUIClient;
00082
00083 Q_OBJECT
00084
00085 public:
00086 KActionCollection( QWidget *parent, const char *name = 0, KInstance *instance = 0 );
00092 KActionCollection( QWidget *watch, QObject* parent, const char *name = 0, KInstance *instance = 0 );
00093 #ifndef KDE_NO_COMPAT
00094 KActionCollection( const KActionCollection © );
00095 #endif
00096 virtual ~KActionCollection();
00097
00102 virtual void setWidget( QWidget *widget );
00103
00111 void setAutoConnectShortcuts( bool );
00112
00119 bool isAutoConnectShortcuts();
00120
00127
00128
00133 bool addDocCollection( KActionCollection* pDoc );
00134
00136
00137
00143
00144
00146 virtual KAccel* accel() KDE_DEPRECATED;
00148 virtual const KAccel* accel() const KDE_DEPRECATED;
00149
00151 KAccel* kaccel();
00153 const KAccel* kaccel() const;
00154
00156 KAccel* builderKAccel() const;
00158
00159
00160
00162 virtual uint count() const;
00163 bool isEmpty() const { return (count() == 0); }
00168 virtual KAction* action( int index ) const;
00176 virtual KAction* action( const char* name, const char* classname = 0 ) const;
00177
00182 virtual QStringList groups() const;
00187 virtual KActionPtrList actions( const QString& group ) const;
00189 virtual KActionPtrList actions() const;
00190
00194 bool readShortcutSettings( const QString& sConfigGroup = QString::null, KConfigBase* pConfig = 0 );
00198 bool writeShortcutSettings( const QString& sConfigGroup = QString::null, KConfigBase* pConfig = 0 ) const;
00199
00200 void setInstance( KInstance *instance );
00202 KInstance *instance() const;
00203
00207 void setXMLFile( const QString& );
00211 const QString& xmlFile() const;
00212
00213
00225 void setHighlightingEnabled( bool enable );
00234 bool highlightingEnabled() const;
00235
00249 void connectHighlight( QWidget *container, KAction *action );
00263 void disconnectHighlight( QWidget *container, KAction *action );
00264
00268 const KXMLGUIClient *parentGUIClient() const;
00269
00270 signals:
00271 void inserted( KAction* );
00272 void removed( KAction* );
00273
00282 void actionHighlighted( KAction *action );
00291 void actionHighlighted( KAction *action, bool highlight );
00301 void actionStatusText( const QString &text );
00307 void clearStatusText();
00308
00309 private:
00316 void beginXMLPlug( QWidget *widget );
00317 void endXMLPlug();
00319 void prepareXMLUnplug();
00320 void unplugShortcuts( KAccel* kaccel );
00321
00322 void _clear();
00323 void _insert( KAction* );
00324 void _remove( KAction* );
00325 KAction* _take( KAction* );
00326
00327 private slots:
00328 void slotMenuItemHighlighted( int id );
00329 void slotToolBarButtonHighlighted( int id, bool highlight );
00330 void slotMenuAboutToHide();
00331 void slotDestroyed();
00332
00333 private:
00334 KAction *findAction( QWidget *container, int id );
00335
00336 #ifndef KDE_NO_COMPAT
00337 public:
00338 KActionCollection( QObject *parent, const char *name = 0, KInstance *instance = 0 );
00339 #endif
00340
00341 public:
00352 void insert( KAction* action);
00353
00360 void remove( KAction* action );
00361
00369 KAction* take( KAction* action );
00370
00371 #ifndef KDE_NO_COMPAT
00372 KActionCollection operator+ ( const KActionCollection& ) const;
00373 KActionCollection& operator= ( const KActionCollection& );
00374 KActionCollection& operator+= ( const KActionCollection& );
00375 #endif // !KDE_NO_COMPAT
00376
00377
00378 public slots:
00383 void clear();
00384
00385 protected:
00386 virtual void virtual_hook( int id, void* data );
00387 private:
00388 KActionCollection( const char* name, const KXMLGUIClient* parent );
00389 class KActionCollectionPrivate;
00390 KActionCollectionPrivate *d;
00391 };
00392
00393 #endif