digestactionmanager.h

Go to the documentation of this file.
00001 // BASED ON: qdesigner_actions.h in qt-mac-opensource-4.0.0-b2-snapshot-20050318, located in the /tools/designer/src/designer/ sub-dir of Qt.
00002 //           Imported on Wed Mar 30 2005 by Aidan Lane.
00003 //           Modifications Copyright (c) CEMA, Monash University. All rights reserved.
00004 /****************************************************************************
00005  **
00006  ** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
00007  **
00008  ** This file is part of the designer application of the Qt Toolkit.
00009  **
00010  ** This file may be distributed and/or modified under the terms of the
00011  ** GNU General Public License version 2 as published by the Free Software
00012  ** Foundation and appearing in the file LICENSE.GPL included in the
00013  ** packaging of this file.
00014  **
00015  ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
00016  **   information about Qt Commercial License Agreements.
00017  ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00018  **
00019  ** Contact info@trolltech.com if any conditions of this licensing are
00020  ** not clear to you.
00021  **
00022  ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00023  ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00024  **
00025  ****************************************************************************/
00026 
00027 
00028 // TODO: CLEANUP!
00029 // TODO: CLEANUP!
00030 // TODO: CLEANUP!
00031 // TODO: CLEANUP!
00032 // TODO: CLEANUP!
00033 // TODO: CLEANUP!
00034 // TODO: CLEANUP!
00035 // TODO: CLEANUP!
00036 // TODO: CLEANUP!
00037 
00038 
00039 #ifndef DIGESTACTIONMANAGER_H
00040 #define DIGESTACTIONMANAGER_H
00041 
00042 #include <QObject>
00043 #include <QPointer>
00044 
00045 
00046 class QAction;
00047 class QActionGroup;
00048 
00049 class DigestApplication;
00050 class MDIDiagramWindow;
00051 class MDIChildBase;
00052 
00053 
00065 class DigestActionManager: public QObject
00066 {
00067   Q_OBJECT
00068  
00069  public:
00070   DigestActionManager( DigestApplication* diagramManager );
00071   virtual ~DigestActionManager();
00072 
00073   static DigestActionManager* instance();
00074 
00075   DigestApplication* diagramManager() const;
00076   MDIDiagramWindow* activeDiagramWindow() const;
00077 
00078   bool saveDiagram(MDIDiagramWindow *fw);
00079   /* TODO: remove me if UNNEEDED
00080   bool readInForm(const QString &fileName);
00081   bool writeOutForm(MDIDiagramWindow *formWindow, const QString &fileName);
00082   */
00083 
00084   QActionGroup* fileActions() const;
00085   QActionGroup* recentFilesActions() const;
00086   QActionGroup* editActions() const;
00087   QActionGroup* viewActions() const;
00088   QActionGroup* toolActions() const { return m_toolActions; }
00089   QActionGroup* windowActions() const;
00090   QActionGroup* helpActions() const;
00091 
00092   QAction *useBigIconsAction() const; //TODO: remove me
00093 
00094 
00095   //
00096   // file actions
00097   //
00098   QAction* newDiagramAction() const;
00099   QAction* openDiagramAction() const;
00100   QAction* closeWindowAction() const;
00101   QAction* saveDiagramAction() const;
00102   QAction* saveDiagramAsAction() const;
00103   QAction* saveAllDiagramsAction() const;
00104   QAction* appQuitAction() const;
00105 
00106   //
00107   // edit actions
00108   //
00109   QAction* undoAction() const;
00110   QAction* redoAction() const;
00111   QAction* cutAction() const;
00112   QAction* copyAction() const;
00113   QAction* pasteAction() const;
00114   QAction* deleteAction() const;
00115   QAction* selectAllAction() const;
00116   QAction* bringToFrontAction()   const { return m_bringToFrontAction; }
00117   QAction* sendToBackAction()     const { return m_sendToBackAction; }
00118   QAction* bringForwardAction()   const { return m_bringForwardAction; }
00119   QAction* sendBackwardAction()   const { return m_sendBackwardAction; }
00120   QAction* appPrefsAction() const;
00121   QAction* showPropertiesAction() const { return m_showPropertiesAction; }
00122 
00123   //
00124   // view actions
00125   //
00126   QAction* showLabelsAction()       const { return m_showLabelsAction; }
00127   QAction* actualSizeAction()       const { return m_actualSizeAction; }
00128   QAction* zoomInAction()           const { return m_zoomInAction; }
00129   QAction* zoomOutAction()          const { return m_zoomOutAction; }
00130   QAction* toggleGridShownAction()  const { return m_toggleGridShownAction; }
00131   QAction* toggleSnapToGridAction() const { return m_toggleSnapToGridAction; }
00132   QAction* fullScreenAction()       const { return m_fullScreenAction; }
00133 
00134 
00135   //
00136   // tool actions
00137   //
00138   QAction* selectionToolAction()  const { return m_selectionToolAction; }
00139   QAction* zoomToolAction()       const { return m_zoomToolAction; }
00140   QAction* shapeToolAction()      const { return m_shapeToolAction; }
00141   QAction* polygonToolAction()    const { return m_polygonToolAction; }
00142   QAction* polylineToolAction()   const { return m_polylineToolAction; }
00143   QAction* textToolAction()       const { return m_textToolAction; }
00144 
00145   //
00146   // window actions
00147   //
00148   QAction* minimizeWindowAction() const;
00149   QAction* zoomWindowAction() const;
00150   QAction* toggleElementInspectorAction() const;
00151   QAction* bringAllToFront() const;
00152 
00153   //
00154   // help actions
00155   //
00156   QAction* appHelpAction() const;
00157   QAction* appAboutAction() const;
00158 
00159 
00160  signals:
00161   void useBigIcons(bool);
00162 
00163 
00164 
00165  protected slots:
00166   void setActiveDiagramWindow( MDIChildBase* child );
00167 
00168   void openRecentForm();
00169   void clearRecentFiles();
00170 
00171   void toggleGridShown();
00172   void toggleSnapToGrid();
00173   void increaseGridRes();
00174   void decreaseGridRes();
00175   void showProperties();
00176 
00177   void setCurrentTool( QAction* toolAction );
00178 
00179   void minimizeWindow();
00180   void zoomWindow();
00181   void toggleElementInspector();
00182   void bringAllToFront();
00183 
00184   void showAppHelp();
00185 
00186   void syncToggleGridShownActionText();
00187   void syncToggleSnapToGridActionText();
00188   void syncElementInspectorActionText();
00189 
00190 
00191  private:
00192   enum { MaxRecentFiles = 10 };
00193 
00194   void fixActionContext();
00195   void updateRecentFileActions();
00196   void addRecentFile(const QString &fileName);
00197 
00198   QPointer<DigestApplication> m_diagramManager;
00199   QPointer<MDIDiagramWindow>  m_activeDiagramWindow;
00200 
00201   QActionGroup* m_fileActions;
00202   QActionGroup* m_recentFilesActions;
00203   QActionGroup* m_editActions;
00204   QActionGroup* m_viewActions;
00205   QActionGroup* m_toolActions;
00206   QActionGroup* m_windowActions;
00207   QActionGroup* m_helpActions;
00208 
00209   QAction* m_newDiagramAction;
00210   QAction* m_openDiagramAction;
00211   QAction* m_closeWindowAction;
00212   QAction* m_saveDiagramAction;
00213   QAction* m_saveDiagramAsAction;
00214   QAction* m_saveAllDiagramsAction;
00215   QAction* m_appQuitAction;
00216 
00217   QAction* m_undoAction;
00218   QAction* m_redoAction;
00219   QAction* m_cutAction;
00220   QAction* m_copyAction;
00221   QAction* m_pasteAction;
00222   QAction* m_deleteAction;
00223   QAction* m_selectAllAction;
00224   QAction* m_bringToFrontAction;
00225   QAction* m_sendToBackAction;
00226   QAction* m_bringForwardAction;
00227   QAction* m_sendBackwardAction;
00228   QAction* m_appPrefsAction;
00229   QAction* m_showPropertiesAction;
00230 
00231   QAction* m_showLabelsAction;
00232   QAction* m_actualSizeAction;
00233   QAction* m_zoomInAction;
00234   QAction* m_zoomOutAction;
00235   QAction* m_toggleGridShownAction;
00236   QAction* m_toggleSnapToGridAction;
00237   QAction* m_fullScreenAction;
00238 
00239   QAction* m_selectionToolAction;
00240   QAction* m_zoomToolAction;
00241   QAction* m_shapeToolAction;
00242   QAction* m_polygonToolAction;
00243   QAction* m_polylineToolAction;
00244   QAction* m_textToolAction;
00245 
00246   QAction* m_minimizeWindowAction;
00247   QAction* m_zoomWindowAction;
00248   QAction* m_toggleElementInspectorAction;
00249   QAction* m_bringAllToFrontAction;
00250 
00251   QAction* m_appHelpAction;
00252   QAction* m_appAboutAction;
00253 
00254   //TODO: remove me:
00255   QAction *m_useBigIcons;
00256 };
00257 
00258 #endif // DIGESTACTIONMANAGER_H
00259 

Generated on Mon Jul 30 09:46:50 2007 for Digest by  doxygen 1.5.2