CHANGED: #1471 Implemented property querying for CGroupList.

This commit is contained in:
dfighter1985 2012-08-01 05:51:35 +02:00
parent a812f5dd29
commit bc5b5d0af4
3 changed files with 146 additions and 0 deletions

View file

@ -108,6 +108,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
@ -194,6 +196,8 @@ namespace NLGUI
protected: protected:
std::string _HardText;
uint32 _TextId;
//max number of elements //max number of elements
sint32 _MaxElements; sint32 _MaxElements;

View file

@ -50,6 +50,7 @@ namespace NLGUI
_OverColor = CRGBA(255, 255, 255, 32); _OverColor = CRGBA(255, 255, 255, 32);
_OverElt = -1; _OverElt = -1;
_IsGroupList = true; _IsGroupList = true;
_TextId = 0;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -190,6 +191,86 @@ namespace NLGUI
} }
} }
std::string CGroupList::getProperty( const std::string &name ) const
{
if( name == "maxelements" )
{
return toString( _MaxElements );
}
else
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 == "dynamic_display_size" )
{
return toString( _DynamicDisplaySize );
}
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 CGroupList::parse (xmlNodePtr cur, CInterfaceGroup * parentGroup) bool CGroupList::parse (xmlNodePtr cur, CInterfaceGroup * parentGroup)
{ {

View file

@ -0,0 +1,61 @@
<widget>
<header>
<name>GroupList</name>
<guiname>CGroupList</guiname>
<ancestor>InterfaceGroup</ancestor>
<description></description>
<abstract>false</abstract>
<icon></icon>
</header>
<properties>
<property>
<name>maxelements</name>
<type>int</type>
<default>1024</default>
</property>
<property>
<name>addelt</name>
<type>string</type>
<default>B</default>
</property>
<property>
<name>align</name>
<type>string</type>
<default>L</default>
</property>
<property>
<name>space</name>
<type>int</type>
<default>0</default>
</property>
<property>
<name>over</name>
<type>bool</type>
<default>false</default>
</property>
<property>
<name>dynamic_display_size</name>
<type>bool</type>
<default>false</default>
</property>
<property>
<name>col_over</name>
<type>string</type>
<default>255 255 255 32</default>
</property>
<property>
<name>hardtext</name>
<type>string</type>
<default></default>
</property>
<property>
<name>textid</name>
<type>int</type>
<default>0</default>
</property>
</properties>
</widget>