From cdb93cedaa01a408d90b9d17b4899ccc4591c4d0 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Mon, 30 Jul 2012 06:33:36 +0200 Subject: [PATCH] CHANGED: #1471 Implemented property querying for CCtrlScroll. --HG-- branch : gsoc2012-gui-editor --- code/nel/include/nel/gui/ctrl_scroll.h | 4 + code/nel/src/gui/ctrl_scroll.cpp | 148 ++++++++++++++++++ code/nel/src/gui/interface_element.cpp | 2 + .../plugins/gui_editor/widgets/CtrlScroll.xml | 107 +++++++++++++ 4 files changed, 261 insertions(+) create mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/CtrlScroll.xml diff --git a/code/nel/include/nel/gui/ctrl_scroll.h b/code/nel/include/nel/gui/ctrl_scroll.h index c20e41e4e..0e623b747 100644 --- a/code/nel/include/nel/gui/ctrl_scroll.h +++ b/code/nel/include/nel/gui/ctrl_scroll.h @@ -40,6 +40,7 @@ namespace NLGUI CCtrlScroll(const TCtorParam ¶m); ~CCtrlScroll(); + std::string getProperty( const std::string &name ) const; virtual bool parse(xmlNodePtr cur, CInterfaceGroup * parentGroup); @@ -65,6 +66,9 @@ namespace NLGUI void setTextureBottomOrLeft (const std::string &txName); void setTextureMiddle (const std::string &txName); void setTextureTopOrRight (const std::string &txName); + std::string getTextureBottomOrLeft() const; + std::string getTextureMiddle() const; + std::string getTextureTopOrRight() const; void setTextureBottomOrLeft (sint32 txid) { _TxIdB = txid; } void setTextureMiddle (sint32 txid) { _TxIdM = txid; } diff --git a/code/nel/src/gui/ctrl_scroll.cpp b/code/nel/src/gui/ctrl_scroll.cpp index 597ccc3cd..58be5d7cd 100644 --- a/code/nel/src/gui/ctrl_scroll.cpp +++ b/code/nel/src/gui/ctrl_scroll.cpp @@ -85,6 +85,139 @@ namespace NLGUI } } + std::string CCtrlScroll::getProperty( const std::string &name ) const + { + + if( name == "tx_bottomleft" ) + { + return getTextureBottomOrLeft(); + } + else + if( name == "tx_middle" ) + { + return getTextureMiddle(); + } + else + if( name == "tx_topright" ) + { + return getTextureTopOrRight(); + } + else + if( name == "vertical" ) + { + return toString( _Vertical ); + } + else + if( name == "align" ) + { + switch( _Aligned ) + { + case 0: + return "T"; + break; + case 1: + return "B"; + break; + case 2: + return "L"; + break; + case 3: + return "R"; + break; + } + + return ""; + } + else + if( name == "min" ) + { + return toString( _Min ); + } + else + if( name == "max" ) + { + return toString( _Max ); + } + else + if( name == "value" ) + { + if( _IsDBLink ) + return _DBLink.getNodePtr()->getFullName(); + else + return toString( _Value ); + } + else + if( name == "tracksize" ) + { + return toString( _TrackSize ); + } + else + if( name == "onscroll" ) + { + return _AHOnScroll; + } + else + if( name == "params" ) + { + return _AHOnScrollParams; + } + else + if( name == "onscrollend" ) + { + return _AHOnScrollEnd; + } + else + if( name == "end_params" ) + { + return _AHOnScrollEndParams; + } + else + if( name == "onscrollcancel" ) + { + return _AHOnScrollCancel; + } + else + if( name == "cancel_params" ) + { + return _AHOnScrollCancelParams; + } + else + if( name == "target" ) + { + if( _Target != NULL ) + return _Target->getId(); + else + return ""; + } + else + if( name == "target_stepx" ) + { + return toString( _TargetStepX ); + } + else + if( name == "target_stepy" ) + { + return toString( _TargetStepY ); + } + else + if( name == "step_value" ) + { + return toString( _StepValue ); + } + else + if( name == "cancelable" ) + { + return toString( _Cancelable ); + } + else + if( name == "frozen" ) + { + return toString( _Frozen ); + } + else + return CCtrlBase::getProperty( name ); + } + // ------------------------------------------------------------------------------------------------ bool CCtrlScroll::parse(xmlNodePtr node, CInterfaceGroup * parentGroup) { @@ -708,6 +841,21 @@ namespace NLGUI _TxIdT = rVR.getTextureIdFromName(txName); } + std::string CCtrlScroll::getTextureBottomOrLeft() const + { + return CViewRenderer::getInstance()->getTextureNameFromId( _TxIdB ); + } + + std::string CCtrlScroll::getTextureMiddle() const + { + return CViewRenderer::getInstance()->getTextureNameFromId( _TxIdM ); + } + + std::string CCtrlScroll::getTextureTopOrRight() const + { + return CViewRenderer::getInstance()->getTextureNameFromId( _TxIdT ); + } + // ------------------------------------------------------------------------------------------------ void CCtrlScroll::setValue(sint32 value) { diff --git a/code/nel/src/gui/interface_element.cpp b/code/nel/src/gui/interface_element.cpp index 9ac109937..9e9574e96 100644 --- a/code/nel/src/gui/interface_element.cpp +++ b/code/nel/src/gui/interface_element.cpp @@ -288,6 +288,8 @@ namespace NLGUI return toString( _AvoidResizeParent ); } + nlwarning( "Invalid property '%s' queried for widget '%s'", name.c_str(), _Id.c_str() ); + return ""; } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/CtrlScroll.xml b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/CtrlScroll.xml new file mode 100644 index 000000000..db587084e --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/CtrlScroll.xml @@ -0,0 +1,107 @@ + +
+ CtrlScroll + CCtrlScroll + CtrlBase + + false + +
+ + + tx_bottomleft + string + w_scroll_10_b.tga + + + tx_middle + string + w_scroll_10_m.tga + + + tx_topright + string + w_scroll_10_t.tga + + + vertical + bool + true + + + align + string + B + + + min + int + 0 + + + max + int + 100 + + + value + string + 0 + + + tracksize + int + 16 + + + onscroll + string + + + + params + string + + + onscrollend + string + + + end_params + string + + + onscrollcancel + string + + + cancel_params + string + + + target + string + + + target_stepx + int + 1 + + target_stepy + int + 1 + + stepvalue + int + 0 + + cancelable + bool + false + + frozen + bool + false + + +