guiTreeViewCtrl.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2012 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. #ifndef _GUI_TREEVIEWCTRL_H
  23. #define _GUI_TREEVIEWCTRL_H
  24. #include "core/bitSet.h"
  25. #include "math/mRect.h"
  26. #include "gfx/gFont.h"
  27. #include "gui/core/guiControl.h"
  28. #include "gui/core/guiArrayCtrl.h"
  29. class GuiTextEditCtrl;
  30. //------------------------------------------------------------------------------
  31. class GuiTreeViewCtrl : public GuiArrayCtrl
  32. {
  33. private:
  34. typedef GuiArrayCtrl Parent;
  35. public:
  36. /// @section GuiControl_Intro Introduction
  37. /// @nosubgrouping
  38. ///
  39. class Item
  40. {
  41. public:
  42. enum ItemState
  43. {
  44. Selected = BIT( 0 ),
  45. Expanded = BIT( 1 ),
  46. Marked = BIT( 2 ), ///< Marked items are drawn with a border around them. This is
  47. /// different than "Selected" because it can only be set by script.
  48. Filtered = BIT( 3 ), ///< Whether the item is currently filtered out.
  49. MouseOverBmp = BIT( 4 ),
  50. MouseOverText = BIT( 5 ),
  51. MouseOverIcon = BIT( 6 ),
  52. InspectorData = BIT( 7 ), ///< Set if we're representing some inspector
  53. /// info (ie, use mInspectorInfo, not mScriptInfo)
  54. VirtualParent = BIT( 8 ), ///< This indicates that we should be rendered as
  55. /// a parent even though we don't have any children.
  56. /// This is useful for preventing scenarios where
  57. /// we might want to create thousands of
  58. /// Items that might never be shown (for instance
  59. /// if we're browsing the object hierarchy in
  60. /// Torque, which might have thousands of objects).
  61. RebuildVisited = BIT( 9 ), ///< Rebuild traversal for virtual parents has visited and validated this item.
  62. ShowObjectId = BIT( 10 ),
  63. ShowClassName = BIT( 11 ),
  64. ShowObjectName = BIT( 12 ),
  65. ShowInternalName = BIT( 13 ),
  66. ShowClassNameForUnnamed = BIT( 14 ),
  67. ForceItemName = BIT(15),
  68. ForceDragTarget = BIT(16),
  69. DenyDrag = BIT(17),
  70. };
  71. GuiTreeViewCtrl* mParentControl;
  72. BitSet32 mState;
  73. SimObjectPtr< GuiControlProfile > mProfile;
  74. S16 mId;
  75. U16 mTabLevel;
  76. Item* mParent;
  77. Item* mChild;
  78. Item* mNext;
  79. Item* mPrevious;
  80. String mTooltip;
  81. S32 mIcon; //stores the icon that will represent the item in the tree
  82. S32 mDataRenderWidth; /// this stores the pixel width needed
  83. /// to render the item's data in the
  84. /// onRenderCell function to optimize
  85. /// for speed.
  86. Item( GuiTreeViewCtrl* parent, GuiControlProfile *pProfile );
  87. ~Item();
  88. struct ScriptTag
  89. {
  90. S8 mNormalImage;
  91. S8 mExpandedImage;
  92. StringTableEntry mText;
  93. StringTableEntry mValue;
  94. } mScriptInfo;
  95. struct InspectorTag
  96. {
  97. SimObjectPtr<SimObject> mObject;
  98. } mInspectorInfo;
  99. /// @name Get Methods
  100. /// @{
  101. ///
  102. S8 getNormalImage() const;
  103. S8 getExpandedImage() const;
  104. StringTableEntry getText();
  105. StringTableEntry getValue();
  106. inline const S16 getID() const { return mId; };
  107. SimObject *getObject();
  108. U32 getDisplayTextLength();
  109. S32 getDisplayTextWidth(GFont *font);
  110. void getDisplayText(U32 bufLen, char *buf);
  111. bool hasObjectBasedTooltip();
  112. void getTooltipText(U32 bufLen, char *buf);
  113. /// @}
  114. /// @name Set Methods
  115. /// @{
  116. /// Set whether an item is expanded or not (showing children or having them hidden)
  117. void setExpanded( const bool f = true );
  118. /// Set the image to display when an item IS expanded
  119. void setExpandedImage(const S8 id);
  120. /// Set the image to display when an item is NOT expanded
  121. void setNormalImage(const S8 id);
  122. /// Assign a SimObject pointer to an inspector data item
  123. void setObject(SimObject *obj);
  124. /// Set the items displayable text (caption)
  125. void setText(StringTableEntry txt);
  126. /// Set the items script value (data)
  127. void setValue(StringTableEntry val);
  128. /// Set the items virtual parent flag
  129. void setVirtualParent( bool value );
  130. /// Set whether the item is filtered out or not.
  131. void setFiltered( bool value ) { mState.set( Filtered ); }
  132. /// @}
  133. /// @name State Retrieval
  134. /// @{
  135. /// Returns true if this item is expanded. For
  136. /// inspector objects, the expansion is stored
  137. /// on the SimObject, for other things we use our
  138. /// bit vector.
  139. bool isExpanded() const;
  140. /// Return whether the item is current filtered out or not.
  141. /// @note Parent items may be filtered and yet still be visible if they have
  142. /// children that are not filtered.
  143. bool isFiltered() const { return mState.test( Filtered ); }
  144. /// Returns true if an item is inspector data
  145. /// or false if it's just an item.
  146. bool isInspectorData() const { return mState.test(InspectorData); };
  147. /// Returns true if we've been manually set to allow dragging overrides.
  148. /// As it's a manually set flag, by default it is false.
  149. bool isDragTargetAllowed() const { return mState.test(ForceDragTarget); };
  150. /// Returns true if we've been manually set to allow dragging overrides.
  151. /// As it's a manually set flag, by default it is false.
  152. bool isDragAllowed() const { return !mState.test(DenyDrag); };
  153. /// Returns true if we should show the expand art
  154. /// and make the item interact with the mouse as if
  155. /// it were a parent.
  156. bool isParent() const;
  157. /// Return true if text label for inspector item should include internal name only.
  158. bool showInternalNameOnly() const { return mState.test( ShowInternalName ) && !mState.test( ShowObjectName | ShowClassName | ShowObjectId ); }
  159. /// Return true if text label for inspector item should include object name only.
  160. bool showObjectNameOnly() const { return mState.test( ShowObjectName ) && !mState.test( ShowInternalName | ShowClassName | ShowObjectId ); }
  161. /// @}
  162. /// @name Searching Methods
  163. /// @{
  164. /// Find a regular data item by it's script name.
  165. Item* findChildByName( const char* name );
  166. /// Find an inspector data item by it's SimObject pointer
  167. Item* findChildByValue(const SimObject *obj);
  168. /// Find a regular data item by it's script value
  169. Item* findChildByValue(StringTableEntry Value);
  170. /// @}
  171. /// Sort the childs of the item by their text.
  172. ///
  173. /// @param caseSensitive If true, sorting is case-sensitive.
  174. /// @param traverseHierarchy If true, also triggers a sort() on all child items.
  175. /// @param parentsFirst If true, parents are grouped before children in the resulting sort.
  176. void sort( bool caseSensitive = true, bool traverseHierarchy = false, bool parentsFirst = false );
  177. private:
  178. void _connectMonitors();
  179. void _disconnectMonitors();
  180. };
  181. friend class Item; // _onInspectorSetObjectModified
  182. /// @name Enums
  183. /// @{
  184. ///
  185. enum TreeState
  186. {
  187. RebuildVisible = BIT(0), ///< Temporary flag, we have to rebuild the tree.
  188. IsInspector = BIT(1), ///< We are mapping a SimObject hierarchy.
  189. IsEditable = BIT(2), ///< We allow items to be moved around.
  190. ShowTreeLines = BIT(3), ///< Should we render tree lines or just icons?
  191. BuildingVisTree = BIT(4), ///< We are currently building the visible tree (prevent recursion)
  192. };
  193. protected:
  194. enum
  195. {
  196. MaxIcons = 32,
  197. };
  198. enum Icons
  199. {
  200. Default1 = 0,
  201. SimGroup1,
  202. SimGroup2,
  203. SimGroup3,
  204. SimGroup4,
  205. Hidden,
  206. Lock1,
  207. Lock2,
  208. Default,
  209. Icon31,
  210. Icon32
  211. };
  212. enum mDragMidPointFlags
  213. {
  214. NomDragMidPoint,
  215. AbovemDragMidPoint,
  216. BelowmDragMidPoint
  217. };
  218. ///
  219. enum HitFlags
  220. {
  221. OnIndent = BIT(0),
  222. OnImage = BIT(1),
  223. OnIcon = BIT(2),
  224. OnText = BIT(3),
  225. OnRow = BIT(4),
  226. };
  227. ///
  228. enum BmpIndices
  229. {
  230. BmpFirstChild,
  231. BmpLastChild,
  232. BmpChild,
  233. BmpExp,
  234. BmpExpN,
  235. BmpExpP,
  236. BmpExpPN,
  237. BmpCon,
  238. BmpConN,
  239. BmpConP,
  240. BmpConPN,
  241. BmpLine,
  242. BmpGlow,
  243. };
  244. /// @}
  245. /// @name Callbacks
  246. /// @{
  247. DECLARE_CALLBACK( bool, onDeleteObject, ( SimObject* object ) );
  248. DECLARE_CALLBACK( bool, isValidDragTarget, ( S32 id, const char* value ) );
  249. DECLARE_CALLBACK( void, onDefineIcons, () );
  250. DECLARE_CALLBACK( void, onAddGroupSelected, ( SimGroup* group ) );
  251. DECLARE_CALLBACK( void, onAddSelection, ( S32 itemOrObjectId, bool isLastSelection ) );
  252. DECLARE_CALLBACK( void, onSelect, ( S32 itemOrObjectId ) );
  253. DECLARE_CALLBACK( void, onInspect, ( S32 itemOrObjectId ) );
  254. DECLARE_CALLBACK( void, onRemoveSelection, ( S32 itemOrObjectId ) );
  255. DECLARE_CALLBACK( void, onUnselect, ( S32 itemOrObjectId ) );
  256. DECLARE_CALLBACK( void, onDeleteSelection, () );
  257. DECLARE_CALLBACK( void, onObjectDeleteCompleted, () );
  258. DECLARE_CALLBACK( void, onKeyDown, ( S32 modifier, S32 keyCode ) );
  259. DECLARE_CALLBACK( void, onMouseUp, ( S32 hitItemId, S32 mouseClickCount ) );
  260. DECLARE_CALLBACK( void, onMouseDragged, () );
  261. DECLARE_CALLBACK( void, onRightMouseDown, ( S32 itemId, const Point2I& mousePos, SimObject* object = NULL ) );
  262. DECLARE_CALLBACK( void, onRightMouseUp, ( S32 itemId, const Point2I& mousePos, SimObject* object = NULL ) );
  263. DECLARE_CALLBACK( void, onBeginReparenting, () );
  264. DECLARE_CALLBACK( void, onEndReparenting, () );
  265. DECLARE_CALLBACK( void, onReparent, ( S32 itemOrObjectId, S32 oldParentItemOrObjectId, S32 newParentItemOrObjectId ) );
  266. DECLARE_CALLBACK( void, onDragDropped, () );
  267. DECLARE_CALLBACK( void, onAddMultipleSelectionBegin, () );
  268. DECLARE_CALLBACK( void, onAddMultipleSelectionEnd, () );
  269. DECLARE_CALLBACK( bool, canRenameObject, ( SimObject* object ) );
  270. DECLARE_CALLBACK( bool, handleRenameObject, ( const char* newName, SimObject* object ) );
  271. DECLARE_CALLBACK( void, onClearSelection, () );
  272. /// @}
  273. ///
  274. Vector<Item*> mItems;
  275. Vector<Item*> mVisibleItems;
  276. Vector<Item*> mSelectedItems;
  277. /// Used for tracking stuff that was selected, but may not have been
  278. /// created at time of selection.
  279. Vector<S32> mSelected;
  280. S32 mItemCount;
  281. /// We do our own free list, as we we want to be able to recycle
  282. /// item ids and do some other clever things.
  283. Item* mItemFreeList;
  284. Item* mRoot;
  285. S32 mMaxWidth;
  286. S32 mSelectedItem;
  287. S32 mDraggedToItem;
  288. S32 mStart;
  289. /// A combination of TreeState flags.
  290. BitSet32 mFlags;
  291. Item* mPossibleRenameItem;
  292. Item* mRenamingItem;
  293. Item* mTempItem;
  294. GuiTextEditCtrl* mRenameCtrl;
  295. /// Current filter that determines which items in the tree are displayed and which are hidden.
  296. String mFilterText;
  297. /// If true, all items are filtered. If false, then children of items that successfully pass filter are not filtered
  298. bool mDoFilterChildren;
  299. Vector<U32> mItemFilterExceptionList;
  300. Vector<U32> mHiddenItemsList;
  301. /// If true, a trace of actions taken by the control is logged to the console. Can
  302. /// be turned on with the setDebug() script method.
  303. bool mDebug;
  304. GFXTexHandle mIconTable[MaxIcons];
  305. S32 mTabSize;
  306. S32 mTextOffset;
  307. bool mFullRowSelect;
  308. S32 mItemHeight;
  309. bool mDestroyOnSleep;
  310. bool mSupportMouseDragging;
  311. bool mMultipleSelections;
  312. bool mDeleteObjectAllowed;
  313. bool mDragToItemAllowed;
  314. bool mClearAllOnSingleSelection; ///< When clicking on an already selected item, clear all other selections
  315. bool mCompareToObjectID;
  316. /// Used to hide the root tree element, defaults to true.
  317. bool mShowRoot;
  318. /// If true, object IDs will be included in inspector tree item labels.
  319. bool mShowObjectIds;
  320. /// If true, class names will be included in inspector tree item labels.
  321. bool mShowClassNames;
  322. /// If true, object names will be included in inspector tree item labels.
  323. bool mShowObjectNames;
  324. /// If true, internal names will be included in inspector tree item labels.
  325. bool mShowInternalNames;
  326. /// If true, class names will be used as object names for unnamed objects.
  327. bool mShowClassNameForUnnamedObjects;
  328. /// If true then tooltips will be automatically
  329. /// generated for all Inspector items
  330. bool mUseInspectorTooltips;
  331. /// If true then only render item tooltips if the item
  332. /// extends past the displayable width
  333. bool mTooltipOnWidthOnly;
  334. /// If true clicking on a selected item ( that is an object )
  335. /// will allow you to rename it.
  336. bool mCanRenameObjects;
  337. /// If true then object renaming operates on the internalName rather than
  338. /// the object name.
  339. bool mRenameInternal;
  340. S32 mCurrentDragCell;
  341. S32 mPreviousDragCell;
  342. S32 mDragMidPoint;
  343. bool mMouseDragged;
  344. bool mDragStartInSelection;
  345. Point2I mMouseDownPoint;
  346. StringTableEntry mBitmapBase;
  347. GFXTexHandle mTexRollover;
  348. GFXTexHandle mTexSelected;
  349. ColorI mAltFontColor;
  350. ColorI mAltFontColorHL;
  351. ColorI mAltFontColorSE;
  352. SimObjectPtr<SimObject> mRootObject;
  353. void _destroyChildren( Item* item, Item* parent, bool deleteObjects=true);
  354. void _destroyItem( Item* item, bool deleteObject=true);
  355. void _destroyTree();
  356. void _deleteItem(Item* item);
  357. void _buildItem(Item* item, U32 tabLevel, bool bForceFullUpdate = false, bool skipFlter = false);
  358. Item* _findItemByAmbiguousId( S32 itemOrObjectId, bool buildVirtual = true );
  359. void _expandObjectHierarchy( SimGroup* group );
  360. bool _hitTest(const Point2I & pnt, Item* & item, BitSet32 & flags);
  361. S32 getInspectorItemIconsWidth(Item* & item);
  362. virtual bool onVirtualParentBuild(Item *item, bool bForceFullUpdate = false);
  363. virtual bool onVirtualParentExpand(Item *item);
  364. virtual bool onVirtualParentCollapse(Item *item);
  365. virtual void onItemSelected( Item *item );
  366. virtual void onRemoveSelection( Item *item );
  367. virtual void onClearSelection() {};
  368. Item* addInspectorDataItem(Item *parent, SimObject *obj);
  369. virtual bool isValidDragTarget( Item* item );
  370. bool _isRootLevelItem( Item* item ) const
  371. {
  372. return ( item == mRoot && mShowRoot ) || ( item->mParent == mRoot && !mShowRoot );
  373. }
  374. /// For inspector tree views, this is hooked to the SetModificationSignal of sets
  375. /// so that the tree view knows when it needs to refresh.
  376. void _onInspectorSetObjectModified( SetModification modification, SimSet* set, SimObject* object );
  377. public:
  378. GuiTreeViewCtrl();
  379. virtual ~GuiTreeViewCtrl();
  380. //WLE Vince, Moving this into a function so I don't have to bounce off the console. 12/05/2013
  381. const char* getSelectedObjectList();
  382. /// Used for syncing the mSelected and mSelectedItems lists.
  383. void syncSelection();
  384. void lockSelection(bool lock);
  385. void hideSelection(bool hide);
  386. void toggleLockSelection();
  387. void toggleHideSelection();
  388. virtual bool canAddSelection( Item *item ) { return true; };
  389. void addSelection(S32 itemId, bool update = true, bool isLastSelection = true);
  390. const Vector< Item* >& getSelectedItems() const { return mSelectedItems; }
  391. const Vector< S32 >& getSelected() const { return mSelected; }
  392. const Vector< Item* >& getItems() const { return mItems; }
  393. bool isSelected(S32 itemId)
  394. {
  395. return isSelected( getItem( itemId ) );
  396. }
  397. bool isSelected(Item *item)
  398. {
  399. if ( !item )
  400. return false;
  401. return mSelectedItems.contains( item );
  402. }
  403. void setDebug( bool value ) { mDebug = value; }
  404. /// Should use addSelection and removeSelection when calling from script
  405. /// instead of setItemSelected. Use setItemSelected when you want to select
  406. /// something in the treeview as it has script call backs.
  407. void removeSelection(S32 itemId);
  408. /// Sets the flag of the item with the matching itemId.
  409. bool setItemSelected(S32 itemId, bool select);
  410. bool setItemExpanded(S32 itemId, bool expand);
  411. bool setItemValue(S32 itemId, StringTableEntry Value);
  412. const char * getItemText(S32 itemId);
  413. const char * getItemValue(S32 itemId);
  414. StringTableEntry getTextToRoot(S32 itemId, const char *delimiter = "");
  415. Item* getRootItem() const { return mRoot; }
  416. Item * getItem(S32 itemId) const;
  417. Item * createItem(S32 icon);
  418. bool editItem( S32 itemId, const char* newText, const char* newValue );
  419. bool markItem( S32 itemId, bool mark );
  420. S32 getItemAtPosition(Point2I position);
  421. bool isItemSelected( S32 itemId );
  422. // insertion/removal
  423. void unlinkItem(Item * item);
  424. S32 insertItem(S32 parentId, const char * text, const char * value = "", const char * iconString = "", S16 normalImage = 0, S16 expandedImage = 1);
  425. bool removeItem(S32 itemId, bool deleteObjects=true);
  426. void removeAllChildren(S32 itemId); // Remove all children of the given item
  427. bool buildIconTable(const char * icons);
  428. bool setAddGroup(SimObject * obj);
  429. S32 getIcon(const char * iconString);
  430. // tree items
  431. const S32 getFirstRootItem() const;
  432. S32 getChildItem(S32 itemId);
  433. S32 getParentItem(S32 itemId);
  434. S32 getNextSiblingItem(S32 itemId);
  435. S32 getPrevSiblingItem(S32 itemId);
  436. S32 getItemCount();
  437. S32 getSelectedItem();
  438. S32 getSelectedItem(S32 index); // Given an item's index in the selection list, return its itemId
  439. S32 getSelectedItemsCount() {return mSelectedItems.size();} // Returns the number of selected items
  440. void moveItemUp( S32 itemId );
  441. void moveItemDown( S32 itemId );
  442. // misc.
  443. bool scrollVisible( Item *item );
  444. bool scrollVisible( S32 itemId );
  445. bool scrollVisibleByObjectId( S32 objID );
  446. void deleteSelection();
  447. void clearSelection();
  448. S32 findItemByName(const char *name);
  449. S32 findItemByValue(const char *name);
  450. S32 findItemByObjectId(S32 iObjId);
  451. S32 getItemObject(S32 itemId);
  452. void sortTree( bool caseSensitive, bool traverseHierarchy, bool parentsFirst );
  453. /// @name Filtering
  454. /// @{
  455. /// Get the current filter expression. Only tree items whose text matches this expression
  456. /// are displayed. By default, the expression is empty and all items are shown.
  457. const String& getFilterText() const { return mFilterText; }
  458. /// Set the pattern by which to filter items in the tree. Only items in the tree whose text
  459. /// matches this pattern are displayed.
  460. void setFilterText( const String& text );
  461. void setFilterChildren(bool doFilter) { mDoFilterChildren = doFilter; }
  462. void setItemFilterException(U32 item, bool isExempt);
  463. void setItemHidden(U32 item, bool isHidden);
  464. void clearHiddenItems() { mHiddenItemsList.clear(); }
  465. /// Clear the current item filtering pattern.
  466. void clearFilterText() { setFilterText( String::EmptyString ); }
  467. void reparentItems(Vector<Item*> selectedItems, Item* newParent);
  468. S32 getTabLevel(S32 itemId);
  469. /// @}
  470. // GuiControl
  471. bool onAdd();
  472. bool onWake();
  473. void onSleep();
  474. void onPreRender();
  475. bool onKeyDown( const GuiEvent &event );
  476. void onMouseDown(const GuiEvent &event);
  477. void onMiddleMouseDown(const GuiEvent &event);
  478. void onMouseMove(const GuiEvent &event);
  479. void onMouseEnter(const GuiEvent &event);
  480. void onMouseLeave(const GuiEvent &event);
  481. void onRightMouseDown(const GuiEvent &event);
  482. void onRightMouseUp(const GuiEvent &event);
  483. void onMouseDragged(const GuiEvent &event);
  484. virtual void onMouseUp(const GuiEvent &event);
  485. /// Returns false if the object is a child of one of the inner items.
  486. bool childSearch(Item * item, SimObject *obj, bool yourBaby);
  487. /// Find immediately available inspector items (eg ones that aren't children of other inspector items)
  488. /// and then update their sets
  489. void inspectorSearch(Item * item, Item * parent, SimSet * parentSet, SimSet * newParentSet);
  490. /// Find the Item associated with a sceneObject, returns true if it found one
  491. bool objectSearch( const SimObject *object, Item **item );
  492. // GuiArrayCtrl
  493. void onRenderCell(Point2I offset, Point2I cell, bool, bool);
  494. void onRender(Point2I offset, const RectI &updateRect);
  495. bool renderTooltip( const Point2I &hoverPos, const Point2I& cursorPos, const char* tipText );
  496. static void initPersistFields();
  497. void inspectObject(SimObject * obj, bool okToEdit);
  498. S32 insertObject(S32 parentId, SimObject * obj, bool okToEdit);
  499. void buildVisibleTree(bool bForceFullUpdate = false);
  500. void cancelRename();
  501. void onRenameValidate();
  502. void showItemRenameCtrl( Item* item );
  503. DECLARE_CONOBJECT(GuiTreeViewCtrl);
  504. DECLARE_CATEGORY( "Gui Lists" );
  505. DECLARE_DESCRIPTION( "Hierarchical list of text items with optional icons.\nCan also be used to inspect SimObject hierarchies." );
  506. };
  507. #endif