CHANGED: #1471 Should be able to change text options for CCtrlTextButton.

This commit is contained in:
dfighter1985 2012-08-18 03:37:52 +02:00
parent 79e4832373
commit 3a6ae1b74a
4 changed files with 129 additions and 11 deletions

View file

@ -55,6 +55,7 @@ namespace NLGUI
CViewText &operator=(const CViewText &vt); CViewText &operator=(const CViewText &vt);
std::string getProperty( const std::string &name ) const; std::string getProperty( const std::string &name ) const;
std::string getTextProperty( const std::string &name ) const;
void setProperty( const std::string &name, const std::string &value ); void setProperty( const std::string &name, const std::string &value );
bool setTextProperty( const std::string &name, const std::string &value ); bool setTextProperty( const std::string &name, const std::string &value );
bool serializeTextOptions( xmlNodePtr node ) const; bool serializeTextOptions( xmlNodePtr node ) const;

View file

@ -62,6 +62,13 @@ namespace NLGUI
std::string CCtrlTextButton::getProperty( const std::string &name ) const std::string CCtrlTextButton::getProperty( const std::string &name ) const
{ {
std::string prop;
if( _ViewText != NULL )
prop = _ViewText->getTextProperty( name );
if( !prop.empty() )
return prop;
else
if( name == "tx_normal" ) if( name == "tx_normal" )
{ {
std::string tex; std::string tex;
@ -191,6 +198,15 @@ namespace NLGUI
void CCtrlTextButton::setProperty( const std::string &name, const std::string &value ) void CCtrlTextButton::setProperty( const std::string &name, const std::string &value )
{ {
if( _ViewText != NULL )
{
if( _ViewText->setTextProperty( name, value ) )
{
_ViewText->invalidateContent();
return;
}
}
if( name == "tx_normal" ) if( name == "tx_normal" )
{ {
std::string tex; std::string tex;

View file

@ -177,6 +177,27 @@ namespace NLGUI
} }
std::string CViewText::getProperty( const std::string &name ) const std::string CViewText::getProperty( const std::string &name ) const
{
std::string prop = getTextProperty( name );
if( !prop.empty() )
return prop;
else
if( name == "hardtext" )
{
return _Text.toString();
}
else
if( name == "hardtext_format" )
{
return _HardtextFormat;
}
else
return CViewBase::getProperty( name );
}
std::string CViewText::getTextProperty( const std::string &name ) const
{ {
if( name == "color" ) if( name == "color" )
{ {
@ -290,17 +311,7 @@ namespace NLGUI
return toString( _ContinuousUpdate ); return toString( _ContinuousUpdate );
} }
else else
if( name == "hardtext" ) return "";
{
return _Text.toString();
}
else
if( name == "hardtext_format" )
{
return _HardtextFormat;
}
else
return CViewBase::getProperty( name );
} }
void CViewText::setProperty( const std::string &name, const std::string &value ) void CViewText::setProperty( const std::string &name, const std::string &value )

View file

@ -113,5 +113,95 @@
<type>bool</type> <type>bool</type>
<default>false</default> <default>false</default>
</property> </property>
<property>
<name>color</name>
<type>string</type>
<default>255 255 255 255</default>
</property>
<property>
<name>global_color</name>
<type>bool</type>
<default>false</default>
</property>
<property>
<name>fontsize</name>
<type>int</type>
<default>12</default>
</property>
<property>
<name>shadow</name>
<type>bool</type>
<default>false</default>
</property>
<property>
<name>shadow_color</name>
<type>string</type>
<default>0 0 0 255</default>
</property>
<property>
<name>multi_line</name>
<type>bool</type>
<default>false</default>
</property>
<property>
<name>justification</name>
<type>string</type>
<default>dont_clip_word</default>
</property>
<property>
<name>line_maxw</name>
<type>int</type>
<default>0</default>
</property>
<property>
<name>multi_line_space</name>
<type>int</type>
<default>8</default>
</property>
<property>
<name>multi_line_maxw_only</name>
<type>bool</type>
<default>false</default>
</property>
<property>
<name>multi_max_line</name>
<type>int</type>
<default>0</default>
</property>
<property>
<name>underlined</name>
<type>bool</type>
<default>false</default>
</property>
<property>
<name>case_mode</name>
<type>int</type>
<default>0</default>
</property>
<property>
<name>over_extend_view_text</name>
<type>bool</type>
<default>false</default>
</property>
<property>
<name>over_extend_parent_rect</name>
<type>bool</type>
<default>false</default>
</property>
<property>
<name>clamp_right</name>
<type>bool</type>
<default>true</default>
</property>
<property>
<name>auto_clamp_offset</name>
<type>int</type>
<default>0</default>
</property>
<property>
<name>continuous_update</name>
<type>bool</type>
<default>false</default>
</property>
</properties> </properties>
</widget> </widget>