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

Unigine::WidgetMenuBox Class

Interface for widget menubox handling. See also UnigineScript analog.

To use this class, include the UnigineWidgetMenuBox.h file.

Unigine::WidgetMenuBox Class

Members


static int type ()

WidgetMenuBox type.

Return value

WidgetMenuBox type identifier.

static Ptr< WidgetMenuBox > create (const WidgetPtr & widget)

WidgetMenuBox constructor.

Arguments

  • const WidgetPtr & widget - Widget smart pointer.

static Ptr< WidgetMenuBox > create (const Ptr< Gui > & gui, int x, int y)

WidgetMenuBox constructor.

Arguments

  • const Ptr< Gui > & gui - Gui pointer.
  • int x - Horizontal space.
  • int y - Vertical space.

virtual void setSpace (int x, int y) const =0

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.

virtual int getSpaceX () const =0

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

Return value

Horizontal space.

virtual int getSpaceY () const =0

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

Return value

Vertical space.

virtual void setImage (const ImagePtr & image) const =0

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

Arguments

  • const ImagePtr & image - Image to set.

virtual void getImage (const ImagePtr & image) const =0

Gets the image with mini-icons, which are used with menu items.

Arguments

  • const ImagePtr & image - Image with mini-icons (the vertical strip of square icons).

virtual void setTexture (const char * name) const =0

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

Arguments

  • const char * name - Path to a texture file.

virtual const char * getTexture () const =0

Returns the path to the texture with mini-icons, which are used with the list items. The texture is a vertical strip of square icons.

Return value

Path to the texture file.

virtual void clear () const =0

Removes all items from the menu.

virtual int addItem (const char * str, int texture) const =0

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

Arguments

  • const char * str - Item text.
  • int texture - Zero-based ID of the icon (i.e. number of the icon in the icon texture). -1 means that an item has no icon.

Return value

Number of the added item.

virtual void removeItem (int item) const =0

Removes a given item from the menu.

Arguments

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

virtual int getNumItems () const =0

Returns the total number of items in the menu.

Return value

Number of items.

virtual void setItemText (int item, const char * str) const =0

Sets a text for a given item.

Arguments

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

virtual const char * getItemText (int item) const =0

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

Arguments

  • int item - Item number.

Return value

Item text.

virtual void setItemData (int item, const char * str) const =0

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.
  • const char * str - Item data to set.

virtual const char * getItemData (int item) const =0

Returns the data of 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.

Return value

Item data.

virtual void setItemToolTip (int item, const char * str) const =0

Sets a tooltip for a given item.

Arguments

  • int item - Item number in range from 0 to the total number of items.
  • const char * str - Text of a tooltip to set.

virtual const char * getItemToolTip (int item) const =0

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.

virtual void setItemEnabled (int item, int enable) const =0

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 enable - Positive number to enable the item, 0 to disable it.

virtual int isItemEnabled (int item) const =0

Returns a value indicating if a given item can be clicked.

Arguments

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

Return value

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

virtual void setItemTexture (int item, int texture) const =0

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

virtual int getItemTexture (int item) const =0

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

virtual void setItemSeparator (int item, int separator) const =0

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.

virtual int isItemSeparator (int item) const =0

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.

virtual void setItemSelectable (int item, int selectable) const =0

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.

virtual int isItemSelectable (int item) const =0

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

Return value

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

virtual void setItemSpace (int item, int space) const =0

Sets a space after the given item.

Arguments

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

virtual int getItemSpace (int item) const =0

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.

virtual void setItemWidget (int item, const Ptr< Widget > & menu) const =0

Sets a menu widget for a given item.

Arguments

  • int item - Item number in range from 0 to the total number of menu items.
  • const Ptr< Widget > & menu - Menu widget.

virtual Ptr< Widget > getItemWidget (int item) const =0

Returns the menu widget of a given item.

Arguments

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

Return value

Menu widget.

virtual int getCurrentItem () const =0

Returns the item, which is currently in focus.

Return value

Item number.

virtual const char * getCurrentItemText () const =0

Returns the text of the item, which is currently in focus.

Return value

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

virtual const char * getCurrentItemData () const =0

Returns the data of the item, which is currently in focus. The data can be used as a text identifier of the item (instead of using the number of the item).

Return value

Item data if the item is in range from 0 to the total number of items; otherwise, NULL.
Last update: 2017-07-03