Editor API
UnigineEditor public API
Editor::WindowManager Class Referencefinal

Window manager class. This class is used to manage tool windows in the Editor. More...

#include <WindowManager.h>

Inheritance diagram for Editor::WindowManager:

Public Types

enum  AreaType {
  LAST_USED_AREA, NEW_FLOATING_AREA, ROOT_AREA_LEFT, ROOT_AREA_RIGHT,
  ROOT_AREA_TOP, ROOT_AREA_BOTTOM, NO_AREA
}
 ToolWindowManager area type. More...
 
enum  RefType {
  REF_ADD_TO, REF_LEFT_OF, REF_RIGHT_OF, REF_TOP_OF,
  REF_BOTTOM_OF
}
 Anchor type defining the way to layout tool windows. More...
 

Signals

void windowShown (QWidget *widget)
 This signal is emitted when a tool window is shown, with the tool window as an argument. More...
 
void beforeHide (QWidget *widget)
 This signal is emitted when before a tool window is hidden, with the tool window as an argument. More...
 
void windowHidden (QWidget *widget)
 This signal is emitted when a tool window is hidden, with the tool window as an argument. More...
 
void stateRestored ()
 This signal is emitted when the state of the Tool Window Manager is restored. More...
 

Static Public Member Functions

static WindowManagerinstance ()
 Returns the instance of the WindowManager class. This method is used to subscribe to signals. More...
 
static void add (QWidget *widget, AreaType area=LAST_USED_AREA)
 Adds the specified tool window to the specified area of the main window. By default the tool window is added to the last used one. More...
 
static void add (QWidget *widget, RefType ref, QWidget *area)
 Adds the specified tool window to the specified window area according to the specified anchor type (RefType). More...
 
static void add (const Unigine::Vector< QWidget * > &widgets, AreaType area=LAST_USED_AREA)
 Adds the specified set of tool windows to the specified area of the main window. By default tool windows are added to the last used one. More...
 
static void add (const Unigine::Vector< QWidget * > &widgets, RefType ref, QWidget *area)
 Adds the specified set of tool windows to the specified area according to the specified anchor type (RefType). More...
 
static void addCornerWidget (QWidget *parent, QWidget *child)
 
static void remove (QWidget *widget)
 Removes the specified tool window. More...
 
static bool has (QWidget *widget)
 Checks if the specified tool window exists. More...
 
static void move (QWidget *widget, AreaType area=LAST_USED_AREA)
 Moves the specified tool window to the specified area of the main window. By default the tool window is moved to the last used one. More...
 
static void move (QWidget *widget, RefType ref, QWidget *area)
 Moves the specified tool window to the specified window area according to the specified anchor type (RefType). More...
 
static void move (const Unigine::Vector< QWidget * > &widgets, AreaType area=LAST_USED_AREA)
 Moves the specified set of tool windows to the specified area of the main window. By default tool windows are moved to the last used one. More...
 
static void move (const Unigine::Vector< QWidget * > &widgets, RefType ref, QWidget *area)
 Moves the specified set of tool windows to the specified area according to the specified anchor type (RefType). More...
 
static void resize (QWidget *widget, int width, int height)
 Resizes the specified tool window. More...
 
static void activate (QWidget *widget)
 Activates the specified tool window. More...
 
static void hide (QWidget *widget)
 Hides the specified tool window. More...
 
static bool isHidden (QWidget *widget)
 Checks whether the specified tool window is hidden. More...
 
static void show (QWidget *widget)
 Shows the specified tool window. More...
 
static bool isVisible (QWidget *widget)
 Checks whether the specified tool window is visible. More...
 
static QWidget * getArea (QWidget *child)
 Returns the area to which the specified tool window belongs. More...
 
static Unigine::Vector< QWidget * > allWindows ()
 Returns the list of all existing tool windows. More...
 
static QMenu * findMenu (const char *name)
 Searches for a submenu of the main menu bar with the specified name. More...
 
static QToolBar * findToolBar (const char *name)
 Searches for a toolbar with the specified name. More...
 
static QWidget * getArea (const QString &area_name)
 Returns a window area by its name. More...
 
static QString getAreaName (QWidget *child)
 Returns the name of the area to which the specified tool window belongs. More...
 
static QWidget * getFloatingWindow (QWidget *child)
 Returns the state of a floating area (a separate window that can be moved atop of the main window) to which the tool window belongs. In case the parent area is not a floating one, an empty QByteArray shall be returned. More...
 
static bool restoreLastWindowConfig (QWidget *tool_window, const QString &area_name)
 Restores the state of the specified tool window in the window area with the specified name using the data of the previous session. In case of a failure to obtain the data from the previous session, default settings shall be used. More...
 

