CHANGED: #1471 Implemented property querying for CDBViewBar3.

This commit is contained in:
dfighter1985 2012-08-02 08:12:41 +02:00
parent 01d3e9f3ab
commit 95b5f61d8c
3 changed files with 162 additions and 0 deletions

View file

@ -38,6 +38,7 @@ namespace NLGUI
/// Constructor /// Constructor
CDBViewBar3(const TCtorParam &param); CDBViewBar3(const TCtorParam &param);
std::string getProperty( const std::string &name ) const;
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 ();
@ -96,6 +97,7 @@ namespace NLGUI
void parseValProp(xmlNodePtr cur, CInterfaceProperty &dbProp, sint32 &intProp, const char *name); void parseValProp(xmlNodePtr cur, CInterfaceProperty &dbProp, sint32 &intProp, const char *name);
sint32 getCurrentValProp(const 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,80 @@ namespace NLGUI
} }
std::string CDBViewBar3::getProperty( const std::string &name ) const
{
if( name == "value1" )
{
return getValProp( _Value[ 0 ], _ValueInt[ 0 ] );
}
else
if( name == "value2" )
{
return getValProp( _Value[ 1 ], _ValueInt[ 1 ] );
}
else
if( name == "value3" )
{
return getValProp( _Value[ 2 ], _ValueInt[ 2 ] );
}
else
if( name == "range1" )
{
return getValProp( _Range[ 0 ], _RangeInt[ 0 ] );
}
else
if( name == "range2" )
{
return getValProp( _Range[ 1 ], _RangeInt[ 1 ] );
}
else
if( name == "range3" )
{
return getValProp( _Range[ 2 ], _RangeInt[ 2 ] );
}
else
if( name == "color1" )
{
return toString( _Colors[ 0 ] );
}
else
if( name == "color2" )
{
return toString( _Colors[ 1 ] );
}
else
if( name == "color3" )
{
return toString( _Colors[ 2 ] );
}
else
if( name == "color1_negative" )
{
return toString( _ColorsNegative[ 0 ] );
}
else
if( name == "color2_negative" )
{
return toString( _ColorsNegative[ 1 ] );
}
else
if( name == "color3_negative" )
{
return toString( _ColorsNegative[ 2 ] );
}
else
if( name == "mini" )
{
if( _Mini )
return "true";
else
return "false";
}
else
return CViewBitmap::getProperty( name );
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
bool CDBViewBar3::parse (xmlNodePtr cur, CInterfaceGroup * parentGroup) bool CDBViewBar3::parse (xmlNodePtr cur, CInterfaceGroup * parentGroup)
{ {
@ -154,6 +228,14 @@ namespace NLGUI
return intProp; return intProp;
} }
std::string CDBViewBar3::getValProp( const CInterfaceProperty &prop, sint32 intProp ) const
{
if( prop.getNodePtr() != NULL )
return prop.getNodePtr()->getFullName();
else
return toString( intProp );
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void CDBViewBar3::draw () void CDBViewBar3::draw ()

View file

@ -0,0 +1,78 @@
<widget>
<header>
<name>DBViewBar3</name>
<guiname>CDBViewBar3</guiname>
<ancestor>ViewBitmap</ancestor>
<description></description>
<abstract>false</abstract>
<icon></icon>
</header>
<properties>
<property>
<name>value1</name>
<type>string</type>
<default>0</default>
</property>
<property>
<name>value2</name>
<type>string</type>
<default>0</default>
</property>
<property>
<name>value3</name>
<type>string</type>
<default>0</default>
</property>
<property>
<name>range1</name>
<type>string</type>
<default>255</default>
</property>
<property>
<name>range2</name>
<type>string</type>
<default>255</default>
</property>
<property>
<name>range3</name>
<type>string</type>
<default>255</default>
</property>
<property>
<name>color1</name>
<type>string</type>
<default>255 255 255 255</default>
</property>
<property>
<name>color2</name>
<type>string</type>
<default>255 255 255 255</default>
</property>
<property>
<name>color3</name>
<type>string</type>
<default>255 255 255 255</default>
</property>
<property>
<name>color1_negative</name>
<type>string</type>
<default>0 0 0 0</default>
</property>
<property>
<name>color2_negative</name>
<type>string</type>
<default>0 0 0 0</default>
</property>
<property>
<name>color3_negative</name>
<type>string</type>
<default>0 0 0 0</default>
</property>
<property>
<name>mini</name>
<type>bool</type>
<default>false</default>
</property>
</properties>
</widget>