Unigine.Widget Class
This base class is used to create graphical user interface widgets of different types. The Widget class doesn't provide creating of a widget: you can create the required widget by using a constructor of the corresponding class inherited from the Widget class.
Widgets can be used separately or form a hierarchy.
Working with Widgets#
The example below demonstrates how to create a single widget, a hierarchy of widgets, and add a callback for the widget.
WidgetLifetime.cs
public void on_button_click()
{
Log.Message("world button click\n");
}
private void Init()
{
// create a single widget
WidgetButton button = new WidgetButton("BUTTON");
// add a callback for the button
button.AddCallback(Gui.CALLBACK_INDEX.CLICKED, on_button_click);
// add the button to WindowManager
WindowManager.MainWindow.AddChild(button);
// create a hierarchy of widgets
WidgetHBox hbox = new WidgetHBox();
hbox.Background = 1;
hbox.BackgroundColor = vec4.WHITE;
WindowManager.MainWindow.AddChild(hbox, Gui.ALIGN_EXPAND);
WidgetGroupBox group = new WidgetGroupBox();
group.Background = 1;
group.Text = "Widgets Hierarchy";
hbox.AddChild(group);
group.AddChild(new WidgetLabel("hierarchy_label_0"));
group.AddChild(new WidgetLabel("hierarchy_label_1"));
}
Lifetime of Widgets#
By default each new widget's lifetime matches the lifetime of the Engine (i.e. the widget shall be deleted on Engine shutdown). But you can choose widget's lifetime to be managed:
- By a separate window — in this case the widget is deleted automatically on deleting the window.
- By the world — in this case the widget is deleted when the world is closed.
- Manually — in this case the widget should be deleted manually.
The examples below show how the different lifetime management types work.
Managing Lifetime by the World#
In this example, the widgets appear on loading the world. When you reload or exit the world, or close the Engine window, the widgets are deleted as their lifetime is managed by the world. The corresponding messages will be shown in the console.
WidgetLifetimeWorld.cs
public void on_button_click()
{
Log.Message("world button click\n");
}
public void on_button_remove()
{
Log.Message("world button removed\n");
}
public void on_hbox_remove()
{
Log.Message("world hbox hierarchy removed\n");
}
private void Init()
{
// create a single widget
WidgetButton button = new WidgetButton("WORLD_BUTTON");
// set the world lifetime
button.Lifetime = Widget.LIFETIME.WORLD;
// add a callback for the button
button.AddCallback(Gui.CALLBACK_INDEX.CLICKED, on_button_click);
// the "on_button_remove" callback will be fired on reloading or closing the world, or on Engine shutdown
button.AddCallback(Gui.CALLBACK_INDEX.REMOVE, on_button_remove);
// add the button to WindowManager
WindowManager.MainWindow.AddChild(button);
// create a hierarchy of widgets
WidgetHBox hbox = new WidgetHBox();
// set the world lifetime
hbox.Lifetime = Widget.LIFETIME.WORLD;
// the "on_hbox_remove" callback will be fired on reloading or closing the world, or on Engine shutdown
hbox.AddCallback(Gui.CALLBACK_INDEX.REMOVE, on_hbox_remove);
hbox.Background = 1;
hbox.BackgroundColor = vec4.WHITE;
WindowManager.MainWindow.AddChild(hbox, Gui.ALIGN_EXPAND);
WidgetGroupBox group = new WidgetGroupBox();
group.Background = 1;
group.Text = "Widgets Hierarchy";
hbox.AddChild(group);
group.AddChild(new WidgetLabel("hierarchy_label_0"));
group.AddChild(new WidgetLabel("hierarchy_label_1"));
}
Managing Lifetime by the Window#
In this example, widgets appear in a separate window. When you close the window, the widgets are deleted as their lifetime is managed by this window. The console shows the following information:
- Whether the window, button and hbox hierarchy are deleted or not.
- Whether the remove callbacks are fired or not.
- Messages from the remove callbacks.
After closing, the window can be re-created by pressing T.
WidgetLifetimeWindow.cs
public EngineWindowViewport window;
public WidgetButton button;
public WidgetHBox hbox;
bool button_remove_callback = false;
bool hbox_remove_callback = false;
public void on_window_button_click()
{
Log.Message("window button click\n");
}
public void on_window_button_remove()
{
Log.Message("window button removed\n");
button_remove_callback = true;
}
public void on_window_hbox_remove()
{
Log.Message("window hbox hierarchy removed\n");
hbox_remove_callback = true;
}
public void create_window()
{
button_remove_callback = false;
hbox_remove_callback = false;
window = new EngineWindowViewport("Test", 512, 256, (int)EngineWindow.FLAGS.SHOWN);
// single window widget
button = new WidgetButton("WINDOW_BUTTON");
button.Lifetime = Widget.LIFETIME.WINDOW;
button.AddCallback(Gui.CALLBACK_INDEX.CLICKED, on_window_button_click);
button.AddCallback(Gui.CALLBACK_INDEX.REMOVE, on_window_button_remove);
window.AddChild(button);
// window hierarchy
hbox = new WidgetHBox();
hbox.Lifetime = Widget.LIFETIME.WINDOW;
hbox.AddCallback(Gui.CALLBACK_INDEX.REMOVE, on_window_hbox_remove);
hbox.Background = 1;
hbox.BackgroundColor = vec4.WHITE;
window.AddChild(hbox, Gui.ALIGN_EXPAND);
WidgetGroupBox group = new WidgetGroupBox();
group.Background = 1;
group.Text = "Window Hierarchy";
hbox.AddChild(group);
group.AddChild(new WidgetLabel("hierarchy_window_label_0"));
group.AddChild(new WidgetLabel("hierarchy_window_label_1"));
}
private void Init()
{
create_window();
}
private void Update()
{
if (Input.IsKeyDown(Input.KEY.T) && window.IsDeleted)
create_window();
Log.Message("window deleted: {0}, button deleted: {1}, hbox deleted: {2}, button remove callback: {3}, hbox remove callback: {4}\n",
window.IsDeleted, button.IsDeleted, hbox.IsDeleted, button_remove_callback, hbox_remove_callback);
}
Managing Lifetime by the Engine#
Widgets are created on Engine initialization, and then added to a separate window. The console shows the following information:
- Whether the window, button and hbox hierarchy are deleted or not.
- Whether the remove callbacks are fired or not.
- Messages from the remove callbacks.
If you close the window, it will be deleted and the information in the console will change. All the other widgets are deleted only on Engine shutdown, as their lifetime is managed by the Engine.
If the separate window is closed, press T to re-create it.
WidgetLifetimeEngine.cs
EngineWindowViewport engine_window;
WidgetButton engine_button;
WidgetHBox engine_hbox;
bool engine_button_remove_callback = false;
bool engine_hbox_remove_callback = false;
void on_engine_button_click()
{
Log.Message("engine button click\n");
}
void on_engine_button_remove()
{
Log.Message("engine button removed\n");
engine_button_remove_callback = true;
}
void on_engine_hbox_remove()
{
Log.Message("engine hbox hierarchy removed\n");
engine_hbox_remove_callback = true;
}
void create_engine_window()
{
engine_window = new EngineWindowViewport("Test", 512, 256, (int)EngineWindow.FLAGS.SHOWN);
engine_window.AddChild(engine_button);
engine_window.AddChild(engine_hbox, Gui.ALIGN_EXPAND);
}
private void Init()
{
engine_button_remove_callback = false;
engine_hbox_remove_callback = false;
// single engine widget
engine_button = new WidgetButton("ENGINE_BUTTON");
engine_button.Lifetime = Widget.LIFETIME.ENGINE;
engine_button.AddCallback(Gui.CALLBACK_INDEX.CLICKED, on_engine_button_click);
engine_button.AddCallback(Gui.CALLBACK_INDEX.REMOVE, on_engine_button_remove);
// engine hierarchy
engine_hbox = new WidgetHBox();
engine_hbox.Lifetime = Widget.LIFETIME.ENGINE;
engine_hbox.AddCallback(Gui.CALLBACK_INDEX.REMOVE, on_engine_hbox_remove);
engine_hbox.Background = 1;
engine_hbox.BackgroundColor = vec4.WHITE;
WidgetGroupBox engine_group = new WidgetGroupBox();
engine_group.Background = 1;
engine_group.Text = "Engine Hierarchy";
engine_hbox.AddChild(engine_group);
engine_group.AddChild(new WidgetLabel("hierarchy_engine_label_0"));
engine_group.AddChild(new WidgetLabel("hierarchy_engine_label_1"));
create_engine_window();
}
private void Update()
{
if (Input.IsKeyDown(Input.KEY.T) && engine_window.IsDeleted)
create_engine_window();
Log.Message("engine window deleted: {0}, engine button deleted: {1}, engine hbox deleted: {2}, engine button remove callback: {3}, engine hbox remove callback: {4}\n",
engine_window.IsDeleted, engine_button.IsDeleted, engine_hbox.IsDeleted, engine_button_remove_callback, engine_hbox_remove_callback);
}
See Also#
- Widgets sample set in CPP Samples suite
- Widgets sample in C# Component Samples suite
- A set of UnigineScript API samples located in the <UnigineSDK>/data/samples/widgets/ folder
Widget Class
Enums
TYPE#
Name | Description |
---|---|
WIDGET_VBOX = 0 | Vertical box. See also: WidgetVBox. |
WIDGET_HBOX = 1 | Horizontal box. See also: WidgetHBox. |
WIDGET_GRID_BOX = 2 | Grid box. See also: WidgetGridBox. |
WIDGET_VPANED = 3 | Vertical box that allows resizing of its children. See also: WidgetVPaned. |
WIDGET_HPANED = 4 | Horizontal box that allows resizing of its children. See also: WidgetHPaned. |
WIDGET_LABEL = 5 | Text label. See also: WidgetLabel. |
WIDGET_BUTTON = 6 | Simple button. See also: WidgetButton. |
WIDGET_EDIT_LINE = 7 | Text field. See also: WidgetEditline. |
WIDGET_EDIT_TEXT = 8 | Multiline text field. See also: WidgetEdittext. |
WIDGET_CHECK_BOX = 9 | Checkbox. See also: WidgetCheckbox. |
WIDGET_COMBO_BOX = 10 | Combobox. See also: WidgetCombobox. |
WIDGET_CANVAS = 11 | Canvas widget for drawing text, lines and polygons. See also: WidgetCanvas. |
WIDGET_GROUP_BOX = 12 | Group box. See also: WidgetGroupBox. |
WIDGET_LIST_BOX = 13 | List box. See also: WidgetListBox. |
WIDGET_TREE_BOX = 14 | Tree box. See also: WidgetTreeBox. |
WIDGET_TAB_BOX = 15 | Tabbed box. See also: WidgetTabBox. |
WIDGET_SCROLL = 16 | A scrollbar: horizontal or vertical one. See also: WidgetScroll. |
WIDGET_SCROLL_BOX = 17 | Box with scrolling. See also: WidgetScrollBox. |
WIDGET_SPACER = 18 | Spacer: horizontal or vertical one. See also: WidgetSpacer. |
WIDGET_SLIDER = 19 | A slider: horizontal or vertical one. See also: WidgetSlider. |
WIDGET_SPIN_BOX = 20 | Spinbox. See also: WidgetSpinBox. |
WIDGET_SPIN_BOX_DOUBLE = 21 | Spinbox with double values. See also: WidgetSpinBoxDouble. |
WIDGET_ICON = 22 | Icon. See also: WidgetIcon. |
WIDGET_SPRITE = 23 | Sprite. See also: WidgetSprite. |
WIDGET_SPRITE_VIDEO = 24 | Video Sprite. See also: WidgetSpriteVideo. |
WIDGET_SPRITE_SHADER = 25 | Shader Sprite. See also: WidgetSpriteShader. |
WIDGET_SPRITE_VIEWPORT = 26 | Viewport Sprite. See also: WidgetSpriteViewport. |
WIDGET_SPRITE_NODE = 27 | Node Sprite. See also: WidgetSpriteNode. |
WIDGET_MENU_BAR = 28 | Menu bar. See also: WidgetMenuBar. |
WIDGET_MENU_BOX = 29 | Menu. See also: WidgetMenuBox. |
WIDGET_WINDOW = 30 | Window. See also: WidgetWindow. |
WIDGET_DIALOG = 31 | Dialog window. See also: WidgetDialog. |
WIDGET_DIALOG_MESSAGE = 32 | Message Dialog. See also: WidgetDialogMessage. |
WIDGET_DIALOG_FILE = 33 | File Dialog. See also: WidgetDialogFile. |
WIDGET_DIALOG_COLOR = 34 | Color Dialog. See also: WidgetDialogColor. |
WIDGET_DIALOG_IMAGE = 35 | Image Dialog. See also: WidgetDialogImage. |
WIDGET_MANIPULATOR = 36 | Manipulator widget. See also: WidgetManipulator. |
WIDGET_MANIPULATOR_TRANSLATOR = 37 | Translator Manipulator. See also: WidgetManipulatorTranslator. |
WIDGET_MANIPULATOR_ROTATOR = 38 | Rotator Manipulator. See also: WidgetManipulatorRotator. |
WIDGET_MANIPULATOR_SCALER = 39 | Scaler Manipulator. See also: WidgetManipulatorScaler. |
WIDGET_EXTERN = 40 | External widget. |
WIDGET_ENGINE = 41 | Engine-specific widget (manipulator). See also: WidgetManipulator. |
WIDGET_HIT_TEST_AREA = 42 | Hit-Test Area. See also: WidgetHitTestArea. |
NUM_WIDGETS = 43 | Total number of widget types. |
LIFETIME#
Name | Description |
---|---|
WORLD = 0 | Lifetime of the widget or user interface is managed by the world. The widget/user interface will be deleted automatically on closing the world. |
WINDOW = 1 | Lifetime of the widget or user interface is managed by the window. The widget/user interface will be deleted automatically on deleting the window. |
ENGINE = 2 | Lifetime of the widget or user interface is managed by the Engine. The widget/user interface will be deleted automatically on Engine shutdown.
When using this lifetime management type, the GUI instance can be empty for the widget: it will be assigned automatically when adding the widget to a window. For a user interface, the Gui instance must be set via the setGui() method. |
MANUAL = 3 | Lifetime of the widget or user interface is managed by the user. The widget/user interface should be deleted manually.
When using this lifetime management type, the GUI instance can be empty for the widget: it will be assigned automatically when adding the widget to a window. For a user interface, the Gui instance must be set via the setGui() method. |
Properties
int NumChildren#
int FontWrap#
int FontRich#
int FontOutline#
int FontVOffset#
int FontHOffset#
int FontVSpacing#
int FontHSpacing#
int FontPermanent#
vec4 FontColor#
int FontSize#
int MouseCursor#
int MouseY#
int MouseX#
int Height#
int Width#
int ScreenPositionY#
int ScreenPositionX#
int PositionY#
int PositionX#
Widget NextFocus#
string Data#
int Order#
bool Hidden#
bool Enabled#
bool IntersectionEnabled#
int Flags#
Widget Parent#
Gui ParentGui#
Gui Gui#
string TypeName#
Widget.TYPE Type#
bool IsLayout#
bool IsFixed#
bool IsBackground#
bool IsOverlapped#
bool IsExpanded#
Widget.LIFETIME Lifetime#
float DpiScale#
int RenderHeight#
int RenderWidth#
Members
bool IsCallback ( int callback ) #
Returns a value indicating if there are any callbacks of the specified type set for the widget.Arguments
- int callback - One of the callbacks defined in the Gui class.
Return value
true if at least one callback of the specified type is set for the widget; otherwise, false.IntPtr addCallback ( Gui.CALLBACK_INDEX callback, Callback0Delegate func ) #
Adds a callback function of the specified type for the widget.The signature of the callback function must be as follows:void callback_function_name();
Arguments
- 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 ( Gui.CALLBACK_INDEX callback, Callback1Delegate func ) #
Adds a callback function of the specified type for the widget.The signature of the callback function must be as follows:void callback_function_name(Widget sender);
Arguments
- Gui.CALLBACK_INDEX callback
- Callback1Delegate func - Callback function with the following signature: void Callback1Delegate(Widget sender)
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 ( Gui.CALLBACK_INDEX callback, Callback2Delegate func ) #
Adds a callback function of the specified type for the widget.The signature of the callback function must be as follows:void callback_function_name(Widget sender, Widget pointer);
- sender — the widget that caused the callback function to be called, i.e. the one on which the action took place (e.g. a button, that was clicked).
- pointer — this parameter is used to identify a target widget of a Drag-and-Drop operation. You can find an example in the widgets/sprite_03 UnigineScript sample included in the SDK.
Arguments
- Gui.CALLBACK_INDEX callback
- Callback2Delegate func - Callback function with the following signature: void Callback2Delegate(Widget sender, Widget 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.IntPtr addCallback ( Gui.CALLBACK_INDEX callback, Callback3Delegate func ) #
Adds a callback function of the specified type for the widget.The signature of the callback function must be as follows:void callback_function_name(Widget sender, Widget pointer, int data);
- sender — the widget that caused the callback function to be called, i.e. the one on which the action took place (e.g. a button, that was clicked).
- pointer — this parameter is used to identify a target widget of a Drag-and-Drop operation. You can find an example in the widgets/sprite_03 UnigineScript sample included in the SDK.
- data — this parameter is used for getting mouse or keyboard button state, when a widget is clicked or pressed (callbacks: CLICKED, PRESSED, KEY_PRESSED).
Arguments
- Gui.CALLBACK_INDEX callback
- Callback3Delegate func - Callback function with the following signature: void Callback3Delegate(Widget sender, Widget pointer, int data)
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 ( Gui.CALLBACK_INDEX callback, IntPtr id ) #
Removes the specified callback from the list of callbacks of the specified type added for the widget.Arguments
- 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 ( Gui.CALLBACK_INDEX callback ) #
Clears all callbacks of the specified type added for the widget.Arguments
- Gui.CALLBACK_INDEX callback
void SetCallbackAccel ( Gui.CALLBACK_INDEX callback, uint key, int ctrl, int alt, int shift ) #
Assigns a hot key combination to a given callback function.Arguments
- Gui.CALLBACK_INDEX callback - One of the callbacks defined in the Gui class.
- uint key - ASCII key code: one of the Input.KEY.* values.
- int ctrl - 1 to use the CTRL key modifier, 0 not to use.
- int alt - 1 to use the ALT key modifier, 0 not to use.
- int shift - 1 to use the SHIFT key modifier, 0 not to use.
bool GetCallbackAccel ( Gui.CALLBACK_INDEX callback, out uint key, out int ctrl, out int alt, out int shift ) #
Gets the current hot key combination for a given callback function.Arguments
- Gui.CALLBACK_INDEX callback - Callback number: one of the Gui:: Enumeration (for example, SHOW, HIDE, etc).
- out uint key - ASCII key code: one of the App:: Enumeration with KEY_* prefixes.
- out int ctrl - CTRL key modifier.
- out int alt - ALT key modifier.
- out int shift - SHIFT key modifier.
Return value
true if the specified callback type exists; otherwise, false.int IsCallbackAccel ( uint key, int ctrl, int alt, int shift ) #
Checks if the given key in combination with CTRL, ALT, or/and SHIFT buttons is assigned as a widget callback.Arguments
- uint key - ASCII key code: one of the Input.KEY.* values.
- int ctrl - 1 if the CTRL key modifier is used; otherwise, 0.
- int alt - 1 if the ALT key modifier is used; otherwise, 0.
- int shift - 1 if the SHIFT key modifier is used; otherwise, 0.
Return value
1 if it is used in combinations; otherwise, 0.void SetCallbackEnabled ( Gui.CALLBACK_INDEX callback, bool enabled ) #
Enables or disables a given callback function.Arguments
- Gui.CALLBACK_INDEX callback - One of the callbacks defined in the Gui class.
- bool enabled - true to enable the callback, false to disable it.
int IsCallbackEnabled ( Gui.CALLBACK_INDEX callback ) #
Returns a value indicating if a given callback is enabled.Arguments
- Gui.CALLBACK_INDEX callback - One of the callbacks defined in the Gui class.
Return value
1 if callback is enabled; otherwise, 0.Widget GetChild ( int num ) #
Returns the widget child by its number.Arguments
- int num - Widget number.
Return value
Required widget.int IsChild ( Widget w ) #
Checks if a given widget is a child of the current widget.Arguments
- Widget w - Widget to check.
Return value
1 if the widget in question is a child; otherwise, 0.void SetFocus ( ) #
Sets focus on the widget.int IsFocused ( ) #
Returns a value indicating if the widget is in focus.Return value
1 if the widget is in focus; otherwise, 0.void SetFont ( string name ) #
Sets a font that will be used to render text on the widget.Arguments
- string name - Font name.
bool GetIntersection ( int local_pos_x, int local_pos_y ) #
Checks for an intersection with the widget's bounds for the given point.Arguments
- int local_pos_x - Local X coordinate.
- int local_pos_y - Local Y coordinate.
Return value
true if the input coordinate is inside the widget; otherwise, false.Widget GetHierarchyIntersection ( int screen_pos_x, int screen_pos_y ) #
Checks for an intersection with a widget that belongs to the hierarchy of the current widget.Arguments
- int screen_pos_x - The X coordinate of the screen position.
- int screen_pos_y - The Y coordinate of the screen position.
Return value
Widget the intersection with which is found.int GetKeyActivity ( uint key ) #
Checks if a given key already has a special purpose for the widget.Arguments
- uint key - ASCII key code: one of the Input.KEY.* values.
Return value
1 if the key cannot be used; otherwise, 0.void SetPermanentFocus ( ) #
Sets permanent focus on the widget (it means that the widget is always in focus).void SetPosition ( int x, int y ) #
Sets a position of the widget relative to its parent.Arguments
- int x - X coordinate of the upper left corner of the widget.
- int y - Y coordinate of the upper left corner of the widget.
void SetToolTip ( string str, int reset = 0 ) #
Sets a tooltip for the widget.Arguments
- string str - Tooltip text.
- int reset - 1 to recalculate a tooltip location if the mouse cursor was relocated; otherwise — 0(by default).
string GetToolTip ( ) #
Returns the widget's tooltip text.Return value
Tooltip text.void AddAttach ( Widget w, string format = 0, int multiplier = 1, int flags = 0 ) #
Attaches a given widget to the current one. When applied to checkboxes, converts them into a group of radio buttons. A horizontal/vertical slider can be attached to a label or a text field. The text field can be attached to any of the sliders.Arguments
- Widget w - Widget to attach.
- string format - Format string for values entered into the attached widget. If none specified, "%d" is implied. This is an optional parameter.
- int multiplier - Multiplier value, which is used to scale values provided by the attached widget. This is an optional parameter.
- int flags - One of the ATTACH_* pre-defined variables. This is an optional parameter.
void AddChild ( Widget w, int flags = 0 ) #
Adds a child to the widget.Arguments
- Widget w - Child widget.
- int flags - One of the ALIGN_* pre-defined variables. This is an optional parameter.
void Arrange ( ) #
Rearranges the widget and its children to lay them out neatly. This function forces to recalculate widget size and allows to get updated GUI layout data in the current frame. If this function is not called, widget modifications made in the current update() will be available only in the next frame (i.e. with one-frame lag), as GUI is calculated and rendered after the script update() function has been executed.void Raise ( Widget w ) #
Brings a given widget to the top.Arguments
- Widget w - Widget to be brought up.
void RemoveAttach ( Widget w ) #
Detaches a given widget from the current one.Arguments
- Widget w - Widget to detach.
void RemoveChild ( Widget w ) #
Removes a child widget from the list of the widget's children.Arguments
- Widget w - Child widget.
void RemoveFocus ( ) #
Removes focus from the widget.void ReplaceChild ( Widget w, Widget old_w, int flags = 0 ) #
Replaces one child widget with another.Arguments
- Widget w - Replacement widget.
- Widget old_w - Widget to be replaced.
- int flags - One of the ALIGN_* pre-defined variables. This is an optional parameter.
void RunCallback ( int callback ) #
Runs a given callback function.Arguments
- int callback - One of the callbacks defined in the Gui class.
Widget.LIFETIME GetLifetimeSelf ( ) #
Returns the lifetime management type set for the widget.int GetRenderWidth ( ) #
Returns the widget frame width in pixels.Return value
The widget frame width in pixels.int GetRenderHeight ( ) #
Returns the widget frame height in pixels.Return value
The widget frame height in pixels.float GetDpiScale ( ) #
Returns the current DPI scale applied to the widget.Return value
The current DPI scale applied to the widget.int ToRenderSize ( int unit_size ) #
Transforms the unit value to the pixel value.Arguments
- int unit_size - Size in units.
Return value
Size in pixels.int ToUnitSize ( int render_size ) #
Transforms the pixel value to the unit value.Arguments
- int render_size - Size in pixels.
Return value
Size in units.ivec2 ToRenderSize ( ivec2 unit_size ) #
Transforms the unit value to the pixel value.Arguments
- ivec2 unit_size - Size in units.
Return value
Size in pixels.ivec2 ToUnitSize ( ivec2 render_size ) #
Transforms the pixel value to the unit value.Arguments
- ivec2 render_size - Size in pixels.