]>
vaikene.ee Git - evaf/blob - SdiWindow/sdiwindow.h
2 * @file SdiWindow/sdiwindow.h
3 * @brief SdiWindow module's implementation
6 * Copyright (c) 2011-2019 Enar Vaikene
8 * This file is part of the eVaf C++ cross-platform application development framework.
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.
16 * Alternatively, this file may be used in accordance with the Commercial License
17 * Agreement provided with the Software.
20 #ifndef __SDIWINDOW_SDIWINDOW_H
21 # define __SDIWINDOW_SDIWINDOW_H
23 #include "isdiwindow.h"
25 #include <Plugins/iPlugin>
34 #include <QScopedPointer>
43 * Main window widget implementing the iSdiWindow interface
45 class MainWindow
: public QWidget
, public iSdiWindow
48 Q_INTERFACES(eVaf::SdiWindow::iSdiWindow
)
52 MainWindow(QWidget
* parent
= nullptr, Qt::WindowFlags flags
= Qt::WindowFlags());
54 virtual ~MainWindow();
56 virtual bool init(QString
const & args
);
60 virtual bool isReady() { return mReady
; }
62 virtual void addPanel(QString
const & name
, Gui::Panel
* panel
);
64 virtual Gui::Panel
* panel(QString
const & name
) const;
66 virtual bool showPanel(QString
const & name
);
68 virtual void changeEvent(QEvent
* e
);
70 virtual void closeEvent(QCloseEvent
* e
);
82 void restoreSettings();
90 /// The layout of the main window
91 QVBoxLayout
* mLayout
;
93 /// Name of the main panel that becomes part of this window
94 QString mMainPanelName
;
96 /// List of GUI::Panel objects added to the manager
97 QList
<Gui::Panel
*> mPanels
;
99 /// List of minimized GUI::Panel objects
100 QVector
<Gui::Panel
*> mMinimizedPanels
;
102 /// Hash with panel names
103 QHash
<QString
, Gui::Panel
*> mPanelNames
;
105 /// Current main panel added to this window
106 Gui::Panel
* mMainPanel
;
111 /// Gets the main panel name from module attributes
112 QString
getMainPanelName(QString
const & args
) const;
117 /// Panel destroyed signal. We need to remove the panel from all the
119 void panelDestroyed(QObject
* obj
= nullptr);
124 * SdiWindow module's implementation
126 class SdiWindowPlugin
: public Plugins::iPlugin
129 Q_INTERFACES(eVaf::Plugins::iPlugin
)
135 virtual ~SdiWindowPlugin();
137 virtual bool init(const QString
& args
);
141 virtual bool isReady() const { return mWindow
!= nullptr && mWindow
->isReady(); }
146 /// iSdiWindow interface implementation
147 QScopedPointer
<MainWindow
> mWindow
;
150 } // namespace eVaf::SdiWindow::Internal
151 } // namespace eVaf::SdiWindow
154 #endif // sdiwindow.h