kactioncollection.h
/* This file is part of the KDE libraries
Copyright (C) 1999 Reginald Stadlbauer <reggie@kde.org>
(C) 1999 Simon Hausmann <hausmann@kde.org>
(C) 2000 Nicolas Hadacek <haadcek@kde.org>
(C) 2000 Kurt Granroth <granroth@kde.org>
(C) 2000 Michael Koch <koch@kde.org>
(C) 2001 Holger Freyther <freyther@kde.org>
(C) 2002 Ellis Whitehead <ellis@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef __kactioncollection_h__
#define __kactioncollection_h__
#include <kaction.h>
#include <qkeysequence.h>
#include <qobject.h>
#include <qvaluelist.h>
#include <qguardedptr.h>
#include <kguiitem.h>
#include <kshortcut.h>
#include <kstdaction.h>
#include <kicontheme.h>
class QMenuBar;
class QPopupMenu;
class QComboBox;
class QPoint;
class QIconSet;
class QString;
class KToolBar;
class KAccel;
class KAccelActions;
class KConfig;
class KConfigBase;
class KURL;
class KInstance;
class KToolBar;
class KActionCollection;
class KPopupMenu;
class KMainWindow;
class KXMLGUIClient;
typedef QValueList<KAction *> KActionPtrList;
class KDEUI_EXPORT KActionCollection : public QObject
{
friend class KAction;
friend class KXMLGUIClient;
Q_OBJECT
public:
KActionCollection( QWidget *parent, const char *name = 0, KInstance *instance = 0 );
KActionCollection( QWidget *watch, QObject* parent, const char *name = 0, KInstance *instance = 0 );
#ifndef KDE_NO_COMPAT
KActionCollection( const KActionCollection &copy );
#endif
virtual ~KActionCollection();
virtual void setWidget( QWidget *widget );
void setAutoConnectShortcuts( bool );
bool isAutoConnectShortcuts();
//void setDefaultScope( KAction::Scope );
bool addDocCollection( KActionCollection* pDoc );
//uint widgetCount() const;
//bool ownsKAccel() const;
virtual KAccel* accel() KDE_DEPRECATED;
virtual const KAccel* accel() const KDE_DEPRECATED;
KAccel* kaccel();
const KAccel* kaccel() const;
KAccel* builderKAccel() const;
//KAccel* widgetKAccel( uint i );
//const KAccel* widgetKAccel( uint i ) const;
virtual uint count() const;
bool isEmpty() const { return (count() == 0); }
virtual KAction* action( int index ) const;
virtual KAction* action( const char* name, const char* classname = 0 ) const;
virtual QStringList groups() const;
virtual KActionPtrList actions( const QString& group ) const;
virtual KActionPtrList actions() const;
bool readShortcutSettings( const QString& sConfigGroup = QString::null, KConfigBase* pConfig = 0 );
bool writeShortcutSettings( const QString& sConfigGroup = QString::null, KConfigBase* pConfig = 0 ) const;
void setInstance( KInstance *instance );
KInstance *instance() const;
void setXMLFile( const QString& );
const QString& xmlFile() const;
//TODO FOR KDE4 make this default true
void setHighlightingEnabled( bool enable );
bool highlightingEnabled() const;
void connectHighlight( QWidget *container, KAction *action );
void disconnectHighlight( QWidget *container, KAction *action );
const KXMLGUIClient *parentGUIClient() const;
signals:
void inserted( KAction* );
void removed( KAction* );
void actionHighlighted( KAction *action );
void actionHighlighted( KAction *action, bool highlight );
void actionStatusText( const QString &text );
void clearStatusText();
private:
void beginXMLPlug( QWidget *widget );
void endXMLPlug();
void prepareXMLUnplug();
void unplugShortcuts( KAccel* kaccel );
void _clear();
void _insert( KAction* );
void _remove( KAction* );
KAction* _take( KAction* );
private slots:
void slotMenuItemHighlighted( int id );
void slotToolBarButtonHighlighted( int id, bool highlight );
void slotMenuAboutToHide();
void slotDestroyed();
private:
KAction *findAction( QWidget *container, int id );
#ifndef KDE_NO_COMPAT
public:
KActionCollection( QObject *parent, const char *name = 0, KInstance *instance = 0 );
#endif
public:
void insert( KAction* action);
void remove( KAction* action );
KAction* take( KAction* action );
#ifndef KDE_NO_COMPAT
KActionCollection operator+ ( const KActionCollection& ) const;
KActionCollection& operator= ( const KActionCollection& );
KActionCollection& operator+= ( const KActionCollection& );
#endif // !KDE_NO_COMPAT
// KDE4: clear() doesn't need to be a slot
public slots:
void clear();
protected:
virtual void virtual_hook( int id, void* data );
private:
KActionCollection( const char* name, const KXMLGUIClient* parent );
class KActionCollectionPrivate;
KActionCollectionPrivate *d;
};
#endif
KURL
KActionCollection
A managed set of KAction objects.
Definition: kactioncollection.h:78
KAccel
KXMLGUIClient
A KXMLGUIClient can be used with KXMLGUIFactory to create a GUI from actions and an XML document...
Definition: kxmlguiclient.h:43
KXMLGUIClient::setXMLFile
virtual void setXMLFile(const QString &file, bool merge=false, bool setXMLDoc=true)
Sets the name of the rc file containing the XML for the part.
Definition: kxmlguiclient.cpp:165
KXMLGUIClient::xmlFile
virtual QString xmlFile() const
This will return the name of the XML file as set by setXMLFile().
Definition: kxmlguiclient.cpp:133
KMainWindow
KDE top level main window
Definition: kmainwindow.h:98
KXMLGUIClient::endXMLPlug
void endXMLPlug()
Definition: kxmlguiclient.cpp:934
KInstance
KXMLGUIClient::setInstance
virtual void setInstance(KInstance *instance)
Returns true if client was added to super client list.
Definition: kxmlguiclient.cpp:157
KXMLGUIClient::action
KAction * action(const char *name) const
Retrieves an action of the client by name.
Definition: kxmlguiclient.cpp:93
KConfigBase
KConfig
KToolBar
Floatable toolbar with auto resize.
Definition: ktoolbar.h:103
KAction
Class to encapsulate user-driven action or event.
Definition: kaction.h:202
KXMLGUIClient::beginXMLPlug
void beginXMLPlug(QWidget *)
Definition: kxmlguiclient.cpp:926
KXMLGUIClient::prepareXMLUnplug
void prepareXMLUnplug(QWidget *)
Definition: kxmlguiclient.cpp:942
KXMLGUIClient::instance
virtual KInstance * instance() const
Definition: kxmlguiclient.cpp:123

KDE Home | KDE Accessibility Home | Description of Access Keys