CHANGED: #1471 CDBViewNumber fields can now be serialized.

--HG--
branch : gsoc2012-gui-editor
This commit is contained in:
dfighter1985 2012-08-12 02:58:14 +02:00
parent 0f3f381201
commit 1d4119c918
2 changed files with 24 additions and 0 deletions

View file

@ -41,6 +41,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;
virtual bool parse (xmlNodePtr cur, CInterfaceGroup * parentGroup);
virtual void checkCoords();
virtual void draw ();

View file

@ -139,6 +139,29 @@ namespace NLGUI
CViewText::setProperty( name, value );
}
xmlNodePtr CDBViewNumber::serialize( xmlNodePtr parentNode, const char *type ) const
{
xmlNodePtr node = CViewText::serialize( parentNode, type );
if( node == NULL )
return NULL;
xmlSetProp( node, BAD_CAST "type", BAD_CAST "text_number" );
if( _Number.getNodePtr() != NULL )
xmlSetProp( node, BAD_CAST "value", BAD_CAST _Number.getNodePtr()->getFullName().c_str() );
else
xmlSetProp( node, BAD_CAST "value", BAD_CAST "" );
xmlSetProp( node, BAD_CAST "positive", BAD_CAST toString( _Positive ).c_str() );
xmlSetProp( node, BAD_CAST "format", BAD_CAST toString( _Format ).c_str() );
xmlSetProp( node, BAD_CAST "divisor", BAD_CAST toString( _Divisor ).c_str() );
xmlSetProp( node, BAD_CAST "modulo", BAD_CAST toString( _Modulo ).c_str() );
xmlSetProp( node, BAD_CAST "suffix", BAD_CAST _Suffix.toString().c_str() );
xmlSetProp( node, BAD_CAST "prefix", BAD_CAST _Prefix.toString().c_str() );
return node;
}
// ***************************************************************************
bool CDBViewNumber::parse (xmlNodePtr cur, CInterfaceGroup * parentGroup)
{