KDEUI
kactioncategory.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 #ifndef KACTIONCATEGORY_H
00022 #define KACTIONCATEGORY_H
00023
00024 #include <QtCore/QObject>
00025 #include <QtCore/QString>
00026 #include <QtCore/QList>
00027
00028 #include "kstandardaction.h"
00029 #include "kactioncollection.h"
00030
00031
00032 class KAction;
00033 struct KActionCategoryPrivate;
00034
00035 class QAction;
00036
00037
00038
00095 class KDEUI_EXPORT KActionCategory : public QObject
00096 {
00097 Q_OBJECT
00098
00099 Q_PROPERTY( QString text READ text WRITE setText )
00100
00101 public:
00102
00106 explicit KActionCategory(const QString &text, KActionCollection *parent=NULL);
00107
00111 virtual ~KActionCategory();
00112
00122 QAction * addAction(const QString &name, QAction *action);
00123
00124 KAction * addAction(const QString &name, KAction *action);
00125
00126 KAction * addAction(
00127 KStandardAction::StandardAction actionType,
00128 const QObject *receiver = NULL,
00129 const char *member = NULL);
00130
00131 KAction * addAction(
00132 KStandardAction::StandardAction actionType,
00133 const QString &name,
00134 const QObject *receiver = NULL,
00135 const char *member = NULL);
00136
00137 KAction *addAction(
00138 const QString &name,
00139 const QObject *receiver = NULL,
00140 const char *member = NULL);
00141
00142 template<class ActionType>
00143 ActionType *add(
00144 const QString &name,
00145 const QObject *receiver = NULL,
00146 const char *member = NULL)
00147 {
00148 ActionType *action = collection()->add<ActionType>(name, receiver, member);
00149 addAction(action);
00150 return action;
00151 }
00152
00154
00158 const QList<QAction*> actions() const;
00159
00163 KActionCollection * collection() const;
00164
00168 QString text() const;
00169
00173 void setText(const QString& text);
00174
00175 private:
00176
00180 void unlistAction(QAction *action);
00181
00185 void addAction(QAction *action);
00186
00188 friend class KActionCollectionPrivate;
00189
00191 KActionCategoryPrivate *const d;
00192 };
00193
00194
00195 #endif