From 64eb2a86f2ce6ef84d7b5410167197c2b8dd3243 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Tue, 14 Aug 2012 01:20:14 +0200 Subject: [PATCH] CHANGED: #1471 CGroupList fields can now we serialized. --- code/nel/include/nel/gui/group_list.h | 1 + code/nel/src/gui/group_list.cpp | 63 +++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/code/nel/include/nel/gui/group_list.h b/code/nel/include/nel/gui/group_list.h index 892521992..ded670716 100644 --- a/code/nel/include/nel/gui/group_list.h +++ b/code/nel/include/nel/gui/group_list.h @@ -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 diff --git a/code/nel/src/gui/group_list.cpp b/code/nel/src/gui/group_list.cpp index 4bd96b456..b493c9abd 100644 --- a/code/nel/src/gui/group_list.cpp +++ b/code/nel/src/gui/group_list.cpp @@ -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) {