This page has been translated automatically.
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
Extending Editor Functionality
编程
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine Tools
GUI
Double Precision Coordinates
应用程序接口
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
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

Unigine::UserInterface Class

Header: #include <UnigineUserInterface.h>

The class is used to work with widgets that are created by loading a UI file.

See Also#

  • C++ API sample <UnigineSDK>/source/samples/Api/Widgets/UserInterface
  • C# API sample <UnigineSDK>/source/csharp/samples/Api/Widgets/UserInterface

UserInterface Class

Members


static UserInterfacePtr create ( const Ptr<Gui> & gui, const char * name, const char * prefix = 0 ) #

UserInterface constructor.

Arguments

  • const Ptr<Gui> & gui - GUI smart pointer.
  • const char * name - User interface name.
  • const char * prefix - Names prefix.

int getCallback ( int num, int callback ) #

Returns the number of a given callback function.

Arguments

  • int num - Widget number.
  • int callback - Callback type number. One of the callbacks defined in the Gui class (for example, CLICK, SHOW, HIDE, etc).

Return value

Callback number.

void * addCallback ( const char * name, Gui::CALLBACK_INDEX callback, Unigine::CallbackBase * func ) #

Adds a callback function of the specified type for the widget with the specified name.The signature of the callback function must be as follows:
Source code (C++)
void callback_function_name();

Arguments

  • const char * name - Widget name.
  • Gui::CALLBACK_INDEX callback - Callback type number. One of the callbacks defined in the Gui class (for example, CLICK, SHOW, HIDE, etc).
  • Unigine::CallbackBase * func - Callback pointer.

Return value

ID of the last added callback, if the callback was added successfully; otherwise, nullptr. This ID can be used to remove this callback when necessary.

void * addCallback ( const char * name, Gui::CALLBACK_INDEX callback, Unigine::CallbackBase1< Ptr<Widget> > * func ) #

Adds a callback function of the specified type for the widget with the specified name.The signature of the callback function must be as follows:
Source code (C++)
void callback_function_name(WidgetPtr widget);

Arguments

  • const char * name - Widget name.
  • Gui::CALLBACK_INDEX callback - Callback type number. One of the callbacks defined in the Gui class (for example, CLICK, SHOW, HIDE, etc).
  • Unigine::CallbackBase1< Ptr<Widget> > * func - Callback pointer.

Return value

ID of the last added callback, if the callback was added successfully; otherwise, nullptr. This ID can be used to remove this callback when necessary.

void * addCallback ( const char * name, Gui::CALLBACK_INDEX callback, Unigine::CallbackBase2< Ptr<Widget>, Ptr<Widget> > * func ) #

Adds a callback function of the specified type for the widget with the specified name.The signature of the callback function must be as follows:
Source code (C++)
void callback_function_name(WidgetPtr widget1, WidgetPtr widget2);

Arguments

  • const char * name - Widget name.
  • Gui::CALLBACK_INDEX callback - Callback type number. One of the callbacks defined in the Gui class (for example, CLICK, SHOW, HIDE, etc).
  • Unigine::CallbackBase2< Ptr<Widget>, Ptr<Widget> > * func - Callback pointer.

Return value

ID of the last added callback, if the callback was added successfully; otherwise, nullptr. This ID can be used to remove this callback when necessary.

void * addCallback ( const char * name, Gui::CALLBACK_INDEX callback, Unigine::CallbackBase3< Ptr<Widget>, Ptr<Widget>, int > * func ) #

Adds a callback function of the specified type for the widget with the specified name.The signature of the callback function must be as follows:
Source code (C++)
void callback_function_name(WidgetPtr widget1, WidgetPtr widget2, int arg3);

Arguments

  • const char * name - Widget name.
  • Gui::CALLBACK_INDEX callback - Callback type number. One of the callbacks defined in the Gui class (for example, CLICK, SHOW, HIDE, etc).
  • Unigine::CallbackBase3< Ptr<Widget>, Ptr<Widget>, int > * func - Callback pointer.

Return value

