mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-23 15:26:16 +00:00
CHANGED: #1471 Implemented CCtrlTextButton property querying.
This commit is contained in:
parent
e9b8d83c58
commit
1d81411cf0
6 changed files with 259 additions and 1 deletions
|
@ -42,6 +42,8 @@ namespace NLGUI
|
|||
/// Constructor
|
||||
CCtrlTextButton(const TCtorParam ¶m);
|
||||
|
||||
std::string getProperty( const std::string &name ) const;
|
||||
|
||||
// Init part
|
||||
virtual bool parse (xmlNodePtr cur,CInterfaceGroup * parentGroup);
|
||||
|
||||
|
|
|
@ -328,6 +328,8 @@ public:
|
|||
|
||||
static CRGBA stringToRGBA( const char *ptr );
|
||||
|
||||
std::string toString() const;
|
||||
|
||||
|
||||
/// Swap the B and R components, to simulate a CBRGA
|
||||
void swapBR()
|
||||
|
|
|
@ -60,6 +60,130 @@ namespace NLGUI
|
|||
_ForceTextOver = false;
|
||||
}
|
||||
|
||||
std::string CCtrlTextButton::getProperty( const std::string &name ) const
|
||||
{
|
||||
if( name == "tx_normal" )
|
||||
{
|
||||
std::string tex;
|
||||
tex = CViewRenderer::getInstance()->getTextureNameFromId( _TextureIdNormal[ 0 ] );
|
||||
std::string::size_type i = tex.rfind( "_l.tga" );
|
||||
if( i != std::string::npos )
|
||||
tex = tex.substr( 0, i );
|
||||
return tex;
|
||||
}
|
||||
else
|
||||
if( name == "tx_pushed" )
|
||||
{
|
||||
std::string tex;
|
||||
tex = CViewRenderer::getInstance()->getTextureNameFromId( _TextureIdPushed[ 0 ] );
|
||||
std::string::size_type i = tex.rfind( "_l.tga" );
|
||||
if( i != std::string::npos )
|
||||
tex = tex.substr( 0, i );
|
||||
return tex;
|
||||
}
|
||||
else
|
||||
if( name == "tx_over" )
|
||||
{
|
||||
std::string tex;
|
||||
tex = CViewRenderer::getInstance()->getTextureNameFromId( _TextureIdOver[ 0 ] );
|
||||
std::string::size_type i = tex.rfind( "_l.tga" );
|
||||
if( i != std::string::npos )
|
||||
tex = tex.substr( 0, i );
|
||||
return tex;
|
||||
}
|
||||
else
|
||||
if( name == "wmargin" )
|
||||
{
|
||||
return toString( _WMargin );
|
||||
}
|
||||
else
|
||||
if( name == "wmin" )
|
||||
{
|
||||
return toString( _WMin );
|
||||
}
|
||||
else
|
||||
if( name == "text_y" )
|
||||
{
|
||||
return toString( _TextY );
|
||||
}
|
||||
else
|
||||
if( name == "text_x" )
|
||||
{
|
||||
return toString( _TextX );
|
||||
}
|
||||
else
|
||||
if( name == "text_underlined" )
|
||||
{
|
||||
return toString( _ViewText->getUnderlined() );
|
||||
}
|
||||
else
|
||||
if( name == "text_posref" )
|
||||
{
|
||||
std::string pr;
|
||||
pr = CInterfaceElement::HotSpotToString( _TextParentPosRef );
|
||||
pr += " ";
|
||||
pr += CInterfaceElement::HotSpotToString( _TextPosRef );
|
||||
return pr;
|
||||
}
|
||||
else
|
||||
if( name == "text_color_normal" )
|
||||
{
|
||||
return toString( _TextColorNormal );
|
||||
}
|
||||
else
|
||||
if( name == "text_color_pushed" )
|
||||
{
|
||||
return toString( _TextColorPushed );
|
||||
}
|
||||
else
|
||||
if( name == "text_color_over" )
|
||||
{
|
||||
return toString( _TextColorOver );
|
||||
}
|
||||
else
|
||||
if( name == "text_shadow_color_normal" )
|
||||
{
|
||||
return toString( _TextShadowColorNormal );
|
||||
}
|
||||
else
|
||||
if( name == "text_shadow_color_pushed" )
|
||||
{
|
||||
return toString( _TextShadowColorPushed );
|
||||
}
|
||||
else
|
||||
if( name == "text_shadow_color_over" )
|
||||
{
|
||||
return toString( _TextShadowColorOver );
|
||||
}
|
||||
else
|
||||
if( name == "text_global_color_normal" )
|
||||
{
|
||||
return toString( _TextModulateGlobalColorNormal );
|
||||
}
|
||||
else
|
||||
if( name == "text_global_color_pushed" )
|
||||
{
|
||||
return toString( _TextModulateGlobalColorPushed );
|
||||
}
|
||||
else
|
||||
if( name == "text_global_color_over" )
|
||||
{
|
||||
return toString( _TextModulateGlobalColorOver );
|
||||
}
|
||||
else
|
||||
if( name == "force_text_over" )
|
||||
{
|
||||
return toString( _ForceTextOver );
|
||||
}
|
||||
else
|
||||
if( name == "text_header_color" )
|
||||
{
|
||||
return toString( _TextHeaderColor );
|
||||
}
|
||||
else
|
||||
return CCtrlBaseButton::getProperty( name );
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
bool CCtrlTextButton::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup)
|
||||
{
|
||||
|
|
|
@ -219,7 +219,7 @@ namespace NLGUI
|
|||
{
|
||||
if( name == "id" )
|
||||
{
|
||||
return getId();
|
||||
return stripId( getId() );
|
||||
}
|
||||
else
|
||||
if( name == "active" )
|
||||
|
|
|
@ -743,6 +743,19 @@ CRGBA CRGBA::stringToRGBA( const char *ptr )
|
|||
return CRGBA( r,g,b,a );
|
||||
}
|
||||
|
||||
std::string CRGBA::toString() const
|
||||
{
|
||||
std::string s;
|
||||
s = NLMISC::toString( R );
|
||||
s += " ";
|
||||
s += NLMISC::toString( G );
|
||||
s += " ";
|
||||
s += NLMISC::toString( B );
|
||||
s += " ";
|
||||
s += NLMISC::toString( A );
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
|
|
|
@ -0,0 +1,117 @@
|
|||
<widget>
|
||||
<header>
|
||||
<name>CtrlTextButton</name>
|
||||
<guiname>CCtrlTextButton</guiname>
|
||||
<ancestor>CtrlBaseButton</ancestor>
|
||||
<description></description>
|
||||
<abstract>false</abstract>
|
||||
<icon></icon>
|
||||
</header>
|
||||
<properties>
|
||||
<property>
|
||||
<name>tx_normal</name>
|
||||
<type>string</type>
|
||||
<default></default>
|
||||
</property>
|
||||
<property>
|
||||
<name>tx_pushed</name>
|
||||
<type>string</type>
|
||||
<default></default>
|
||||
</property>
|
||||
<property>
|
||||
<name>tx_over</name>
|
||||
<type>string</type>
|
||||
<default></default>
|
||||
</property>
|
||||
<property>
|
||||
<name>hardtext</name>
|
||||
<type>string</type>
|
||||
<default></default>
|
||||
</property>
|
||||
<property>
|
||||
<name>wmargin</name>
|
||||
<type>int</type>
|
||||
<default>0</default>
|
||||
</property>
|
||||
<property>
|
||||
<name>wmin</name>
|
||||
<type>int</type>
|
||||
<default>0</default>
|
||||
</property>
|
||||
<property>
|
||||
<name>text_y</name>
|
||||
<type>int</type>
|
||||
<default>-2</default>
|
||||
</property>
|
||||
<property>
|
||||
<name>text_x</name>
|
||||
<type>int</type>
|
||||
<default>-2</default>
|
||||
</property>
|
||||
<property>
|
||||
<name>text_underlined</name>
|
||||
<type>bool</type>
|
||||
<default>false</default>
|
||||
</property>
|
||||
<property>
|
||||
<name>text_posref</name>
|
||||
<type>string</type>
|
||||
<default>MM MM</default>
|
||||
</property>
|
||||
<property>
|
||||
<name>text_color_normal</name>
|
||||
<type>string</type>
|
||||
<default>255 255 255 255</default>
|
||||
</property>
|
||||
<property>
|
||||
<name>text_color_pushed</name>
|
||||
<type>string</type>
|
||||
<default>255 255 255 255</default>
|
||||
</property>
|
||||
<property>
|
||||
<name>text_color_over</name>
|
||||
<type>string</type>
|
||||
<default>255 255 255 255</default>
|
||||
</property>
|
||||
<property>
|
||||
<name>text_shadow_color_normal</name>
|
||||
<type>string</type>
|
||||
<default>0 0 0 255</default>
|
||||
</property>
|
||||
<property>
|
||||
<name>text_shadow_color_pushed</name>
|
||||
<type>string</type>
|
||||
<default>0 0 0 255</default>
|
||||
</property>
|
||||
<property>
|
||||
<name>text_shadow_color_over</name>
|
||||
<type>string</type>
|
||||
<default>0 0 0 255</default>
|
||||
</property>
|
||||
<property>
|
||||
<name>text_global_color_normal</name>
|
||||
<type>bool</type>
|
||||
<default>true</default>
|
||||
</property>
|
||||
<property>
|
||||
<name>text_global_color_pushed</name>
|
||||
<type>bool</type>
|
||||
<default>true</default>
|
||||
</property>
|
||||
<property>
|
||||
<name>text_global_color_over</name>
|
||||
<type>bool</type>
|
||||
<default>true</default>
|
||||
</property>
|
||||
<property>
|
||||
<name>force_text_over</name>
|
||||
<type>bool</type>
|
||||
<default>false</default>
|
||||
</property>
|
||||
<property>
|
||||
<name>text_header_color</name>
|
||||
<type>bool</type>
|
||||
<default>false</default>
|
||||
</property>
|
||||
</properties>
|
||||
</widget>
|
Loading…
Reference in a new issue