.section Widgets
.topic widget.treeview
.title TreeView
.toc 0 TreeView
.index TreeView
.index TreeItem
.index wgtTreeView
.index wgtTreeItem
.index wgtTreeViewGetSelected

.h2 TreeView

A hierarchical tree control with expandable/collapsible nodes. Supports single and multi-selection and drag-to-reorder. Tree items are added as children of the TreeView or of other tree items to create nested hierarchies.

Header: widgets/widgetTreeView.h

.h3 Creation

.code
WidgetT *tv    = wgtTreeView(parent);
WidgetT *root  = wgtTreeItem(tv, "Root");
WidgetT *child = wgtTreeItem(root, "Child");
.endcode

.h3 Macros

.index wgtTreeViewSetSelected
.index wgtTreeViewSetMultiSelect
.index wgtTreeViewSetReorderable
.index wgtTreeItemSetExpanded
.index wgtTreeItemIsExpanded
.index wgtTreeItemIsSelected
.index wgtTreeItemSetSelected

.table
  Macro                                          Description
  -----                                          -----------
  wgtTreeView(parent)                            Create a tree view control.
  wgtTreeItem(parent, text)                      Add a tree item as a child of the tree view or another tree item.
  wgtTreeViewGetSelected(w)                      Get the currently selected tree item (returns WidgetT *, NULL if none).
  wgtTreeViewSetSelected(w, item)                Set the selected tree item.
  wgtTreeViewSetMultiSelect(w, multi)            Enable or disable multi-selection.
  wgtTreeViewSetReorderable(w, reorderable)      Enable drag-to-reorder of items.
  wgtTreeItemSetExpanded(w, expanded)            Expand or collapse a tree item.
  wgtTreeItemIsExpanded(w)                       Check if a tree item is expanded.
  wgtTreeItemIsSelected(w)                       Check if a tree item is selected (multi-select mode).
  wgtTreeItemSetSelected(w, selected)            Select or deselect a tree item.
.endtable

.h3 Events

.table
  Callback     Description
  --------     -----------
  onClick      Fires when a tree item is clicked.
  onDblClick   Fires when a tree item is double-clicked.
  onChange     Fires when the selection changes.
.endtable

.h3 Methods (BASIC Interface)

.table
  Method           Description
  ------           -----------
  SetMultiSelect   Enable or disable multi-selection.
  SetReorderable   Enable or disable drag-to-reorder.
.endtable

.hr
