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
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

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: ()