From cf53991e7a26fb9a957f437720c4f0d8cc5de261 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sat, 4 Aug 2012 01:46:37 +0200 Subject: [PATCH] CHANGED: #1471 Implemented property setting for CCtrlTabButton and CCtrlScroll. --- code/nel/include/nel/gui/ctrl_scroll.h | 1 + code/nel/include/nel/gui/group_tab.h | 1 + code/nel/src/gui/ctrl_scroll.cpp | 174 +++++++++++++++++++++++++ code/nel/src/gui/group_tab.cpp | 10 ++ 4 files changed, 186 insertions(+) diff --git a/code/nel/include/nel/gui/ctrl_scroll.h b/code/nel/include/nel/gui/ctrl_scroll.h index 0e623b747..8939b480d 100644 --- a/code/nel/include/nel/gui/ctrl_scroll.h +++ b/code/nel/include/nel/gui/ctrl_scroll.h @@ -41,6 +41,7 @@ namespace NLGUI ~CCtrlScroll(); 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); diff --git a/code/nel/include/nel/gui/group_tab.h b/code/nel/include/nel/gui/group_tab.h index ae7b45b08..06cfdb437 100644 --- a/code/nel/include/nel/gui/group_tab.h +++ b/code/nel/include/nel/gui/group_tab.h @@ -154,6 +154,7 @@ namespace NLGUI CCtrlTabButton(const TCtorParam ¶m); + void setProperty( const std::string &name, const std::string &value ); std::string getProperty( const std::string &name ) const; virtual bool parse (xmlNodePtr cur, CInterfaceGroup *parentGroup); diff --git a/code/nel/src/gui/ctrl_scroll.cpp b/code/nel/src/gui/ctrl_scroll.cpp index 58be5d7cd..699466bab 100644 --- a/code/nel/src/gui/ctrl_scroll.cpp +++ b/code/nel/src/gui/ctrl_scroll.cpp @@ -218,6 +218,180 @@ namespace NLGUI return CCtrlBase::getProperty( name ); } + + void CCtrlScroll::setProperty( const std::string &name, const std::string &value ) + { + if( name == "tx_bottomleft" ) + { + setTextureBottomOrLeft( value ); + return; + } + else + if( name == "tx_middle" ) + { + setTextureMiddle( value ); + return; + } + else + if( name == "tx_topright" ) + { + setTextureTopOrRight( value ); + return; + } + else + if( name == "vertical" ) + { + bool b; + if( fromString( value, b ) ) + _Vertical = b; + return; + } + else + if( name == "align" ) + { + if( value == "T" ) + _Aligned = 0; + else + if( value == "B" ) + _Aligned = 1; + else + if( value == "L" ) + _Aligned = 2; + else + if( value == "R" ) + _Aligned = 3; + + return; + } + else + if( name == "min" ) + { + sint32 i; + if( fromString( value, i ) ) + _Min = i; + return; + } + else + if( name == "max" ) + { + sint32 i; + if( fromString( value, i ) ) + _Max = i; + return; + } + else + if( name == "value" ) + { + sint32 i; + if( fromString( value, i ) ) + { + _IsDBLink = false; + _Value = i; + } + else + { + _IsDBLink = true; + _DBLink.link( value.c_str() ); + _DBLink.getNodePtr()->addObserver( this, ICDBNode::CTextId() ); + } + return; + } + else + if( name == "tracksize" ) + { + sint32 i; + if( fromString( value, i ) ) + _TrackSize = i; + return; + } + else + if( name == "onscroll" ) + { + _AHOnScroll = value; + return; + } + else + if( name == "params" ) + { + _AHOnScrollParams = value; + return; + } + else + if( name == "onscrollend" ) + { + _AHOnScrollEnd = value; + return; + } + else + if( name == "end_params" ) + { + _AHOnScrollEndParams = value; + return; + } + else + if( name == "onscrollcancel" ) + { + _AHOnScrollCancel = value; + return; + } + else + if( name == "cancel_params" ) + { + _AHOnScrollCancelParams = value; + return; + } + else + if( name == "target" ) + { + _Target = dynamic_cast< CInterfaceGroup* >( + CWidgetManager::getInstance()->getElementFromId( value ) + ); + return; + } + else + if( name == "target_stepx" ) + { + sint32 i; + if( fromString( value, i ) ) + _TargetStepX = i; + return; + } + else + if( name == "target_stepy" ) + { + sint32 i; + if( fromString( value, i ) ) + _TargetStepY = i; + return; + } + else + if( name == "step_value" ) + { + uint32 i; + if( fromString( value, i ) ) + _StepValue = i; + return; + } + else + if( name == "cancelable" ) + { + bool b; + if( fromString( value, b ) ) + _Cancelable = b; + return; + } + else + if( name == "frozen" ) + { + bool b; + if( fromString( value, b ) ) + _Frozen = b; + return; + } + else + CCtrlBase::setProperty( name, value ); + } + // ------------------------------------------------------------------------------------------------ bool CCtrlScroll::parse(xmlNodePtr node, CInterfaceGroup * parentGroup) { diff --git a/code/nel/src/gui/group_tab.cpp b/code/nel/src/gui/group_tab.cpp index 1e2ec7dc2..6f7c35c17 100644 --- a/code/nel/src/gui/group_tab.cpp +++ b/code/nel/src/gui/group_tab.cpp @@ -756,6 +756,16 @@ namespace NLGUI return CCtrlTextButton::getProperty( name ); } + void CCtrlTabButton::setProperty( const std::string &name, const std::string &value ) + { + if( name == "group" ) + { + _AssociatedGroup = value; + } + else + CCtrlTextButton::setProperty( name, value ); + } + // *************************************************************************** bool CCtrlTabButton::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup) {