CHANGED: #1471 CCtrlTooltip fields can now be serialized.

--HG--
branch : gsoc2012-gui-editor
This commit is contained in:
dfighter1985 2012-08-11 19:32:18 +02:00
parent bffa5806ca
commit 4e00abc283
3 changed files with 17 additions and 0 deletions

View file

@ -41,6 +41,7 @@ namespace NLGUI
virtual bool handleEvent (const NLGUI::CEventDescriptor& eventDesc); virtual bool handleEvent (const NLGUI::CEventDescriptor& eventDesc);
virtual void draw(); virtual void draw();
xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const;
virtual bool parse (xmlNodePtr cur, CInterfaceGroup *parentGroup); virtual bool parse (xmlNodePtr cur, CInterfaceGroup *parentGroup);
// Can do nothing with tooltip (but display it :) ) // Can do nothing with tooltip (but display it :) )
virtual bool isCapturable() const {return false;} virtual bool isCapturable() const {return false;}

View file

@ -398,6 +398,9 @@ namespace NLGUI
if( node == NULL ) if( node == NULL )
return NULL; return NULL;
if( xmlGetProp( node, BAD_CAST "type" ) == NULL )
xmlSetProp( node, BAD_CAST "type", BAD_CAST "scroll" );
xmlSetProp( node, BAD_CAST "tx_bottomleft", BAD_CAST getTextureBottomOrLeft().c_str() ); xmlSetProp( node, BAD_CAST "tx_bottomleft", BAD_CAST getTextureBottomOrLeft().c_str() );
xmlSetProp( node, BAD_CAST "tx_middle", BAD_CAST getTextureMiddle().c_str() ); xmlSetProp( node, BAD_CAST "tx_middle", BAD_CAST getTextureMiddle().c_str() );
xmlSetProp( node, BAD_CAST "tx_topright", BAD_CAST getTextureTopOrRight().c_str() ); xmlSetProp( node, BAD_CAST "tx_topright", BAD_CAST getTextureTopOrRight().c_str() );

View file

@ -44,6 +44,19 @@ namespace NLGUI
return false; return false;
} }
xmlNodePtr CCtrlToolTip::serialize( xmlNodePtr parentNode, const char *type ) const
{
xmlNodePtr node = CCtrlBase::serialize( parentNode, type );
if( node == NULL )
return NULL;
if( xmlGetProp( node, BAD_CAST "type" ) == NULL )
xmlSetProp( node, BAD_CAST "type", BAD_CAST "tooltip" );
return node;
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
bool CCtrlToolTip::parse(xmlNodePtr cur, CInterfaceGroup *parentGroup) bool CCtrlToolTip::parse(xmlNodePtr cur, CInterfaceGroup *parentGroup)
{ {