From 0e23702cd2474f059e6ceb0f7e2d6a6a8ca310b0 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sat, 4 Aug 2012 19:36:27 +0200 Subject: [PATCH] CHANGED: #1471 Implemented property setting for CViewBitmap. --- code/nel/include/nel/gui/view_bitmap.h | 1 + code/nel/src/gui/view_bitmap.cpp | 120 +++++++++++++++++++++++++ 2 files changed, 121 insertions(+) diff --git a/code/nel/include/nel/gui/view_bitmap.h b/code/nel/include/nel/gui/view_bitmap.h index c187e7448..e2243e714 100644 --- a/code/nel/include/nel/gui/view_bitmap.h +++ b/code/nel/include/nel/gui/view_bitmap.h @@ -59,6 +59,7 @@ namespace NLGUI } std::string getProperty( const std::string &name ) const; + void setProperty( const std::string &name, const std::string &value ); /** * parse an xml node and initialize the base view mambers. Must call CViewBase::parse diff --git a/code/nel/src/gui/view_bitmap.cpp b/code/nel/src/gui/view_bitmap.cpp index 50bb4f768..43d078df2 100644 --- a/code/nel/src/gui/view_bitmap.cpp +++ b/code/nel/src/gui/view_bitmap.cpp @@ -110,6 +110,126 @@ namespace NLGUI return CViewBase::getProperty( name ); } + void CViewBitmap::setProperty( const std::string &name, const std::string &value ) + { + if( name == "color" ) + { + CRGBA c; + if( fromString( value, c ) ) + _Color = c; + return; + } + else + if( name == "txtoffsetx" ) + { + sint32 i; + if( fromString( value, i ) ) + _TxtOffsetX = i; + return; + } + else + if( name == "txtoffsety" ) + { + sint32 i; + if( fromString( value, i ) ) + _TxtOffsetY = i; + return; + } + else + if( name == "txtwidth" ) + { + sint32 i; + if( fromString( value, i ) ) + _TxtWidth = i; + return; + } + else + if( name == "txtheight" ) + { + sint32 i; + if( fromString( value, i ) ) + _TxtHeight = i; + return; + } + else + if( name == "texture" ) + { + setTexture( value ); + return; + } + else + if( name == "scale" ) + { + bool b; + if( fromString( value, b ) ) + _Scale = b; + return; + } + else + if( name == "rot" ) + { + sint32 i; + if( fromString( value, i ) ) + _Rot = i; + return; + } + else + if( name == "flip" ) + { + bool b; + if( fromString( value, b ) ) + _Flip = b; + return; + } + else + if( name == "tile" ) + { + bool b; + if( fromString( value, b ) ) + _Tile = b; + return; + } + else + if( name == "align" ) + { + std::string::size_type i; + for( i = 0; i < value.size(); i++ ) + { + const char c = value[ i ]; + + switch( c ) + { + case 'L': + _Align &= ~1; + break; + + case 'R': + _Align |= 1; + break; + + case 'B': + _Align &= ~2; + break; + + case 'T': + _Align |= 2; + break; + } + } + return; + } + else + if( name == "inherit_gc_alpha" ) + { + bool b; + if( fromString( value, b ) ) + _InheritGCAlpha = b; + return; + } + else + CViewBase::setProperty( name, value ); + } + // ---------------------------------------------------------------------------- bool CViewBitmap::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup)