From 04beaac3c8a26e835bb572a2bccdd5a7cfb6b667 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sat, 4 Aug 2012 19:55:10 +0200 Subject: [PATCH] CHANGED: #1471 Implemented property setting for CDBViewBar. --HG-- branch : gsoc2012-gui-editor --- code/nel/include/nel/gui/dbview_bar.h | 1 + code/nel/src/gui/dbview_bar.cpp | 70 +++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) diff --git a/code/nel/include/nel/gui/dbview_bar.h b/code/nel/include/nel/gui/dbview_bar.h index 739a0e407..f905453c9 100644 --- a/code/nel/include/nel/gui/dbview_bar.h +++ b/code/nel/include/nel/gui/dbview_bar.h @@ -53,6 +53,7 @@ namespace NLGUI void setType (TViewBar vb); std::string getProperty( const std::string &name ) const; + void setProperty( const std::string &name, const std::string &value ); bool parse(xmlNodePtr cur,CInterfaceGroup * parentGroup); virtual uint32 getMemory() { return (uint32)(sizeof(*this)+_Id.size()); } virtual void updateCoords (); diff --git a/code/nel/src/gui/dbview_bar.cpp b/code/nel/src/gui/dbview_bar.cpp index ff26998f7..36999f5dd 100644 --- a/code/nel/src/gui/dbview_bar.cpp +++ b/code/nel/src/gui/dbview_bar.cpp @@ -101,6 +101,76 @@ namespace NLGUI return CViewBitmap::getProperty( name ); } + void CDBViewBar::setProperty( const std::string &name, const std::string &value ) + { + if( name == "value" ) + { + sint32 i; + if( fromString( value, i ) ) + _ValueInt = i; + else + _Value.link( value.c_str() ); + return; + } + else + if( name == "range" ) + { + sint32 i; + if( fromString( value, i ) ) + _RangeInt = i; + else + _Range.link( value.c_str() ); + return; + } + else + if( name == "reference" ) + { + sint32 i; + if( fromString( value, i ) ) + _ReferenceInt = i; + else + _Reference.link( value.c_str() ); + return; + } + else + if( name == "color_negative" ) + { + CRGBA c; + if( fromString( value, c ) ) + _ColorNegative = c; + return; + } + else + if( name == "mini" ) + { + bool b; + if( fromString( value, b ) ) + if( b ) + _Type = ViewBar_Mini; + return; + } + else + if( name == "ultra_mini" ) + { + bool b; + if( fromString( value, b ) ) + if( b ) + _Type = ViewBar_UltraMini; + return; + } + else + if( name == "mini_thick" ) + { + bool b; + if( fromString( value, b ) ) + if( b ) + _Type = ViewBar_MiniThick; + return; + } + else + CViewBitmap::setProperty( name, value ); + } + // ---------------------------------------------------------------------------- bool CDBViewBar::parse (xmlNodePtr cur, CInterfaceGroup * parentGroup) {