Torque 3D - Script Manual: GuiTreeViewCtrl Class Reference

TorqueScript

Main   Class List   Namespace List   Online

GuiTreeViewCtrl Class Reference
[Container Controls]

Hierarchical list of text items with optional icons. More...

Inheritance diagram for GuiTreeViewCtrl:

List of all members.

Public Member Functions

void addSelection (int id, bool isLastSelection=true)
 Add an item/object to the current selection.
bool buildIconTable (builds an icon table)
void clear ()
 empty tree
void clearFilterText ()
 Clear the current item filtering pattern.
void clearSelection ()
 Unselect all currently selected items.
void deleteSelection ()
 Delete all items/objects in the current selection.
bool editItem (TreeItemId item, string newText, string newValue)
bool expandItem (TreeItemId item, bool expand=true)
int findChildItemByName (int parentId, string childName)
 Get the child item of the given parent item whose text matches childName.
int findItemByName (string text)
 Get the ID of the item whose text matches the given text.
int findItemByObjectId (find item by object id and returns the mId)
int findItemByValue (string value)
 Get the ID of the item whose value matches value.
int getChild (TreeItemId item)
string getFilterText ()
 Get the current filter expression. Only tree items whose text matches this expression are displayed. By default, the expression is empty and all items are shown.
string getItemText (TreeItemId item)
string getItemValue (TreeItemId item)
int getNextSibling (TreeItemId item)
int getParent (TreeItemId item)
int getPrevSibling (TreeItemId item)
int getSelectedItem (int index=0)
 Return the selected item at the given index.
int getSelectedObject (int index=0)
 Return the currently selected SimObject at the given index in inspector mode or -1.
string getTextToRoot (TreeItemId item, Delimiter=none)
 gets the text from the current node to the root, concatenating at each branch upward, with a specified delimiter optionally
void hideSelection (bool state=true)
 Call SimObject::setHidden( state ) on all objects in the current selection.
int insertItem (int parentId, string text, string value="", string icon="", int normalImage=0, int expandedImage=0)
 Add a new item to the tree.
bool isItemSelected (int id)
 Check whether the given item is currently selected in the tree.
bool isParentItem (int id)
 Returns true if the given item contains child items.
void lockSelection (bool lock=true)
 Set whether the current selection can be changed by the user or not.
bool markItem (TreeItemId item, bool mark=true)
void moveItemDown (TreeItemId item)
void moveItemUp (TreeItemId item)
void open (SimSet obj, bool okToEdit=true)
 Set the root of the tree view to the specified object, or to the root set.
bool removeItem (TreeItemId item)
void removeSelection (deselects an item)
void scrollVisible (TreeItemId item)
int scrollVisibleByObjectId (show item by object id.returns true if sucessful.)
bool selectItem (TreeItemId item, bool select=true)
void setDebug (bool value=true)
 Enable/disable debug output.
void setFilterText (string pattern)
 Set the pattern by which to filter items in the tree. Only items in the tree whose text matches this pattern are displayed.
void setItemImages (int id, int normalImage, int expandedImage)
 Sets the normal and expanded images to show for the given item.
void setItemTooltip (int id, string text)
 Set the tooltip to show for the given item.
void showItemRenameCtrl (TreeItemId id)
 Show the rename text field for the given item (only one at a time).
void sort (int parent, bool traverseHierarchy=false, bool parentsFirst=false, bool caseSensitive=true)
 Sorts all items of the given parent (or root). With 'hierarchy', traverses hierarchy.
void toggleHideSelection ()
 Toggle the hidden state of all objects in the current selection.
void toggleLockSelection ()
 Toggle the locked state of all objects in the current selection.
Callbacks

bool canRenameObject (SimObject object)
bool handleRenameObject (string newName, SimObject object)
bool isValidDragTarget (int id, string value)
void onAddGroupSelected (SimGroup group)
void onAddMultipleSelectionBegin ()
void onAddMultipleSelectionEnd ()
void onAddSelection (int itemOrObjectId, bool isLastSelection)
void onBeginReparenting ()
void onClearSelection ()
void onDefineIcons ()
bool onDeleteObject (SimObject object)
void onDeleteSelection ()
void onDragDropped ()
void onEndReparenting ()
void onInspect (int itemOrObjectId)
void onKeyDown (int modifier, int keyCode)
void onMouseDragged ()
void onMouseUp (int hitItemId, int mouseClickCount)
void onObjectDeleteCompleted ()
void onRemoveSelection (int itemOrObjectId)
void onReparent (int itemOrObjectId, int oldParentItemOrObjectId, int newParentItemOrObjectId)
void onRightMouseDown (int itemId, Point2I mousePos, SimObject object)
void onRightMouseUp (int itemId, Point2I mousePos, SimObject object)
void onSelect (int itemOrObjectId)
void onUnselect (int itemOrObjectId)

