scraction.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 #ifndef SCRACTION_H
00023 #define SCRACTION_H
00024
00025 #include <QAction>
00026 #include <QPixmap>
00027 #include <QMenu>
00028 #include "scribusapi.h"
00029 class ScribusDoc;
00033 class SCRIBUS_API ScrAction : public QAction
00034 {
00035 Q_OBJECT
00036
00037 public:
00038 typedef enum {Normal, DataInt, DataDouble, DataQString, RecentFile, DLL, Window, RecentScript, UnicodeChar, Layer, ActionDLL, RecentPaste } ActionType;
00039
00046 ScrAction ( QObject *parent ) ;
00047
00056 ScrAction( const QString &menuText, QKeySequence accel, QObject *parent );
00057
00071 ScrAction( ActionType mType, const QPixmap & icon16, const QPixmap & icon22, const QString &menuText, QKeySequence accel, QObject *parent, int extraInt = 0, double extraDouble = 0.0, QString extraQString = QString::null );
00081 ScrAction( const QPixmap & icon16, const QPixmap & icon22, const QString & menuText, QKeySequence accel, QObject *parent );
00082 ~ScrAction();
00083
00090 int getMenuIndex() const;
00091
00098 QString cleanMenuText();
00099
00106 bool isDLLAction() const;
00107
00114 int dllID() const;
00115
00123 void setToggleAction(bool isToggle, bool fakeToggle=false);
00124
00130 void saveShortcut();
00136 void restoreShortcut();
00142 ActionType actionType();
00148 int actionInt() const;
00149 double actionDouble() const;
00150 const QString actionQString();
00151 void setActionQString(const QString &);
00152
00154 void setTexts(const QString &newText, bool setTextToo = true);
00155
00156 public slots:
00157 void toggle();
00158
00159 signals:
00160 void triggeredData(int);
00161 void triggeredData(double);
00162 void triggeredData(QString);
00163 void triggeredData(ScribusDoc*);
00164 void toggledData(bool, int);
00165 void toggledData(bool, double);
00166 void toggledData(bool, QString);
00167 void triggeredUnicodeShortcut(const QString&, int);
00168
00169 protected:
00170 void initScrAction();
00171 int menuIndex;
00172 int pluginID;
00173 int windowID;
00174 int layerID;
00175 int _dataInt;
00176 double _dataDouble;
00177 QString _dataQString;
00178 ActionType _actionType;
00179 QMenu *popupMenuAddedTo;
00180 QKeySequence savedKeySequence;
00181 bool shortcutSaved;
00182 bool fakeToggle;
00183
00191 void addedTo( int index, QMenu * menu );
00192
00193 private slots:
00199 void triggeredToTriggeredData();
00206 void toggledToToggledData(bool ison);
00207 };
00208
00209 #endif