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