CHANGED: #1471 Controls are now serialized into the XML output file when saving.
This commit is contained in:
parent
17215417e3
commit
1c7a240285
5 changed files with 30 additions and 4 deletions
|
@ -46,6 +46,8 @@ namespace NLGUI
|
||||||
xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const;
|
xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const;
|
||||||
xmlNodePtr serializeGroup( xmlNodePtr parentNode, const char *type ) const;
|
xmlNodePtr serializeGroup( xmlNodePtr parentNode, const char *type ) const;
|
||||||
xmlNodePtr serializeSubGroups( xmlNodePtr parentNode ) const;
|
xmlNodePtr serializeSubGroups( xmlNodePtr parentNode ) const;
|
||||||
|
xmlNodePtr serializeControls( xmlNodePtr parentNode ) const;
|
||||||
|
xmlNodePtr serializeViews( xmlNodePtr parentNode ) const;
|
||||||
|
|
||||||
virtual uint32 getMemory ();
|
virtual uint32 getMemory ();
|
||||||
|
|
||||||
|
|
|
@ -396,6 +396,9 @@ namespace NLGUI
|
||||||
if( node == NULL )
|
if( node == NULL )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
if( xmlGetProp( node, BAD_CAST "type" ) == NULL )
|
||||||
|
xmlSetProp( node, BAD_CAST "type", BAD_CAST "button" );
|
||||||
|
|
||||||
xmlNewProp( node, BAD_CAST "button_type", BAD_CAST getTypeString().c_str() );
|
xmlNewProp( node, BAD_CAST "button_type", BAD_CAST getTypeString().c_str() );
|
||||||
xmlNewProp( node, BAD_CAST "pushed", BAD_CAST toString( _Pushed ).c_str() );
|
xmlNewProp( node, BAD_CAST "pushed", BAD_CAST toString( _Pushed ).c_str() );
|
||||||
xmlNewProp( node, BAD_CAST "over_when_pushed", BAD_CAST toString( _OverWhenPushed ).c_str() );
|
xmlNewProp( node, BAD_CAST "over_when_pushed", BAD_CAST toString( _OverWhenPushed ).c_str() );
|
||||||
|
|
|
@ -386,6 +386,9 @@ namespace NLGUI
|
||||||
if( node == NULL )
|
if( node == NULL )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
if( xmlGetProp( node, BAD_CAST "type" ) == NULL )
|
||||||
|
xmlSetProp( node, BAD_CAST "type", BAD_CAST "text_button" );
|
||||||
|
|
||||||
std::string tex;
|
std::string tex;
|
||||||
tex = CViewRenderer::getInstance()->getTextureNameFromId( _TextureIdNormal[ 0 ] );
|
tex = CViewRenderer::getInstance()->getTextureNameFromId( _TextureIdNormal[ 0 ] );
|
||||||
std::string::size_type i = tex.rfind( "_l.tga" );
|
std::string::size_type i = tex.rfind( "_l.tga" );
|
||||||
|
|
|
@ -798,6 +798,9 @@ namespace NLGUI
|
||||||
if( node == NULL )
|
if( node == NULL )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
if( xmlGetProp( node, BAD_CAST "type" ) == NULL )
|
||||||
|
xmlSetProp( node, BAD_CAST "type", BAD_CAST "tab_button" );
|
||||||
|
|
||||||
xmlNewProp( node, BAD_CAST "group", BAD_CAST _AssociatedGroup.c_str() );
|
xmlNewProp( node, BAD_CAST "group", BAD_CAST _AssociatedGroup.c_str() );
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
|
|
|
@ -672,6 +672,7 @@ namespace NLGUI
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
serializeSubGroups( node );
|
serializeSubGroups( node );
|
||||||
|
serializeControls( node );
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
@ -716,15 +717,29 @@ namespace NLGUI
|
||||||
|
|
||||||
xmlNodePtr CInterfaceGroup::serializeSubGroups( xmlNodePtr parentNode ) const
|
xmlNodePtr CInterfaceGroup::serializeSubGroups( xmlNodePtr parentNode ) const
|
||||||
{
|
{
|
||||||
xmlNodePtr node = parentNode;
|
|
||||||
|
|
||||||
std::vector< CInterfaceGroup* >::const_iterator itr;
|
std::vector< CInterfaceGroup* >::const_iterator itr;
|
||||||
for( itr = _ChildrenGroups.begin(); itr != _ChildrenGroups.end(); ++itr )
|
for( itr = _ChildrenGroups.begin(); itr != _ChildrenGroups.end(); ++itr )
|
||||||
{
|
{
|
||||||
(*itr)->serialize( node, "group" );
|
(*itr)->serialize( parentNode, "group" );
|
||||||
}
|
}
|
||||||
|
|
||||||
return node;
|
return parentNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
xmlNodePtr CInterfaceGroup::serializeControls( xmlNodePtr parentNode ) const
|
||||||
|
{
|
||||||
|
std::vector< CCtrlBase* >::const_iterator itr;
|
||||||
|
for( itr = _Controls.begin(); itr != _Controls.end(); ++itr )
|
||||||
|
{
|
||||||
|
(*itr)->serialize( parentNode, "ctrl" );
|
||||||
|
}
|
||||||
|
|
||||||
|
return parentNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
xmlNodePtr CInterfaceGroup::serializeViews( xmlNodePtr parentNode ) const
|
||||||
|
{
|
||||||
|
return parentNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in a new issue