CHANGED: #1471 Implemented property setting for CDBViewBar3.

This commit is contained in:
dfighter1985 2012-08-04 20:06:18 +02:00
parent 4dae3b0a18
commit 3e9ad85b40
2 changed files with 111 additions and 1 deletions

View file

@ -39,6 +39,7 @@ namespace NLGUI
CDBViewBar3(const TCtorParam &param);
std::string getProperty( const std::string &name ) const;
void setProperty( const std::string &name, const std::string &value );
bool parse(xmlNodePtr cur,CInterfaceGroup * parentGroup);
virtual uint32 getMemory() { return (uint32)(sizeof(*this)+_Id.size()); }
virtual void updateCoords ();
@ -96,6 +97,7 @@ namespace NLGUI
sint32 _BarH;
void parseValProp(xmlNodePtr cur, CInterfaceProperty &dbProp, sint32 &intProp, const char *name);
void setValProp( const std::string &value, CInterfaceProperty &dbProp, sint32 &intProp );
sint32 getCurrentValProp(const CInterfaceProperty &dbProp, sint32 intProp);
std::string getValProp( const CInterfaceProperty &prop, sint32 intProp ) const;
};

View file

@ -55,6 +55,16 @@ namespace NLGUI
}
void CDBViewBar3::setValProp( const std::string &value, CInterfaceProperty &dbProp, sint32 &intProp )
{
sint32 i;
if( fromString( value, i ) )
intProp = i;
else
dbProp.link( value.c_str() );
}
std::string CDBViewBar3::getProperty( const std::string &name ) const
{
if( name == "value1" )
@ -129,6 +139,104 @@ namespace NLGUI
}
void CDBViewBar3::setProperty( const std::string &name, const std::string &value )
{
if( name == "value1" )
{
setValProp( value, _Value[ 0 ], _ValueInt[ 0 ] );
return;
}
else
if( name == "value2" )
{
setValProp( value, _Value[ 1 ], _ValueInt[ 1 ] );
return;
}
else
if( name == "value3" )
{
setValProp( value, _Value[ 2 ], _ValueInt[ 2 ] );
return;
}
else
if( name == "range1" )
{
setValProp( value, _Range[ 0 ], _RangeInt[ 0 ] );
return;
}
else
if( name == "range2" )
{
setValProp( value, _Range[ 1 ], _RangeInt[ 1 ] );
return;
}
else
if( name == "range3" )
{
setValProp( value, _Range[ 2 ], _RangeInt[ 2 ] );
return;
}
else
if( name == "color1" )
{
CRGBA c;
if( fromString( value, c ) )
_Colors[ 0 ] = c;
return;
}
else
if( name == "color2" )
{
CRGBA c;
if( fromString( value, c ) )
_Colors[ 1 ] = c;
return;
}
else
if( name == "color3" )
{
CRGBA c;
if( fromString( value, c ) )
_Colors[ 2 ] = c;
return;
}
else
if( name == "color1_negative" )
{
CRGBA c;
if( fromString( value, c ) )
_ColorsNegative[ 0 ] = c;
return;
}
else
if( name == "color2_negative" )
{
CRGBA c;
if( fromString( value, c ) )
_ColorsNegative[ 1 ] = c;
return;
}
else
if( name == "color3_negative" )
{
CRGBA c;
if( fromString( value, c ) )
_ColorsNegative[ 2 ] = c;
return;
}
else
if( name == "mini" )
{
bool b;
if( fromString( value, b ) )
_Mini = b;
return;
}
else
CViewBitmap::setProperty( name, value );
}
// ----------------------------------------------------------------------------
bool CDBViewBar3::parse (xmlNodePtr cur, CInterfaceGroup * parentGroup)
{