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
Programming
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
API
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
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.

WidgetMenuBox Class

Warning
The scope of applications for UnigineScript is limited to implementing materials-related logic (material expressions, scriptable materials, brush materials). Do not use UnigineScript as a language for application logic, please consider C#/C++ instead, as these APIs are the preferred ones. Availability of new Engine features in UnigineScipt (beyond its scope of applications) is not guaranteed, as the current level of support assumes only fixing critical issues.
Inherits: 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#

  • 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

Members


static 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.

static 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 setCurrentItem ( int item ) #

Sets the item that is clicked last.

Arguments

  • int item - Item number.

int getCurrentItem ( ) #

Returns the item that is clicked last.

Return value

Item number.

string getCurrentItemData ( ) #

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

Return value

Item data.

string getCurrentItemText ( ) #

Returns the text of the item that is clicked last.

Return value

Item text if the item is in range from 0 to the total number of items; otherwise, NULL

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, int 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.
  • int 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

1 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

1 if the item can be selected; 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 between the given menu item and the next 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 between the given menu item and the next item.

Arguments

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

Return value

Space between items, in pixels.

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.

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 new tooltip for the 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 a tooltip of a given item.

Arguments

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

Return value

Item tooptip.

void setItemWidget ( int item, Widget w ) #

Sets a widget for the given item of the menu.

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 a widget set for the given item of the menu.

Arguments

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

Return value

A widget used as an item.

int getNumItems ( ) #

Returns the number of items in the menu.

Return value

Number of items.

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 getSpaceX ( ) #

Returns the horizontal space between menu items and between them and menu borders.

Return value

Horizontal space.

int getSpaceY ( ) #

Returns the vertical space between menu items and between them and menu borders.

Return value

Vertical space.

void setTexture ( string texture ) #

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

Arguments

  • string texture - Path to a texture file.

string getTexture ( ) #

Returns file name of the image with mini icons.

Return value

Path to the texture file.

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 setBackgroundColor ( vec4 color ) #

Sets the background color to be used for the widget.

Arguments

  • vec4 color - Four-component vector specifying the color in the RGBA format.

vec4 getBackgroundColor ( ) #

Returns the current background color used for the widget.

Return value

Four-component vector specifying the color in the RGBA format.

void setSelectionColor ( vec4 color ) #

Sets the color to be used to highlight the selection for the widget.

Arguments

  • vec4 color - Four-component vector specifying the color in the RGBA format.

vec4 getSelectionColor ( ) #

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

Return value

Four-component vector specifying the color in the RGBA format.

void setBorderColor ( vec4 color ) #

Sets the border color for the widget.

Arguments

  • vec4 color - Four-component vector specifying the color in the RGBA format.

vec4 getBorderColor ( ) #

Returns the current border color for the widget.

Return value

Four-component vector specifying the color in the RGBA format.

void setCurrentItemHighlight ( int highlight = false ) #

Sets the highlight flag for the item that is clicked last.

Arguments

  • int highlight - 1 to enable highlight; 0 to disable it.

int isCurrentItemHighlight ( ) #

Returns the highlight flag for the item that is clicked last.

Return value

1 if highlight is enabled; otherwise 0.

void setCurrentItemColor ( vec4 color ) #

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

Arguments

  • vec4 color - Four-component vector specifying the color in the RGBA format.

vec4 getCurrentItemColor ( ) #

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

Return value

Four-component vector specifying the color in the RGBA format.

void resetCurrentItem ( ) #

Resets the item clicked last.
Last update: 2020-07-31
Build: ()