]> Shamusworld >> Repos - architektonas/blob - src/mainapp/mdiwindow.h
Fixed problem with MDI activation.
[architektonas] / src / mainapp / mdiwindow.h
1 #ifndef __MDIWINDOW_H__
2 #define __MDIWINDOW_H__
3
4 #include <QtGui>
5 #include "document.h"
6 #include "layerwidget.h"
7 #include "pentoolbar.h"
8 //#include "qg_graphicview.h"
9
10 class 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 //class MDIWindow: public QG_GraphicView
20 {
21         Q_OBJECT
22
23         public:
24                 MDIWindow(Document * doc, QWidget * parent, const char * name = NULL,
25                         Qt::WindowFlags wflags = Qt::SubWindow);
26                 ~MDIWindow();
27
28                 void initDoc(Document * doc = NULL);
29
30         public slots:
31                 void slotPenChanged(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(void);
37                 void slotFilePrint(void);
38
39         public:
40                 QG_GraphicView * getGraphicView();
41                 Document * getDocument();
42                 Drawing * GetDrawing();
43                 EventHandler * getEventHandler();
44                 void addChildWindow(MDIWindow * w);
45                 void removeChildWindow(MDIWindow * w);
46                 MDIWindow * getPrintPreview();
47                 void setParentWindow(MDIWindow * p);
48                 int getId();
49                 bool CloseMDI(void);
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                 Document * document;
69                 /** Does the window own the document? */
70                 bool owner;
71                 /** List of known child windows that show blocks of the same drawing. */
72                 QList<MDIWindow *> childWindows;
73                 /**
74                 * Pointer to parent window which needs to know if this window
75                 * is closed or NULL.
76                 */
77                 MDIWindow * parentWindow;
78 };
79
80 #endif  // __MDIWINDOW_H__