This page has been translated automatically.
Programming
Fundamentials
Setting Up Development Environment
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Bounds-Related Classes
Containers
Controls-Related Classes
Core Library
Engine-Related Classes
GUI-Related Classes
Node-Related Classes
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Rendering-Related Classes
Utility Classes
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::Widgets

Unigine::Widgets are user classes that allow to code user interface only once and use them for both internal GUI (in-app) and external one (rendered in separate windows):

  • If the Unigine-based application is run without the Interface plugin, widgets will be created inside the window, in the same way as default GUI is usually rendered.
  • If the Interface plugin is loaded on the application start-up (via extern_plugin console command), widgets will be automatically created in separate windows in addition to the main application window.

Available Widgets

Unigine::Widgets act identical to UnigineScript widgets and support completely the same interface:

Also, there are three additional widgets available:

  • Unigine::Widgets::DockBox — a widget that can be dragged and docked inside a window.
  • Unigine::Widgets::Graph — a widget to create flow graphs. Unigine::Schemer editor is implemented based on this class.
  • Unigine::Widgets::MdiBox — a widget to create multiple windows inside other windows

How to Use Unigine::Widgets Widgets

  1. Include the necessary headers for widgets you are going to create in your script:
    Source code(UnigineScript)
    #include <core/systems/widgets/widget.h>
    #include <core/systems/widgets/widget_window.h>
  2. Create a widget:
    Source code(UnigineScript)
    int init() {
    	
    	// You can declare the namespace for convenience
    	using Unigine::Widgets;
    	
    	// Create Unigine::Widgets::Window
    	Window window = new Window("Unigine::Widgets::Window");
    	
    	// Add the widget to the rendered GUI
    	addChild(window,ALIGN_OVERLAP | ALIGN_CENTER);
    	
    	return 1;
    }
    When the application is run, either internal WidgetWindow or external InterfaceWidgetWindow will be automatically created depending on whether the Interface plugin is used or not.
Last update: 2017-07-03
Build: ()