Public Attributes

void addChildSelectionByValue
 addChildSelectionByValue(TreeItemId parent, value)
void buildVisibleTree
 Build the visible tree.
void cancelRename
 For internal use.
int getFirstRootItem
 Get id for root item.
int getItemCount
string getSelectedItemList
 returns a space seperated list of mulitple item ids
int getSelectedItemsCount
string getSelectedObjectList
 Returns a space sperated list of all selected object ids.
void onRenameValidate
 For internal use.
void removeAllChildren
 removeAllChildren(TreeItemId parent)
void removeChildSelectionByValue
 removeChildSelectionByValue(TreeItemId parent, value)
Inspector Trees

bool canRenameObjects
 If true clicking on a selected item ( that is an object and not the root ) will allow you to rename it.
bool compareToObjectID
bool renameInternal
 If true then object renaming operates on the internalName rather than the object name.
bool showClassNameForUnnamedObjects
 If true, class names will be used as object names for unnamed objects.
bool showClassNames
 If true, item text labels for objects will include class names.
bool showInternalNames
 If true, item text labels for obje ts will include internal names.
bool showObjectIds
 If true, item text labels for objects will include object IDs.
bool showObjectNames
 If true, item text labels for objects will include object names.
TreeView

bool clearAllOnSingleSelection
bool deleteObjectAllowed
bool destroyTreeOnSleep
 If true, the entire tree item hierarchy is deleted when the control goes to sleep.
bool dragToItemAllowed
bool fullRowSelect
int itemHeight
bool mouseDragging
bool multipleSelections
 If true, multiple items can be selected concurrently.
bool showRoot
 If true, the root item is shown in the tree.
int tabSize
int textOffset
bool tooltipOnWidthOnly
bool useInspectorTooltips

Detailed Description

Hierarchical list of text items with optional icons.

Can also be used to inspect SimObject hierarchies, primarily within editors.

GuiTreeViewCtrls can either display arbitrary user-defined trees or can be used to display SimObject hierarchies where each parent node in the tree is a SimSet or SimGroup and each leaf node is a SimObject.

Each item in the tree has a text and a value. For trees that display SimObject hierarchies, the text for each item is automatically derived from objects while the value for each item is the ID of the respective SimObject. For trees that are not tied to SimObjects, both text and value of each item are set by the user.

Additionally, items in the tree can have icons.

Each item in the tree has a distinct numeric ID that is unique within its tree. The ID of the root item, which is always present on a tree, is 0.

Example:
new GuiTreeViewCtrl(DatablockEditorTree)
{
   tabSize = "16";
   textOffset = "2";
   fullRowSelect = "0";
   itemHeight = "21";
   destroyTreeOnSleep = "0";
   MouseDragging = "0";
   MultipleSelections = "1";
   DeleteObjectAllowed = "1";
   DragToItemAllowed = "0";
   ClearAllOnSingleSelection = "1";
   showRoot = "1";
   internalNamesOnly = "0";
   objectNamesOnly = "0";
   compareToObjectID = "0";
   Profile = "GuiTreeViewProfile";
   tooltipprofile = "GuiToolTipProfile";
   hovertime = "1000";
};

Member Function Documentation

void GuiTreeViewCtrl::addSelection ( int  id,
bool  isLastSelection = true 
)

Add an item/object to the current selection.

Parameters:
id ID of item/object to add to the selection.
isLastSelection Whether there are more pending items/objects to be added to the selection. If false, the control will defer refreshing the tree and wait until addSelection() is called with this parameter set to true.
bool GuiTreeViewCtrl::buildIconTable ( builds an icon  table  ) 
bool GuiTreeViewCtrl::canRenameObject ( SimObject  object  ) 
void GuiTreeViewCtrl::clear (  ) 

empty tree

void GuiTreeViewCtrl::clearFilterText (  ) 

Clear the current item filtering pattern.

See also:
setFilterText
getFilterText
void GuiTreeViewCtrl::clearSelection (  ) 

Unselect all currently selected items.

void GuiTreeViewCtrl::deleteSelection (  ) 

Delete all items/objects in the current selection.

bool GuiTreeViewCtrl::editItem ( TreeItemId  item,
string  newText,
string  newValue 
)
bool GuiTreeViewCtrl::expandItem ( TreeItemId  item,
bool  expand = true 
)
int GuiTreeViewCtrl::findChildItemByName ( int  parentId,
string  childName 
)

Get the child item of the given parent item whose text matches childName.

Parameters:
parentId Item ID of the parent in which to look for the child.
childName Text of the child item to find.
Returns:
ID of the child item or -1 if no child in parentId has the given text childName.
Note:
This method does not recurse, i.e. it only looks for direct children.
int GuiTreeViewCtrl::findItemByName ( string  text  ) 

Get the ID of the item whose text matches the given text.

Parameters:
text Item text to match.
Returns:
ID of the item or -1 if no item matches the given text.
int GuiTreeViewCtrl::findItemByObjectId ( find item by object id and returns the  mId  ) 
int GuiTreeViewCtrl::findItemByValue ( string  value  ) 

Get the ID of the item whose value matches value.

Parameters:
value Value text to match.
Returns:
ID of the item or -1 if no item has the given value.
int GuiTreeViewCtrl::getChild ( TreeItemId  item  ) 
string GuiTreeViewCtrl::getFilterText (  ) 

Get the current filter expression. Only tree items whose text matches this expression are displayed. By default, the expression is empty and all items are shown.

Returns:
The current filter pattern or an empty string if no filter pattern is currently active.
See also:
setFilterText
clearFilterText
string GuiTreeViewCtrl::getItemText ( TreeItemId  item  ) 
string GuiTreeViewCtrl::getItemValue ( TreeItemId  item  ) 
int GuiTreeViewCtrl::getNextSibling ( TreeItemId  item  ) 
int GuiTreeViewCtrl::getParent ( TreeItemId  item  ) 
int GuiTreeViewCtrl::getPrevSibling ( TreeItemId  item  ) 
int GuiTreeViewCtrl::getSelectedItem ( int  index = 0  ) 

Return the selected item at the given index.

int GuiTreeViewCtrl::getSelectedObject ( int  index = 0  ) 

Return the currently selected SimObject at the given index in inspector mode or -1.

string GuiTreeViewCtrl::getTextToRoot ( TreeItemId  item,
Delimiter  = none 
)

gets the text from the current node to the root, concatenating at each branch upward, with a specified delimiter optionally

bool GuiTreeViewCtrl::handleRenameObject ( string  newName,
SimObject  object 
)
void GuiTreeViewCtrl::hideSelection ( bool  state = true  ) 

Call SimObject::setHidden( state ) on all objects in the current selection.

Parameters:
state Visibility state to set objects in selection to.
int GuiTreeViewCtrl::insertItem ( int  parentId,
string  text,
string  value = "",
string  icon = "",
int  normalImage = 0,
int  expandedImage = 0 
)

Add a new item to the tree.

Parameters:
parentId Item ID of parent to which to add the item as a child. 0 is root item.
text Text to display on the item in the tree.
value Behind-the-scenes value of the item.
icon 
normalImage 
expandedImage 
Returns:
The ID of the newly added item.
bool GuiTreeViewCtrl::isItemSelected ( int  id  ) 

Check whether the given item is currently selected in the tree.

Parameters:
id Item/object ID.
Returns:
True if the given item/object is currently selected in the tree.
bool GuiTreeViewCtrl::isParentItem ( int  id  ) 

Returns true if the given item contains child items.

bool GuiTreeViewCtrl::isValidDragTarget ( int  id,
string  value 
)
void GuiTreeViewCtrl::lockSelection ( bool  lock = true  ) 

Set whether the current selection can be changed by the user or not.

