]> Shamusworld >> Repos - architektonas/blob - src/mainapp/qc_mdiwindow.h
e0dd4144a490f1256df8eb2627de79f775daf435
[architektonas] / src / mainapp / qc_mdiwindow.h
1 #ifndef QC_MDIWINDOW_H
2 #define QC_MDIWINDOW_H
3
4 #include <QtGui>
5 #include "qc_graphicview.h"
6 #include "qg_layerwidget.h"
7 #include "qg_recentfiles.h"
8 #include "qg_pentoolbar.h"
9 #include "rs_document.h"
10
11 /**
12  * MDI document window. Contains a document and a view (window).
13  *
14  * @author Andrew Mustun
15  */
16 //class QC_MDIWindow: public Q3MainWindow
17 class QC_MDIWindow: public QMdiSubWindow
18 {
19         Q_OBJECT
20
21         public:
22                 QC_MDIWindow(RS_Document * doc, QWidget * parent, const char * name = NULL,
23 //                      Qt::WindowFlags wflags = Qt::WDestructiveClose);
24                         Qt::WindowFlags wflags = Qt::SubWindow);
25                 ~QC_MDIWindow();
26
27                 void initDoc(RS_Document * doc = NULL);
28                 void initView();
29
30         public slots:
31                 void slotPenChanged(RS_Pen p);
32                 void slotFileNew();
33                 bool slotFileOpen(const QString & fileName, RS2::FormatType type);
34                 bool slotFileSave(bool & cancelled);
35                 bool slotFileSaveAs(bool & cancelled);
36                 bool slotFileClose(bool force);
37                 void slotFilePrint();
38
39         public:
40                 QC_GraphicView * getGraphicView();
41                 RS_Document * getDocument();
42                 RS_Graphic * getGraphic();
43                 RS_EventHandler * getEventHandler();
44
45                 void addChildWindow(QC_MDIWindow * w);
46                 void removeChildWindow(QC_MDIWindow * w);
47                 QC_MDIWindow * getPrintPreview();
48                 void setParentWindow(QC_MDIWindow * p);
49                 int getId();
50
51                 bool closeMDI(bool force, bool ask = true);
52
53                 void setForceClosing(bool on);
54
55                 friend std::ostream & operator<<(std::ostream & os, QC_MDIWindow & w);
56
57         signals:
58                 void signalClosing();
59
60         protected:
61                 void closeEvent(QCloseEvent *);
62
63         private:
64                 /** window ID */
65                 int id;
66                 /** ID counter (class variable) */
67                 static int idCounter;
68                 /** Graphic view */
69                 QC_GraphicView * graphicView;
70                 /** Document */
71                 RS_Document * document;
72                 /** Does the window own the document? */
73                 bool owner;
74                 /**
75                 * List of known child windows that show blocks of the same drawing.
76                 */
77 //              Q3PtrList<QC_MDIWindow> childWindows;
78                 QList<QC_MDIWindow *> childWindows;
79                 /**
80                 * Pointer to parent window which needs to know if this window
81                 * is closed or NULL.
82                 */
83                 QC_MDIWindow * parentWindow;
84
85                 /**
86                 * If flag is set, the user will not be asked about closing this file.
87                 */
88                 bool forceClosing;
89 };
90
91 #endif