ID of the last added callback, if the callback was added successfully; otherwise, nullptr. This ID can be used to remove this callback when necessary.

bool removeCallback ( const char * name, Gui::CALLBACK_INDEX callback, void * id ) #

Removes the specified callback from the list of callbacks of the specified type added for the widget with the given name.

Arguments

  • const char * name - Widget name.
  • Gui::CALLBACK_INDEX callback - Callback type number. One of the callbacks defined in the Gui class (for example, CLICK, SHOW, HIDE, etc).
  • void * id - Callback ID obtained when adding it.

Return value

True if the callback with the given ID was removed successfully; otherwise false.

void clearCallbacks ( const char * name, Gui::CALLBACK_INDEX callback ) #

Clears all callbacks of the specified type added for the widget with the given name.

Arguments

  • const char * name - Widget name.
  • Gui::CALLBACK_INDEX callback - Callback type number. One of the callbacks defined in the Gui class (for example, CLICK, SHOW, HIDE, etc).

const char * getCallbackInstanceData ( int num, Gui::CALLBACK_INDEX callback ) #

Returns the callback instance data.

Arguments

  • int num - Widget number.
  • Gui::CALLBACK_INDEX callback - Callback type number. One of the callbacks defined in the Gui class (for example, CLICK, SHOW, HIDE, etc).

Return value

Callback instance data.

const char * getCallbackName ( int num, Gui::CALLBACK_INDEX callback ) #

Returns the name of a given callback function.

Arguments

  • int num - Widget number.
  • Gui::CALLBACK_INDEX callback - Callback type number. One of the callbacks defined in the Gui class (for example, CLICK, SHOW, HIDE, etc).

Return value

Callback function name.

const char * getCallbackStringData ( int num, Gui::CALLBACK_INDEX callback ) #

Returns the callback string data.

Arguments

  • int num - Widget number.
  • Gui::CALLBACK_INDEX callback - Callback type number. One of the callbacks defined in the Gui class (for example, CLICK, SHOW, HIDE, etc).

Return value

Callback string data.

const char * getCallbackVariableData ( int num, Gui::CALLBACK_INDEX callback ) #

Returns the callback variable data.

Arguments

  • int num - Widget number.
  • Gui::CALLBACK_INDEX callback - Callback type number. One of the callbacks defined in the Gui class (for example, CLICK, SHOW, HIDE, etc).

Return value

Callback variable data.

Ptr<Widget> getCallbackWidgetData ( int num, Gui::CALLBACK_INDEX callback ) #

Returns the callback widget data.

Arguments

  • int num - Widget number.
  • Gui::CALLBACK_INDEX callback - Callback type number. One of the callbacks defined in the Gui class (for example, CLICK, SHOW, HIDE, etc).

Return value

Widget data.

int getNumCallbacks ( int num ) #

Returns the total number of callbacks for a given widget.

Arguments

  • int num - Widget number.

Return value

Number of callbacks.

int getNumWidgets ( ) #

Returns the number of associated widgets.

Return value

Number of associated widgets.

Ptr<Widget> getWidget ( int num ) #

Returns pointer to the widget with a given number.

Arguments

  • int num - Widget number.

Return value

Pointer to the widget with the given number.

int getWidgetExport ( int num ) #

Returns a value indicating if a given widget is exported into a script.

Arguments

  • int num - Widget number.

Return value

Returns 1 if the widget is exported; otherwise, 0.

const char * getWidgetName ( int num ) #

Returns widget name by its number.

Arguments

  • int num - Widget number.

Return value

Widget name.

const char * getWidgetNext ( int num ) #

Returns the name of the widget, which will be focused next.

Arguments

  • int num - Current widget number.

Return value

Next Widget name.

int findWidget ( const char * name ) #

Searches a widget by its name.

Arguments

  • const char * name - Widget name.

Return value

Returns the number of the widget if exists; otherwise, -1.

void updateWidgets ( ) #

Updates all widgets belonging to the user interface. This function should be called, for example, after change of the interface language.
Last update: 2020-06-01
Build: ()