Programming
Fundamentials
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Bounds-Related Classes
Containers
Controls-Related Classes
Core Library
Engine-Related Classes
Node-Related Classes
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Rendering-Related Classes
Utility Classes

WidgetListBox Class

Interface for widget listbox handling. See also UnigineScript analog.

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

WidgetListBox Class

Members


WidgetListBox (const Ptr<Gui> & gui)

Constructor. Creates an empty list box.

Arguments

  • const Ptr<Gui> & gui - GUI, to which the new list box will belong.

int isItemSelectable (int item)

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.

void setItemText (int item, const char * str)

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 to be set.

int isMultiSelection ()

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

Return value

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

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

void setCurrentItem (int item)

Places focus on a given item.

Arguments

  • int item - Item number.

void setImage (const Ptr<Image> & image)

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

Arguments

  • const Ptr<Image> & image - Image to set.

void clearSelection ()

Clears list of selected items.

const char * 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.

int getSelectedItem (int num)

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

void setItemData (int item, const char * str)

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 be set.

int getCurrentItem ()

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

Return value

Item number.

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 addItem (const char * str, int texture = -1)

Adds a new item with a given text and an icon. By default, a new item is not selected.

Arguments

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

Return value

Number of the added item.

void showItem (int item)

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

Arguments

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

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

int getNumItems ()

Returns the total number of items in the list box.

Return value

Number of items.

const char * getItemData (int item)

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.

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

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

void clear ()

Removes all items from the list box.

void setMultiSelection (int selection)

Enables or disables multiple selection of items. The default is 0.

Arguments

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

const char * getCurrentItemText ()

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

void setTexture (const char * texture)

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

Arguments

  • const char * texture - Path to a texture with mini-icons (the vertical strip of square icons).

void setItemColor (int item, const Math::vec4 & color)

Sets a custom color for a given item.

Arguments

  • int item - Item number in range from 0 to the total number of items.
  • const Math::vec4 & color - Color to set.

Ptr<WidgetListBox> create (const Ptr<Widget> & widget)

WidgetListBox constructor.

Arguments

  • const Ptr<Widget> & widget - Widget smart pointer.

Return value

int type ()

WidgetListBox type.

Return value

WidgetListBox type identifier.

Math::vec4 getItemColor (int item)

Returns a color set to a given item.

Arguments

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

Return value

Item color.

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.

const char * getCurrentItemData ()

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

void getImage (const Ptr<Image> & image)

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

Arguments

  • const Ptr<Image> & image

void setItemSelected (int item, int selected)

Sets a value indicating if a given item is selected.

Arguments

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

const char * 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 getNumSelectedItems ()

Returns the number of selected items in the box.

Return value

Number of selected items.
Last update: 2017-07-03