From 34961bd5d2155be3fc424d3bde754a99d565a56c Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Wed, 1 Aug 2012 06:24:14 +0200 Subject: [PATCH] CHANGED: #1471 Implemented property querying for CGroupParagraph. --HG-- branch : gsoc2012-gui-editor --- code/nel/include/nel/gui/group_paragraph.h | 4 ++ code/nel/src/gui/group_list.cpp | 6 +- code/nel/src/gui/group_paragraph.cpp | 78 +++++++++++++++++++++- 3 files changed, 82 insertions(+), 6 deletions(-) diff --git a/code/nel/include/nel/gui/group_paragraph.h b/code/nel/include/nel/gui/group_paragraph.h index b32947330..2cac42bd2 100644 --- a/code/nel/include/nel/gui/group_paragraph.h +++ b/code/nel/include/nel/gui/group_paragraph.h @@ -125,6 +125,8 @@ namespace NLGUI return &_Templ; } + std::string getProperty( const std::string &name ) const; + /** * parse the element and initalize it * \paral cur : pointer to the node describing this element @@ -289,6 +291,8 @@ namespace NLGUI CInterfaceElement *_BrowseGroup; private: + std::string _HardText; + uint32 _TextId; // void setHSGroup (CViewBase *child, EAlign addElt, EAlign align); // void setHSParent(CViewBase *view, EAlign addElt, EAlign align, uint space); diff --git a/code/nel/src/gui/group_list.cpp b/code/nel/src/gui/group_list.cpp index 4a163a9a9..f60cc475c 100644 --- a/code/nel/src/gui/group_list.cpp +++ b/code/nel/src/gui/group_list.cpp @@ -362,6 +362,7 @@ namespace NLGUI ptr = (char*) xmlGetProp( cur, (xmlChar*)"hardtext" ); if (ptr) { + _HardText = std::string( ptr ); const char *propPtr = ptr; ucstring Text = ucstring(propPtr); if ((strlen(propPtr)>2) && (propPtr[0] == 'u') && (propPtr[1] == 'i')) @@ -374,9 +375,8 @@ namespace NLGUI ptr = (char*) xmlGetProp( cur, (xmlChar*)"textid" ); if (ptr) { - uint32 textId; - fromString((const char*)ptr, textId); - addTextChildID(textId); + fromString((const char*)ptr, _TextId ); + addTextChildID( _TextId ); } } diff --git a/code/nel/src/gui/group_paragraph.cpp b/code/nel/src/gui/group_paragraph.cpp index 1805b2d47..b5896cf18 100644 --- a/code/nel/src/gui/group_paragraph.cpp +++ b/code/nel/src/gui/group_paragraph.cpp @@ -55,6 +55,7 @@ namespace NLGUI _Indent = 0; _FirstViewIndentView = false; _BrowseGroup = NULL; + _TextId = 0; } // ---------------------------------------------------------------------------- @@ -186,6 +187,77 @@ namespace NLGUI } }*/ + + std::string CGroupParagraph::getProperty( const std::string &name ) const + { + if( name == "addelt" ) + { + switch( _AddElt ) + { + case Top: + return "T"; + break; + + case Left: + return "L"; + break; + + case Right: + return "R"; + break; + } + + return "B"; + } + else + if( name == "align" ) + { + switch( _Align ) + { + case Top: + return "T"; + break; + + case Left: + return "L"; + break; + + case Right: + return "R"; + break; + } + + return "B"; + } + else + if( name == "space" ) + { + return toString( _Space ); + } + else + if( name == "over" ) + { + return toString( _Over ); + } + else + if( name == "col_over" ) + { + return toString( _OverColor ); + } + else + if( name == "hardtext" ) + { + return _HardText; + } + else + if( name == "textid" ) + { + return toString( _TextId ); + } + else + return CInterfaceGroup::getProperty( name ); + } + // ---------------------------------------------------------------------------- bool CGroupParagraph::parse (xmlNodePtr cur, CInterfaceGroup * parentGroup) { @@ -263,6 +335,7 @@ namespace NLGUI ptr = (char*) xmlGetProp( cur, (xmlChar*)"hardtext" ); if (ptr) { + _HardText = std::string( ptr ); const char *propPtr = ptr; ucstring Text = ucstring(propPtr); if ((strlen(propPtr)>2) && (propPtr[0] == 'u') && (propPtr[1] == 'i')) @@ -275,9 +348,8 @@ namespace NLGUI ptr = (char*) xmlGetProp( cur, (xmlChar*)"textid" ); if (ptr) { - uint32 textId; - fromString((const char*)ptr, textId); - addTextChildID(textId); + fromString((const char*)ptr, _TextId ); + addTextChildID( _TextId ); } }