CHANGED: #1471 Implemented property querying for CGroupParagraph.

This commit is contained in:
dfighter1985 2012-08-01 06:24:14 +02:00
parent eec6a5cb8a
commit a3b7a78961
3 changed files with 82 additions and 6 deletions

View file

@ -125,6 +125,8 @@ namespace NLGUI
return &_Templ; return &_Templ;
} }
std::string getProperty( const std::string &name ) const;
/** /**
* parse the element and initalize it * parse the element and initalize it
* \paral cur : pointer to the node describing this element * \paral cur : pointer to the node describing this element
@ -289,6 +291,8 @@ namespace NLGUI
CInterfaceElement *_BrowseGroup; CInterfaceElement *_BrowseGroup;
private: private:
std::string _HardText;
uint32 _TextId;
// void setHSGroup (CViewBase *child, EAlign addElt, EAlign align); // void setHSGroup (CViewBase *child, EAlign addElt, EAlign align);
// void setHSParent(CViewBase *view, EAlign addElt, EAlign align, uint space); // void setHSParent(CViewBase *view, EAlign addElt, EAlign align, uint space);

View file

@ -362,6 +362,7 @@ namespace NLGUI
ptr = (char*) xmlGetProp( cur, (xmlChar*)"hardtext" ); ptr = (char*) xmlGetProp( cur, (xmlChar*)"hardtext" );
if (ptr) if (ptr)
{ {
_HardText = std::string( ptr );
const char *propPtr = ptr; const char *propPtr = ptr;
ucstring Text = ucstring(propPtr); ucstring Text = ucstring(propPtr);
if ((strlen(propPtr)>2) && (propPtr[0] == 'u') && (propPtr[1] == 'i')) if ((strlen(propPtr)>2) && (propPtr[0] == 'u') && (propPtr[1] == 'i'))
@ -374,9 +375,8 @@ namespace NLGUI
ptr = (char*) xmlGetProp( cur, (xmlChar*)"textid" ); ptr = (char*) xmlGetProp( cur, (xmlChar*)"textid" );
if (ptr) if (ptr)
{ {
uint32 textId; fromString((const char*)ptr, _TextId );
fromString((const char*)ptr, textId); addTextChildID( _TextId );
addTextChildID(textId);
} }
} }

View file

@ -55,6 +55,7 @@ namespace NLGUI
_Indent = 0; _Indent = 0;
_FirstViewIndentView = false; _FirstViewIndentView = false;
_BrowseGroup = NULL; _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) bool CGroupParagraph::parse (xmlNodePtr cur, CInterfaceGroup * parentGroup)
{ {
@ -263,6 +335,7 @@ namespace NLGUI
ptr = (char*) xmlGetProp( cur, (xmlChar*)"hardtext" ); ptr = (char*) xmlGetProp( cur, (xmlChar*)"hardtext" );
if (ptr) if (ptr)
{ {
_HardText = std::string( ptr );
const char *propPtr = ptr; const char *propPtr = ptr;
ucstring Text = ucstring(propPtr); ucstring Text = ucstring(propPtr);
if ((strlen(propPtr)>2) && (propPtr[0] == 'u') && (propPtr[1] == 'i')) if ((strlen(propPtr)>2) && (propPtr[0] == 'u') && (propPtr[1] == 'i'))
@ -275,9 +348,8 @@ namespace NLGUI
ptr = (char*) xmlGetProp( cur, (xmlChar*)"textid" ); ptr = (char*) xmlGetProp( cur, (xmlChar*)"textid" );
if (ptr) if (ptr)
{ {
uint32 textId; fromString((const char*)ptr, _TextId );
fromString((const char*)ptr, textId); addTextChildID( _TextId );
addTextChildID(textId);
} }
} }