mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-17 13:01:41 +00:00
Size parent is now queried directly from the widget.
This commit is contained in:
parent
c8dd68418f
commit
6b3e8d3766
2 changed files with 35 additions and 3 deletions
|
@ -494,6 +494,7 @@ namespace NLGUI
|
||||||
void setPosParent( const std::string &id );
|
void setPosParent( const std::string &id );
|
||||||
void getPosParent( std::string &id ) const;
|
void getPosParent( std::string &id ) const;
|
||||||
void setSizeParent( const std::string &id );
|
void setSizeParent( const std::string &id );
|
||||||
|
void getSizeParent( std::string &id ) const;
|
||||||
|
|
||||||
void setSerializable( bool b ){ serializable = b; }
|
void setSerializable( bool b ){ serializable = b; }
|
||||||
bool IsSerializable() const{ return serializable; }
|
bool IsSerializable() const{ return serializable; }
|
||||||
|
|
|
@ -154,7 +154,9 @@ namespace NLGUI
|
||||||
else
|
else
|
||||||
if( name == "sizeparent" )
|
if( name == "sizeparent" )
|
||||||
{
|
{
|
||||||
return CWidgetManager::getInstance()->getParser()->getParentSizeAssociation( (CInterfaceElement*)this );
|
std::string sp;
|
||||||
|
getSizeParent( sp );
|
||||||
|
return sp;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if( name == "global_color" )
|
if( name == "global_color" )
|
||||||
|
@ -301,8 +303,8 @@ namespace NLGUI
|
||||||
getPosParent( pp );
|
getPosParent( pp );
|
||||||
xmlNewProp( node, BAD_CAST "posparent", BAD_CAST pp.c_str() );
|
xmlNewProp( node, BAD_CAST "posparent", BAD_CAST pp.c_str() );
|
||||||
xmlNewProp( node, BAD_CAST "sizeref", BAD_CAST getSizeRefAsString().c_str() );
|
xmlNewProp( node, BAD_CAST "sizeref", BAD_CAST getSizeRefAsString().c_str() );
|
||||||
xmlNewProp( node, BAD_CAST "sizeparent",
|
getSizeParent( pp );
|
||||||
BAD_CAST CWidgetManager::getInstance()->getParser()->getParentSizeAssociation( (CInterfaceElement*)this ).c_str() );
|
xmlNewProp( node, BAD_CAST "sizeparent", BAD_CAST pp.c_str() );
|
||||||
|
|
||||||
xmlNewProp( node, BAD_CAST "global_color", BAD_CAST toString( _ModulateGlobalColor ).c_str() );
|
xmlNewProp( node, BAD_CAST "global_color", BAD_CAST toString( _ModulateGlobalColor ).c_str() );
|
||||||
xmlNewProp( node, BAD_CAST "render_layer", BAD_CAST toString( _RenderLayer ).c_str() );
|
xmlNewProp( node, BAD_CAST "render_layer", BAD_CAST toString( _RenderLayer ).c_str() );
|
||||||
|
@ -1598,6 +1600,35 @@ namespace NLGUI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CInterfaceElement::getSizeParent( std::string &id ) const
|
||||||
|
{
|
||||||
|
CInterfaceElement *p = getParentSize();
|
||||||
|
|
||||||
|
// If there's no parent set then the size parent is the parent
|
||||||
|
if( p == NULL )
|
||||||
|
{
|
||||||
|
id = "parent";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the size parent is the same as the group parent, then the size parent is the parent ofc
|
||||||
|
if( p == getParent() )
|
||||||
|
{
|
||||||
|
id = "parent";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the size parent is in the parent group, use the short Id
|
||||||
|
if( p->isInGroup( getParent() ) )
|
||||||
|
{
|
||||||
|
id = p->getShortId();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise use the full Id
|
||||||
|
id = p->getId();
|
||||||
|
}
|
||||||
|
|
||||||
void CInterfaceElement::registerDeletionWatcher( IDeletionWatcher *watcher )
|
void CInterfaceElement::registerDeletionWatcher( IDeletionWatcher *watcher )
|
||||||
{
|
{
|
||||||
std::vector< IDeletionWatcher* >::iterator itr
|
std::vector< IDeletionWatcher* >::iterator itr
|
||||||
|
|
Loading…
Reference in a new issue