Parameters:
lock If true, the current selection is frozen and cannot be changed. If false, the selection may be modified.
bool GuiTreeViewCtrl::markItem ( TreeItemId  item,
bool  mark = true 
)
void GuiTreeViewCtrl::moveItemDown ( TreeItemId  item  ) 
void GuiTreeViewCtrl::moveItemUp ( TreeItemId  item  ) 
void GuiTreeViewCtrl::onAddGroupSelected ( SimGroup  group  ) 
void GuiTreeViewCtrl::onAddMultipleSelectionBegin (  ) 
void GuiTreeViewCtrl::onAddMultipleSelectionEnd (  ) 
void GuiTreeViewCtrl::onAddSelection ( int  itemOrObjectId,
bool  isLastSelection 
)
void GuiTreeViewCtrl::onBeginReparenting (  ) 
void GuiTreeViewCtrl::onClearSelection (  ) 
void GuiTreeViewCtrl::onDefineIcons (  ) 
bool GuiTreeViewCtrl::onDeleteObject ( SimObject  object  ) 
void GuiTreeViewCtrl::onDeleteSelection (  ) 
void GuiTreeViewCtrl::onDragDropped (  ) 
void GuiTreeViewCtrl::onEndReparenting (  ) 
void GuiTreeViewCtrl::onInspect ( int  itemOrObjectId  ) 
void GuiTreeViewCtrl::onKeyDown ( int  modifier,
int  keyCode 
)
void GuiTreeViewCtrl::onMouseDragged (  ) 
void GuiTreeViewCtrl::onMouseUp ( int  hitItemId,
int  mouseClickCount 
)
void GuiTreeViewCtrl::onObjectDeleteCompleted (  ) 
void GuiTreeViewCtrl::onRemoveSelection ( int  itemOrObjectId  ) 
void GuiTreeViewCtrl::onReparent ( int  itemOrObjectId,
int  oldParentItemOrObjectId,
int  newParentItemOrObjectId 
)
void GuiTreeViewCtrl::onRightMouseDown ( int  itemId,
Point2I  mousePos,
SimObject  object 
)
void GuiTreeViewCtrl::onRightMouseUp ( int  itemId,
Point2I  mousePos,
SimObject  object 
)
void GuiTreeViewCtrl::onSelect ( int  itemOrObjectId  ) 
void GuiTreeViewCtrl::onUnselect ( int  itemOrObjectId  ) 
void GuiTreeViewCtrl::open ( SimSet  obj,
bool  okToEdit = true 
)

Set the root of the tree view to the specified object, or to the root set.

bool GuiTreeViewCtrl::removeItem ( TreeItemId  item  ) 
void GuiTreeViewCtrl::removeSelection ( deselects an  item  ) 
void GuiTreeViewCtrl::scrollVisible ( TreeItemId  item  ) 
int GuiTreeViewCtrl::scrollVisibleByObjectId ( show item by object id.returns true if  sucessful.  ) 
bool GuiTreeViewCtrl::selectItem ( TreeItemId  item,
bool  select = true 
)
void GuiTreeViewCtrl::setDebug ( bool  value = true  ) 

Enable/disable debug output.

void GuiTreeViewCtrl::setFilterText ( string  pattern  ) 

Set the pattern by which to filter items in the tree. Only items in the tree whose text matches this pattern are displayed.

Parameters:
pattern New pattern based on which visible items in the tree should be filtered. If empty, all items become visible.
See also:
getFilterText
clearFilterText
void GuiTreeViewCtrl::setItemImages ( int  id,
int  normalImage,
int  expandedImage 
)

Sets the normal and expanded images to show for the given item.

void GuiTreeViewCtrl::setItemTooltip ( int  id,
string  text 
)

Set the tooltip to show for the given item.

void GuiTreeViewCtrl::showItemRenameCtrl ( TreeItemId  id  ) 

Show the rename text field for the given item (only one at a time).

void GuiTreeViewCtrl::sort ( int  parent,
bool  traverseHierarchy = false,
bool  parentsFirst = false,
bool  caseSensitive = true 
)

Sorts all items of the given parent (or root). With 'hierarchy', traverses hierarchy.

void GuiTreeViewCtrl::toggleHideSelection (  ) 

Toggle the hidden state of all objects in the current selection.

void GuiTreeViewCtrl::toggleLockSelection (  ) 

Toggle the locked state of all objects in the current selection.


Member Data Documentation

addChildSelectionByValue(TreeItemId parent, value)

Build the visible tree.

For internal use.

If true clicking on a selected item ( that is an object and not the root ) will allow you to rename it.

If true, the entire tree item hierarchy is deleted when the control goes to sleep.

Get id for root item.

returns a space seperated list of mulitple item ids

Returns a space sperated list of all selected object ids.

If true, multiple items can be selected concurrently.

For internal use.

removeAllChildren(TreeItemId parent)

removeChildSelectionByValue(TreeItemId parent, value)

If true then object renaming operates on the internalName rather than the object name.

If true, class names will be used as object names for unnamed objects.

If true, item text labels for objects will include class names.

If true, item text labels for obje ts will include internal names.

If true, item text labels for objects will include object IDs.

If true, item text labels for objects will include object names.

If true, the root item is shown in the tree.



Copyright © GarageGames, LLC. All Rights Reserved.