00001 /*************************************************************************** 00002 ** 00003 ** This file is part of QGpGuiTools. 00004 ** 00005 ** This library is free software; you can redistribute it and/or 00006 ** modify it under the terms of the GNU Lesser General Public 00007 ** License as published by the Free Software Foundation; either 00008 ** version 2.1 of the License, or (at your option) any later version. 00009 ** 00010 ** This file is distributed in the hope that it will be useful, but WITHOUT 00011 ** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 ** FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 00013 ** License for more details. 00014 ** 00015 ** You should have received a copy of the GNU Lesser General Public 00016 ** License along with this library; if not, write to the Free Software 00017 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00018 ** 00019 ** See http://www.geopsy.org for more information. 00020 ** 00021 ** Created: 2010-06-24 00022 ** Authors: 00023 ** Marc Wathelet (LGIT, Grenoble, France) 00024 ** 00025 ***************************************************************************/ 00026 00027 #ifndef MULTIDOCUMENTENVIRONMENT_H 00028 #define MULTIDOCUMENTENVIRONMENT_H 00029 00030 #include <QtGui> 00031 00032 #include "QGpGuiToolsDLLExport.h" 00033 00034 namespace QGpGuiTools { 00035 00036 class MultiDocumentWindow; 00037 00038 class QGPGUITOOLS_EXPORT MultiDocumentEnvironment : public QObject 00039 { 00040 Q_OBJECT 00041 public: 00042 MultiDocumentEnvironment(QObject * parent=0); 00043 ~MultiDocumentEnvironment(); 00044 00045 static MultiDocumentEnvironment * instance() {return _instance;} 00046 00047 void addFileActions(QMenu * m, QToolBar * tb); 00048 void addEditActions(QMenu * m, QToolBar * tb); 00049 void addViewActions(QMenu * m, QToolBar * tb); 00050 void addWindowsActions(QMenu * m); 00051 void addHelpActions(QMenu * m); 00052 00053 QAction * _fileNewAction; 00054 QAction * _fileOpenAction; 00055 QAction * _fileSaveAction; 00056 QAction * _fileSaveAsAction; 00057 QAction * _filePrintAction; 00058 QAction * _fileQuitAction; 00059 00060 QAction * _editUndoAction; 00061 QAction * _editRedoAction; 00062 QAction * _editCutAction; 00063 QAction * _editCopyAction; 00064 QAction * _editPasteAction; 00065 00066 QAction * _windowsNewWindowAction; 00067 00068 QAction * _helpDocumentationAction; 00069 QAction * _helpWhatsThisAction; 00070 QAction * _helpAboutAction; 00071 QAction * _helpAboutQtAction; 00072 00073 const QList<MultiDocumentWindow *>& windows() const {return _windows;} 00074 MultiDocumentWindow * currentWindow() const; 00075 public slots: 00076 virtual void newDocument(); 00077 virtual void openDocument(); 00078 virtual void saveDocument(); 00079 virtual void saveDocumentAs(); 00080 virtual void printDocument(); 00081 virtual bool quit(); 00082 00083 virtual void undo(); 00084 virtual void redo(); 00085 virtual void cut(); 00086 virtual void copy(); 00087 virtual void paste(); 00088 00089 virtual void helpDocumentation(); 00090 virtual void helpAbout(); 00091 00092 virtual MultiDocumentWindow * addWindow(); 00093 protected: 00094 void createFileActions(); 00095 void createEditActions(); 00096 void createViewActions(); 00097 void createWindowsActions(); 00098 void createHelpActions(); 00099 virtual MultiDocumentWindow * createWindow(); 00100 protected slots: 00101 virtual void askForClose(bool& ok) {ok=true;} 00102 private slots: 00103 void clearCloseMarks(); 00104 void removeWindow(QObject * windowObject); 00105 private: 00106 static MultiDocumentEnvironment * _instance; 00107 QList<MultiDocumentWindow *> _windows; 00108 }; 00109 00110 } // namespace QGpGuiTools 00111 00112 #endif // MULTIDOCUMENTENVIRONMENT_H