mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-05 23:09:02 +00:00
CHANGED: #1471 Implemented property querying for CCtrlBaseButton.
This commit is contained in:
parent
307129e1bf
commit
942acc490b
4 changed files with 179 additions and 1 deletions
|
@ -41,6 +41,8 @@ namespace NLGUI
|
|||
/// Constructor
|
||||
CCtrlBaseButton(const TCtorParam ¶m);
|
||||
|
||||
std::string getProperty( const std::string &name ) const;
|
||||
|
||||
virtual bool parse (xmlNodePtr cur,CInterfaceGroup * parentGroup);
|
||||
virtual bool handleEvent (const NLGUI::CEventDescriptor& event);
|
||||
|
||||
|
@ -48,6 +50,7 @@ namespace NLGUI
|
|||
// @{
|
||||
void setType (EType t) { _Type = t; }
|
||||
EType getType() { return _Type; }
|
||||
std::string getTypeString() const;
|
||||
|
||||
void setClickWhenPushed(bool click) { _ClickWhenPushed = click; }
|
||||
bool getClickWhenPushed() const { return _ClickWhenPushed; }
|
||||
|
@ -125,10 +128,17 @@ namespace NLGUI
|
|||
void setParamsOnClockTick (const std::string &ahParamsName) { _AHClockTickParams = ahParamsName; }
|
||||
|
||||
// get Event part
|
||||
std::string _getActionOnOver() const{ return CAHManager::getInstance()->getAHName( _AHOnOver ); }
|
||||
std::string _getActionOnLeftClick() const { return CAHManager::getInstance()->getAHName( _AHOnLeftClick ); }
|
||||
std::string _getActionOnLeftLongClick() const { return CAHManager::getInstance()->getAHName( _AHOnLeftLongClick ); }
|
||||
std::string _getActionOnDblLeftClick() const { return CAHManager::getInstance()->getAHName( _AHOnLeftDblClick ); }
|
||||
std::string _getActionOnRightClick() const { return CAHManager::getInstance()->getAHName( _AHOnRightClick ); }
|
||||
std::string _getActionOnClockTick() const { return CAHManager::getInstance()->getAHName( _AHOnClockTick ); }
|
||||
|
||||
IActionHandler *getActionOnLeftClick () const { return _AHOnLeftClick; }
|
||||
IActionHandler *getActionOnRightClick () const { return _AHOnRightClick; }
|
||||
IActionHandler *getActionOnClockTick () const { return _AHOnClockTick; }
|
||||
std::string _getParamsOnOver() const{ return _AHOverParams.toString(); }
|
||||
std::string _getParamsOnLeftClick () const { return _AHLeftClickParams.toString(); }
|
||||
const std::string &getParamsOnLeftClick () const { return _AHLeftClickParams; }
|
||||
const std::string &getParamsOnRightClick () const { return _AHRightClickParams; }
|
||||
|
|
|
@ -43,6 +43,8 @@ namespace NLGUI
|
|||
_Align = 0;
|
||||
}
|
||||
|
||||
std::string getProperty( const std::string &name ) const;
|
||||
|
||||
// Init part
|
||||
virtual bool parse (xmlNodePtr cur,CInterfaceGroup * parentGroup);
|
||||
|
||||
|
|
|
@ -62,6 +62,148 @@ namespace NLGUI
|
|||
_AHOnLeftDblClick = NULL;
|
||||
}
|
||||
|
||||
std::string CCtrlBaseButton::getProperty( const std::string &name ) const
|
||||
{
|
||||
if( name == "button_type" )
|
||||
{
|
||||
return getTypeString();
|
||||
}
|
||||
else
|
||||
if( name == "pushed" )
|
||||
{
|
||||
return toString( _Pushed );
|
||||
}
|
||||
else
|
||||
if( name == "over_when_pushed" )
|
||||
{
|
||||
return toString( _OverWhenPushed );
|
||||
}
|
||||
else
|
||||
if( name == "clicked_when_pushed" )
|
||||
{
|
||||
return toString( _ClickWhenPushed );
|
||||
}
|
||||
else
|
||||
if( name == "color" )
|
||||
{
|
||||
return getColorAsString();
|
||||
}
|
||||
else
|
||||
if( name == "col_pushed" )
|
||||
{
|
||||
return getColorPushedAsString();
|
||||
}
|
||||
else
|
||||
if( name == "col_over" )
|
||||
{
|
||||
return getColorOverAsString();
|
||||
}
|
||||
else
|
||||
if( name == "global_color_normal" )
|
||||
{
|
||||
return toString( _ModulateGlobalColorNormal );
|
||||
}
|
||||
else
|
||||
if( name == "global_color_pushed" )
|
||||
{
|
||||
return toString( _ModulateGlobalColorPushed );
|
||||
}
|
||||
else
|
||||
if( name == "global_color_over" )
|
||||
{
|
||||
return toString( _ModulateGlobalColorOver );
|
||||
}
|
||||
else
|
||||
if( name == "onover" )
|
||||
{
|
||||
return _getActionOnOver();
|
||||
}
|
||||
else
|
||||
if( name == "params_over" )
|
||||
{
|
||||
return _getParamsOnOver();
|
||||
}
|
||||
else
|
||||
if( name == "onclick_l" )
|
||||
{
|
||||
return _getActionOnLeftClick();
|
||||
}
|
||||
else
|
||||
if( name == "params_l" )
|
||||
{
|
||||
return _getParamsOnLeftClick();
|
||||
}
|
||||
else
|
||||
if( name == "ondblclick_l" )
|
||||
{
|
||||
return _getActionOnDblLeftClick();
|
||||
}
|
||||
else
|
||||
if( name == "params_dblclick_l" )
|
||||
{
|
||||
return _AHLeftDblClickParams.toString();
|
||||
}
|
||||
else
|
||||
if( name == "onlongclick_l" )
|
||||
{
|
||||
return _getActionOnLeftLongClick();
|
||||
}
|
||||
else
|
||||
if( name == "params_longclick_l" )
|
||||
{
|
||||
return _AHLeftLongClickParams.toString();
|
||||
}
|
||||
else
|
||||
if( name == "onclick_r" )
|
||||
{
|
||||
return _getActionOnRightClick();
|
||||
}
|
||||
else
|
||||
if( name == "params_r" )
|
||||
{
|
||||
return _AHRightClickParams.toString();
|
||||
}
|
||||
else
|
||||
if( name == "onclock_tick" )
|
||||
{
|
||||
return _getActionOnClockTick();
|
||||
}
|
||||
else
|
||||
if( name == "params_clock_tick" )
|
||||
{
|
||||
return _AHClockTickParams.toString();
|
||||
}
|
||||
else
|
||||
if( name == "menu_l" )
|
||||
{
|
||||
return _ListMenuLeft.toString();
|
||||
}
|
||||
else
|
||||
if( name == "menu_r" )
|
||||
{
|
||||
return _ListMenuRight.toString();
|
||||
}
|
||||
else
|
||||
if( name == "menu_b" )
|
||||
{
|
||||
if( _ListMenuLeft.toString() == _ListMenuRight.toString() )
|
||||
return _ListMenuLeft.toString();
|
||||
else
|
||||
return "";
|
||||
}
|
||||
else
|
||||
if( name == "frozen" )
|
||||
{
|
||||
return toString( _Frozen );
|
||||
}
|
||||
else
|
||||
if( name == "frozen_half_tone" )
|
||||
{
|
||||
return toString( _FrozenHalfTone );
|
||||
}
|
||||
else
|
||||
return CCtrlBase::getProperty( name );
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
|
@ -368,6 +510,26 @@ namespace NLGUI
|
|||
return false;
|
||||
}
|
||||
|
||||
std::string CCtrlBaseButton::getTypeString() const
|
||||
{
|
||||
switch( _Type )
|
||||
{
|
||||
case PushButton:
|
||||
return "push_button";
|
||||
break;
|
||||
|
||||
case ToggleButton:
|
||||
return "toggle_button";
|
||||
break;
|
||||
|
||||
case RadioButton:
|
||||
return "radio_button";
|
||||
break;
|
||||
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CCtrlBaseButton::initRBRef()
|
||||
{
|
||||
|
|
|
@ -28,6 +28,10 @@ NLMISC_REGISTER_OBJECT(CViewBase, CCtrlButton, std::string, "button");
|
|||
|
||||
namespace NLGUI
|
||||
{
|
||||
std::string CCtrlButton::getProperty( const std::string &name ) const
|
||||
{
|
||||
return CCtrlBaseButton::getProperty( name );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
bool CCtrlButton::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup)
|
||||
|
|
Loading…
Reference in a new issue