This page has been translated automatically.
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Content Creation
Materials
Unigine Material Library
Tutorials
Внимание! Эта версия документация УСТАРЕЛА, поскольку относится к более ранней версии SDK! Пожалуйста, переключитесь на самую актуальную документацию для последней версии SDK.
Внимание! Эта версия документации описывает устаревшую версию SDK, которая больше не поддерживается! Пожалуйста, обновитесь до последней версии SDK.

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 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 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 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.
Last update: 03.07.2017
Build: ()