Friends

class Editor::Presenter
 

Detailed Description

Window manager class. This class is used to manage tool windows in the Editor.

Member Enumeration Documentation

◆ AreaType

ToolWindowManager area type.

Enumerator
LAST_USED_AREA 

Last used area.

NEW_FLOATING_AREA 

New floating area.

ROOT_AREA_LEFT 

Left part of the root area.

ROOT_AREA_RIGHT 

Right part of the root area.

ROOT_AREA_TOP 

Upper part of the root area.

ROOT_AREA_BOTTOM 

Lower part of the root area.

NO_AREA 

No area.

◆ RefType

Anchor type defining the way to layout tool windows.

Enumerator
REF_ADD_TO 

New tab occupying the whole area.

REF_LEFT_OF 

Left anchor of the area.

REF_RIGHT_OF 

Right anchor of the area.

REF_TOP_OF 

Top anchor of the area.

REF_BOTTOM_OF 

Bottom anchor of the area.

Member Function Documentation

◆ activate()

static void Editor::WindowManager::activate ( QWidget *  widget)
static

Activates the specified tool window.

Parameters
widgetTool window to be activated.

◆ add() [1/4]

static void Editor::WindowManager::add ( QWidget *  widget,
AreaType  area = LAST_USED_AREA 
)
static

Adds the specified tool window to the specified area of the main window. By default the tool window is added to the last used one.

Parameters
widgetTool window to be added.
areaMain window area to which the specified tool window is to be added.

To get a window area use getArea()

◆ add() [2/4]

static void Editor::WindowManager::add ( QWidget *  widget,
RefType  ref,
QWidget *  area 
)
static

Adds the specified tool window to the specified window area according to the specified anchor type (RefType).

Parameters
widgetTool window to be added.
refAnchor type to define the layout relative to the specified area.
areaWindow area to which the specified tool window is to be added.

◆ add() [3/4]

static void Editor::WindowManager::add ( const Unigine::Vector< QWidget * > &  widgets,
AreaType  area = LAST_USED_AREA 
)
static

Adds the specified set of tool windows to the specified area of the main window. By default tool windows are added to the last used one.

Parameters
widgetsList of tool windows to be added.
areaMain window area to which the specified tool windows are to be added.

◆ add() [4/4]

static void Editor::WindowManager::add ( const Unigine::Vector< QWidget * > &  widgets,
RefType  ref,
QWidget *  area 
)
static

Adds the specified set of tool windows to the specified area according to the specified anchor type (RefType).

Parameters
widgetsList of tool windows to be added.
refAnchor type to define the layout relative to the specified area.
areaWindow area to which the specified tool windows are to be added.

To get a window area use getArea()

◆ addCornerWidget()

static void Editor::WindowManager::addCornerWidget ( QWidget *  parent,
QWidget *  child 
)
static

◆ allWindows()

static Unigine::Vector<QWidget *> Editor::WindowManager::allWindows ( )
static

Returns the list of all existing tool windows.

Returns
Vector containing all existing tool windows.

◆ beforeHide

void Editor::WindowManager::beforeHide ( QWidget *  widget)
signal

This signal is emitted when before a tool window is hidden, with the tool window as an argument.

◆ findMenu()

static QMenu* Editor::WindowManager::findMenu ( const char *  name)
static

Searches for a submenu of the main menu bar with the specified name.

Parameters
nameName of the submenu to be found.
Returns
Menu with the specified name; otherwise nullptr.

◆ findToolBar()

static QToolBar* Editor::WindowManager::findToolBar ( const char *  name)
static

Searches for a toolbar with the specified name.

Parameters
nameName of the toolbar to be found.
Returns
Toolbar with the specified name; otherwise nullptr.

◆ getArea() [1/2]

static QWidget* Editor::WindowManager::getArea ( QWidget *  child)
static

Returns the area to which the specified tool window belongs.

Parameters
childTool window for which the area is to be obtained.
Returns
The area to which the specified tool window belongs; otherwise nullptr.

◆ getArea() [2/2]

static QWidget* Editor::WindowManager::getArea ( const QString &  area_name)
static

Returns a window area by its name.

Parameters
area_nameName of the window area.
Returns
Window area with the specified name (if it exists); otherwise nullptr.

◆ getAreaName()

static QString Editor::WindowManager::getAreaName ( QWidget *  child)
static

Returns the name of the area to which the specified tool window belongs.

Parameters
childTool window for which the area name is to be obtained.
Returns
Name of the area to which the specified tool window belongs; otherwise an empty string.

