Getting Started
Migrating to UNIGINE 2.0
C++ API Migration
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
Plugins Library
High-Level Systems
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins

WidgetMenuBar Class

This class creates a horizontal menu bar.

See Also

WidgetMenuBar Class

This class inherits from Widget

Members


WidgetMenuBar (Gui gui, int x = 0, int y = 0)

Constructor. Creates an empty menu bar.

Arguments

  • Gui gui - GUI, to which the menu bar will belong.
  • int x - Offset along the X axis.
  • int y - Offset along the Y axis.

int addItem (string title, WidgetMenuBox menu = 0)

Adds a menu with a given title.

Arguments

  • string title - Menu title.
  • WidgetMenuBox menu - Menu.

Return value

Number of the added menu.

void clear ()

Removes all menus from the menu bar.

string getItemData (int item)

Returns the data of the currently selected item.

Arguments

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

Return value

Item data.

WidgetMenuBox getItemMenu (int item)

Returns the menu of a given item.

Arguments

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

Return value

Menu.

int getItemSpace (int item)

Returns the space between the given menu item and the next item located to the right.

Arguments

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

Return value

Space between items, in pixels.

string getItemText (int item)

Returns the title of a given item.

Arguments

  • int item - Item number.

Return value

Item title.

int getNumItems ()

Returns the number of items in the menu bar.

Return value

Number of items.

int getSpaceX ()

Returns the horizontal space between menu items and menu borders.

Return value

Horizontal space, in pixels.

int getSpaceY ()

Returns the vertical space between menu items and menu borders.

Return value

Vertical space, in pixels.

int isItemEnabled (int item)

Returns a value indicating if the given item is enabled.

Arguments

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

Return value

1 if the item is enabled; otherwise - 0.

void removeItem (int item)

Removes a given item from the menu bar.

Arguments

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

void setItemData (int item, string data)

Sets the 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 data - Data to set.

void setItemEnabled (int item, int enabled)

Sets an enabled flag for the item.

Arguments

  • int item - Item number in range from 0 to the total number of items.
  • int enabled - Enabled flag:
    • 1 - Item is enabled.
    • 0 - Item is disabled.

void setItemMenu (int item, WidgetMenuBox menu)

Sets a menu for a given item.

Arguments

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

void setItemSpace (int item, int space)

Sets a space between the given menu item and the next item located to the right.

Arguments

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

void setItemText (int item, string title)

Sets a title for a given item.

Arguments

  • int item - Item number in range from 0 to the total number of menu bar items.
  • string title - Menu title.

void setSpace (int x, int y)

Sets a space between menu items and menu borders.

Arguments

  • int x - Horizontal space, in pixels.
  • int y - Vertical space, in pixels.
Last update: 2017-07-03