/** * @file SdiWindow/sdiwindow.h * @brief SdiWindow module's implementation * @author Enar Vaikene * * Copyright (c) 2011-2019 Enar Vaikene * * This file is part of the eVaf C++ cross-platform application development framework. * * This file can be used under the terms of the GNU General Public License * version 3.0 as published by the Free Software Foundation and appearing in * the file LICENSE included in the packaging of this file. Please review the * the following information to ensure the GNU General Public License version * 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html. * * Alternatively, this file may be used in accordance with the Commercial License * Agreement provided with the Software. */ #ifndef __SDIWINDOW_SDIWINDOW_H # define __SDIWINDOW_SDIWINDOW_H #include "isdiwindow.h" #include #include #include #include #include #include #include #include #include class QVBoxLayout; namespace eVaf { namespace SdiWindow { namespace Internal { /** * Main window widget implementing the iSdiWindow interface */ class MainWindow : public QWidget, public iSdiWindow { Q_OBJECT Q_INTERFACES(eVaf::SdiWindow::iSdiWindow) public: MainWindow(QWidget * parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags()); virtual ~MainWindow(); virtual bool init(QString const & args); virtual void done(); virtual bool isReady() { return mReady; } virtual void addPanel(QString const & name, Gui::Panel * panel); virtual Gui::Panel * panel(QString const & name) const; virtual bool showPanel(QString const & name); virtual void changeEvent(QEvent * e); virtual void closeEvent(QCloseEvent * e); protected: // Methods private: // Methods void setWindowSize(); void saveSettings(); void restoreSettings(); private: // Members /// Ready flag bool mReady; /// The layout of the main window QVBoxLayout * mLayout; /// Name of the main panel that becomes part of this window QString mMainPanelName; /// List of GUI::Panel objects added to the manager QList mPanels; /// List of minimized GUI::Panel objects QVector mMinimizedPanels; /// Hash with panel names QHash mPanelNames; /// Current main panel added to this window Gui::Panel * mMainPanel; private: // Methods /// Gets the main panel name from module attributes QString getMainPanelName(QString const & args) const; private slots: /// Panel destroyed signal. We need to remove the panel from all the /// lists. void panelDestroyed(QObject * obj = nullptr); }; /** * SdiWindow module's implementation */ class SdiWindowPlugin : public Plugins::iPlugin { Q_OBJECT Q_INTERFACES(eVaf::Plugins::iPlugin) public: SdiWindowPlugin(); virtual ~SdiWindowPlugin(); virtual bool init(const QString & args); virtual void done(); virtual bool isReady() const { return mWindow != nullptr && mWindow->isReady(); } private: /// iSdiWindow interface implementation QScopedPointer mWindow; }; } // namespace eVaf::SdiWindow::Internal } // namespace eVaf::SdiWindow } // namespace eVaf #endif // sdiwindow.h