◆ getFloatingWindow()

static QWidget* Editor::WindowManager::getFloatingWindow ( QWidget *  child)
static

Returns the state of a floating area (a separate window that can be moved atop of the main window) to which the tool window belongs. In case the parent area is not a floating one, an empty QByteArray shall be returned.

Parameters
childTool window for which the area name is to be obtained.
Returns
State of a floating area; otherwise, if the parent area is not a floating one, empty QByteArray.

◆ has()

static bool Editor::WindowManager::has ( QWidget *  widget)
static

Checks if the specified tool window exists.

Parameters
widgetTool window to be checked.

◆ hide()

static void Editor::WindowManager::hide ( QWidget *  widget)
static

Hides the specified tool window.

Parameters
widgetTool window to be hidden.

◆ instance()

static WindowManager* Editor::WindowManager::instance ( )
static

Returns the instance of the WindowManager class. This method is used to subscribe to signals.

Returns
WindowManager class instance.

Example:

,this , [this](QWidget *widget)
{
if (widget == this)
{
clear();
}
});

◆ isHidden()

static bool Editor::WindowManager::isHidden ( QWidget *  widget)
static

Checks whether the specified tool window is hidden.

Parameters
widgetTool window to be checked.

◆ isVisible()

static bool Editor::WindowManager::isVisible ( QWidget *  widget)
static

Checks whether the specified tool window is visible.

Parameters
widgetTool window to be checked.

◆ move() [1/4]

static void Editor::WindowManager::move ( QWidget *  widget,
AreaType  area = LAST_USED_AREA 
)
static

Moves the specified tool window to the specified area of the main window. By default the tool window is moved to the last used one.

Parameters
widgetTool window to be moved.
areaMain window area to which the specified tool window is to be moved.

To get a window area use getArea()

◆ move() [2/4]

static void Editor::WindowManager::move ( QWidget *  widget,
RefType  ref,
QWidget *  area 
)
static

Moves the specified tool window to the specified window area according to the specified anchor type (RefType).

Parameters
widgetTool window to be moved.
refAnchor type to define the layout relative to the specified area.
areaWindow area to which the specified tool window is to be moved.

◆ move() [3/4]

static void Editor::WindowManager::move ( const Unigine::Vector< QWidget * > &  widgets,
AreaType  area = LAST_USED_AREA 
)
static

Moves the specified set of tool windows to the specified area of the main window. By default tool windows are moved to the last used one.

Parameters
widgetsList of tool windows to be moved.
areaMain window area to which the specified tool windows are to be moved.

◆ move() [4/4]

static void Editor::WindowManager::move ( const Unigine::Vector< QWidget * > &  widgets,
RefType  ref,
QWidget *  area 
)
static

Moves the specified set of tool windows to the specified area according to the specified anchor type (RefType).

Parameters
widgetsList of tool windows to be moved.
refAnchor type to define the layout relative to the specified area.
areaWindow area to which the specified tool windows are to be moved.

To get a window area use getArea()

◆ remove()

static void Editor::WindowManager::remove ( QWidget *  widget)
static

Removes the specified tool window.

Parameters
widgetTool window to be removed.

◆ resize()

static void Editor::WindowManager::resize ( QWidget *  widget,
int  width,
int  height 
)
static

Resizes the specified tool window.

Parameters
widgetTool window to be resized.
widthNew tool window width, in pixels.
heightNew tool window height, in pixels.

◆ restoreLastWindowConfig()

static bool Editor::WindowManager::restoreLastWindowConfig ( QWidget *  tool_window,
const QString &  area_name 
)
static

Restores the state of the specified tool window in the window area with the specified name using the data of the previous session. In case of a failure to obtain the data from the previous session, default settings shall be used.

Parameters
tool_windowTool window to be restored.
area_nameName of the window area.
Returns
true if the state of the specified tool window is restored successfully; otherwise, false.

◆ show()

static void Editor::WindowManager::show ( QWidget *  widget)
static

Shows the specified tool window.

Parameters
widgetTool window to be shown.

◆ stateRestored

void Editor::WindowManager::stateRestored ( )
signal

This signal is emitted when the state of the Tool Window Manager is restored.

◆ windowHidden

void Editor::WindowManager::windowHidden ( QWidget *  widget)
signal

This signal is emitted when a tool window is hidden, with the tool window as an argument.

◆ windowShown

void Editor::WindowManager::windowShown ( QWidget *  widget)
signal

This signal is emitted when a tool window is shown, with the tool window as an argument.

Friends And Related Function Documentation

◆ Editor::Presenter

friend class Editor::Presenter
friend