CHANGED: #1471 Implemented property setting for CDBViewBar.

This commit is contained in:
dfighter1985 2012-08-04 19:55:10 +02:00
parent 0e23702cd2
commit 4dae3b0a18
2 changed files with 71 additions and 0 deletions

View file

@ -53,6 +53,7 @@ namespace NLGUI
void setType (TViewBar vb); void setType (TViewBar vb);
std::string getProperty( const std::string &name ) const; std::string getProperty( const std::string &name ) const;
void setProperty( const std::string &name, const std::string &value );
bool parse(xmlNodePtr cur,CInterfaceGroup * parentGroup); bool parse(xmlNodePtr cur,CInterfaceGroup * parentGroup);
virtual uint32 getMemory() { return (uint32)(sizeof(*this)+_Id.size()); } virtual uint32 getMemory() { return (uint32)(sizeof(*this)+_Id.size()); }
virtual void updateCoords (); virtual void updateCoords ();

View file

@ -101,6 +101,76 @@ namespace NLGUI
return CViewBitmap::getProperty( name ); return CViewBitmap::getProperty( name );
} }
void CDBViewBar::setProperty( const std::string &name, const std::string &value )
{
if( name == "value" )
{
sint32 i;
if( fromString( value, i ) )
_ValueInt = i;
else
_Value.link( value.c_str() );
return;
}
else
if( name == "range" )
{
sint32 i;
if( fromString( value, i ) )
_RangeInt = i;
else
_Range.link( value.c_str() );
return;
}
else
if( name == "reference" )
{
sint32 i;
if( fromString( value, i ) )
_ReferenceInt = i;
else
_Reference.link( value.c_str() );
return;
}
else
if( name == "color_negative" )
{
CRGBA c;
if( fromString( value, c ) )
_ColorNegative = c;
return;
}
else
if( name == "mini" )
{
bool b;
if( fromString( value, b ) )
if( b )
_Type = ViewBar_Mini;
return;
}
else
if( name == "ultra_mini" )
{
bool b;
if( fromString( value, b ) )
if( b )
_Type = ViewBar_UltraMini;
return;
}
else
if( name == "mini_thick" )
{
bool b;
if( fromString( value, b ) )
if( b )
_Type = ViewBar_MiniThick;
return;
}
else
CViewBitmap::setProperty( name, value );
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
bool CDBViewBar::parse (xmlNodePtr cur, CInterfaceGroup * parentGroup) bool CDBViewBar::parse (xmlNodePtr cur, CInterfaceGroup * parentGroup)
{ {