CHANGED: #1471 Controls are now serialized into the XML output file when saving.

--HG--
branch : gsoc2012-gui-editor
This commit is contained in:
dfighter1985 2012-08-10 20:08:36 +02:00
parent 5e52281c6e
commit 37053325f9
5 changed files with 30 additions and 4 deletions

View file

@ -46,6 +46,8 @@ namespace NLGUI
xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const;
xmlNodePtr serializeGroup( xmlNodePtr parentNode, const char *type ) const;
xmlNodePtr serializeSubGroups( xmlNodePtr parentNode ) const;
xmlNodePtr serializeControls( xmlNodePtr parentNode ) const;
xmlNodePtr serializeViews( xmlNodePtr parentNode ) const;
virtual uint32 getMemory ();

View file

@ -396,6 +396,9 @@ namespace NLGUI
if( node == 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 "pushed", BAD_CAST toString( _Pushed ).c_str() );
xmlNewProp( node, BAD_CAST "over_when_pushed", BAD_CAST toString( _OverWhenPushed ).c_str() );

View file

@ -386,6 +386,9 @@ namespace NLGUI
if( node == NULL )
return NULL;
if( xmlGetProp( node, BAD_CAST "type" ) == NULL )
xmlSetProp( node, BAD_CAST "type", BAD_CAST "text_button" );
std::string tex;
tex = CViewRenderer::getInstance()->getTextureNameFromId( _TextureIdNormal[ 0 ] );
std::string::size_type i = tex.rfind( "_l.tga" );

View file

@ -798,6 +798,9 @@ namespace NLGUI
if( node == 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() );
return node;

View file

@ -672,6 +672,7 @@ namespace NLGUI
return NULL;
serializeSubGroups( node );
serializeControls( node );
return node;
}
@ -716,15 +717,29 @@ namespace NLGUI
xmlNodePtr CInterfaceGroup::serializeSubGroups( xmlNodePtr parentNode ) const
{
xmlNodePtr node = parentNode;
std::vector< CInterfaceGroup* >::const_iterator 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;
}
// ------------------------------------------------------------------------------------------------