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