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 : 2008-09-14 00022 ** Authors : 00023 ** Marc Wathelet 00024 ** Marc Wathelet (LGIT, Grenoble, France) 00025 ** 00026 ***************************************************************************/ 00027 00028 #ifndef MULTIDOCUMENTWINDOW_H 00029 #define MULTIDOCUMENTWINDOW_H 00030 00031 #include <QtGui> 00032 #include <QGpCoreTools.h> 00033 #include "QGpGuiToolsDLLExport.h" 00034 00035 namespace QGpGuiTools { 00036 00037 class MultiDocumentTabWidget; 00038 class MultiDocumentTab; 00039 class MultiDocumentSubWindow; 00040 00041 class QGPGUITOOLS_EXPORT MultiDocumentWindow : public QMainWindow 00042 { 00043 Q_OBJECT 00044 public: 00045 MultiDocumentWindow(QWidget * parent=0, Qt::WindowFlags f=0); 00046 ~MultiDocumentWindow(); 00047 00048 void setCloseMarks(bool c=true); 00049 00050 virtual void newDocument() {} 00051 virtual void openDocument() {} 00052 virtual void saveDocument() {} 00053 virtual void saveDocumentAs() {} 00054 virtual void printDocument() {} 00055 public slots: 00056 void addWindow(MultiDocumentSubWindow * w); 00057 00058 void addTab(); 00059 void insertTab(int at); 00060 private slots: 00061 void closeSubWindow(); 00062 void closeAllSubWindows(); 00063 void closeTab(int at=-1); 00064 void closeAllTabs(); 00065 void cascadeSubWindows(); 00066 void tileSubWindows(); 00067 void setCurrentSubWindow(QMdiSubWindow * w); 00068 void showToolBarMenu(); 00069 signals: 00070 void clearCloseMarks(); 00071 void askForClose(bool& ok); 00072 void activeWindowChanged(MultiDocumentSubWindow * w); 00073 protected: 00074 QAction * _windowsNewTabAction; 00075 QAction * _windowsCloseAction; 00076 QAction * _windowsCloseAllSubWindowsAction; 00077 QAction * _windowsCloseTabAction; 00078 QAction * _windowsCloseAllTabsAction; 00079 QAction * _windowsCascadeAction; 00080 QAction * _windowsTileAction; 00081 QMenu * _toolBarsMenu; 00082 QAction * _windowsToolBarsAction; 00083 00084 QMenu * _fileMenu; 00085 QToolBar * _fileBar; 00086 QMenu * _editMenu; 00087 QToolBar * _editBar; 00088 QMenu * _viewMenu; 00089 QToolBar * _viewBar; 00090 QMenu * _windowsMenu; 00091 QMenu * _helpMenu; 00092 00093 virtual void closeEvent(QCloseEvent * e); 00094 void addFileActions(); 00095 void addEditActions(); 00096 void addViewActions(); 00097 void createWindowsActions(); 00098 void addWindowsActions(); 00099 virtual void addWindowsActions(QMenu * m); 00100 void addHelpActions(); 00101 private: 00102 MultiDocumentTab * tab(int index) const; 00103 void setWindowsMenuEnabled(bool b); 00104 00105 MultiDocumentTabWidget * _tabs; 00106 }; 00107 00108 } // namespace QGpGuiTools 00109 00110 #endif // MULTIDOCUMENTWINDOW_H