GuiTreeViewCtrl
Engine/source/gui/controls/guiTreeViewCtrl.h
Classes:
Enums
TreeState { RebuildVisible = BIT(0) IsInspector = BIT(1) IsEditable = BIT(2) ShowTreeLines = BIT(3) BuildingVisTree = BIT(4) }
_Anonymous_ { MaxIcons = 32 }
Icons { Default1 = 0 SimGroup1 SimGroup2 SimGroup3 SimGroup4 Hidden Lock1 Lock2 Default Icon31 Icon32 }
mDragMidPointFlags { NomDragMidPoint AbovemDragMidPoint BelowmDragMidPoint }
HitFlags { OnIndent = BIT(0) OnImage = BIT(1) OnIcon = BIT(2) OnText = BIT(3) OnRow = BIT(4) }
BmpIndices { BmpFirstChild BmpLastChild BmpChild BmpExp BmpExpN BmpExpP BmpExpPN BmpCon BmpConN BmpConP BmpConPN BmpLine BmpGlow }
Callbacks
DECLARE_CALLBACK(bool , onDeleteObject , (SimObject *object) )
DECLARE_CALLBACK(bool , isValidDragTarget , (S32 id, const char *value) )
DECLARE_CALLBACK(void , onDefineIcons , () )
DECLARE_CALLBACK(void , onAddGroupSelected , (SimGroup *group) )
DECLARE_CALLBACK(void , onAddSelection , (S32 itemOrObjectId, bool isLastSelection) )
DECLARE_CALLBACK(void , onSelect , (S32 itemOrObjectId) )
DECLARE_CALLBACK(void , onInspect , (S32 itemOrObjectId) )
DECLARE_CALLBACK(void , onRemoveSelection , (S32 itemOrObjectId) )
DECLARE_CALLBACK(void , onUnselect , (S32 itemOrObjectId) )
DECLARE_CALLBACK(void , onDeleteSelection , () )
DECLARE_CALLBACK(void , onObjectDeleteCompleted , () )
DECLARE_CALLBACK(void , onKeyDown , (S32 modifier, S32 keyCode) )
DECLARE_CALLBACK(void , onMouseUp , (S32 hitItemId, S32 mouseClickCount) )
DECLARE_CALLBACK(void , onMouseDragged , () )
DECLARE_CALLBACK(void , onRightMouseDown , (S32 itemId, const Point2I &mousePos, SimObject *object=<a href="/coding/file/typesx86unix_8h/#typesx86unix_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>) )
DECLARE_CALLBACK(void , onRightMouseUp , (S32 itemId, const Point2I &mousePos, SimObject *object=<a href="/coding/file/typesx86unix_8h/#typesx86unix_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>) )
DECLARE_CALLBACK(void , onBeginReparenting , () )
DECLARE_CALLBACK(void , onEndReparenting , () )
DECLARE_CALLBACK(void , onReparent , (S32 itemOrObjectId, S32 oldParentItemOrObjectId, S32 newParentItemOrObjectId) )
DECLARE_CALLBACK(void , onDragDropped , () )
DECLARE_CALLBACK(void , onAddMultipleSelectionBegin , () )
DECLARE_CALLBACK(void , onAddMultipleSelectionEnd , () )
DECLARE_CALLBACK(bool , canRenameObject , (SimObject *object) )
DECLARE_CALLBACK(bool , handleRenameObject , (const char *newName, SimObject *object) )
DECLARE_CALLBACK(void , onClearSelection , () )
Filtering
Get the current filter expression.
setFilterText(const String & text)
Set the pattern by which to filter items in the tree.
setFilterChildren(bool doFilter)
setItemFilterException(U32 item, bool isExempt)
setItemHidden(U32 item, bool isHidden)
Clear the current item filtering pattern.
reparentItems(Vector< Item * > selectedItems, Item * newParent)
getTabLevel(S32 itemId)
Private Types
Parent
Public Friends
class
Protected Attributes
bool
If true clicking on a selected item ( that is an object ) will allow you to rename it.
bool
When clicking on an already selected item, clear all other selections.
bool
bool
If true, a trace of actions taken by the control is logged to the console.
bool
bool
bool
If true, all items are filtered. If false, then children of items that successfully pass filter are not filtered.
bool
Current filter that determines which items in the tree are displayed and which are hidden.
bool
mIconTable [MaxIcons]
Item *
We do our own free list, as we we want to be able to recycle item ids and do some other clever things.
bool
bool
bool
If true then object renaming operates on the internalName rather than the object name.
Used for tracking stuff that was selected, but may not have been created at time of selection.
bool
If true, class names will be used as object names for unnamed objects.
bool
If true, class names will be included in inspector tree item labels.
bool
If true, internal names will be included in inspector tree item labels.
bool
If true, object IDs will be included in inspector tree item labels.
bool
If true, object names will be included in inspector tree item labels.
bool
Used to hide the root tree element, defaults to true.
bool
If true then only render item tooltips if the item extends past the displayable width.
bool
If true then tooltips will be automatically generated for all Inspector items.
Protected Functions
_buildItem(Item * item, U32 tabLevel, bool bForceFullUpdate, bool skipFlter)
_deleteItem(Item * item)
_destroyChildren(Item * item, Item * parent, bool deleteObjects)
_destroyItem(Item * item, bool deleteObject)
_expandObjectHierarchy(SimGroup * group)
Item *
_findItemByAmbiguousId(S32 itemOrObjectId, bool buildVirtual)
bool
_isRootLevelItem(Item * item)
_onInspectorSetObjectModified(SetModification modification, SimSet * set, SimObject * object)
For inspector tree views, this is hooked to the SetModificationSignal of sets so that the tree view knows when it needs to refresh.
Item *
addInspectorDataItem(Item * parent, SimObject * obj)
getInspectorItemIconsWidth(Item *& item)
bool
isValidDragTarget(Item * item)
onItemSelected(Item * item)
onRemoveSelection(Item * item)
bool
onVirtualParentBuild(Item * item, bool bForceFullUpdate)
bool
onVirtualParentCollapse(Item * item)
bool
onVirtualParentExpand(Item * item)
Public Functions
addSelection(S32 itemId, bool update, bool isLastSelection)
bool
buildIconTable(const char * icons)
buildVisibleTree(bool bForceFullUpdate)
bool
canAddSelection(Item * item)
bool
childSearch(Item * item, SimObject * obj, bool yourBaby)
Returns false if the object is a child of one of the inner items.
Item *
createItem(S32 icon)
DECLARE_CATEGORY("Gui Lists" )
DECLARE_DESCRIPTION("Hierarchical list of text items with optional icons.\nCan also be used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> inspect <a href="/coding/class/classsimobject/">SimObject</a> hierarchies." )
findItemByName(const char * name)
findItemByObjectId(S32 iObjId)
findItemByValue(const char * name)
getChildItem(S32 itemId)
getItemAtPosition(Point2I position)
getItemObject(S32 itemId)
const char *
getItemText(S32 itemId)
const char *
getItemValue(S32 itemId)
getNextSiblingItem(S32 itemId)
getParentItem(S32 itemId)
getPrevSiblingItem(S32 itemId)
Item *
getSelectedItem(S32 index)
const char *
getTextToRoot(S32 itemId, const char * delimiter)
hideSelection(bool hide)
insertObject(S32 parentId, SimObject * obj, bool okToEdit)
inspectObject(SimObject * obj, bool okToEdit)
inspectorSearch(Item * item, Item * parent, SimSet * parentSet, SimSet * newParentSet)
Find immediately available inspector items (eg ones that aren't children of other inspector items) and then update their sets.
bool
isItemSelected(S32 itemId)
bool
isSelected(Item * item)
bool
isSelected(S32 itemId)
lockSelection(bool lock)
moveItemDown(S32 itemId)
moveItemUp(S32 itemId)
bool
objectSearch(const SimObject * object, Item ** item)
Find the Item associated with a sceneObject, returns true if it found one.
bool
onAdd()
Called when this object is added to the scene.
onMiddleMouseDown(const GuiEvent & event)
onMouseDown(const GuiEvent & event)
onMouseDragged(const GuiEvent & event)
onMouseEnter(const GuiEvent & event)
onMouseLeave(const GuiEvent & event)
onMouseMove(const GuiEvent & event)
Do special pre-render processing.
onRenderCell(Point2I offset, Point2I cell, bool , bool )
onRightMouseDown(const GuiEvent & event)
onRightMouseUp(const GuiEvent & event)
bool
onWake()
Called when this object is asked to wake up returns true if it's actually awake at the end.
removeAllChildren(S32 itemId)
bool
removeItem(S32 itemId, bool deleteObjects)
removeSelection(S32 itemId)
Should use addSelection and removeSelection when calling from script instead of setItemSelected.
bool
scrollVisible(Item * item)
bool
scrollVisible(S32 itemId)
bool
scrollVisibleByObjectId(S32 objID)
bool
setAddGroup(SimObject * obj)
bool
setItemExpanded(S32 itemId, bool expand)
bool
setItemSelected(S32 itemId, bool select)
Sets the flag of the item with the matching itemId.
bool
setItemValue(S32 itemId, StringTableEntry Value)
showItemRenameCtrl(Item * item)
Used for syncing the mSelected and mSelectedItems lists.
unlinkItem(Item * item)
Public Static Functions
Detailed Description
Enums
TreeState
Enumerator
- RebuildVisible = BIT(0)
Temporary flag, we have to rebuild the tree.
- IsInspector = BIT(1)
We are mapping a SimObject hierarchy.
- IsEditable = BIT(2)
We allow items to be moved around.
- ShowTreeLines = BIT(3)
Should we render tree lines or just icons?
- BuildingVisTree = BIT(4)
We are currently building the visible tree (prevent recursion)
@100
Enumerator
- MaxIcons = 32
Icons
Enumerator
- Default1 = 0
- SimGroup1
- SimGroup2
- SimGroup3
- SimGroup4
- Hidden
- Lock1
- Lock2
- Default
- Icon31
- Icon32
mDragMidPointFlags
Enumerator
- NomDragMidPoint
- AbovemDragMidPoint
- BelowmDragMidPoint
HitFlags
Enumerator
- OnIndent = BIT(0)
- OnImage = BIT(1)
- OnIcon = BIT(2)
- OnText = BIT(3)
- OnRow = BIT(4)
BmpIndices
Enumerator
- BmpFirstChild
- BmpLastChild
- BmpChild
- BmpExp
- BmpExpN
- BmpExpP
- BmpExpPN
- BmpCon
- BmpConN
- BmpConP
- BmpConPN
- BmpLine
- BmpGlow
Callbacks
DECLARE_CALLBACK(bool , onDeleteObject , (SimObject *object) )
DECLARE_CALLBACK(bool , isValidDragTarget , (S32 id, const char *value) )
DECLARE_CALLBACK(void , onDefineIcons , () )
DECLARE_CALLBACK(void , onAddGroupSelected , (SimGroup *group) )
DECLARE_CALLBACK(void , onAddSelection , (S32 itemOrObjectId, bool isLastSelection) )
DECLARE_CALLBACK(void , onSelect , (S32 itemOrObjectId) )
DECLARE_CALLBACK(void , onInspect , (S32 itemOrObjectId) )
DECLARE_CALLBACK(void , onRemoveSelection , (S32 itemOrObjectId) )
DECLARE_CALLBACK(void , onUnselect , (S32 itemOrObjectId) )
DECLARE_CALLBACK(void , onDeleteSelection , () )
DECLARE_CALLBACK(void , onObjectDeleteCompleted , () )
DECLARE_CALLBACK(void , onKeyDown , (S32 modifier, S32 keyCode) )
DECLARE_CALLBACK(void , onMouseUp , (S32 hitItemId, S32 mouseClickCount) )
DECLARE_CALLBACK(void , onMouseDragged , () )
DECLARE_CALLBACK(void , onRightMouseDown , (S32 itemId, const Point2I &mousePos, SimObject *object=<a href="/coding/file/typesx86unix_8h/#typesx86unix_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>) )
DECLARE_CALLBACK(void , onRightMouseUp , (S32 itemId, const Point2I &mousePos, SimObject *object=<a href="/coding/file/typesx86unix_8h/#typesx86unix_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>) )
DECLARE_CALLBACK(void , onBeginReparenting , () )
DECLARE_CALLBACK(void , onEndReparenting , () )
DECLARE_CALLBACK(void , onReparent , (S32 itemOrObjectId, S32 oldParentItemOrObjectId, S32 newParentItemOrObjectId) )
DECLARE_CALLBACK(void , onDragDropped , () )
DECLARE_CALLBACK(void , onAddMultipleSelectionBegin , () )
DECLARE_CALLBACK(void , onAddMultipleSelectionEnd , () )
DECLARE_CALLBACK(bool , canRenameObject , (SimObject *object) )
DECLARE_CALLBACK(bool , handleRenameObject , (const char *newName, SimObject *object) )
DECLARE_CALLBACK(void , onClearSelection , () )
Filtering
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.
setFilterText(const String & text)
Set the pattern by which to filter items in the tree.
Only items in the tree whose text matches this pattern are displayed.
setFilterChildren(bool doFilter)
setItemFilterException(U32 item, bool isExempt)
setItemHidden(U32 item, bool isHidden)
clearHiddenItems()
clearFilterText()
Clear the current item filtering pattern.
reparentItems(Vector< Item * > selectedItems, Item * newParent)
getTabLevel(S32 itemId)
Private Types
typedef GuiArrayCtrl Parent
Public Friends
Protected Attributes
ColorI mAltFontColor
ColorI mAltFontColorHL
ColorI mAltFontColorSE
StringTableEntry mBitmapBase
bool mCanRenameObjects
If true clicking on a selected item ( that is an object ) will allow you to rename it.
bool mClearAllOnSingleSelection
When clicking on an already selected item, clear all other selections.
bool mCompareToObjectID
S32 mCurrentDragCell
bool mDebug
If true, a trace of actions taken by the control is logged to the console.
Can be turned on with the setDebug() script method.
bool mDeleteObjectAllowed
bool mDestroyOnSleep
bool mDoFilterChildren
If true, all items are filtered. If false, then children of items that successfully pass filter are not filtered.
S32 mDraggedToItem
S32 mDragMidPoint
bool mDragStartInSelection
bool mDragToItemAllowed
String mFilterText
Current filter that determines which items in the tree are displayed and which are hidden.
BitSet32 mFlags
A combination of TreeState flags.
bool mFullRowSelect
Vector< U32 > mHiddenItemsList
GFXTexHandle mIconTable [MaxIcons]
S32 mItemCount
Vector< U32 > mItemFilterExceptionList
Item * mItemFreeList
We do our own free list, as we we want to be able to recycle item ids and do some other clever things.
S32 mItemHeight
Vector< Item * > mItems
S32 mMaxWidth
Point2I mMouseDownPoint
bool mMouseDragged
bool mMultipleSelections
Item * mPossibleRenameItem
S32 mPreviousDragCell
GuiTextEditCtrl * mRenameCtrl
bool mRenameInternal
If true then object renaming operates on the internalName rather than the object name.
Item * mRenamingItem
Item * mRoot
SimObjectPtr< SimObject > mRootObject
Vector< S32 > mSelected
Used for tracking stuff that was selected, but may not have been created at time of selection.
S32 mSelectedItem
Vector< Item * > mSelectedItems
bool mShowClassNameForUnnamedObjects
If true, class names will be used as object names for unnamed objects.
bool mShowClassNames
If true, class names will be included in inspector tree item labels.
bool mShowInternalNames
If true, internal names will be included in inspector tree item labels.
bool mShowObjectIds
If true, object IDs will be included in inspector tree item labels.
bool mShowObjectNames
If true, object names will be included in inspector tree item labels.
bool mShowRoot
Used to hide the root tree element, defaults to true.
S32 mStart
bool mSupportMouseDragging
S32 mTabSize
Item * mTempItem
GFXTexHandle mTexRollover
GFXTexHandle mTexSelected
S32 mTextOffset
bool mTooltipOnWidthOnly
If true then only render item tooltips if the item extends past the displayable width.
bool mUseInspectorTooltips
If true then tooltips will be automatically generated for all Inspector items.
Vector< Item * > mVisibleItems
Protected Functions
_buildItem(Item * item, U32 tabLevel, bool bForceFullUpdate, bool skipFlter)
_deleteItem(Item * item)
_destroyChildren(Item * item, Item * parent, bool deleteObjects)
_destroyItem(Item * item, bool deleteObject)
_destroyTree()
_expandObjectHierarchy(SimGroup * group)
_findItemByAmbiguousId(S32 itemOrObjectId, bool buildVirtual)
_hitTest(const Point2I & pnt, Item *& item, BitSet32 & flags)
_isRootLevelItem(Item * item)
_onInspectorSetObjectModified(SetModification modification, SimSet * set, SimObject * object)
For inspector tree views, this is hooked to the SetModificationSignal of sets so that the tree view knows when it needs to refresh.
addInspectorDataItem(Item * parent, SimObject * obj)
getInspectorItemIconsWidth(Item *& item)
isValidDragTarget(Item * item)
onClearSelection()
onItemSelected(Item * item)
Reimplemented by: GuiFileTreeCtrl
onRemoveSelection(Item * item)
onVirtualParentBuild(Item * item, bool bForceFullUpdate)
onVirtualParentCollapse(Item * item)
onVirtualParentExpand(Item * item)
Reimplemented by: GuiFileTreeCtrl
Public Functions
GuiTreeViewCtrl()
~GuiTreeViewCtrl()
addSelection(S32 itemId, bool update, bool isLastSelection)
buildIconTable(const char * icons)
buildVisibleTree(bool bForceFullUpdate)
canAddSelection(Item * item)
cancelRename()
childSearch(Item * item, SimObject * obj, bool yourBaby)
Returns false if the object is a child of one of the inner items.
clearSelection()
createItem(S32 icon)
DECLARE_CATEGORY("Gui Lists" )
DECLARE_CONOBJECT(GuiTreeViewCtrl )
DECLARE_DESCRIPTION("Hierarchical list of text items with optional icons.\nCan also be used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> inspect <a href="/coding/class/classsimobject/">SimObject</a> hierarchies." )
deleteSelection()
editItem(S32 itemId, const char * newText, const char * newValue)
findItemByName(const char * name)
findItemByObjectId(S32 iObjId)
findItemByValue(const char * name)
getChildItem(S32 itemId)
getFirstRootItem()
getIcon(const char * iconString)
getItem(S32 itemId)
getItemAtPosition(Point2I position)
getItemCount()
getItemObject(S32 itemId)
getItems()
getItemText(S32 itemId)
getItemValue(S32 itemId)
getNextSiblingItem(S32 itemId)
getParentItem(S32 itemId)
getPrevSiblingItem(S32 itemId)
getRootItem()
getSelected()
getSelectedItem()
getSelectedItem(S32 index)
getSelectedItems()
getSelectedItemsCount()
getSelectedObjectList()
getTextToRoot(S32 itemId, const char * delimiter)
hideSelection(bool hide)
insertItem(S32 parentId, const char * text, const char * value, const char * iconString, S16 normalImage, S16 expandedImage)
insertObject(S32 parentId, SimObject * obj, bool okToEdit)
inspectObject(SimObject * obj, bool okToEdit)
inspectorSearch(Item * item, Item * parent, SimSet * parentSet, SimSet * newParentSet)
Find immediately available inspector items (eg ones that aren't children of other inspector items) and then update their sets.
isItemSelected(S32 itemId)
isSelected(Item * item)
isSelected(S32 itemId)
lockSelection(bool lock)
markItem(S32 itemId, bool mark)
moveItemDown(S32 itemId)
moveItemUp(S32 itemId)
objectSearch(const SimObject * object, Item ** item)
Find the Item associated with a sceneObject, returns true if it found one.
onAdd()
Reimplemented from: GuiControl
onKeyDown(const GuiEvent & event)
Reimplemented from: GuiControl
onMiddleMouseDown(const GuiEvent & event)
Reimplemented from: GuiControl
onMouseDown(const GuiEvent & event)
Reimplemented from: GuiControl
onMouseDragged(const GuiEvent & event)
Reimplemented from: GuiControl
onMouseEnter(const GuiEvent & event)
Reimplemented from: GuiControl
onMouseLeave(const GuiEvent & event)
Reimplemented from: GuiControl
onMouseMove(const GuiEvent & event)
Reimplemented from: GuiControl
onMouseUp(const GuiEvent & event)
Reimplemented from: GuiControl
onPreRender()
Reimplemented from: GuiControl
onRenameValidate()
onRender(Point2I offset, const RectI & updateRect)
Reimplemented from: GuiControl
onRenderCell(Point2I offset, Point2I cell, bool , bool )
Reimplemented from: GuiArrayCtrl
onRightMouseDown(const GuiEvent & event)
Reimplemented from: GuiControl
onRightMouseUp(const GuiEvent & event)
Reimplemented from: GuiControl
onSleep()
Reimplemented from: GuiControl
onWake()
Reimplemented from: GuiControl
removeAllChildren(S32 itemId)
removeItem(S32 itemId, bool deleteObjects)
removeSelection(S32 itemId)
Should use addSelection and removeSelection when calling from script instead of setItemSelected.
Use setItemSelected when you want to select something in the treeview as it has script call backs.
renderTooltip(const Point2I & hoverPos, const Point2I & cursorPos, const char * tipText)
scrollVisible(Item * item)
scrollVisible(S32 itemId)
scrollVisibleByObjectId(S32 objID)
setAddGroup(SimObject * obj)
setDebug(bool value)
setItemExpanded(S32 itemId, bool expand)
setItemSelected(S32 itemId, bool select)
Sets the flag of the item with the matching itemId.
setItemValue(S32 itemId, StringTableEntry Value)
showItemRenameCtrl(Item * item)
sortTree(bool caseSensitive, bool traverseHierarchy, bool parentsFirst)
syncSelection()
Used for syncing the mSelected and mSelectedItems lists.
toggleHideSelection()
toggleLockSelection()
unlinkItem(Item * item)