aboutsummaryrefslogtreecommitdiffstats
path: root/SQLiteStudio3/guiSQLiteStudio/mdiarea.h
diff options
context:
space:
mode:
Diffstat (limited to 'SQLiteStudio3/guiSQLiteStudio/mdiarea.h')
-rw-r--r--SQLiteStudio3/guiSQLiteStudio/mdiarea.h73
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