This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
Basics
Rendering
Professional (SIM)
UnigineEditor
Interface Overview
Assets Workflow
Version Control
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Lighting
Sandworm
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Built-in Node Types
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Materials and Shaders
Rebuilding the Engine Tools
GUI
Double Precision Coordinates
API
Animations-Related Classes
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
VR-Related Classes
Content Creation
Content Optimization
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials

Unigine.WidgetMenuBox Class

Inherits from: Widget

This class creates a menu box. A menu box can be either stand-alone or attached to a menu bar. In the first case, it needs to be handled manually. By using this widget, you can do the following:

  • Create hierarchical menus.
  • Use the other widgets as menu items (See the example).

See Also#

  • Widgets sample in C# Component Samples suite
  • A set of UnigineScript API samples located in the <UnigineSDK>/data/samples/widgets/ folder:
    • menubox_00
    • menubox_01
    • menubox_02
  • The Widgets article providing details on menubox features

WidgetMenuBox Class

Properties

string CurrentItemData#

The data of the item clicked last. the data can be used as a text identifier of the item (instead of using the number of the item).

string CurrentItemText#

The text of the item that is clicked last.

int CurrentItem#

The item that is clicked last.

int NumItems#

The total number of items in the menu.

string Texture#

The path to the texture with mini icons that are used with the list items. the texture is a vertical strip of square icons.

int SpaceY#

The vertical space between menu items and between them and menu borders.

int SpaceX#

The horizontal space between menu items and between them and menu borders.

vec4 BorderColor#

The border color for the widget.

vec4 SelectionColor#

The color used to highlight the current selection for the widget.

vec4 BackgroundColor#

The background color used for the widget.

bool CurrentItemHighlight#

The highlight flag for the item that is clicked last.

vec4 CurrentItemColor#

The color of the highlight for item that is clicked last. the highlight state should be enabled.

Members


WidgetMenuBox ( Gui gui, int x = 0, int y = 0 ) #

Constructor. Creates an empty menu box with specified spacing between menu items as well as items and menu borders and adds it to the specified GUI.

Arguments

  • Gui gui - GUI, to which the menu will belong.
  • int x - Horizontal space.
  • int y - Vertical space.

WidgetMenuBox ( int x = 0, int y = 0 ) #

Constructor. Creates an empty menu box with specified spacing between menu items as well as items and menu borders and adds it to the Engine GUI.

Arguments

  • int x - Horizontal space.
  • int y - Vertical space.

void SetImage ( Image image ) #

Sets an image with mini icons to be used with items. The image is a vertical strip of square icons.

Arguments

  • Image image - Image to set.

Image GetImage ( ) #

Gets the image with mini icons that are used with menu items.

Return value

Image with mini icons (the vertical strip of square icons).

void SetItemData ( int item, string str ) #

Sets the text data for a given item. The data can be used as a text identifier of the item (instead of using the number of the item).

Arguments

  • int item - Item number in range from 0 to the total number of items.
  • string str - Data to set.

string GetItemData ( int item ) #

Returns the text data of the item with the specified number. The data can be used as a text identifier of the item (instead of using the item number).

Arguments

  • int item - Item number in range from 0 to the total number of items.

Return value

Item text data.

void SetItemEnabled ( int item, bool enabled ) #

Sets a value indicating if a given item is enabled (i.e. can be clicked).

Arguments

  • int item - Item number in range from 0 to the total number of items.
  • bool enabled - 1 to enable the item, 0 to disable it.

int IsItemEnabled ( int item ) #

Returns a value indicating if a given item is enabled (i.e. can be clicked).

Arguments

  • int item - Item number.

Return value

Positive number if the item is enabled; otherwise, 0.

void SetItemSelectable ( int item, int selectable ) #

Sets a value indicating if a given item can be selected.

Arguments

  • int item - Item number in range from 0 to the total number of items.
  • int selectable - 1 to set the item as selectable; otherwise, 0.

int IsItemSelectable ( int item ) #

Returns a value indicating if the given item can be selected. By default, the item is selectable.

Arguments

  • int item - Item number.

Return value

Returns 1 if the item is selectable; otherwise, 0.

void SetItemSeparator ( int item, int separator ) #

Adds or removes a separator after a given item.

Arguments

  • int item - Item number in range from 0 to the total number of items.
  • int separator - Positive number to add a separator, 0 to remove it.

int IsItemSeparator ( int item ) #

Checks whether a separator is placed after the given item.

Arguments

  • int item - Item number in range from 0 to the total number of items.

Return value

Positive number if separator is placed; otherwise, 0.

void SetItemSpace ( int item, int space ) #

Sets a space after the given item.

Arguments

  • int item - Item number in range from 0 to the total number of menu bar items.
  • int space - Space to set, in pixels.

int GetItemSpace ( int item ) #

Returns the space after the given item.

Arguments

  • int item - Item number in range from 0 to the total number of items.

Return value

Item space.

void SetItemText ( int item, string str ) #

Sets a text for a given item.

Arguments

  • int item - Item number in range from 0 to the total number of items.
  • string str - Item text.

string GetItemText ( int item ) #

Returns the text of a given item in range from 0 to the total number of items.

Arguments

  • int item - Item number in range from 0 to the total number of items.

Return value

Item text.

void SetItemTexture ( int item, int texture ) #

Sets an icon for a given item.

Arguments

  • int item - Item number in range from 0 to the total number of items.
  • int texture - Zero-based ID of the icon (i.e. number of the icon in the icon texture).

int GetItemTexture ( int item ) #

Returns the icon of a given item.

Arguments

  • int item - Item number in range from 0 to the total number of items.

Return value

Zero-based ID of the icon (i.e. number of the icon in the icon texture).

void SetItemToolTip ( int item, string str ) #

Sets a tooltip for a given item.

Arguments

  • int item - Item number in range from 0 to the total number of items.
  • string str - Tooltip to set.

string GetItemToolTip ( int item ) #

Returns the tooltip of a given item.

Arguments

  • int item - Item number in range from 0 to the total number of items.

Return value

Text of the item tooltip.

void SetItemWidget ( int item, Widget w ) #

Sets a menu widget for a given item.

Arguments

  • int item - Item number in range from 0 to the total number of items.
  • Widget w - A widget to be used as a menu item.

Widget GetItemWidget ( int item ) #

Returns the menu widget of a given item.

Arguments

  • int item - Item number on range from 0 to the total number of menu items.

Return value

Menu widget.

void SetSpace ( int x, int y ) #

Sets a space between menu items and between them and menu borders.

Arguments

  • int x - Horizontal space. If a negative value is provided, 0 will be used instead.
  • int y - Vertical space. If a negative value is provided, 0 will be used instead.

int AddItem ( string str, int texture = -1 ) #

Adds a new item with a given text and an icon.

Arguments

  • string str - Item text.
  • int texture - Zero-based ID of the icon (i.e. number of the icon in the icon texture).

Return value

Number of the added item.

void Clear ( ) #

Removes all items from the menu.

void RemoveItem ( int item ) #

Removes a given item from the menu.

Arguments

  • int item - Item number in range from 0 to the total number of items.

void ResetCurrentItem ( ) #

Resets the item clicked last.
Last update: 2023-01-11
Build: ()