/*************************************************************************** * Copyright (C) 2009 by Martin Moracek * * xmoracek@fi.muni.cz * * * * DiVinE is free software, distributed under GNU GPL and BSD licences. * * Detailed licence texts may be found in the COPYING file in the * * distribution tarball. The tool is a product of the ParaDiSe * * Laboratory, Faculty of Informatics of Masaryk University. * * * * This distribution includes freely redistributable third-party code. * * Please refer to AUTHORS and COPYING included in the distribution for * * copyright and licensing details. * ***************************************************************************/ #ifndef LAYOUT_MANAGER_H_ #define LAYOUT_MANAGER_H_ #include #include #include class QWidget; class QAction; class QMainWindow; namespace divine { namespace gui { /*! * The LayoutSet class stores the visibility of widgets and action in one layout. * \see LayoutManager */ class LayoutSet { public: void makeVisible(); void addWidget(QWidget * widget, bool state); void removeWidget(QWidget * widget); void addAction(QAction * action, bool state); void removeAction(QAction * action); private: typedef QHash WidgetHash; typedef QHash ActionHash; private: WidgetHash widgets_; ActionHash actions_; }; /*! * The LayoutManager class provides mechanism for managing application layouts. * It helps serialize geometry and visibility of widgets and actions among * number of layouts. */ class LayoutManager : public QObject { Q_OBJECT public: LayoutManager(QMainWindow * parent, const QStringList & layouts); ~LayoutManager(); void switchLayout(const QString & layout); void readSettings(); void writeSettings(); void addWidget(QWidget * widget, const QStringList & layouts); void removeWidget(QWidget * widget); void addAction(QAction * action, const QStringList & layouts); void removeAction(QAction * action); private: typedef QPair LayoutPair; typedef QHash LayoutHash; private: QMainWindow * parent_; QString active_; LayoutHash layouts_; }; } } #endif