]> vaikene.ee Git - evaf/blob - src/plugins/SdiWindow/sdiwindow.h
f0cfe6fc52aae2e5f96c7d6487acb2483388d5db
[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 #include <QWeakPointer>
32
33 class QVBoxLayout;
34
35 namespace eVaf {
36 namespace SdiWindow {
37 namespace Internal {
38
39 /**
40 * Main window widget implementing the iSdiWindow interface
41 */
42 class MainWindow : public QWidget, public iSdiWindow
43 {
44 Q_OBJECT
45 Q_INTERFACES(eVaf::SdiWindow::iSdiWindow)
46
47 public:
48
49 MainWindow(QWidget * parent = 0, Qt::WindowFlags flags = 0);
50
51 virtual ~MainWindow();
52
53 virtual bool init(QString const & args);
54
55 virtual void done();
56
57 virtual bool isReady() { return mReady; }
58
59 virtual void addWidget(QWidget * widget);
60
61 virtual void addLayout(QLayout * layout);
62
63
64 private: // Methods
65
66 void setWindowSize();
67
68 void saveSettings();
69
70 void restoreSettings();
71
72
73 private: // Members
74
75 /// Ready flag
76 bool mReady;
77
78 /// The layout of the window
79 QVBoxLayout * mLayout;
80
81 /// Widgets and layouts added to the main window
82 QList<QWeakPointer<QObject> > mItemsAdded;
83
84 };
85
86 /**
87 * SdiWindow module's implementation
88 */
89 class SdiWindowPlugin : public Plugins::iPlugin
90 {
91 Q_OBJECT
92 Q_INTERFACES(eVaf::Plugins::iPlugin)
93
94 public:
95
96 SdiWindowPlugin();
97
98 virtual ~SdiWindowPlugin();
99
100 virtual bool init(const QString & args);
101
102 virtual void done();
103
104 virtual bool isReady() const { return mWindow != 0 && mWindow->isReady(); }
105
106
107 private:
108
109 /// iSdiWindow interface implementation
110 MainWindow * mWindow;
111 };
112
113 } // namespace eVaf::SdiWindow::Internal
114 } // namespace eVaf::SdiWindow
115 } // namespace eVaf
116
117 #endif // sdiwindow.h