This page has been translated automatically.
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
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

WidgetTreeBox Class

Interface for widget treebox handling. See also UnigineScript analog.

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

WidgetTreeBox Class

Members


WidgetTreeBox (const Ptr<Gui> & gui)

Constructor. Creates an empty tree box.

Arguments

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

int getItem (int num)

Returns the ID of a given item by its number. The IDs are unique, and the numbers simply point at the place in the list of all items.

Arguments

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

Return value

ID of the item.

int isItemSelectable (int item)

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

Arguments

  • int item - Item number.

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 ID.
  • const char * str - Item text.

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 ID.
  • int texture - Zero-based ID of the icon (i.e. number of the icon in the icon texture).

void setItemFolded (int item, int folded)

Expands or collapses an hierarchy of a given item.

Arguments

  • int item - Item ID.
  • int folded - 1 to collapse the item hierarchy, 0 to expand it.

void addItemChild (int item, int child)

Adds a child to a given item.

Arguments

  • int item - Item ID.
  • int child - Child item ID.

void setItemHidden (int item, int hidden)

Sets a value indicating if a given item is hidden.

Arguments

  • int item - Item ID.
  • int hidden - 1 to hide the item, 0 to show it.

void setImage (const Ptr<Image> & image)

Sets an image with mini-icons to be used with 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 ID.

Return value

Item text.

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

WidgetTreeBox constructor.

Arguments

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

Return value

int getSelectedItem (int num)

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

Arguments

  • int num - Number of an item in the list of selected items.

Return value

ID of the selected item.

void setItemData (int item, const char * str)

Sets a custom data for the 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 ID.
  • const char * str - Data to set.

int getItemChild (int item, int num)

Returns a child of a given item.

Arguments

  • int item - Item ID.
  • int num - Child number in the list of children in range from 0 to the total number.

Return value

Child item ID.

void setCurrentItem (int item)

Places focus on a given item (multi-selection mode).

Arguments

  • int item - Item ID.

void setItemParent (int item, int parent)

Sets a parent for a given item.

Arguments

  • int item - Item ID.
  • int parent - Parent item ID. -1 removes the current parent.

int getCurrentItem ()

Returns the item currently in focus (multi-selection mode).

Return value

Item ID.

void setItemSelectable (int item, int selectable)

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

Arguments

  • int item - Item number.
  • 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 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

ID of the added item.

void showItem (int item)

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

Arguments

  • int item - Item ID.

void setEditable (int editable)

Sets a value indicating if item hierarchy can be edited.

Arguments

  • int editable - 1 to make the hierarchy editable, 0 to make it read-only.

int getItemTexture (int item)

Returns the icon of a given item.

Arguments

  • int item - Item ID.

Return value

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

int getNumItems ()

Returns the number of visible items in the tree box. Items that are currently to a parent level are not returned.

Return value

Number of items.

const char * getItemData (int item)

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

Return value

Item data.

int isItemFolded (int item)

Returns a value indicating if a given item is collapsed.

Arguments

  • int item - Item ID.

Return value

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

int isItemSelected (int item)

Returns a value indicating if a given item is selected.

Arguments

  • int item - Item ID.

Return value

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

void clear ()

Removes all items from the tree box.

void getItems (Vector< int > & items)

Returns all items in the tree box.

Arguments

  • Vector< int > & items - An array with item IDs.

void setMultiSelection (int selection)

Sets a value indicating if multiple selection is enabled for tree box items.

Arguments

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

const char * getCurrentItemText ()

Returns the text of the currently focused item (multi-selection mode).

Return value

Item text.

int getItemParent (int item)

Returns the parent of a given item.

Arguments

  • int item - Item ID.

Return value

Parent item ID.

void setTexture (const char * texture)

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

Arguments

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

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

Sets a custom color for a given item.

Arguments

  • int item - Item ID.
  • const Math::vec4 & color - Color to set.

int isItemChild (int item, int child)

Checks if a given item is a child of another specified item.

Arguments

  • int item - Item ID.
  • int child - Child item ID.

Return value

Returns 1 if child is actually a child of the item; otherwise, 0.

int type ()

WidgetTreeBox type.

Return value

WidgetTreeBox type identifier.

Math::vec4 getItemColor (int item)

Returns a color set to a given item.

Arguments

  • int item - Item ID.

Return value

Color.

int isEditable ()

Returns a value indicating if item hierarchy can be edited. The default is 0.

Return value

Returns 1 if the hierarchy can be edited; otherwise, 0.

void removeItem (int item)

Removes a given item from the tree box. Children items will be kept.

Arguments

  • int item - Item ID.

int getNumItemChildren (int item)

Returns the number of child items of a given item.

Arguments

  • int item - Item ID.

Return value

Number of child items.

const char * getCurrentItemData ()

Returns the data of the currently focused item (multi-selection mode). The data can be used as a text identifier of the item (instead of using the number of the item).

Return value

Item data.

int isItemHidden (int item)

Returns a value indicating if an item is hidden or not.

Arguments

  • int item - Item ID.

Return value

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

void getImage (const Ptr<Image> & image)

Returns the image with mini-icons.

Arguments

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

void removeItemChild (int item, int child)

Removes a child of a given item.

Arguments

  • int item - Item ID.
  • int child - Child item ID.

void setItemSelected (int item, int selected)

Sets a value indicating if a given item is selected.

Arguments

  • int item - Item ID.
  • int selected - 1 to select the item, 0 to deselect it.

const char * getTexture ()

Returns file name of the image with mini-icons. The texture is a vertical strip of square icons.

Return value

Path to the texture file.

int getNumSelectedItems ()

Returns number of selected items in the box (multi-selection mode).

Return value

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