This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
Professional (SIM)
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Lighting
Sandworm
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Built-in Node Types
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Materials and Shaders
Rebuilding the Engine Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
Content Creation
Content Optimization
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Unigine.WindowManager Class

The class to manage windows enabling you to access any window of the appllication, group or stack windows, create various dialogs and so on.

Accessing Windows#

An application window can be accessed via the WindowManager.GetWindow() function. There are also some properties (like WindowManager.MainWindow) that allow accessing the specific windows (a focused window, a fullscreen window and so on).

Source code (C#)
// get the main window
EngineWindow main_window = WindowManager.MainWindow;
// change its position and size
if (main_window)
{
	main_window.Position = new ivec2(1020, 60);
	main_window.Size = new ivec2(305, 670);
}

Grouping Windows#

The engine windows created via the EngineWindow class can be grouped. There are three types of the window groups:

  • Vertical
  • Horizontal
  • Group of tabs
The number of windows in the group is unlimited.

The WindowManager class provides two main functions for grouping windows:

Source code (C#)
// create separate windows
EngineWindow horizontal_1 = new EngineWindow("Horizontal 1", 512, 256);
EngineWindow horizontal_2 = new EngineWindow("Horizontal 2", 512, 256);
EngineWindow horizontal_3 = new EngineWindow("Horizontal 3", 512, 256);
EngineWindow horizontal_4 = new EngineWindow("Horizontal 4", 512, 256);

// create 2 horizontal window groups 
EngineWindow horizontal_group_1 = WindowManager.Stack(horizontal_1, horizontal_2, 1, EngineWindow.GROUP_TYPE.HORIZONTAL);
EngineWindow horizontal_group_2 = WindowManager.Stack(horizontal_3, horizontal_4, 1, EngineWindow.GROUP_TYPE.HORIZONTAL);
// create a vertical group of 2 horizontal groups
EngineWindow vertical_group = WindowManager.StackGroups(horizontal_group_1, horizontal_group_2, EngineWindow.GROUP_TYPE.VERTICAL);
// specify position, size, title of the verical window group
vertical_group.Position = new ivec2(50, 60);
vertical_group.Size = new ivec2(565, 310);
vertical_group.Title = "Horizontal Group";
// render the window group
vertical_group.Show();
Each window or window group has a state, so it changes after stacking.

There are also functions based on the WindowManager.Stack() function that should be used in specific cases to avoid additional checking of arguments:

  • WindowManager.StackToParentGroup() stacks the second window to the parent group of the first window. In the result, both windows passed as arguments will be on the same level in the group hierarchy.
  • WindowManager.StackWindows() creates a group of the separate/nested windows. The windows are stacked in the default order.
  • WindowManager.StackToWindow() stacks the window to the other window. If the first argument is the separate window, a new window group is returned. If the first argument is the nested window, the window is added to its group.
  • WindowManager.StackToGroup() stacks the window or window group to another window group.
Follow the links to see the code examples.

For ungrouping, the WindowManager.Unstack() function is used: it removes the window or the window group from the parent group.

Creating Dialog Windows#

To create a dialog window, use the corresponding functions of the class. For example:

Source code (C#)
using Unigine;

namespace UnigineApp
{
	class AppSystemLogic : SystemLogic
	{
		
		// create a window with widgets in the client area
		public EngineWindow create_window (string name)
		{
			EngineWindow window = new EngineWindow(name, 512, 256);

			window.AddChild(new WidgetLabel(window.SelfGui, String.Format("This is {0} window.", name)), Gui.ALIGN_TOP);
			window.AddChild(new WidgetButton(window.SelfGui, name), Gui.ALIGN_CENTER);

			return window;
		}

		public override bool Init()
		{
			// create a window
			EngineWindow window = create_window("Window");
			// get the child widget of the window
			Widget button = window.GetChild(1);
			// add a callback that shows the message dialog
			button.AddCallback(Gui.CALLBACK_INDEX.CLICKED, () => WindowManager.DialogMessage("Message", "Button has been clicked"));
			// show the window
			window.Position = new ivec2(50, 60);
			window.Show();
		
			// get the main window
			EngineWindow main_window = WindowManager.MainWindow;
			// change its position and size
			if (main_window)
			{
				main_window.Position = new ivec2(1020, 60);
				main_window.Size = new ivec2(305, 670);
			}
			
			return true;
		}
	}
}

WindowManager Class

Enums

CALLBACKS#

NameDescription
WINDOW_CREATED = 0Callback after the window has been created.
WINDOW_REMOVED = 1Callback after the window has been removed.
WINDOWS_STACKED = 2Callback after the window has been stacked.
WINDOW_UNSTACKED = 3Callback after the window has been unstacked.
NUM = 4Callback counter.

Properties

EngineWindow MainWindow#

The engine window.

int NumWindows#

The number of windows.

EngineWindow GuiFocusedWindow#

The window the GUI of which is in focus, or null if no window is found.

EngineWindow FullscreenWindow#

The window in the fullscreen state, or null if no window is found.

bool IsFullscreenMode#

The value indicating if the window is the fullscreen state.

bool IsMultipleWindowsSupported#

The value indicating if multiple windows are supported.

EngineWindow FocusedWindow#

The window which is currently in focus.

EngineWindow UnderCursorWindow#

The window which is currently under cursor.

Members


EngineWindow GetWindow ( int index ) #

Returns the window by its index.

Arguments

  • int index - Index of the window.

Return value

Engine window.

int GetWindowIndex ( EngineWindow window ) #

Returns the index of the specified window.

Arguments

Return value

Index of the window.

EngineWindow Stack ( EngineWindow first, EngineWindow second, int index = -1, EngineWindow.GROUP_TYPE group_type = Enum.EngineWindow.GROUP_TYPE.TAB, bool decompose_second = false ) #

Returns the group of windows. If the first argument is a window, a new group is always created. If the first argument is a group, the second element is added to this group. The order of stacking can be changed by passing the index argument. To combine two groups into a new one, use the StackGroups() method.
Source code (C#)
EngineWindow window_1 = new EngineWindow("Window 1", 512, 256);
EngineWindow window_2 = new EngineWindow("Window 2", 512, 256);

// create a horizontal group of windows
EngineWindow group_1 = WindowManager.Stack(window_1, window_2, 1, EngineWindow.GROUP_TYPE.HORIZONTAL);

Arguments

  • EngineWindow first - The first window or group for merging.
  • EngineWindow second - The second window for merging.
  • int index - A place where a window or a group should be placed in a group.
  • EngineWindow.GROUP_TYPE group_type - Type of a group to be created, if the first argument is a window and not a group.
  • bool decompose_second - Flag to decompose the second argument of the merge, if it is a group, and combine with the first window or a group.

Return value

Group of windows.

EngineWindow StackToParentGroup ( EngineWindow destination, EngineWindow window, int index = -1, bool decompose_second = false ) #

Stacks the second window to the parent window group of the first window. In the result, both windows passed as arguments will be on the same level in the group hierarchy. If the first window has no parent group, the function will return it as is.
Source code (C#)
EngineWindow window_1 = new EngineWindow("Window 1", 512, 256);
EngineWindow window_2 = new EngineWindow("Window 2", 512, 256);
EngineWindow window_3 = new EngineWindow("Window 3", 512, 256);

// stack 2 separate windows
EngineWindow group_0 = WindowManager.StackWindows(window_1, window_2, EngineWindow.GROUP_TYPE.HORIZONTAL);
// stack a separate window to the parent group of "window_1"
WindowManager.StackToParentGroup(window_1,window_3);

Arguments

  • EngineWindow destination - The window into the parent group of which the other window is stacked.
  • EngineWindow window - The window to be stacked.
  • int index - A place where a window or a group should be placed in a group.
  • bool decompose_second - Flag to decompose the second argument of the merge, if it is a group, and combine with the first window or a group.

Return value

Group of windows.

EngineWindow StackWindows ( EngineWindow first, EngineWindow second, EngineWindow.GROUP_TYPE group_type = Enum.EngineWindow.GROUP_TYPE.TAB ) #

Returns a newly created group of the separate and/or nested windows. You cannot stack the window group to the separate window, however, you can stack a window nested in the window group: in this case, the window will be unstacked from its parent group and added to the new one. The windows are stacked in the default order. For example:
Source code (C#)
EngineWindow window_1 = new EngineWindow("Window 1", 512, 256);
EngineWindow window_2 = new EngineWindow("Window 2", 512, 256);
EngineWindow window_3 = new EngineWindow("Window 3", 512, 256);

// stack 2 separate windows
EngineWindow group_0 = WindowManager.StackWindows(window_1, window_2, EngineWindow.GROUP_TYPE.HORIZONTAL);

// stack a window from the window group to a separate window
EngineWindow group_1 = WindowManager.StackWindows(window_3, window_1, EngineWindow.GROUP_TYPE.VERTICAL);
In the result, group_1 will be a vertical group of window_3 and window_1.

Arguments

Return value

Group of windows.

EngineWindow StackGroups ( EngineWindow first, EngineWindow second, EngineWindow.GROUP_TYPE group_type = Enum.EngineWindow.GROUP_TYPE.TAB, bool decompose_second = false ) #

Returns the group of window groups. The second group is added to the first group. To combine two windows or a group and a window, use the Stack() method.
Source code (C#)
EngineWindow window_1 = new EngineWindow("Window 1", 512, 256);
EngineWindow window_2 = new EngineWindow("Window 2", 512, 256);
EngineWindow window_3 = new EngineWindow("Window 3", 512, 256);
EngineWindow window_4 = new EngineWindow("Window 4", 512, 256);

// create 2 horizontal groups of windows
EngineWindow group_1 = WindowManager.Stack(window_1, window_2, 1, EngineWindow.GROUP_TYPE.HORIZONTAL);
EngineWindow group_2 = WindowManager.Stack(window_3, window_4, 1, EngineWindow.GROUP_TYPE.HORIZONTAL);
// stack one group to another to create a new vertical group
EngineWindow group_3 = WindowManager.StackGroups(group_1, group_2, EngineWindow.GROUP_TYPE.VERTICAL);

Arguments

  • EngineWindow first - The first window group for merging.
  • EngineWindow second - The second window group for merging.
  • EngineWindow.GROUP_TYPE group_type - Type of a group to be created.
  • bool decompose_second - Flag to decompose the second argument of the merge, if it is a group, and combine with the first group.

Return value

Group of windows.

EngineWindow StackToWindow ( EngineWindow destination_window, EngineWindow window, EngineWindow.GROUP_TYPE group_type = Enum.EngineWindow.GROUP_TYPE.TAB, bool decompose_second = false ) #

Stacks the window to the other window. If the first argument is the separate window, a new window group is returned. If the first argument is the nested window, the window is added to its group.
Source code (C#)
EngineWindow window_1 = new EngineWindow("Window 1", 512, 256);
EngineWindow window_2 = new EngineWindow("Window 2", 512, 256);
EngineWindow window_3 = new EngineWindow("Window 3", 512, 256);

// create a group of 2 windows
EngineWindow group_1 = WindowManager.Stack(window_1, window_2, 1, EngineWindow.GROUP_TYPE.HORIZONTAL);
// stack a separate window to the window from the window group
WindowManager.StackToWindow(window_1, window_3, EngineWindow.GROUP_TYPE.VERTICAL);
In the result, group_1 will consist of 3 windows: window_1 and window_3 stacked vertically and window_2 stacked horizontally.

Arguments

  • EngineWindow destination_window - The parent window to which another window is stacked.
  • EngineWindow window - The window to be stacked.
  • EngineWindow.GROUP_TYPE group_type - Type of a group to be created.
  • bool decompose_second - Flag to decompose the second argument of the merge, if it is a group, and combine with the first group.

Return value

Group of stacked windows.

EngineWindow StackToGroup ( EngineWindow destination_group, EngineWindow group, int index = -1, bool decompose_second = false ) #

Stacks the window or window group to another window group. The updated group of windows is returned.
Source code (C#)
EngineWindow window_1 = new EngineWindow("Window 1", 512, 256);
EngineWindow window_2 = new EngineWindow("Window 2", 512, 256);
EngineWindow window_3 = new EngineWindow("Window 3", 512, 256);
EngineWindow window_4 = new EngineWindow("Window 4", 512, 256);

// create 2 horizontal groups of windows
EngineWindow group_1 = WindowManager.Stack(window_1, window_2, 1, EngineWindow.GROUP_TYPE.HORIZONTAL);
EngineWindow group_2 = WindowManager.Stack(window_3, window_4, 1, EngineWindow.GROUP_TYPE.HORIZONTAL);

// stack one group to another
WindowManager.StackToGroup(group_1, group_2);

Arguments

  • EngineWindow destination_group - The parent group to which another group is stacked.
  • EngineWindow group - The window or window group to be stacked.
  • int index - A place where a window or a group should be placed in a group.
  • bool decompose_second - Flag to decompose the second argument of the merge and combine with the first group.

Return value

Group of stacked windows.

void Unstack ( EngineWindow unstacked ) #

Removes a window or a group from a parent group. If there is only one window left, the group is automatically deleted after removing the window from it.

Arguments

  • EngineWindow unstacked - A window or a group to be removed from a parent group.

bool IsMultipleWindowsSupported ( ) #

Returns the value indicating if the engine can create more than one window. In addition to the settings defined by the user, it is currently impossible to create more than one window using Vulkan and DirectX 12. GL and DirectX 11, however, allow creating multiple windows.

Return value

true if multiple windows are supported, otherwise false.

EngineWindow GetWindowByID ( ulong win_id ) #

Returns the window by its ID.

Arguments

  • ulong win_id - Window ID.

Return value

Window with the specified ID, or null if the window is not found.

bool DialogMessage ( string title, string message ) #

Displays a message dialog with the specified title and text.

Arguments

  • string title - Title of the message dialog to be displayed.
  • string message - Message text to be displayed.

Return value

true if the message is displayed successfully; otherwise, false.

bool DialogWarning ( string title, string warning ) #

Displays a warning dialog with the specified title and text.

Arguments

  • string title - Title of the warning dialog to be displayed.
  • string warning - Warning message text to be displayed.

Return value

true if the message is displayed successfully; otherwise, false.

bool DialogError ( string title, string error ) #

Displays an error dialog with the specified title and text.

Arguments

  • string title - Title of the error dialog to be displayed.
  • string error - Error message text to be displayed.

Return value

true if the message is displayed successfully; otherwise, false.

int ShowSystemDialog ( SystemDialog dialog ) #

Displays a custom system dialog with an arbitrary set of buttons.

Arguments

Return value

Number of the dialog button clicked by the user; or -1 if an error has occurred.

string DialogOpenFolder ( string path ) #

Opens a common dialog enabling the user to specify a folder to open. When the dialog opens the specified default path shall be set displaying the corresponding elements.

Arguments

  • string path - Path to be set by default when the dialog opens.

Return value

Resulting folder name specified by the user.

string DialogOpenFolder ( ) #

Opens a common dialog enabling the user to specify a folder to open.

Return value

Resulting folder name specified by the user.

string[] DialogOpenFiles ( string path, string filter ) #

Opens a common dialog enabling the user to specify a list of filenames to open multiple files. When the dialog opens the specified default path and file filter shall be set displaying the corresponding elements.

Arguments

  • string path - Path to be set by default when the dialog opens.
  • string filter - File name filter string to be set by default when the dialog opens. This filter string determines file type choices to be displayed in the Files of type box.

Return value

Resulting list of filenames specified by the user.

string[] DialogOpenFiles ( string path ) #

Opens a common dialog enabling the user to specify a list of filenames to open multiple files. When the dialog opens the specified default path shall be set displaying the corresponding elements.

Arguments

  • string path - Path to be set by default when the dialog opens.

Return value

Resulting list of filenames specified by the user.

string[] DialogOpenFiles ( ) #

Opens a common dialog enabling the user to specify a list of filenames to open multiple files.

Return value

Resulting list of filenames specified by the user.

string DialogOpenFile ( string path, string filter ) #

Opens a common dialog enabling the user to specify a filename to open a file. When the dialog opens the specified default path and file filter shall be set displaying the corresponding elements.

Arguments

  • string path - Path to be set by default when the dialog opens.
  • string filter - File name filter string to be set by default when the dialog opens. This filter string determines file type choices to be displayed in the Files of type box.

Return value

Resulting filename specified by the user.

string DialogOpenFile ( string path ) #

Opens a common dialog enabling the user to specify a filename to open a file. When the dialog opens the specified default path shall be set displaying the corresponding elements.

Arguments

  • string path - Path to be set by default when the dialog opens.

Return value

Resulting filename specified by the user.

string DialogOpenFile ( ) #

Opens a common dialog enabling the user to specify a filename to open a file.

Return value

Resulting filename specified by the user.

string DialogSaveFile ( string path, string filter ) #

Opens a common dialog enabling the user to specify a filename to save a file as. When the dialog opens the specified default path and file filter shall be set displaying the corresponding elements.

Arguments

  • string path - Path to be set by default when the dialog opens.
  • string filter - File name filter string to be set by default when the dialog opens. This filter string determines file type choices to be displayed in the Save as file type or Files of type box.

Return value

Resulting filename specified by the user.

string DialogSaveFile ( string path ) #

Opens a common dialog enabling the user to specify a filename to save a file as. When the dialog opens the specified default path shall be set displaying the corresponding elements.

Arguments

  • string path - Path to be set by default when the dialog opens.

Return value

Resulting filename specified by the user.

string DialogSaveFile ( ) #

Opens a common dialog enabling the user to specify a filename to save a file as.

Return value

Resulting filename specified by the user.

EngineWindow GetUnderCursorWindow ( ) #

Returns the window which is currently under cursor.

Return value

The window which is currently under cursor.

EngineWindow GetFocusedWindow ( ) #

Returns the window which is currently in focus.

Return value

The window which is currently in focus.

EngineWindow GetIntersection ( ivec2 global_pos, EngineWindow[] excludes ) #

Returns the window the intersection with which is detected.

Arguments

  • ivec2 global_pos - The position of the intersection point in global coordinates.
  • EngineWindow[] excludes - The windows to be excluded from the intersection detection.

Return value

The window the intersection with which is detected.

EngineWindow GetIntersection ( ivec2 global_pos ) #

Returns the window the intersection with which is detected.

Arguments

  • ivec2 global_pos - The position of the intersection point in global coordinates.

Return value

The window the intersection with which is detected.

void ForceUpdateWindowOrders ( ) #

Updates the Z order of all windows.
Notice
It is recommended to use this method only when required, because it is very slow.

void SetEventsFilter ( IntPtr func ) #

Sets a callback function to be executed on receiving input events. This input event filter enables you to reject certain input events for the Engine and get necessary information on all input events.

Arguments

  • IntPtr func - Input event callback.
Last update: 2022-12-14
Build: ()