mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-10 09:19:01 +00:00
CHANGED: #1471 Implemented property setting for CCtrlBase.
--HG-- branch : gsoc2012-gui-editor
This commit is contained in:
parent
74cd9b5357
commit
37710898bc
2 changed files with 95 additions and 13 deletions
|
@ -57,12 +57,15 @@ namespace NLGUI
|
|||
virtual ~CCtrlBase();
|
||||
|
||||
static std::string tooltipParentToString( TToolTipParentType type );
|
||||
static TToolTipParentType stringToToolTipParent( const std::string &str );
|
||||
|
||||
std::string getProperty( const std::string &name ) const;
|
||||
|
||||
void setProperty( const std::string &name, const std::string &value );
|
||||
|
||||
// special parse
|
||||
virtual bool parse(xmlNodePtr cur, CInterfaceGroup *parentGroup);
|
||||
|
||||
std::string getProperty( const std::string &name ) const;
|
||||
|
||||
|
||||
/// Handle all events (implemented by derived classes) (return true to signal event handled)
|
||||
virtual bool handleEvent (const NLGUI::CEventDescriptor &event);
|
||||
|
|
|
@ -80,6 +80,22 @@ namespace NLGUI
|
|||
return "";
|
||||
}
|
||||
|
||||
CCtrlBase::TToolTipParentType CCtrlBase::stringToToolTipParent( const std::string &str )
|
||||
{
|
||||
std::string s = toLower( str );
|
||||
|
||||
if( s == "mouse" )
|
||||
return TTMouse;
|
||||
else
|
||||
if( s == "win" )
|
||||
return TTWindow;
|
||||
else
|
||||
if( s == "special" )
|
||||
return TTSpecialWindow;
|
||||
else
|
||||
return TTCtrl;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
bool CCtrlBase::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup)
|
||||
{
|
||||
|
@ -129,14 +145,7 @@ namespace NLGUI
|
|||
_ToolTipParent= TTCtrl;
|
||||
if(prop)
|
||||
{
|
||||
if(stricmp((const char*)prop, "win")==0)
|
||||
_ToolTipParent= TTWindow;
|
||||
else if(stricmp((const char*)prop, "mouse")==0)
|
||||
_ToolTipParent= TTMouse;
|
||||
else if(stricmp((const char*)prop, "special")==0)
|
||||
_ToolTipParent= TTSpecialWindow;
|
||||
else
|
||||
_ToolTipParent= TTCtrl;
|
||||
_ToolTipParent = stringToToolTipParent( std::string( prop ) );
|
||||
}
|
||||
|
||||
// Tooltip special parent
|
||||
|
@ -216,12 +225,12 @@ namespace NLGUI
|
|||
if( name == "tooltip_posref_alt" )
|
||||
{
|
||||
std::string s;
|
||||
if( ( _ToolTipParentPosRef == Hotspot_TTAuto ) && ( _ToolTipPosRef == Hotspot_TTAuto ) )
|
||||
if( ( _ToolTipParentPosRefAlt == Hotspot_TTAuto ) && ( _ToolTipPosRefAlt == Hotspot_TTAuto ) )
|
||||
return "auto";
|
||||
else{
|
||||
s = CInterfaceElement::HotSpotToString( _ToolTipParentPosRef );
|
||||
s = CInterfaceElement::HotSpotToString( _ToolTipParentPosRefAlt );
|
||||
s += " ";
|
||||
s += CInterfaceElement::HotSpotToString( _ToolTipPosRef );
|
||||
s += CInterfaceElement::HotSpotToString( _ToolTipPosRefAlt );
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
@ -234,6 +243,76 @@ namespace NLGUI
|
|||
return CInterfaceElement::getProperty( name );
|
||||
}
|
||||
|
||||
|
||||
void CCtrlBase::setProperty( const std::string &name, const std::string &value )
|
||||
{
|
||||
if( name == "tooltip" )
|
||||
{
|
||||
_ContextHelp = value;
|
||||
return;
|
||||
}
|
||||
else
|
||||
if( name == "tooltip_i18n" )
|
||||
{
|
||||
_ContextHelp = value;
|
||||
return;
|
||||
}
|
||||
else
|
||||
if( name == "on_tooltip" )
|
||||
{
|
||||
_OnContextHelp = value;
|
||||
return;
|
||||
}
|
||||
else
|
||||
if( name == "on_tooltip_params" )
|
||||
{
|
||||
_OnContextHelpParams = value;
|
||||
return;
|
||||
}
|
||||
else
|
||||
if( name == "tooltip_parent" )
|
||||
{
|
||||
_ToolTipParent = stringToToolTipParent( value );
|
||||
return;
|
||||
}
|
||||
else
|
||||
if( name == "tooltip_special_parent" )
|
||||
{
|
||||
_ToolTipSpecialParent = value;
|
||||
return;
|
||||
}
|
||||
else
|
||||
if( name == "tooltip_posref" )
|
||||
{
|
||||
THotSpot parentHS;
|
||||
THotSpot HS;
|
||||
convertTooltipHotSpot( value.c_str(), parentHS, HS );
|
||||
_ToolTipParentPosRef = parentHS;
|
||||
_ToolTipPosRef = HS;
|
||||
return;
|
||||
}
|
||||
else
|
||||
if( name == "tooltip_posref_alt" )
|
||||
{
|
||||
THotSpot parentHS;
|
||||
THotSpot HS;
|
||||
convertTooltipHotSpot( value.c_str(), parentHS, HS );
|
||||
_ToolTipParentPosRefAlt = parentHS;
|
||||
_ToolTipPosRefAlt = HS;
|
||||
return;
|
||||
}
|
||||
else
|
||||
if( name == "instant_help" )
|
||||
{
|
||||
bool b;
|
||||
if( fromString( value, b ) )
|
||||
_ToolTipInstant = b;
|
||||
return;
|
||||
}
|
||||
else
|
||||
CInterfaceElement::setProperty( name, value );
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CCtrlBase::convertTooltipHotSpot(const char *prop, THotSpot &parentHS, THotSpot &childHS)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue