Editor API
UnigineEditor public API
WindowManager.h
1 // Copyright (C), UNIGINE. All rights reserved.
2 #pragma once
3 
4 
5 #include <EditorGlobal.h>
6 #include <QObject>
7 
8 
10 // Forward decl.
12 namespace Editor { class Presenter; }
13 class QWidget;
14 class QMenu;
15 
16 
17 namespace Editor
18 {
20 // WindowManager.
25 class EDITOR_API WindowManager final : public QObject
26 {
27  Q_OBJECT
28 
29 public:
31  enum AreaType
32  {
45  NO_AREA
46  };
47 
49  enum RefType
50  {
60  REF_BOTTOM_OF
61  };
62 
63 public:
78  static WindowManager *instance();
79 
87  static void add(QWidget *widget, AreaType area = LAST_USED_AREA);
95  static void add(QWidget *widget, RefType ref, QWidget *area);
102  static void add(const QVector<QWidget *> &widgets, AreaType area = LAST_USED_AREA);
111  static void add(const QVector<QWidget *> &widgets, RefType ref, QWidget *area);
112  static void addCornerWidget(QWidget *parent, QWidget *child);
113 
116  static void remove(QWidget *widget);
119  static bool has(QWidget *widget);
120 
128  static void move(QWidget *widget, AreaType area = LAST_USED_AREA);
136  static void move(QWidget *widget, RefType ref, QWidget *area);
143  static void move(const QVector<QWidget *> &widgets, AreaType area = LAST_USED_AREA);
152  static void move(const QVector<QWidget *> &widgets, RefType ref, QWidget *area);
153 
158  static void resize(QWidget *widget, int width, int height);
159 
162  static void activate(QWidget *widget);
165  static void hide(QWidget *widget);
168  static bool isHidden(QWidget *widget);
171  static void show(QWidget *widget);
174  static bool isVisible(QWidget *widget);
175 
179  static QWidget *getArea(QWidget *child);
182  static QVector<QWidget *> allWindows();
183 
187  static QMenu *findMenu(const QString &name);
188 
189 signals:
194  void windowShown (QWidget *widget);
199  void beforeHide (QWidget *widget);
203  void windowHidden (QWidget *widget);
207  void stateRestored();
208 
209 private:
210  explicit WindowManager(QObject *parent = nullptr);
211  ~WindowManager() override;
212 
213  friend class Editor::Presenter;
214 };
215 
216 
217 } // namespace Editor
Last used area.
Definition: WindowManager.h:33
Definition: Actions.h:9
Right part of the root area.
Definition: WindowManager.h:39
Upper part of the root area.
Definition: WindowManager.h:41
Left anchor of the area.
Definition: WindowManager.h:54
New tab occupying the whole area.
Definition: WindowManager.h:52
Left part of the root area.
Definition: WindowManager.h:37
RefType
Anchor type defining the way to layout tool windows.
Definition: WindowManager.h:49
New floating area.
Definition: WindowManager.h:35
AreaType
ToolWindowManager area type.
Definition: WindowManager.h:31
Window manager class. This class is used to manage tool windows in the Editor.
Definition: WindowManager.h:25
Top anchor of the area.
Definition: WindowManager.h:58
Right anchor of the area.
Definition: WindowManager.h:56
Lower part of the root area.
Definition: WindowManager.h:43