From 88819cbcd9040b5bf860806c9367f5f533324254 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sat, 4 Aug 2012 18:14:43 +0200 Subject: [PATCH] CHANGED: #1471 Implemented property setting for CDBViewNumber. --HG-- branch : gsoc2012-gui-editor --- code/nel/include/nel/gui/dbview_number.h | 1 + code/nel/src/gui/dbview_number.cpp | 55 ++++++++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/code/nel/include/nel/gui/dbview_number.h b/code/nel/include/nel/gui/dbview_number.h index a7fcf612a..af4fb5091 100644 --- a/code/nel/include/nel/gui/dbview_number.h +++ b/code/nel/include/nel/gui/dbview_number.h @@ -40,6 +40,7 @@ namespace NLGUI CDBViewNumber(const TCtorParam ¶m); std::string getProperty( const std::string &name ) const; + void setProperty( const std::string &name, const std::string &value ); virtual bool parse (xmlNodePtr cur, CInterfaceGroup * parentGroup); virtual void checkCoords(); virtual void draw (); diff --git a/code/nel/src/gui/dbview_number.cpp b/code/nel/src/gui/dbview_number.cpp index ca8c4271c..2e41eaf9f 100644 --- a/code/nel/src/gui/dbview_number.cpp +++ b/code/nel/src/gui/dbview_number.cpp @@ -84,6 +84,61 @@ namespace NLGUI return CViewText::getProperty( name ); } + void CDBViewNumber::setProperty( const std::string &name, const std::string &value ) + { + if( name == "value" ) + { + _Number.link( value.c_str() ); + return; + } + else + if( name == "positive" ) + { + bool b; + if( fromString( value, b ) ) + _Positive = b; + return; + } + else + if( name == "format" ) + { + bool b; + if( fromString( value, b ) ) + _Format = b; + return; + } + else + if( name == "divisor" ) + { + sint64 i; + if( fromString( value, i ) ) + _Divisor = i; + return; + } + else + if( name == "modulo" ) + { + sint64 i; + if( fromString( value, i ) ) + _Divisor = i; + return; + } + else + if( name == "suffix" ) + { + _Suffix = value; + return; + } + else + if( name == "prefix" ) + { + _Prefix = value; + return; + } + else + CViewText::setProperty( name, value ); + } + // *************************************************************************** bool CDBViewNumber::parse (xmlNodePtr cur, CInterfaceGroup * parentGroup) {