Unigine::EngineWindow Class
Header: | #include <UnigineWindowManager.h> |
The class to create and manage engine windows: their components, relations with other windows, size, position, and other features.
To create the engine window, use one of the class constructors. For example:
// create an engine window of the specified size with the specified name
EngineWindowPtr window = EngineWindow::create(name, 580, 300);
// set an icon and a title for the window
window->setIcon(icon);
window->setTitle("Vertical Group");
// set the window as the main one
window->setMain(true);
// enable the console, profiler and visualizer for the window
window->setConsoleUsage(true);
window->setProfilerUsage(true);
window->setVisualizerUsage(true);
// add widgets to the client area of the engine window
window->addChild(WidgetLabel::create(window->getSelfGui(), String::format("This is %s window.", name)));
window->addChild(WidgetButton::create(window->getSelfGui(), name), Gui::ALIGN_CENTER);
// separate windows
EngineWindowPtr settings = EngineWindow::create("Settings", 512, 256);
EngineWindowPtr parameters = EngineWindow::create("Parameters", 512, 256);
// grouped windows
EngineWindowPtr settings_and_parameters = WindowManager::stackWindows(settings, parameters, EngineWindow::GROUP_TYPE_TAB);
To render the engine window, use the show() function.
For more information on working with window groups, check the article on WindowManager class.
See Also#
- A set of SDK samples (samples/Api/WindowManager) demonstrating various usage aspects.
EngineWindow Class
Enums
HITTEST#
STATE#
GROUP_TYPE#
CALLBACK_INDEX#
FLAGS#
Members
EngineWindow ( const char * title, int width, int height, int flags = 0 ) #
Constructor. Creates the engine window of the specified size with the specified name using the specified flags.Arguments
- const char * title - The title of the window, in UTF-8 encoding.
- int width - Window width.
- int height - Window height.
- int flags - Mask containing window flags.
EngineWindow ( int width, int height, int flags = 0 ) #
Constructor. Creates the engine window of the specified size using the specified flags.Arguments
- int width - Window width.
- int height - Window height.
- int flags - Mask containing window flags.
EngineWindow ( const Math::ivec2 & size, int flags = 0 ) #
Constructor. Creates the engine window of the specified size using the specified flags.Arguments
void setMain ( bool main ) #
Sets the window as the main window.There may be several windows that are set as main, or no main windows at all.
Arguments
- bool main - true to set the window as the main window, otherwise false.
bool isMain ( ) const#
Returns a value indicating if this window is the main window.Return value
true if the window is the main window, otherwise false.void setCamera ( const Ptr<Camera> & camera ) #
Sets the camera the image from which is rendered to the engine window. This value has a higher priority over the main camera flag.Arguments
Ptr<Camera> getCamera ( ) const#
Returns the camera the image from which is rendered to the engine window. This value has a higher priority over the main camera flag.Return value
The camera the image from which is rendered to the engine window.Ptr<Gui> getGui ( ) const#
Returns the parent Gui for a nested engine window.Return value
Gui instance.Ptr<Gui> getSelfGui ( ) const#
Returns Gui instance for a fully-featured system window. For a nested window, may return nullptr.Return value
Gui instance.int getDisplayIndex ( ) const#
Returns the number of the display, on which the window is currently displayed.Return value
The number of the display, on which the window is currently displayed.bool isSeparateWindow ( ) const#
Returns a value indicating if this window is an independent system window.Return value
true if the window is a separate window, otherwise false.bool isSeparateGroup ( ) const#
Returns a value indicating if this window group is an independent group of windows located on the desktop.Return value
true if the window group is an independent group of windows, otherwise false.bool isNestedWindow ( ) const#
Returns a value indicating if this window is a part of a window group.Return value
true if the window is a nested window, otherwise false.bool isNestedGroup ( ) const#
Returns a value indicating if this window group is a part of a window group.Return value
true if the window group is nested to another window group, otherwise false.bool isWindow ( ) const#
Returns a value indicating if the object is a separate or a nested window.Return value
true for a separate or a nested window, otherwise false.bool isGroup ( ) const#
Returns a value indicating if the object is a separate or a nested group of windows.Return value
true for a separate or a nested group of windows, otherwise false.bool isNested ( ) const#
Returns a value indicating if the object is a nested window or group of windows.Return value
true for a nested window or group of windows, otherwise false.bool isSeparate ( ) const#
Returns a value indicating if the object is a separate window or group of windows.Return value
true for a separate window or group of windows, otherwise false.EngineWindow::STATE getState ( ) const#
Returns the window state: if it's a separate or nested window or group of windows.Return value
The window state.EngineWindow::GROUP_TYPE getGroupType ( ) const#
Returns the window group type — vertical, horizontal, tab arrangement of windows, or an independent window inside a group.Return value
The window group type.void setPosition ( const Math::ivec2 & position ) #
Sets the position of the left top corner of the engine window in the screen coordinates. In case of several displays, the position is relative to the main display.Arguments
- const Math::ivec2 & position - The engine window screen position — coordinates of the left top corner.
Math::ivec2 getPosition ( ) const#
Returns the position of the left top corner of the engine window in the screen coordinates. In case of several displays, the position is relative to the main display.Return value
The engine window screen position — coordinates of the left top corner.Math::ivec2 getClientPosition ( ) const#
Sets the position of the left top corner of the window content area (without the top bar and border of the system window) in the screen coordinates. In case of several displays, the position is relative to the main display.Return value
The screen position of the window content area — coordinates of the left top corner.Math::ivec2 getClientLocalPosition ( ) const#
Returns the position of the left top corner of the window content area (without the top bar and border of the system window) in coordinates of the GUI used for rendering of this window.Return value
The screen position of the window content area — coordinates of the left top corner, in coordinates of the current window GUI.void moveToCenter ( ) #
Moves the engine window to the center of the current screen.void setSize ( const Math::ivec2 & size ) #
Sets the engine window size.Arguments
- const Math::ivec2 & size - The engine window size.
Math::ivec2 getSize ( ) const#
Returns the engine window size.Return value
The engine window size.Math::ivec2 getClientSize ( ) const#
Returns the size of the window client (content) area.Return value
The size of the window client area.void setMinSize ( const Math::ivec2 & size ) #
Sets the minimum possible window size when resizing the window.Arguments
- const Math::ivec2 & size - The minimum possible size of the window.
Math::ivec2 getMinSize ( ) const#
Returns the minimum possible window size when resizing the window.Return value
The minimum possible size of the window.void setMaxSize ( const Math::ivec2 & size ) #
Sets the maximum possible window size when resizing the window..Arguments
- const Math::ivec2 & size - The maximum possible size of the window.
Math::ivec2 getMaxSize ( ) const#
Returns the maximum possible window size when resizing the window..Return value
The maximum possible size of the window.void setTitle ( const char * title ) #
Sets the text of the title for the engine window.Arguments
- const char * title - The title of the engine window.
const char * getTitle ( ) const#
Returns the text of the title for the engine window.Return value
The title for the engine window.bool setIcon ( const Ptr<Image> & icon ) #
Sets the icon for the engine window.Arguments
Return value
true if the specified icon is successfully set for the engine window, otherwise false.Ptr<Image> getIcon ( ) #
Returns the icon for the engine window.Return value
The icon for the engine window.void setOpacity ( float opacity ) #
Sets the opacity for the engine window.Arguments
- float opacity - The opacity for the engine window.
float getOpacity ( ) const#
Returns the current opacity for the engine window.Return value
The opacity for the engine window.void setBordersEnabled ( bool enabled ) #
Enables and disables the borders for the engine window.Arguments
- bool enabled - true to enable the borders for the engine window, otherwise false.
bool isBordersEnabled ( ) const#
Returns the value indicating if the borders are enabled for the engine window.Return value
true if the borders are enabled for the engine window, otherwise false.void setBorderSize ( int size ) #
Sets the engine window border size.Arguments
- int size - The engine window border size.
int getBorderSize ( ) const#
Returns the engine window border size.Return value
The engine window border size.void setConsoleUsage ( bool usage ) #
Enables and disables usage of the console for the engine window in focus.Arguments
- bool usage - true to enable usage of the console for the engine window in focus, otherwise false.
bool isConsoleUsage ( ) const#
Returns the value indicating if usage of the console is enabled for the engine window.Return value
true if usage of the console is enabled for the engine window, otherwise false.void setProfilerUsage ( bool usage ) #
Enables and disables usage of the profiler for the engine window.Arguments
- bool usage - true to enable usage of the profiler for the engine window, otherwise false.
bool isProfilerUsage ( ) const#
Returns the value indicating if usage of the profiler is enabled for the engine window.Return value
true if usage of the profiler is enabled for the engine window, otherwise false.void setVisualizerUsage ( bool usage ) #
Enables and disables usage of the visualizer for the engine window.Arguments
- bool usage - true to enable usage of the visualizer for the engine window, otherwise false.
bool isVisualizerUsage ( ) const#
Returns the value indicating if usage of the visualizer is enabled for the engine window.Return value
true if usage of the visualizer is enabled for the engine window, otherwise false.void setResizable ( bool resizable ) #
Enables and disables the possibility to resize the engine window by the mouse.Arguments
- bool resizable - true to make the engine window resizable by the mouse, otherwise false.
bool isResizable ( ) const#
Returns the value indicating if the engine window is resizable by the mouse.Return value
true if the engine window is resizable by the mouse, otherwise false.void setResizeBorderSize ( int size ) #
Sets the size of the border that is manipulated to resize the window.Arguments
- int size - The size of the border that is manipulated to resize the window, in pixels.
int getResizeBorderSize ( ) const#
Returns the size of the border that is manipulated to resize the window.Return value
The size of the border that is manipulated to resize the window, in pixels.void setDraggableHeight ( int height ) #
Sets the height from the top of the window that is manipulated to drag the window by the mouse.Arguments
- int height - The height from the top of the window that is manipulated to drag the window, in pixels.
int getDraggableHeight ( ) const#
Sets the height from the top of the window that is manipulated to drag the window by the mouse.Return value
The height from the top of the window that is manipulated to drag the window, in pixels.bool isFullscreen ( ) const#
Returns the value indicating if the window is in a fullscreen state.Return value
true if the engine window is the fullscreen state, false if it's in the window mode.void show ( ) #
Enables rendering of the engine window.bool isShown ( ) const#
Returns a value indicating if a widget is rendered.Return value
true if the engine window is rendered, otherwise false.void hide ( ) #
Disables rendering of the engine window.bool isHidden ( ) const#
Returns a value indicating if a widget is hidden.Return value
true if the engine window isn't rendered, otherwise false.void setFocus ( ) #
Sets the focus to the engine window.bool isFocused ( ) const#
Returns the value if the engine window is currently in focus.Return value
true if the engine window is in focus, otherwise false.void minimize ( ) #
Minimizes the engine window to an iconic representation.bool isMinimized ( ) const#
Returns the value indicating if the engine window is minimized to tray.Return value
true if the engine window is minimized, otherwise false.void maximize ( ) #
Makes the engine window as large as possible.bool isMaximized ( ) const#
Returns the value indicating if the engine window is maximized.Return value
true if the engine window is maximized, otherwise false.void restore ( ) #
Restores the size and position of the minimized or maximized engine window.void setMouseGrab ( bool value ) #
Sets a value indicating if the mouse pointer is bound to the engine window.Arguments
- bool value - true if the pointer cannot leave the engine window, otherwise false.
EngineWindow::HITTEST getHitTestResult ( ) const#
Returns a value indicating in which area of the engine window the mouse is located.Return value
Value indicating the window area, one of the HITTEST_* values.int getOrder ( ) const#
Returns the order of the window. This value allows comparing which window is closer to the viewer (a relatively smaller value).Return value
The order of the window.void toTop ( ) #
Makes the window appear on top of all other windows.void addChild ( const Ptr<Widget> & widget, int flags = -1 ) #
Adds the specified widget as a child to the client area of the engine window.Arguments
- const Ptr<Widget> & widget - Child widget to be added.
- int flags - Widget flags: one of the ALIGN_* pre-defined variables. This is an optional parameter.
void removeChild ( const Ptr<Widget> & widget ) #
Removes the specified widget from the engine window.Arguments
Ptr<Widget> getChild ( int index ) const#
Returns the child widget by its index.Arguments
- int index - Widget index.
Return value
Child widget.int getNumChildren ( ) const#
Returns the total number of children widgets of the engine window.Return value
The total number of children widgets.void setGroupUsage ( bool usage ) #
Sets the value indicating if the engine window can become a group.Arguments
- bool usage - true to enable usage of the engine window as a group, otherwise false.
bool isGroupUsage ( ) const#
Returns the value indicating if the engine window can become a group.Return value
true if usage of the engine window as a group is enabled, otherwise false.void setNestedUsage ( bool usage ) #
Sets the value indicating if the engine window can be used as a nested window.Arguments
- bool usage - true to enable usage of the engine window as a nested window, otherwise false.
bool isNestedUsage ( ) const#
Returns the value indicating if the engine window can be used as a nested window.Return value
true if usage of the engine window as a nested window is enabled, otherwise false.int getNumNestedWindows ( ) const#
Returns the total number of nested windows in the group.Return value
The total number of nested windows in the group.Ptr<EngineWindow> getNestedWindow ( int index ) const#
Returns the nested engine window by its index.Arguments
- int index - Index of the nested window.
Return value
Nested engine window.int getNestedWindowIndex ( const Ptr<EngineWindow> & window ) #
Returns the index of the specified nested engine window.Arguments
- const Ptr<EngineWindow> & window - Nested engine window.
Return value
Index of the nested window.bool containsNestedWindow ( const Ptr<EngineWindow> & window ) const#
Returns the value indicating if the specified window is a direct child of the current window.Arguments
- const Ptr<EngineWindow> & window - Window to be checked.
Return value
true if the specified window is a direct child of the current one, otherwise false.bool containsNestedWindowGlobal ( const Ptr<EngineWindow> & window ) const#
Returns the value indicating if the specified window is a child of the current window or any of its children.Arguments
- const Ptr<EngineWindow> & window - Window to be checked.
Return value
true if the specified window is a child of the current one, otherwise false.Ptr<EngineWindow> getParentGroup ( ) const#
Returns the group into which the current window is nested, or nullptr if it's a separate window.Return value
The group into which the current window is nested, or nullptr if it's a separate window.Ptr<EngineWindow> getGlobalParentGroup ( ) const#
Returns the top group of the hierarchy into which the current window is nested, or nullptr if it's a separate window.Return value
The top group of the hierarchy into which the current window is nested, or nullptr if it's a separate window.bool isGlobalChildOf ( const Ptr<EngineWindow> & window ) #
Returns the value specifying if the current window is a part of a hierarchy of the specified window.Arguments
- const Ptr<EngineWindow> & window - Window to be checked.
Return value
true if the current window is globally a child of the specified one, otherwise false.int getCurrentTab ( ) const#
Returns the index of the currently active tab in a tab group.Return value
The index of the currently active tab.int getTabWidth ( int index ) const#
Returns the width of the tab.Arguments
- int index - The index of the tab.
Return value
The width of the the tab.int getTabHeight ( int index ) const#
Returns the height of the tab.Arguments
- int index - The index of the tab.
Return value
The height of the tab.int getTabBarWidth ( int index ) const#
Returns the width of the tab bar.Arguments
- int index - The index of the tab.
Return value
The width of the tab bar.int getTabBarHeight ( int index ) const#
Returns the height of the tab bar.Arguments
- int index - The index of the tab.
Return value
The height of the tab bar.Math::ivec2 getTabLocalPosition ( int index ) const#
Returns the screen position of the tab relatively to the parent group (global window). The coordinates represent the displacement from the top left corner of the parent group (global window).Arguments
- int index - The index of the tab.
Return value
The screen position of the tab relatively to the parent group (global window).Math::ivec2 getTabBarLocalPosition ( int index ) const#
Returns the screen position of the tab bar relatively to the parent group (global window). The coordinates represent the displacement from the top left corner of the parent group (global window).Arguments
- int index - The index of the tab.
Return value
The screen position of the tab bar relatively to the parent group (global window).void setHorizontalTabWidth ( int index, int width ) #
Sets the width of the tab in the group of tabs arranged horizontally.Arguments
- int index - The index of the tab.
- int width - The width of the tab in the group of tabs arranged horizontally.
void setVerticalTabHeight ( int index, int height ) #
Sets the height of the tab in the group of tabs arranged vertically.Arguments
- int index - The index of the tab.
- int height - The height of the tab in the group of tabs arranged vertically.
void setSeparatorPosition ( int index, int pos ) #
Sets the position of the line separating a tab group from the rest of the area. The separator line can be horizontal or vertical depending on the group type.Arguments
- int index - Index of the tab.
- int pos - Position of the separation line, in pixels, from the top-left corner of the window.
int getSeparatorPosition ( int index ) const#
Returns the position of the line separating a tab group from the rest of the area. The separator line can be horizontal or vertical depending on the group type.Arguments
- int index - Index of the tab.
Return value
Position of the separation line, in pixels, from the top-left corner of the window.void setSeparatorValue ( int index, float value ) #
Sets the size of the tab separator.Arguments
- int index - Index of the tab.
- float value - Size of the tab separator.
float getSeparatorValue ( int index ) const#
Returns the size of the tab separator.Arguments
- int index - Index of the tab.
Return value
Size of the tab separator.void swapTabs ( int first, int second ) #
Swaps the specified tabs.Arguments
- int first - Index of the first tab.
- int second - Index of the second tab.
bool isHover ( const Math::ivec2 & global_mouse_pos ) const#
Returns the value indicating if the mouse is hovering over the window.Arguments
- const Math::ivec2 & global_mouse_pos - Global screen coordinates of the mouse relative to the main display.
Return value
true if the mouse hovers over the current window, otherwise false.bool isClientHover ( const Math::ivec2 & global_mouse_pos ) const#
Returns the value indicating if the mouse is hovering over the client area of the window.Arguments
- const Math::ivec2 & global_mouse_pos - Global screen coordinates of the mouse relative to the main display.
Return value
true if the mouse hovers over the client area of the window, otherwise false.int getHoverTabBar ( const Math::ivec2 & global_mouse_pos, Math::ivec2 & out_bar_pos, Math::ivec2 & out_bar_size ) const#
Returns the index of the tab over the bar of which the mouse hovers.Arguments
- const Math::ivec2 & global_mouse_pos - Global screen coordinates of the mouse relative to the main display.
- Math::ivec2 & out_bar_pos - Position of the tab bar.
- Math::ivec2 & out_bar_size - Size of the tab bar.
Return value
Index of the tab.int getHoverTabBarArea ( const Math::ivec2 & global_mouse_pos, Math::ivec2 & out_area_pos, Math::ivec2 & out_area_size ) const#
Returns the index of the tab over the bar area of which the mouse hovers.Arguments
- const Math::ivec2 & global_mouse_pos - Global screen coordinates of the mouse relative to the main display.
- Math::ivec2 & out_area_pos
- Math::ivec2 & out_area_size
Return value
Index of the tab.int getNumDroppedItems ( ) const#
Returns the total number of files and/or folders dropped to the window.Return value
The number of dropped files and/or folders.const char * getDroppedItem ( int index ) #
Returns the absolute path to the file or folder dropped to the window.Arguments
- int index - Index of the dropped file or folder.
Return value
Absolute path to the dropped file or folder.unsigned long long getID ( ) const#
Returns the ID of the engine window, if the window is external, i.e. not nested in any window and can be moved independently on the desktop.Return value
ID of the engine window, if the window is external.const char * getVideoModeName ( ) const#
Returns the window size and name of the current video mode.Return value
The window size and name of the current video mode: fullscreen or windowed.void screenshot ( const char * path ) #
Creates a screenshot after the rendering stage is completed.Arguments
- const char * path - Path to save the screenshot.
void setHoldEngine ( bool engine ) #
Sets the value indicating if the engine can stop operating (quit automatically) while this window is open.Arguments
- bool engine - true if the engine can't stop operating while this window is open, otherwise false.
bool isHoldEngine ( ) const#
Sets the value indicating if the engine can stop operating (quit automatically) while this window is open.Return value
true if the engine can't stop operating while this window is open, otherwise false.void setIgnoreSystemClose ( bool close ) #
Sets the value indicating if this window can be closed using the OS methods (ALT+F4 or cross in the top-right corner of the window).Arguments
- bool close - If true, the window can't be closed using the OS methods.
bool isIgnoreSystemClose ( ) const#
Returns the value indicating if this window can be closed using the OS methods (ALT+F4 or cross in the top-right corner of the window).Return value
If true, the window can't be closed using the OS methods.void disableFullscreen ( ) #
Disables the fullscreen mode for the window in the fullscreen mode and sets the focus to this window.bool enableFullscreen ( int display = -1, int mode = -1 ) #
Enables the specified fullscreen mode for the specified display.Arguments
- int display - Display index.
- int mode - Index of the mode supported by the display.
Return value
true if the specified fullscreen mode has been enabled for the specified display; otherwise, false.void setModal ( const Ptr<EngineWindow> & parent_window ) #
Sets this window modal to the specified parent window.Arguments
- const Ptr<EngineWindow> & parent_window - Parent window.
bool isModal ( ) const#
Checks if the window is modal.Return value
true if the window is modal; otherwise, false.bool isModalParent ( ) const#
Checks if this window is parent for any modal window.Return value
true if the window is parent for any modal window; otherwise, false.Ptr<EngineWindow> getModalParent ( ) const#
Returns the modal parent of the window.Return value
The modal parent of the window.void addModalWindow ( const Ptr<EngineWindow> & window ) #
Adds the argument window as modal to the current window.Arguments
- const Ptr<EngineWindow> & window - Window to be added as modal.
void removeModalWindow ( const Ptr<EngineWindow> & window ) #
Removes the argument modal window from this window.Arguments
- const Ptr<EngineWindow> & window - Engine window.
int getNumModalWindows ( ) const#
Returns the total number of modal windows for this window.Return value
The total number of modal windows.Ptr<EngineWindow> getModalWindow ( int index ) const#
Returns the modal window for this window by its index.Arguments
- int index - Index of the modal window.
Return value
Modal window.bool isChild ( const Ptr<Widget> & widget ) const#
Checks if the argument widget is the child of the current window.Arguments
Return value
true if the widget is the child of the current window; otherwise, false.void unstack ( ) #
Removes the current window from a parent group. If there is only one window left, the group is automatically deleted after removing the window from it.Last update:
2022-10-19
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)