Unigine.UserInterface Class
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
Properties
int NumWidgets#
The number of associated widgets.
Members
static UserInterface ( Gui gui, string name, string prefix = 0 ) #
UserInterface constructor.Arguments
- Gui gui - GUI smart pointer.
- string name - User interface name.
- string prefix - Names prefix.
int GetCallback ( int num, int callback ) #
Returns the number of a given callback function.Arguments
- int num - Widget number.
- int callback
Return value
Callback number.IntPtr addCallback ( string name, Gui.CALLBACK_INDEX callback, Callback0Delegate 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:void callback_function_name();
Arguments
- string name - Widget name.
- Gui.CALLBACK_INDEX callback
- Callback0Delegate func - Callback function with the following signature: void Callback0Delegate()
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.IntPtr addCallback ( string name, Gui.CALLBACK_INDEX callback, Callback1Delegate 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:void callback_function_name(Widget widget);
Arguments
- string name - Widget name.
- Gui.CALLBACK_INDEX callback
- Callback1Delegate func - Callback function with the following signature: void Callback1Delegate(Widget widget)
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.IntPtr addCallback ( string name, Gui.CALLBACK_INDEX callback, Call2backDelegate 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:void callback_function_name(Widget widget1, Widget widget2);
Arguments
- string name - Widget name.
- Gui.CALLBACK_INDEX callback
- Call2backDelegate func - Callback function with the following signature: void Callback2Delegate(Widget widget1, Widget widget2)
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.IntPtr addCallback ( string name, Gui.CALLBACK_INDEX callback, Callback3Delegate 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:void callback_function_name(Widget widget1, Widget widget2, int arg3);
Arguments
- string name - Widget name.
- Gui.CALLBACK_INDEX callback
- Callback3Delegate func - Callback function with the following signature: void Callback3Delegate(Widget widget1, Widget widget2, int arg3)
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 ( string name, Gui.CALLBACK_INDEX callback, IntPtr id ) #
Removes the specified callback from the list of callbacks of the specified type added for the widget with the given name.Arguments
- string name - Widget name.
- Gui.CALLBACK_INDEX callback
- IntPtr id - Callback ID obtained when adding it.
Return value
True if the callback with the given ID was removed successfully; otherwise false.void clearCallbacks ( string name, Gui.CALLBACK_INDEX callback ) #
Clears all callbacks of the specified type added for the widget with the given name.Arguments
- string name - Widget name.
- Gui.CALLBACK_INDEX callback
string GetCallbackInstanceData ( int num, Gui.CALLBACK_INDEX callback ) #
Returns the callback instance data.Arguments
- int num - Widget number.
- Gui.CALLBACK_INDEX callback
Return value
Callback instance data.string GetCallbackName ( int num, Gui.CALLBACK_INDEX callback ) #
Returns the name of a given callback function.Arguments
- int num - Widget number.
- Gui.CALLBACK_INDEX callback
Return value
Callback function name.string GetCallbackStringData ( int num, Gui.CALLBACK_INDEX callback ) #
Returns the callback string data.Arguments
- int num - Widget number.
- Gui.CALLBACK_INDEX callback
Return value
Callback string data.string GetCallbackVariableData ( int num, Gui.CALLBACK_INDEX callback ) #
Returns the callback variable data.Arguments
- int num - Widget number.
- Gui.CALLBACK_INDEX callback
Return value
Callback variable data.Widget GetCallbackWidgetData ( int num, Gui.CALLBACK_INDEX callback ) #
Returns the callback widget data.Arguments
- int num - Widget number.
- Gui.CALLBACK_INDEX callback
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.Widget GetWidget ( int num ) #
Returns pointer to the widget with a given number.Arguments
- int num - Widget ID.
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 ID.
Return value
Returns 1 if the widget is exported; otherwise, 0.string GetWidgetName ( int num ) #
Returns widget name by its number.Arguments
- int num - Widget ID.
Return value
Widget name.string GetWidgetNext ( int num ) #
Returns the name of the widget, which will be focused next.Arguments
- int num - Widget number.
Return value
Next Widget name.int FindWidget ( string name ) #
Searches a widget by its name.Arguments
- string 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
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)