Back to index

scribus-ng  1.3.4.dfsg+svn20071115
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.h>
00026 #include "scribusapi.h"
00027 class ScribusDoc;
00031 class SCRIBUS_API ScrAction : public QAction
00032 {
00033        Q_OBJECT
00034 
00035 public:
00036        typedef enum {Normal, DataInt, DataDouble, DataQString, RecentFile, DLL, Window, RecentScript, UnicodeChar, Layer, ActionDLL, RecentPaste } ActionType;
00037        
00045        ScrAction ( QObject *parent, const char *name = 0 ) ;
00046               
00056        ScrAction( const QString &menuText, QKeySequence accel, QObject *parent, const char *name = 0 );
00057               
00072        ScrAction( ActionType mType, const QIconSet & icon, const QString &menuText, QKeySequence accel, QObject *parent, const char *name = 0, int extraInt = 0, double extraDouble = 0.0, QString extraQString = QString::null );            
00083        ScrAction( const QIconSet & icon, const QString & menuText, QKeySequence accel, QObject *parent, const char * name = 0 );
00084        ~ScrAction();
00085        
00092        const int getMenuIndex();
00093                      
00101        bool addTo(QWidget *w);
00102        
00109        QWidget *getWidgetAddedTo();
00110                      
00117        QString cleanMenuText();
00118 
00125        const bool isDLLAction();
00126        
00133        const int dllID();
00134        
00142        void setToggleAction(bool isToggle, bool fakeToggle=false);
00143        
00149        void saveShortcut();
00155        void restoreShortcut();     
00161        ActionType actionType();
00167        const int actionInt();      
00168        const double actionDouble();       
00169        const QString actionQString();     
00170        
00172        void setTexts(const QString &newText, bool setTextToo = true);
00173        
00174 public slots:
00175        void toggle();
00176        
00177 signals:
00178        void activatedData(int);
00179        void activatedData(double);
00180        void activatedData(QString);
00181        void activatedData(ScribusDoc*);
00182        void toggledData(bool, int);
00183        void toggledData(bool, double);
00184        void toggledData(bool, QString);
00185        void activatedUnicodeShortcut(const QString&, int);
00186        
00187 protected:
00188        void initScrAction();
00189        int menuIndex;
00190        int pluginID;
00191        int windowID;
00192        int layerID;
00193        int _dataInt;
00194        double _dataDouble;
00195        QString _dataQString;
00196        ActionType _actionType;
00197        QWidget *widgetAddedTo;
00198        QWidget *containerWidgetAddedTo;
00199        QPopupMenu *popupMenuAddedTo;
00200        QKeySequence savedKeySequence;
00201        bool shortcutSaved;
00202        bool fakeToggle;
00203        
00211        void addedTo( int index, QPopupMenu * menu );
00212                      
00220        void addedTo( QWidget * actionWidget, QWidget * container );
00221        
00227        void setIconSizes();
00228                      
00229 private slots:
00235        void activatedToActivatedData();
00242        void toggledToToggledData(bool ison);
00243 };
00244 
00245 #endif