]> Shamusworld >> Repos - architektonas/blob - src/mainapp/mdiwindow.h
Sanity check stage II: rename classes...
[architektonas] / src / mainapp / mdiwindow.h
1 #ifndef QC_MDIWINDOW_H
2 #define QC_MDIWINDOW_H
3
4 #include <QtGui>
5 #include "rs_document.h"
6 #include "layerwidget.h"
7 #include "pentoolbar.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::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                 QG_GraphicView * getGraphicView();
40                 RS_Document * getDocument();
41                 Drawing * getGraphic();
42                 RS_EventHandler * getEventHandler();
43                 void addChildWindow(MDIWindow * w);
44                 void removeChildWindow(MDIWindow * w);
45                 MDIWindow * getPrintPreview();
46                 void setParentWindow(MDIWindow * p);
47                 int getId();
48                 bool closeMDI(bool force, bool ask = true);
49                 void setForceClosing(bool on);
50
51                 friend std::ostream & operator<<(std::ostream & os, MDIWindow & w);
52
53         signals:
54                 void signalClosing();
55
56         protected:
57                 void closeEvent(QCloseEvent *);
58
59         private:
60                 /** window ID */
61                 int id;
62                 /** ID counter (class variable) */
63                 static int idCounter;
64                 /** Graphic view */
65 //let's see if we can get rid of this...
66                 QG_GraphicView * graphicView;
67                 /** Document */
68                 RS_Document * document;
69                 /** Does the window own the document? */
70                 bool owner;
71                 /**
72                 * List of known child windows that show blocks of the same drawing.
73                 */
74                 QList<MDIWindow *> childWindows;
75                 /**
76                 * Pointer to parent window which needs to know if this window
77                 * is closed or NULL.
78                 */
79                 MDIWindow * parentWindow;
80                 /**
81                 * If flag is set, the user will not be asked about closing this file.
82                 */
83                 bool forceClosing;
84 };
85
86 #endif