This page has been translated automatically.
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
FAQ
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
CIGI Client Plugin
Rendering-Related 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::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: 2018-08-10
Build: ()