how do i change the parent of a IGUIElement ?
im using svn4170, my C::B CodeCompletion found a function setParent() but searching IGUIElement.h revealed no such thing.
thx in advance
EDIT: would this be corrent?
Code: Select all
void setParent(IGUIElement* newParent)
{
remove();
if (newParent)
{
newParent->addChild(this);
Parent = newParent;
// maybe recalculate size
}
else
{
if (Environment)
{
Parent = Environment->getRootGUIElement();
Parent->addChild(this);
}
else
{
// ERROR ?
Parent = 0;
}
}
}