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

WidgetListBox Class

This class creates a list box, which is multiple line text box where more than one item can be picked.

See Also

WidgetListBox Class

This class inherits from Widget

Members


WidgetListBox (Gui gui)

Constructor. Creates an empty list box.

Arguments

  • Gui gui - GUI, to which the new list box will belong.

int addItem (string str, int texture = -1 = -1)

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

Arguments

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

Return value

Number of the added item.

void clearSelection ()

Clears list of selected items.

void clear ()

Removes all items from the list box.

string getCurrentItemData ()

Returns the data of a given item.

Return value

Item data.

string getCurrentItemText ()

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

Return value

Item text.

int getCurrentItem ()

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

Return value

Item number.

Image getImage ()

Returns the image with mini-icons.

Return value

Image with mini-icons.

vec4 getItemColor (int item)

Returns a color set to a given item.

Arguments

  • int item - Item number.

Return value

Color.

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.

string getItemText (int item)

Returns the text of a given item.

Arguments

  • int item - Item number.

Return value

Item text.

int getItemTexture (int item)

Returns the icon of a given item.

Arguments

  • int item - Item number.

Return value

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

int getNumItems ()

Returns the total number of items in the list box.

Return value

Number of items.

int getNumSelectedItems ()

Returns number of selected items in the box.

Return value

Number of selected items.

int getSelectedItem (int num)

Returns ID of a selected item (multi-selection mode).

Arguments

  • int num - Number in the list of the selected items in range from 0 to the total number of the selected items.

Return value

ID of a selected item.

string getTexture ()

Returns the path to the texture with mini-icons, which are used with the list items.

Return value

Path to the texture file.

int isItemSelectable (int item)

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

Arguments

  • int item - Item number.

Return value

1 if the item is selectable; otherwise, 0.

int isItemSelected (int item)

Returns a value indicating if a given item is selected.

Arguments

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

Return value

1 if the item is selected; otherwise, 0.

int isMultiSelection ()

Returns a value indicating if multiple selection of items is enabled.

Return value

1 if several items can be selected at once; otherwise, 0.

void removeItem (int item)

Removes a given item from the list box.

Arguments

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

void setCurrentItem (int item)

Places focus on a given item.

Arguments

  • int item - Item number.

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.

void setItemColor (int item, vec4 color)

Sets a custom color for a given item.

Arguments

  • int item - Item number.
  • vec4 color - Color to set.

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 setItemSelectable (int item, int state)

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 state - 1 to set the item as selectable; otherwise, 0.

void setItemSelected (int item, int state)

Selects or deselects a given item.

Arguments

  • int item - Item number in range from 0 to the total number of items.
  • int state - 1 to select the item, 0 to deselect it.

void setItemText (int item, string text)

Sets a text for a given item.

Arguments

  • int item - Item number.
  • string text - Item text.

void setItemTexture (int item, int icon)

Sets an icon for a given item.

Arguments

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

void setMultiSelection (int mode)

Enables or disables multiple selection of items.

Arguments

  • int mode - 1 to enable multiple selection, 0 to disable it.

void setTexture (string texture)

Sets a path to 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.

void showItem (int item)

Scrolls a list box so that a given item is visible.

Arguments

  • int item - Item number.
Last update: 2017-07-03