Editor API
UnigineEditor public API
UnigineEditor::WindowManager Class Referencefinal

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

Inherits QObject.

Classes

struct  RestoreState
 Auxiliary information required to restore window state (insert it back to where it was taken from). See the take method. More...
 

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=AreaType::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=AreaType::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)
 Adds the specified widget as a corner widget (child) to the specified window(parent). It is a widget to be shown in the top-right corner of the window. More...
 
static bool remove (QWidget *widget)
 Removes the specified tool window. More...
 
static bool has (QWidget *widget)
 Checks if the specified tool window exists. More...
 
static RestoreState take (QWidget *widget)
 Takes the specified window from the Window Manager and saves its current state to be used later to restore it (restore()). This can be used for maximizing a viewport to fullscreen. More...
 
static bool restore (QWidget *widget, RestoreState state)
 Restores the specified window back to where it was taken from (take()) using the saved state. This can be used to return a viewport back to normal state after maximizing it to fullscreen. More...
 
static void move (QWidget *widget, AreaType area=AreaType::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=AreaType::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 *widget)
 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 *widget)
 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 *widget, 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...
 

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 UnigineEditor::WindowManager::activate ( QWidget *  widget)
static

Activates the specified tool window.

Parameters
widgetTool window to be activated.

◆ add() [1/4]

static void UnigineEditor::WindowManager::add ( QWidget *  widget,
AreaType  area = AreaType::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 UnigineEditor::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 UnigineEditor::WindowManager::add ( const Unigine::Vector< QWidget * > &  widgets,
AreaType  area = AreaType::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 UnigineEditor::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 UnigineEditor::WindowManager::addCornerWidget ( QWidget *  parent,
QWidget *  child 
)
static

Adds the specified widget as a corner widget (child) to the specified window(parent). It is a widget to be shown in the top-right corner of the window.

Parameters
parentWindow to which the corner widget is to be added.
childCorner widget to be added.

◆ allWindows()

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

Returns the list of all existing tool windows.

Returns
Vector containing all existing tool windows.

◆ beforeHide

void UnigineEditor::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* UnigineEditor::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* UnigineEditor::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* UnigineEditor::WindowManager::getArea ( QWidget *  widget)
static

Returns the area to which the specified tool window belongs.

Parameters
widgetTool 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* UnigineEditor::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 UnigineEditor::WindowManager::getAreaName ( QWidget *  widget)
static

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

Parameters
widgetTool 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* UnigineEditor::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 UnigineEditor::WindowManager::has ( QWidget *  widget)
static

Checks if the specified tool window exists.

Parameters
widgetTool window to be checked.

◆ hide()

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

Hides the specified tool window.

Parameters
widgetTool window to be hidden.

◆ instance()

static WindowManager* UnigineEditor::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 UnigineEditor::WindowManager::isHidden ( QWidget *  widget)
static

Checks whether the specified tool window is hidden.

Parameters
widgetTool window to be checked.

◆ isVisible()

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

Checks whether the specified tool window is visible.

Parameters
widgetTool window to be checked.

◆ move() [1/4]

static void UnigineEditor::WindowManager::move ( QWidget *  widget,
AreaType  area = AreaType::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 UnigineEditor::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 UnigineEditor::WindowManager::move ( const Unigine::Vector< QWidget * > &  widgets,
AreaType  area = AreaType::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 UnigineEditor::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 bool UnigineEditor::WindowManager::remove ( QWidget *  widget)
static

Removes the specified tool window.

Parameters
widgetTool window to be removed.

◆ resize()

static void UnigineEditor::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.

◆ restore()

static bool UnigineEditor::WindowManager::restore ( QWidget *  widget,
RestoreState  state 
)
static

Restores the specified window back to where it was taken from (take()) using the saved state. This can be used to return a viewport back to normal state after maximizing it to fullscreen.

Parameters
widgetWindow to be restored.
statePreviously saved restore state to be used.
Returns
true if the state of the specified window is restored successfully; otherwise, false.

◆ restoreLastWindowConfig()

static bool UnigineEditor::WindowManager::restoreLastWindowConfig ( QWidget *  widget,
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
widgetTool 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 UnigineEditor::WindowManager::show ( QWidget *  widget)
static

Shows the specified tool window.

Parameters
widgetTool window to be shown.

◆ stateRestored

void UnigineEditor::WindowManager::stateRestored ( )
signal

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

◆ take()

static RestoreState UnigineEditor::WindowManager::take ( QWidget *  widget)
static

Takes the specified window from the Window Manager and saves its current state to be used later to restore it (restore()). This can be used for maximizing a viewport to fullscreen.

Parameters
widgetWindow to be taken.

◆ windowHidden

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

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

◆ windowShown

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

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