CHANGED: #1471 Implemented property querying for CCtrlScroll.

This commit is contained in:
dfighter1985 2012-07-30 06:33:36 +02:00
parent f37239091d
commit d939a09864
4 changed files with 261 additions and 0 deletions

View file

@ -40,6 +40,7 @@ namespace NLGUI
CCtrlScroll(const TCtorParam &param);
~CCtrlScroll();
std::string getProperty( const std::string &name ) const;
virtual bool parse(xmlNodePtr cur, CInterfaceGroup * parentGroup);
@ -65,6 +66,9 @@ namespace NLGUI
void setTextureBottomOrLeft (const std::string &txName);
void setTextureMiddle (const std::string &txName);
void setTextureTopOrRight (const std::string &txName);
std::string getTextureBottomOrLeft() const;
std::string getTextureMiddle() const;
std::string getTextureTopOrRight() const;
void setTextureBottomOrLeft (sint32 txid) { _TxIdB = txid; }
void setTextureMiddle (sint32 txid) { _TxIdM = txid; }

View file

@ -85,6 +85,139 @@ namespace NLGUI
}
}
std::string CCtrlScroll::getProperty( const std::string &name ) const
{
if( name == "tx_bottomleft" )
{
return getTextureBottomOrLeft();
}
else
if( name == "tx_middle" )
{
return getTextureMiddle();
}
else
if( name == "tx_topright" )
{
return getTextureTopOrRight();
}
else
if( name == "vertical" )
{
return toString( _Vertical );
}
else
if( name == "align" )
{
switch( _Aligned )
{
case 0:
return "T";
break;
case 1:
return "B";
break;
case 2:
return "L";
break;
case 3:
return "R";
break;
}
return "";
}
else
if( name == "min" )
{
return toString( _Min );
}
else
if( name == "max" )
{
return toString( _Max );
}
else
if( name == "value" )
{
if( _IsDBLink )
return _DBLink.getNodePtr()->getFullName();
else
return toString( _Value );
}
else
if( name == "tracksize" )
{
return toString( _TrackSize );
}
else
if( name == "onscroll" )
{
return _AHOnScroll;
}
else
if( name == "params" )
{
return _AHOnScrollParams;
}
else
if( name == "onscrollend" )
{
return _AHOnScrollEnd;
}
else
if( name == "end_params" )
{
return _AHOnScrollEndParams;
}
else
if( name == "onscrollcancel" )
{
return _AHOnScrollCancel;
}
else
if( name == "cancel_params" )
{
return _AHOnScrollCancelParams;
}
else
if( name == "target" )
{
if( _Target != NULL )
return _Target->getId();
else
return "";
}
else
if( name == "target_stepx" )
{
return toString( _TargetStepX );
}
else
if( name == "target_stepy" )
{
return toString( _TargetStepY );
}
else
if( name == "step_value" )
{
return toString( _StepValue );
}
else
if( name == "cancelable" )
{
return toString( _Cancelable );
}
else
if( name == "frozen" )
{
return toString( _Frozen );
}
else
return CCtrlBase::getProperty( name );
}
// ------------------------------------------------------------------------------------------------
bool CCtrlScroll::parse(xmlNodePtr node, CInterfaceGroup * parentGroup)
{
@ -708,6 +841,21 @@ namespace NLGUI
_TxIdT = rVR.getTextureIdFromName(txName);
}
std::string CCtrlScroll::getTextureBottomOrLeft() const
{
return CViewRenderer::getInstance()->getTextureNameFromId( _TxIdB );
}
std::string CCtrlScroll::getTextureMiddle() const
{
return CViewRenderer::getInstance()->getTextureNameFromId( _TxIdM );
}
std::string CCtrlScroll::getTextureTopOrRight() const
{
return CViewRenderer::getInstance()->getTextureNameFromId( _TxIdT );
}
// ------------------------------------------------------------------------------------------------
void CCtrlScroll::setValue(sint32 value)
{

View file

@ -288,6 +288,8 @@ namespace NLGUI
return toString( _AvoidResizeParent );
}
nlwarning( "Invalid property '%s' queried for widget '%s'", name.c_str(), _Id.c_str() );
return "";
}

View file

@ -0,0 +1,107 @@
<widget>
<header>
<name>CtrlScroll</name>
<guiname>CCtrlScroll</guiname>
<ancestor>CtrlBase</ancestor>
<description></description>
<abstract>false</abstract>
<icon></icon>
</header>
<properties>
<property>
<name>tx_bottomleft</name>
<type>string</type>
<default>w_scroll_10_b.tga</default>
</property>
<property>
<name>tx_middle</name>
<type>string</type>
<default>w_scroll_10_m.tga</default>
</property>
<property>
<name>tx_topright</name>
<type>string</type>
<default>w_scroll_10_t.tga</default>
</property>
<property>
<name>vertical</name>
<type>bool</type>
<default>true</default>
</property>
<property>
<name>align</name>
<type>string</type>
<default>B</default>
</property>
<property>
<name>min</name>
<type>int</type>
<default>0</default>
</property>
<property>
<name>max</name>
<type>int</type>
<default>100</default>
</property>
<property>
<name>value</name>
<type>string</type>
<default>0</default>
</property>
<property>
<name>tracksize</name>
<type>int</type>
<default>16</default>
</property>
<property>
<name>onscroll</name>
<type>string</type>
<default></default>
</property>
<property>
<name>params</name>
<type>string</type>
<default></default>
</property>
<name>onscrollend</name>
<type>string</type>
<default></default>
</property>
<name>end_params</name>
<type>string</type>
<default></default>
</property>
<name>onscrollcancel</name>
<type>string</type>
<default></default>
</property>
<name>cancel_params</name>
<type>string</type>
<default></default>
</property>
<name>target</name>
<type>string</type>
<default></default>
</property>
<name>target_stepx</name>
<type>int</type>
<default>1</default>
</property>
<name>target_stepy</name>
<type>int</type>
<default>1</default>
</property>
<name>stepvalue</name>
<type>int</type>
<default>0</default>
</property>
<name>cancelable</name>
<type>bool</type>
<default>false</default>
</property>
<name>frozen</name>
<type>bool</type>
<default>false</default>
</property>
</properties>
</widget>