Kross
actioncollection.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 #ifndef KROSS_ACTIONCOLLECTION_H
00021 #define KROSS_ACTIONCOLLECTION_H
00022
00023 #include "krossconfig.h"
00024 #include "action.h"
00025
00026
00027 #include <QtCore/QObject>
00028 #include <QtCore/QDir>
00029
00030 class QDomElement;
00031 class QIODevice;
00032
00033 namespace Kross {
00034
00039 class KROSSCORE_EXPORT ActionCollection : public QObject
00040 {
00041 Q_OBJECT
00042
00043 public:
00044
00055 explicit ActionCollection(const QString& name, ActionCollection* parent = 0);
00056
00060 virtual ~ActionCollection();
00061
00065 QString name() const;
00066
00070 QString text() const;
00071
00075 void setText(const QString& text);
00076
00080 QString description() const;
00081
00085 void setDescription(const QString& description);
00086
00090 QString iconName() const;
00091
00095 void setIconName(const QString& iconname);
00096
00100 QIcon icon() const;
00101
00105 bool isEnabled() const;
00106
00110 void setEnabled(bool enabled);
00111
00117 ActionCollection* parentCollection() const;
00118
00123 bool hasCollection(const QString& name) const;
00124
00129 ActionCollection* collection(const QString& name) const;
00130
00135 QStringList collections() const;
00136
00137 QList<Action*> actions() const;
00138
00142 Action* action(const QString& name) const;
00143 void addAction(Action* action);
00144 void addAction(const QString& name, Action* action);
00145 void removeAction(const QString& name);
00146 void removeAction(Action* action);
00147
00158 bool readXml(const QDomElement& element, const QDir& directory = QDir());
00159
00163 bool readXml(QIODevice* device, const QDir& directory = QDir());
00164
00171 bool readXmlFile(const QString& file);
00172
00177 QDomElement writeXml();
00178
00183 bool writeXml(QIODevice* device, int indent = 2);
00184
00185 Q_SIGNALS:
00186
00191 void updated();
00192
00193
00194
00195
00196
00197 protected:
00198 void registerCollection(ActionCollection* collection);
00199 void unregisterCollection(const QString& name);
00200
00201 private:
00203 class Private;
00205 Private* const d;
00206 };
00207
00208 }
00209
00210 #endif
00211