mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-12-25 02:00:54 +00:00
CHANGED: #1471 Implemented property setting for CCtrlBase.
This commit is contained in:
parent
d562a50ceb
commit
b8d5721b4a
2 changed files with 95 additions and 13 deletions
|
@ -57,12 +57,15 @@ namespace NLGUI
|
||||||
virtual ~CCtrlBase();
|
virtual ~CCtrlBase();
|
||||||
|
|
||||||
static std::string tooltipParentToString( TToolTipParentType type );
|
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
|
// special parse
|
||||||
virtual bool parse(xmlNodePtr cur, CInterfaceGroup *parentGroup);
|
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)
|
/// Handle all events (implemented by derived classes) (return true to signal event handled)
|
||||||
virtual bool handleEvent (const NLGUI::CEventDescriptor &event);
|
virtual bool handleEvent (const NLGUI::CEventDescriptor &event);
|
||||||
|
|
|
@ -80,6 +80,22 @@ namespace NLGUI
|
||||||
return "";
|
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)
|
bool CCtrlBase::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup)
|
||||||
{
|
{
|
||||||
|
@ -129,14 +145,7 @@ namespace NLGUI
|
||||||
_ToolTipParent= TTCtrl;
|
_ToolTipParent= TTCtrl;
|
||||||
if(prop)
|
if(prop)
|
||||||
{
|
{
|
||||||
if(stricmp((const char*)prop, "win")==0)
|
_ToolTipParent = stringToToolTipParent( std::string( prop ) );
|
||||||
_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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tooltip special parent
|
// Tooltip special parent
|
||||||
|
@ -216,12 +225,12 @@ namespace NLGUI
|
||||||
if( name == "tooltip_posref_alt" )
|
if( name == "tooltip_posref_alt" )
|
||||||
{
|
{
|
||||||
std::string s;
|
std::string s;
|
||||||
if( ( _ToolTipParentPosRef == Hotspot_TTAuto ) && ( _ToolTipPosRef == Hotspot_TTAuto ) )
|
if( ( _ToolTipParentPosRefAlt == Hotspot_TTAuto ) && ( _ToolTipPosRefAlt == Hotspot_TTAuto ) )
|
||||||
return "auto";
|
return "auto";
|
||||||
else{
|
else{
|
||||||
s = CInterfaceElement::HotSpotToString( _ToolTipParentPosRef );
|
s = CInterfaceElement::HotSpotToString( _ToolTipParentPosRefAlt );
|
||||||
s += " ";
|
s += " ";
|
||||||
s += CInterfaceElement::HotSpotToString( _ToolTipPosRef );
|
s += CInterfaceElement::HotSpotToString( _ToolTipPosRefAlt );
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -234,6 +243,76 @@ namespace NLGUI
|
||||||
return CInterfaceElement::getProperty( name );
|
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)
|
void CCtrlBase::convertTooltipHotSpot(const char *prop, THotSpot &parentHS, THotSpot &childHS)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue