CHANGED: #1471 Implemented property querying for CViewBitmapCombo.

This commit is contained in:
dfighter1985 2012-08-02 06:56:05 +02:00
parent 23085a00b7
commit efa4a4d14e
3 changed files with 117 additions and 0 deletions

View file

@ -105,6 +105,11 @@ namespace NLGUI
public:
/// ctor
CViewBitmapCombo(const TCtorParam &param);
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

View file

@ -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()
{

View file

@ -0,0 +1,42 @@
<widget>
<header>
<name>ViewBitmapCombo</name>
<guiname>CViewBitmapCombo</guiname>
<ancestor>CtrlBase</ancestor>
<description></description>
<abstract>false</abstract>
<icon></icon>
</header>
<properties>
<property>
<name>tx_normal</name>
<type>string</type>
<default></default>
</property>
<property>
<name>tx_over</name>
<type>string</type>
<default></default>
</property>
<property>
<name>tx_pushed</name>
<type>string</type>
<default></default>
</property>
<property>
<name>col_normal</name>
<type>string</type>
<default></default>
</property>
<property>
<name>col_over</name>
<type>string</type>
<default></default>
</property>
<property>
<name>col_pushed</name>
<type>string</type>
<default></default>
</property>
</properties>
</widget>