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