mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-23 15:26:16 +00:00
MODIFIED: Preliminary support for a little cleanup when removing a widget from it's parent group ( for example when moving the widget ).
This commit is contained in:
parent
b106d18c8b
commit
b2d052108f
4 changed files with 27 additions and 6 deletions
|
@ -124,6 +124,8 @@ namespace NLGUI
|
|||
REFLECT_LUA_METHOD("getViewText", luaGetViewText)
|
||||
REFLECT_EXPORT_END
|
||||
|
||||
void onRemoved();
|
||||
|
||||
protected:
|
||||
|
||||
enum {NumTexture= 3};
|
||||
|
|
|
@ -486,6 +486,9 @@ namespace NLGUI
|
|||
void setSerializable( bool b ){ serializable = b; }
|
||||
bool IsSerializable() const{ return serializable; }
|
||||
|
||||
/// Called when the widget is removed from it's parent group
|
||||
virtual void onRemoved(){}
|
||||
|
||||
protected:
|
||||
|
||||
bool editorSelected;
|
||||
|
|
|
@ -64,8 +64,8 @@ namespace NLGUI
|
|||
{
|
||||
if( _ViewText != NULL )
|
||||
{
|
||||
if( getParent() != NULL )
|
||||
getParent()->delElement( _ViewText );
|
||||
if( _Parent != NULL )
|
||||
_Parent->delView( _ViewText );
|
||||
_ViewText = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -967,6 +967,13 @@ namespace NLGUI
|
|||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
void CCtrlTextButton::onRemoved()
|
||||
{
|
||||
if( _ViewText != NULL )
|
||||
{
|
||||
if( _Parent != NULL )
|
||||
_Parent->delView( _ViewText, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1084,9 +1084,12 @@ namespace NLGUI
|
|||
{
|
||||
if (_Views[i] == child)
|
||||
{
|
||||
if (!dontDelete) delete _Views[i];
|
||||
CViewBase *v = _Views[i];
|
||||
_Views.erase(_Views.begin()+i);
|
||||
delEltOrder (child);
|
||||
child->onRemoved();
|
||||
child->setParent( NULL );
|
||||
if (!dontDelete) delete v;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1100,9 +1103,12 @@ namespace NLGUI
|
|||
{
|
||||
if (_Controls[i] == child)
|
||||
{
|
||||
if (!dontDelete) delete _Controls[i];
|
||||
CCtrlBase *c = _Controls[i];
|
||||
_Controls.erase(_Controls.begin()+i);
|
||||
delEltOrder (child);
|
||||
child->onRemoved();
|
||||
child->setParent( NULL );
|
||||
if (!dontDelete) delete c;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1116,9 +1122,12 @@ namespace NLGUI
|
|||
{
|
||||
if (_ChildrenGroups[i] == child)
|
||||
{
|
||||
if (!dontDelete) delete _ChildrenGroups[i];
|
||||
CInterfaceGroup *g = _ChildrenGroups[i];
|
||||
_ChildrenGroups.erase(_ChildrenGroups.begin()+i);
|
||||
delEltOrder (child);
|
||||
child->onRemoved();
|
||||
child->setParent( NULL );
|
||||
if (!dontDelete) delete g;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue