Scribus Developer Documentation - API
logo-pen

Scribus Developer Documentation - API

scraction.h

Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 
00008 /***************************************************************************
00009     begin                : Jan 2005
00010     copyright            : (C) 2005 by Craig Bradney
00011     email                : cbradney@zip.com.au
00012  ***************************************************************************/
00013 
00014 /***************************************************************************
00015  *                                                                         *
00016  *   This program is free software; you can redistribute it and/or modify  *
00017  *   it under the terms of the GNU General Public License as published by  *
00018  *   the Free Software Foundation; either version 2 of the License, or     *
00019  *   (at your option) any later version.                                   *
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
Created with personalized Doxygen. This is documentation for GPL software Scribus - Open Source Desktop Publishing.