]> Shamusworld >> Repos - architektonas/blob - src/mainapp/mdiwindow.h
31c03e4aa606f800d2a75022bfb558012fb2aa4d
[architektonas] / src / mainapp / mdiwindow.h
1 #ifndef QC_MDIWINDOW_H
2 #define QC_MDIWINDOW_H
3
4 #include <QtGui>
5 #include "document.h"
6 #include "layerwidget.h"
7 #include "pentoolbar.h"
8
9 class 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(Document * doc, QWidget * parent, const char * name = NULL,
23                         Qt::WindowFlags wflags = Qt::SubWindow);
24                 ~MDIWindow();
25
26                 void initDoc(Document * doc = NULL);
27                 void initView();
28
29         public slots:
30                 void slotPenChanged(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 //WAS:          bool slotFileClose(bool force);
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 //WAS:          bool closeMDI(bool force, bool ask = true);
50                 bool CloseMDI(void);
51 //              void setForceClosing(bool on);
52
53                 friend std::ostream & operator<<(std::ostream & os, MDIWindow & w);
54
55         signals:
56                 void signalClosing();
57
58         protected:
59                 void closeEvent(QCloseEvent *);
60
61         private:
62                 /** window ID */
63                 int id;
64                 /** ID counter (class variable) */
65                 static int idCounter;
66                 /** Graphic view */
67 //let's see if we can get rid of this...
68                 QG_GraphicView * graphicView;
69                 /** Document */
70                 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