diff options
| author | 2014-12-06 17:33:25 -0500 | |
|---|---|---|
| committer | 2014-12-06 17:33:25 -0500 | |
| commit | 7167ce41b61d2ba2cdb526777a4233eb84a3b66a (patch) | |
| tree | a35c14143716e1f2c98f808c81f89426045a946f /SQLiteStudio3/guiSQLiteStudio/mdiarea.h | |
Imported Upstream version 2.99.6upstream/2.99.6
Diffstat (limited to 'SQLiteStudio3/guiSQLiteStudio/mdiarea.h')
| -rw-r--r-- | SQLiteStudio3/guiSQLiteStudio/mdiarea.h | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/SQLiteStudio3/guiSQLiteStudio/mdiarea.h b/SQLiteStudio3/guiSQLiteStudio/mdiarea.h new file mode 100644 index 0000000..f34434e --- /dev/null +++ b/SQLiteStudio3/guiSQLiteStudio/mdiarea.h @@ -0,0 +1,73 @@ +#ifndef MDIAREA_H +#define MDIAREA_H + +#include "mdiwindow.h" +#include "guiSQLiteStudio_global.h" +#include <QMdiArea> + +class TaskBar; +class QActionGroup; +class MdiChild; + +class GUI_API_EXPORT MdiArea : public QMdiArea +{ + Q_OBJECT + public: + explicit MdiArea(QWidget *parent = 0); + + MdiWindow* addSubWindow(MdiChild* mdiChild); + MdiWindow* getActiveWindow(); + MdiWindow* getWindowByTitle(const QString& title); + MdiWindow* getWindowByChild(MdiChild* child); + MdiWindow* getCurrentWindow(); + bool isActiveSubWindow(MdiWindow* window); + bool isActiveSubWindow(MdiChild* child); + QStringList getWindowTitles(); + void setTaskBar(TaskBar *value); + TaskBar* getTaskBar() const; + QAction* getTaskByWindow(MdiWindow* window); + QList<MdiWindow*> getWindows() const; + QList<MdiChild*> getMdiChilds() const; + + template<class T> + QList<T*> getMdiChilds() const; + + private: + QList<MdiWindow*> getWindowsToTile() const; + + TaskBar* taskBar = nullptr; + QHash<QAction*,MdiWindow*> actionToWinMap; + QHash<MdiWindow*,QAction*> winToActionMap; + + signals: + void windowListChanged(); + + private slots: + void taskActivated(); + void windowActivated(); + + public slots: + void windowDestroyed(MdiWindow* window); + void tileHorizontally(); + void tileVertically(); + void closeAllButActive(); +}; + +template<class T> +QList<T*> MdiArea::getMdiChilds() const +{ + QList<T*> childs; + T* child = nullptr; + for (MdiWindow* win : getWindows()) + { + child = dynamic_cast<T*>(win->getMdiChild()); + if (child) + childs << child; + } + + return childs; +} + +#define MDIAREA MainWindow::getInstance()->getMdiArea() + +#endif // MDIAREA_H |
