From ab69e85538499d513ef448f336ef4eb4c7f7ecd9 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Thu, 2 Aug 2012 06:56:05 +0200 Subject: [PATCH] CHANGED: #1471 Implemented property querying for CViewBitmapCombo. --HG-- branch : gsoc2012-gui-editor --- code/nel/include/nel/gui/view_bitmap_combo.h | 7 ++ code/nel/src/gui/view_bitmap_combo.cpp | 68 +++++++++++++++++++ .../gui_editor/widgets/ViewBitmapCombo.xml | 42 ++++++++++++ 3 files changed, 117 insertions(+) create mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/ViewBitmapCombo.xml diff --git a/code/nel/include/nel/gui/view_bitmap_combo.h b/code/nel/include/nel/gui/view_bitmap_combo.h index 5a992a588..2548a143f 100644 --- a/code/nel/include/nel/gui/view_bitmap_combo.h +++ b/code/nel/include/nel/gui/view_bitmap_combo.h @@ -105,6 +105,11 @@ namespace NLGUI public: /// ctor CViewBitmapCombo(const TCtorParam ¶m); + + + std::string getProperty( const std::string &name ) const; + + /** * parse an xml node and initialize the base view members. Must call CViewBase::parse * \param cur : pointer to the xml node to be parsed @@ -159,6 +164,8 @@ namespace NLGUI private: void parseTexList(const std::string &names, TStringArray &dest); void parseColList(const std::string &names, TColorArray &dest); + void getTexList( const TStringArray &arr, std::string &dest ) const; + void getColList( const TColorArray &arr, std::string &dest ) const; void setupSize(); void getDimensions(uint &numRow, uint &numCol); // From ICDBNode::IPropertyObserver diff --git a/code/nel/src/gui/view_bitmap_combo.cpp b/code/nel/src/gui/view_bitmap_combo.cpp index a13bf9364..b7aa6f034 100644 --- a/code/nel/src/gui/view_bitmap_combo.cpp +++ b/code/nel/src/gui/view_bitmap_combo.cpp @@ -169,6 +169,52 @@ namespace NLGUI { } + std::string CViewBitmapCombo::getProperty( const std::string &name ) const + { + if( name == "tx_normal" ) + { + std::string normal; + getTexList( _Texs, normal ); + return normal; + } + else + if( name == "tx_over" ) + { + std::string over; + getTexList( _TexsOver, over ); + return over; + } + else + if( name == "tx_pushed" ) + { + std::string pushed; + getTexList( _TexsPushed, pushed ); + return pushed; + } + else + if( name == "col_normal" ) + { + std::string normal; + getColList( _Col, normal ); + return normal; + } + else + if( name == "col_over" ) + { + std::string over; + getColList( _ColOver, over ); + return over; + } + else + if( name == "col_pushed" ) + { + std::string pushed; + getColList( _ColPushed, pushed ); + return pushed; + } + else + return CViewBase::getProperty( name ); + } //======================================================================================= bool CViewBitmapCombo::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup) @@ -505,6 +551,28 @@ namespace NLGUI while (pos != std::string::npos); } + void CViewBitmapCombo::getTexList( const TStringArray &arr, std::string &dest ) const + { + dest.clear(); + TStringArray::const_iterator itr; + for( itr = arr.begin(); itr != arr.end(); ++itr ) + { + dest += *itr; + dest += " "; + } + } + + void CViewBitmapCombo::getColList( const TColorArray &arr, std::string &dest ) const + { + dest.clear(); + TColorArray::const_iterator itr; + for( itr = arr.begin(); itr != arr.end(); ++itr ) + { + dest += toString( *itr ); + dest += " "; + } + } + //======================================================================================= void CViewBitmapCombo::setupSize() { diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/ViewBitmapCombo.xml b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/ViewBitmapCombo.xml new file mode 100644 index 000000000..b2ec2aeef --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/ViewBitmapCombo.xml @@ -0,0 +1,42 @@ + +
+ ViewBitmapCombo + CViewBitmapCombo + CtrlBase + + false + +
+ + + tx_normal + string + + + + tx_over + string + + + + tx_pushed + string + + + + col_normal + string + + + + col_over + string + + + + col_pushed + string + + + +