CHANGED: #1471 CGroupParagraph fields can now we serialized.

This commit is contained in:
dfighter1985 2012-08-14 01:33:54 +02:00
parent 493fd206a6
commit a95b52532c
2 changed files with 60 additions and 0 deletions

View file

@ -127,6 +127,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

@ -342,6 +342,65 @@ namespace NLGUI
CInterfaceGroup::setProperty( name, value );
}
xmlNodePtr CGroupParagraph::serialize( xmlNodePtr parentNode, const char *type ) const
{
xmlNodePtr node = CInterfaceGroup::serialize( parentNode, type );
if( node == NULL )
return NULL;
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 "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 CGroupParagraph::parse (xmlNodePtr cur, CInterfaceGroup * parentGroup)
{