]> Shamusworld >> Repos - architektonas/blob - src/mainapp/mdiwindow.h
c3b782b3781c86229a5dc955fb0d357a2d68b185
[architektonas] / src / mainapp / mdiwindow.h
1 #ifndef QC_MDIWINDOW_H
2 #define QC_MDIWINDOW_H
3
4 #include <QtGui>
5 #include "qg_layerwidget.h"
6 #include "qg_pentoolbar.h"
7 #include "rs_document.h"
8
9 class RS_EventHandler;
10 class QG_GraphicView;
11
12 /**
13  * MDI document window. Contains a document and a view (window).
14  *
15  * @author Andrew Mustun
16  */
17 class MDIWindow: public QMdiSubWindow
18 {
19         Q_OBJECT
20
21         public:
22                 MDIWindow(RS_Document * doc, QWidget * parent, const char * name = NULL,
23 //                      Qt::WindowFlags wflags = Qt::WDestructiveClose);
24                         Qt::WindowFlags wflags = Qt::SubWindow);
25                 ~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                 QG_GraphicView * getGraphicView();
42                 RS_Document * getDocument();
43                 Drawing * getGraphic();
44                 RS_EventHandler * getEventHandler();
45
46                 void addChildWindow(MDIWindow * w);
47                 void removeChildWindow(MDIWindow * w);
48                 MDIWindow * getPrintPreview();
49                 void setParentWindow(MDIWindow * p);
50                 int getId();
51
52                 bool closeMDI(bool force, bool ask = true);
53
54                 void setForceClosing(bool on);
55
56                 friend std::ostream & operator<<(std::ostream & os, MDIWindow & w);
57
58         signals:
59                 void signalClosing();
60
61         protected:
62                 void closeEvent(QCloseEvent *);
63
64         private:
65                 /** window ID */
66                 int id;
67                 /** ID counter (class variable) */
68                 static int idCounter;
69                 /** Graphic view */
70 //let's see if we can get rid of this...
71 //              QC_GraphicView * graphicView;
72                 QG_GraphicView * graphicView;
73                 /** Document */
74                 RS_Document * document;
75                 /** Does the window own the document? */
76                 bool owner;
77                 /**
78                 * List of known child windows that show blocks of the same drawing.
79                 */
80                 QList<MDIWindow *> childWindows;
81                 /**
82                 * Pointer to parent window which needs to know if this window
83                 * is closed or NULL.
84                 */
85                 MDIWindow * parentWindow;
86                 /**
87                 * If flag is set, the user will not be asked about closing this file.
88                 */
89                 bool forceClosing;
90 };
91
92 #endif