mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 16:44:36 +00:00
Merge pull request #2324 from Areloch/TweakedguiTreeViewObjectHandling
Tweaks some object handling of guiTreeViewObj
This commit is contained in:
commit
5d1ff71525
2 changed files with 29 additions and 4 deletions
|
|
@ -390,7 +390,6 @@ void GuiTreeViewCtrl::Item::setObject(SimObject *obj)
|
||||||
{
|
{
|
||||||
if(!mState.test(InspectorData))
|
if(!mState.test(InspectorData))
|
||||||
{
|
{
|
||||||
Con::errorf("Tried to set the object for item %d, which is not InspectorData!", mId);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -409,7 +408,6 @@ SimObject *GuiTreeViewCtrl::Item::getObject()
|
||||||
{
|
{
|
||||||
if(!mState.test(InspectorData))
|
if(!mState.test(InspectorData))
|
||||||
{
|
{
|
||||||
Con::errorf("Tried to get the object for item %d, which is not InspectorData!", mId);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5101,12 +5099,13 @@ DefineEngineMethod( GuiTreeViewCtrl, editItem, bool, ( S32 itemId, const char* n
|
||||||
return(object->editItem(itemId, newText, newValue));
|
return(object->editItem(itemId, newText, newValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineMethod( GuiTreeViewCtrl, removeItem, bool, (S32 itemId), ,
|
DefineEngineMethod( GuiTreeViewCtrl, removeItem, bool, (S32 itemId, bool deleteObjects), (0, true),
|
||||||
"Remove an item from the tree with the given id.\n\n"
|
"Remove an item from the tree with the given id.\n\n"
|
||||||
"@param itemId TreeItemID of item to remove.\n"
|
"@param itemId TreeItemID of item to remove.\n"
|
||||||
|
"@param deleteObjects Whether the object on the item is deleted when the item is.\n"
|
||||||
"@return True if successful, false if not.")
|
"@return True if successful, false if not.")
|
||||||
{
|
{
|
||||||
return(object->removeItem(itemId));
|
return(object->removeItem(itemId, deleteObjects));
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineMethod( GuiTreeViewCtrl, removeAllChildren, void, (S32 itemId), ,
|
DefineEngineMethod( GuiTreeViewCtrl, removeAllChildren, void, (S32 itemId), ,
|
||||||
|
|
@ -5335,6 +5334,31 @@ DefineEngineMethod( GuiTreeViewCtrl, findItemByObjectId, S32, (S32 objectId), ,
|
||||||
return(object->findItemByObjectId(objectId));
|
return(object->findItemByObjectId(objectId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
S32 GuiTreeViewCtrl::getItemObject(S32 itemId)
|
||||||
|
{
|
||||||
|
GuiTreeViewCtrl::Item* item = getItem(itemId);
|
||||||
|
if (!item)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
SimObject* pObj = item->getObject();
|
||||||
|
if (pObj)
|
||||||
|
return pObj->getId();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
DefineEngineMethod(GuiTreeViewCtrl, getItemObject, S32, (S32 itemId), ,
|
||||||
|
"Gets the object for a particular item.\n\n"
|
||||||
|
"@param itemId Item id you want the object id for."
|
||||||
|
"@return Object Id for the given tree item ID.")
|
||||||
|
{
|
||||||
|
return(object->getItemObject(itemId));
|
||||||
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
bool GuiTreeViewCtrl::scrollVisibleByObjectId(S32 objID)
|
bool GuiTreeViewCtrl::scrollVisibleByObjectId(S32 objID)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -554,6 +554,7 @@ class GuiTreeViewCtrl : public GuiArrayCtrl
|
||||||
S32 findItemByName(const char *name);
|
S32 findItemByName(const char *name);
|
||||||
S32 findItemByValue(const char *name);
|
S32 findItemByValue(const char *name);
|
||||||
S32 findItemByObjectId(S32 iObjId);
|
S32 findItemByObjectId(S32 iObjId);
|
||||||
|
S32 getItemObject(S32 itemId);
|
||||||
|
|
||||||
void sortTree( bool caseSensitive, bool traverseHierarchy, bool parentsFirst );
|
void sortTree( bool caseSensitive, bool traverseHierarchy, bool parentsFirst );
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue