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