]> vaikene.ee Git - evaf/blob - src/plugins/SdiWindow/sdiwindow.h
Changed the way how the main window is used.
[evaf] / src / plugins / SdiWindow / sdiwindow.h
1 /**
2 * @file SdiWindow/sdiwindow.h
3 * @brief SdiWindow module's implementation
4 * @author Enar Vaikene
5 *
6 * Copyright (c) 2011 Enar Vaikene
7 *
8 * This file is part of the eVaf C++ cross-platform application development framework.
9 *
10 * This file can be used under the terms of the GNU General Public License
11 * version 3.0 as published by the Free Software Foundation and appearing in
12 * the file LICENSE included in the packaging of this file. Please review the
13 * the following information to ensure the GNU General Public License version
14 * 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
15 *
16 * Alternatively, this file may be used in accordance with the Commercial License
17 * Agreement provided with the Software.
18 */
19
20 #ifndef __SDIWINDOW_SDIWINDOW_H
21 # define __SDIWINDOW_SDIWINDOW_H
22
23 #include "isdiwindow.h"
24
25 #include <Plugins/iPlugin>
26
27 #include <QObject>
28 #include <QString>
29 #include <QWidget>
30 #include <QList>
31
32 class QVBoxLayout;
33
34 namespace eVaf {
35 namespace SdiWindow {
36 namespace Internal {
37
38 /**
39 * Main window widget
40 */
41 class MainWindow : public QWidget
42 {
43 Q_OBJECT
44
45 public:
46
47 MainWindow(QWidget * parent = 0, Qt::WindowFlags flags = 0);
48
49 virtual ~MainWindow();
50
51 bool init();
52
53 void done();
54
55 void addWidget(QWidget * widget);
56
57 void addLayout(QLayout * layout);
58
59
60 private: // Methods
61
62 void setWindowSize();
63
64 void saveSettings();
65
66 void restoreSettings();
67
68
69 private: // Members
70
71 /// The layout of the window
72 QVBoxLayout * mLayout;
73
74 /// Widgets and layouts added to the main window
75 QList<QObject *> mItemsAdded;
76
77 };
78
79 /**
80 * iSdiWindow interface implementation
81 */
82 class SdiWindowImpl : public iSdiWindow
83 {
84 Q_OBJECT
85
86 public:
87
88 SdiWindowImpl();
89
90 virtual ~SdiWindowImpl();
91
92 bool init(const QString & args);
93
94 void done();
95
96 bool isReady() const { return mReady; }
97
98 virtual void addWidget(QWidget * widget) { wWindow->addWidget(widget); }
99
100 virtual void addLayout(QLayout * layout) { wWindow->addLayout(layout); }
101
102
103 private: // Members
104
105 /// Ready flag
106 bool mReady;
107
108 /// The main window widget
109 MainWindow * wWindow;
110 };
111
112 /**
113 * SdiWindow module's implementation
114 */
115 class SdiWindowPlugin : public Plugins::iPlugin
116 {
117 Q_OBJECT
118
119 public:
120
121 SdiWindowPlugin();
122
123 virtual ~SdiWindowPlugin();
124
125 virtual bool init(const QString & args);
126
127 virtual void done();
128
129 virtual bool isReady() const { return mWindow != 0 && mWindow->isReady(); }
130
131
132 private:
133
134 /// iSdiWindow interface implementation
135 SdiWindowImpl * mWindow;
136 };
137
138 } // namespace eVaf::SdiWindow::Internal
139 } // namespace eVaf::SdiWindow
140 } // namespace eVaf
141
142 #endif // sdiwindow.h