CHANGED: #1471 Implemented property querying for CGroupMenu.

This commit is contained in:
dfighter1985 2012-07-31 06:45:03 +02:00
parent 1105f0e3d3
commit d2025b37f8
4 changed files with 169 additions and 57 deletions

View file

@ -296,6 +296,8 @@ namespace NLGUI
TCaseMode getCaseMode() { return _CaseMode; }
std::string getProperty( const std::string &name ) const;
virtual bool parse (xmlNodePtr cur, CInterfaceGroup *parentGroup);
virtual void draw ();
@ -366,6 +368,8 @@ namespace NLGUI
CGroupSubMenu *_RootMenu;
std::string _Extends;
// Text lookup
NLMISC::CRGBA _Color;
NLMISC::CRGBA _ShadowColor;

View file

@ -1920,6 +1920,85 @@ namespace NLGUI
{
}
std::string CGroupMenu::getProperty( const std::string &name ) const
{
if( name == "extends" )
{
return _Extends;
}
else
if( name == "case_mode" )
{
uint32 cm = _CaseMode;
return toString( cm );
}
else
if( name == "color" )
{
return toString( _Color );
}
else
if( name == "shadow_color" )
{
return toString( _ShadowColor );
}
else
if( name == "color_over" )
{
return toString( _ColorOver );
}
else
if( name == "shadow_color_over" )
{
return toString( _ShadowColorOver );
}
else
if( name == "highlight_over" )
{
return toString( _HighLightOver );
}
else
if( name == "color_grayed" )
{
return toString( _ColorGrayed );
}
else
if( name == "shadow_color_grayed" )
{
return toString( _ShadowColorGrayed );
}
else
if( name == "space" )
{
return toString( _Space );
}
else
if( name == "fontsize" )
{
return toString( _FontSize );
}
else
if( name == "shadow" )
{
return toString( _Shadow );
}
else
if( name == "formatted" )
{
return toString( _Formatted );
}
else
if( name == "max_visible_line" )
{
if( _RootMenu == NULL )
return "0";
else
return toString( _RootMenu->getMaxVisibleLine() );
}
else
return CGroupModal::getProperty( name );
}
// ------------------------------------------------------------------------------------------------
bool CGroupMenu::parse (xmlNodePtr in, CInterfaceGroup *parentGroup)
{
@ -1937,6 +2016,8 @@ namespace NLGUI
CGroupSubMenu *gmExtended = NULL;
if (prop)
{
if( editorMode )
_Extends = std::string( prop );
CGroupMenu *gm = dynamic_cast<CGroupMenu *>(CWidgetManager::getInstance()->getElementFromId(prop));
if (!gm)

View file

@ -1,57 +0,0 @@
<widget>
<header>
<name>CtrlBase</name>
<guiname>cb</guiname>
<ancestor>InterfaceElement</ancestor>
<description></description>
<abstract>true</abstract>
<icon></icon>
</header>
<properties>
<property>
<name>tooltip</name>
<type>string</type>
<default></default>
</property>
<property>
<name>tooltip_i18n</name>
<type>string</type>
<default></default>
</property>
<property>
<name>on_tooltip</name>
<type>string</type>
<default></default>
</property>
<property>
<name>on_tooltip_params</name>
<type>string</type>
<default></default>
</property>
<property>
<name>tooltip_parent</name>
<type>string</type>
<default></default>
</property>
<property>
<name>tooltip_special_parent</name>
<type>string</type>
<default></default>
</property>
<property>
<name>tooltip_posref</name>
<type>string</type>
<default>auto</default>
</property>
<property>
<name>tooltip_posref_alt</name>
<type>string</type>
<default>auto</default>
</property>
<property>
<name>instant_help</name>
<type>bool</type>
<default></default>
</property>
</properties>
</widget>

View file

@ -0,0 +1,84 @@
<widget>
<header>
<name>GroupMenu</name>
<guiname>CGroupMenu</guiname>
<ancestor>GroupModal</ancestor>
<description></description>
<abstract>false</abstract>
<icon></icon>
</header>
<properties>
<property>
<name>extends</name>
<type>string</type>
<default></default>
</property>
<property>
<name>color</name>
<type>string</type>
<default>255 255 255 255</default>
</property>
<property>
<name>case_mode</name>
<type>int</type>
<default>2</default>
</property>
<property>
<name>shadow_color</name>
<type>string</type>
<default>0 0 0 255</default>
</property>
<property>
<name>color_over</name>
<type>string</type>
<default>255 255 255 255</default>
</property>
<property>
<name>shadow_color_over</name>
<type>string</type>
<default>0 0 0 255</default>
</property>
<property>
<name>highlight_over</name>
<type>string</type>
<default>128 0 0 255</default>
</property>
<property>
<name>color_grayed</name>
<type>string</type>
<default>128 128 128 255</default>
</property>
<property>
<name>shadow_color_grayed</name>
<type>string</type>
<default>0 0 0 255</default>
</property>
<property>
<name>space</name>
<type>int</type>
<default>3</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>formatted</name>
<type>bool</type>
<default>false</default>
</property>
<property>
<name>max_visible_line</name>
<type>int</type>
<default>0</default>
</property>
</properties>
</widget>