Scribus
Open source desktop publishing at your fingertips
scraction.h
1 /*
2 For general Scribus (>=1.3.2) copyright and licensing information please refer
3 to the COPYING file provided with the program. Following this notice may exist
4 a copyright and/or license notice that predates the release of Scribus 1.3.2
5 for which a new license (GPL+exception) is in place.
6 */
7 
8 /***************************************************************************
9  begin : Jan 2005
10  copyright : (C) 2005 by Craig Bradney
11  email : cbradney@zip.com.au
12  ***************************************************************************/
13 
14 /***************************************************************************
15  * *
16  * This program is free software; you can redistribute it and/or modify *
17  * it under the terms of the GNU General Public License as published by *
18  * the Free Software Foundation; either version 2 of the License, or *
19  * (at your option) any later version. *
20  * *
21  ***************************************************************************/
22 #ifndef SCRACTION_H
23 #define SCRACTION_H
24 
25 #include <QAction>
26 #include <QPixmap>
27 #include <QMenu>
28 #include "scribusapi.h"
29 class ScribusDoc;
33 class SCRIBUS_API ScrAction : public QAction
34 {
35  Q_OBJECT
36 
37 public:
38  typedef enum {Normal, DataInt, DataDouble, DataQString, RecentFile, DLL, Window, RecentScript, UnicodeChar, Layer, ActionDLL, RecentPaste, ActionDLLSE } ActionType;
39 
46  ScrAction ( QObject *parent ) ;
47 
56  ScrAction( const QString &menuText, QKeySequence accel, QObject *parent );
57 
72  ScrAction( ActionType aType,
73  const QString &menuText, QKeySequence accel, QObject *parent, QVariant d = QVariant());
74  ScrAction( ActionType aType, const QPixmap & icon16, const QPixmap & icon22,
75  const QString &menuText, QKeySequence accel, QObject *parent, QVariant d = QVariant());
85  ScrAction( const QPixmap & icon16, const QPixmap & icon22, const QString & menuText, QKeySequence accel, QObject *parent );
95  ScrAction( QKeySequence accel, QObject *parent, QVariant data = QVariant());
96  ~ScrAction();
97 
104  int getMenuIndex() const;
105 
112  QString cleanMenuText();
113 
114  void setToolTipFromTextAndShortcut();
115  void setStatusTextAndShortcut(const QString& statusText);
116 
123  bool isDLLAction() const;
124 
131  int dllID() const;
132 
140  void setToggleAction(bool isToggle, bool fakeToggle=false);
141 
147  void saveShortcut();
153  void restoreShortcut();
159  ActionType actionType();
165  int actionInt() const;
166  double actionDouble() const;
167  const QString actionQString();
168  void setActionQString(const QString &);
169 
171  void setTexts(const QString &newText);//#9114, qt3-qt4 change of behaviour bug: , bool setTextToo = true);
172 
173 public slots:
174  void toggle();
175 
176 signals:
177  void triggeredData(QVariant);
178  void triggeredData(int);
179  void triggeredData(double);
180  void triggeredData(QString);
181  void triggeredData(ScribusDoc*);
182  void triggeredData(QWidget*, ScribusDoc*);
183  void toggledData(bool, int);
184  void toggledData(bool, double);
185  void toggledData(bool, QString);
186  void triggeredUnicodeShortcut(int);
187 
188 protected:
189  void initScrAction();
190  int menuIndex;
191  ActionType _actionType;
192  QMenu *popupMenuAddedTo;
193  QKeySequence savedKeySequence;
194  bool shortcutSaved;
195  bool fakeToggle;
196  QIcon m_icon;
197 
205  void addedTo( int index, QMenu * menu );
206 
207 private slots:
213  void triggeredToTriggeredData();
220  void toggledToToggledData(bool ison);
221 };
222 
223 #endif
the Document Class
Definition: scribusdoc.h:90
Definition: scraction.h:33