]>
vaikene.ee Git - evaf/blob - src/plugins/SdiWindow/sdiwindow.h
2 * @file SdiWindow/sdiwindow.h
3 * @brief SdiWindow module's implementation
6 * Copyright (c) 2011 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 <QWeakPointer>
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
= 0, Qt::WindowFlags flags
= 0);
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
);
75 /// Garbage collector timer
76 virtual void timerEvent(QTimerEvent
* e
);
85 void restoreSettings();
93 /// The layout of the main window
94 QVBoxLayout
* mLayout
;
96 /// Name of the main panel that becomes part of this window
97 QString mMainPanelName
;
99 /// List of GUI::Panel objects added to the manager
100 QList
<QWeakPointer
<Gui::Panel
> > mPanels
;
102 /// List of minimized GUI::Panel objects
103 QVector
<QWeakPointer
<Gui::Panel
> > mMinimizedPanels
;
105 /// Hash with panel names
106 QHash
<QString
, QWeakPointer
<Gui::Panel
> > mPanelNames
;
108 /// Current main panel added to this window
109 QWeakPointer
<Gui::Panel
> mMainPanel
;
111 /// Garbage collector timer ID
117 /// Gets the main panel name from module attributes
118 QString
getMainPanelName(QString
const & args
) const;
123 * SdiWindow module's implementation
125 class SdiWindowPlugin
: public Plugins::iPlugin
128 Q_INTERFACES(eVaf::Plugins::iPlugin
)
134 virtual ~SdiWindowPlugin();
136 virtual bool init(const QString
& args
);
140 virtual bool isReady() const { return mWindow
!= 0 && mWindow
->isReady(); }
145 /// iSdiWindow interface implementation
146 MainWindow
* mWindow
;
149 } // namespace eVaf::SdiWindow::Internal
150 } // namespace eVaf::SdiWindow
153 #endif // sdiwindow.h