CHANGED: #1471 CGroupList fields can now we serialized.

This commit is contained in:
dfighter1985 2012-08-14 01:20:14 +02:00
parent d42171a216
commit bbfa9894a4
2 changed files with 64 additions and 0 deletions

View file

@ -110,6 +110,7 @@ namespace NLGUI
std::string getProperty( const std::string &name ) const;
void setProperty( const std::string &name, const std::string &value );
xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const;
/**
* parse the element and initalize it

View file

@ -369,6 +369,69 @@ namespace NLGUI
CInterfaceGroup::setProperty( name, value );
}
xmlNodePtr CGroupList::serialize( xmlNodePtr parentNode, const char *type ) const
{
xmlNodePtr node = CInterfaceGroup::serialize( parentNode, type );
if( node == NULL )
return NULL;
xmlSetProp( node, BAD_CAST "type", BAD_CAST "list" );
xmlSetProp( node, BAD_CAST "maxelements", BAD_CAST toString( _MaxElements ).c_str() );
std::string addelt;
std::string align;
switch( _AddElt )
{
case Top:
addelt = "T";
break;
case Left:
addelt = "L";
break;
case Right:
addelt = "R";
break;
default:
addelt = "B";
break;
}
switch( _Align )
{
case Top:
align = "T";
break;
case Left:
align = "L";
break;
case Right:
align = "R";
break;
default:
align = "B";
break;
}
xmlSetProp( node, BAD_CAST "addelt", BAD_CAST addelt.c_str() );
xmlSetProp( node, BAD_CAST "align", BAD_CAST align.c_str() );
xmlSetProp( node, BAD_CAST "space", BAD_CAST toString( _Space ).c_str() );
xmlSetProp( node, BAD_CAST "over", BAD_CAST toString( _Over ).c_str() );
xmlSetProp( node, BAD_CAST "dynamic_display_size", BAD_CAST toString( _DynamicDisplaySize ).c_str() );
xmlSetProp( node, BAD_CAST "col_over", BAD_CAST toString( _OverColor ).c_str() );
xmlSetProp( node, BAD_CAST "hardtext", BAD_CAST _HardText.c_str() );
xmlSetProp( node, BAD_CAST "textid", BAD_CAST toString( _TextId ).c_str() );
return node;
}
// ----------------------------------------------------------------------------
bool CGroupList::parse (xmlNodePtr cur, CInterfaceGroup * parentGroup)
{