Editor API
UnigineEditor public API
WindowManager.h
1 // Copyright (C), UNIGINE. All rights reserved.
2 #pragma once
3 
4 
5 #include <editor/EditorGlobal.h>
6 
7 #include <UnigineVector.h>
8 
9 #include <QObject>
10 
11 
13 // Forward decl.
15 namespace Editor { class Presenter; }
16 class QWidget;
17 class QMenu;
18 class QToolBar;
19 
20 
21 namespace Editor
22 {
24 // WindowManager.
29 class EDITOR_API WindowManager final : public QObject
30 {
31  Q_OBJECT
32 
33 public:
35  enum AreaType
36  {
49  NO_AREA
50  };
51 
53  enum RefType
54  {
64  REF_BOTTOM_OF
65  };
66 
67 public:
82  static WindowManager *instance();
83 
91  static void add(QWidget *widget, AreaType area = LAST_USED_AREA);
99  static void add(QWidget *widget, RefType ref, QWidget *area);
106  static void add(const Unigine::Vector<QWidget *> &widgets, AreaType area = LAST_USED_AREA);
115  static void add(const Unigine::Vector<QWidget *> &widgets, RefType ref, QWidget *area);
116  static void addCornerWidget(QWidget *parent, QWidget *child);
117 
120  static void remove(QWidget *widget);
123  static bool has(QWidget *widget);
124 
132  static void move(QWidget *widget, AreaType area = LAST_USED_AREA);
140  static void move(QWidget *widget, RefType ref, QWidget *area);
147  static void move(const Unigine::Vector<QWidget *> &widgets, AreaType area = LAST_USED_AREA);
156  static void move(const Unigine::Vector<QWidget *> &widgets, RefType ref, QWidget *area);
157 
162  static void resize(QWidget *widget, int width, int height);
163 
166  static void activate(QWidget *widget);
169  static void hide(QWidget *widget);
172  static bool isHidden(QWidget *widget);
175  static void show(QWidget *widget);
178  static bool isVisible(QWidget *widget);
179 
183  static QWidget *getArea(QWidget *child);
186  static Unigine::Vector<QWidget *> allWindows();
187 
191  static QMenu *findMenu(const char *name);
192 
196  static QToolBar *findToolBar(const char *name);
197 
198 signals:
203  void windowShown (QWidget *widget);
208  void beforeHide (QWidget *widget);
212  void windowHidden (QWidget *widget);
216  void stateRestored();
217 
218 private:
219  explicit WindowManager(QObject *parent = nullptr);
220  ~WindowManager() override;
221 
222  friend class Editor::Presenter;
223 };
224 
225 
226 } // namespace Editor
Last used area.
Definition: WindowManager.h:37
Right part of the root area.
Definition: WindowManager.h:43
Upper part of the root area.
Definition: WindowManager.h:45
Left anchor of the area.
Definition: WindowManager.h:58
New tab occupying the whole area.
Definition: WindowManager.h:56
Left part of the root area.
Definition: WindowManager.h:41
RefType
Anchor type defining the way to layout tool windows.
Definition: WindowManager.h:53
New floating area.
Definition: WindowManager.h:39
AreaType
ToolWindowManager area type.
Definition: WindowManager.h:35
Window manager class. This class is used to manage tool windows in the Editor.
Definition: WindowManager.h:29
Top anchor of the area.
Definition: WindowManager.h:62
Right anchor of the area.
Definition: WindowManager.h:60
Lower part of the root area.
Definition: WindowManager.h:47