GuiTreeViewCtrl¶
Hierarchical list of text items with optional icons.
- Inherit:
- GuiArrayCtrl
Description¶
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:
newGuiTreeViewCtrl(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";
};
Methods¶
-
void
GuiTreeViewCtrl::
addSelection
(int id, bool isLastSelection)¶ 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.
-
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)¶
-
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: .
-
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
(int id)¶ 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.
-
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)¶ Return the selected item at the given index.
-
int
GuiTreeViewCtrl::
getSelectedObject
(int index)¶ 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)¶ 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, int expandedImage)¶ 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)¶ 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)¶
-
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)¶ 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
(int id)¶ Show item by object id.returns true if sucessful.
-
bool
GuiTreeViewCtrl::
selectItem
(TreeItemId item, bool select)¶
-
void
GuiTreeViewCtrl::
setDebug
(bool value)¶ 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.
-
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, bool parentsFirst, bool caseSensitive)¶ 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.
Fields¶
-
void
GuiTreeViewCtrl::
addChildSelectionByValue
¶ addChildSelectionByValue(TreeItemId parent, value)
-
void
GuiTreeViewCtrl::
buildVisibleTree
¶ Build the visible tree.
-
void
GuiTreeViewCtrl::
cancelRename
¶ For internal use.
-
bool
GuiTreeViewCtrl::
canRenameObjects
¶ If true clicking on a selected item ( that is an object and not the root ) will allow you to rename it.
-
bool
GuiTreeViewCtrl::
clearAllOnSingleSelection
¶
-
bool
GuiTreeViewCtrl::
compareToObjectID
¶
-
bool
GuiTreeViewCtrl::
deleteObjectAllowed
¶
-
bool
GuiTreeViewCtrl::
destroyTreeOnSleep
¶ If true, the entire tree item hierarchy is deleted when the control goes to sleep.
-
bool
GuiTreeViewCtrl::
dragToItemAllowed
¶
-
bool
GuiTreeViewCtrl::
fullRowSelect
¶
-
int
GuiTreeViewCtrl::
getFirstRootItem
¶ Get id for root item.
-
int
GuiTreeViewCtrl::
getItemCount
¶
-
string
GuiTreeViewCtrl::
getSelectedItemList
¶ returns a space seperated list of mulitple item ids
-
int
GuiTreeViewCtrl::
getSelectedItemsCount
¶
-
string
GuiTreeViewCtrl::
getSelectedObjectList
¶ Returns a space sperated list of all selected object ids.
-
int
GuiTreeViewCtrl::
itemHeight
¶
-
bool
GuiTreeViewCtrl::
mouseDragging
¶
-
bool
GuiTreeViewCtrl::
multipleSelections
¶ If true, multiple items can be selected concurrently.
-
void
GuiTreeViewCtrl::
onRenameValidate
¶ For internal use.
-
void
GuiTreeViewCtrl::
removeAllChildren
¶ removeAllChildren(TreeItemId parent)
-
void
GuiTreeViewCtrl::
removeChildSelectionByValue
¶ removeChildSelectionByValue(TreeItemId parent, value)
-
bool
GuiTreeViewCtrl::
renameInternal
¶ If true then object renaming operates on the internalName rather than the object name.
-
bool
GuiTreeViewCtrl::
showClassNameForUnnamedObjects
¶ If true, class names will be used as object names for unnamed objects.
-
bool
GuiTreeViewCtrl::
showClassNames
¶ If true, item text labels for objects will include class names.
-
bool
GuiTreeViewCtrl::
showInternalNames
¶ If true, item text labels for obje ts will include internal names.
-
bool
GuiTreeViewCtrl::
showObjectIds
¶ If true, item text labels for objects will include object IDs.
-
bool
GuiTreeViewCtrl::
showObjectNames
¶ If true, item text labels for objects will include object names.
-
bool
GuiTreeViewCtrl::
showRoot
¶ If true, the root item is shown in the tree.
-
int
GuiTreeViewCtrl::
tabSize
¶
-
int
GuiTreeViewCtrl::
textOffset
¶
-
bool
GuiTreeViewCtrl::
tooltipOnWidthOnly
¶
-
bool
GuiTreeViewCtrl::
useInspectorTooltips
¶