mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-30 07:35:59 +00:00
CHANGED: #1471 CGroupEditBox fields can now be serialized.
This commit is contained in:
parent
17c180db71
commit
4f88c86327
6 changed files with 100 additions and 5 deletions
|
@ -50,6 +50,7 @@ namespace NLGUI
|
|||
|
||||
std::string getProperty( const std::string &name ) const;
|
||||
void setProperty( const std::string &name, const std::string &value );
|
||||
xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const;
|
||||
|
||||
bool parse(xmlNodePtr cur,CInterfaceGroup * parentGroup);
|
||||
virtual uint32 getMemory() { return (uint32)(sizeof(*this)+_Id.size()); }
|
||||
|
|
|
@ -432,6 +432,92 @@ namespace NLGUI
|
|||
CInterfaceGroup::setProperty( name, value );
|
||||
}
|
||||
|
||||
xmlNodePtr CGroupEditBox::serialize( xmlNodePtr parentNode, const char *type ) const
|
||||
{
|
||||
xmlNodePtr node = CInterfaceGroup::serialize( parentNode, type );
|
||||
if( node == NULL )
|
||||
return NULL;
|
||||
|
||||
xmlSetProp( node, BAD_CAST "type", BAD_CAST "edit_box" );
|
||||
|
||||
xmlSetProp( node, BAD_CAST "onchange", BAD_CAST _AHOnChange.c_str() );
|
||||
xmlSetProp( node, BAD_CAST "onchange_params", BAD_CAST _ParamsOnChange.c_str() );
|
||||
xmlSetProp( node, BAD_CAST "on_focus_lost", BAD_CAST _AHOnFocusLost.c_str() );
|
||||
xmlSetProp( node, BAD_CAST "on_focus_lost_params", BAD_CAST _AHOnFocusLostParams.c_str() );
|
||||
xmlSetProp( node, BAD_CAST "on_focus", BAD_CAST _AHOnFocus.c_str() );
|
||||
xmlSetProp( node, BAD_CAST "on_focus_params", BAD_CAST _AHOnFocusParams.c_str() );
|
||||
xmlSetProp( node, BAD_CAST "max_num_chars", BAD_CAST toString( _MaxNumChar ).c_str() );
|
||||
xmlSetProp( node, BAD_CAST "max_num_return", BAD_CAST toString( _MaxNumReturn ).c_str() );
|
||||
xmlSetProp( node, BAD_CAST "max_chars_size", BAD_CAST toString( _MaxCharsSize ).c_str() );
|
||||
xmlSetProp( node, BAD_CAST "enter_loose_focus", BAD_CAST toString( _LooseFocusOnEnter ).c_str() );
|
||||
xmlSetProp( node, BAD_CAST "enter_recover_focus", BAD_CAST toString( _RecoverFocusOnEnter ).c_str() );
|
||||
xmlSetProp( node, BAD_CAST "prompt", BAD_CAST _Prompt.toString().c_str() );
|
||||
|
||||
std::string e;
|
||||
switch( _EntryType )
|
||||
{
|
||||
case Integer:
|
||||
e = "integer";
|
||||
break;
|
||||
|
||||
case PositiveInteger:
|
||||
e = "positive_integer";
|
||||
break;
|
||||
|
||||
case Float:
|
||||
e = "float";
|
||||
break;
|
||||
|
||||
case PositiveFloat:
|
||||
e = "positive_float";
|
||||
break;
|
||||
|
||||
case Alpha:
|
||||
e = "alpha";
|
||||
break;
|
||||
|
||||
case AlphaNum:
|
||||
e = "alpha_num";
|
||||
break;
|
||||
|
||||
case AlphaNumSpace:
|
||||
e = "alpha_num_space";
|
||||
break;
|
||||
|
||||
case Password:
|
||||
e = "password";
|
||||
break;
|
||||
|
||||
case Filename:
|
||||
e = "filename";
|
||||
break;
|
||||
|
||||
case PlayerName:
|
||||
e = "playername";
|
||||
break;
|
||||
}
|
||||
|
||||
xmlSetProp( node, BAD_CAST "enter_type", BAD_CAST e.c_str() );
|
||||
xmlSetProp( node, BAD_CAST "menu_r", BAD_CAST _ListMenuRight.c_str() );
|
||||
xmlSetProp( node, BAD_CAST "max_historic", BAD_CAST toString( _MaxHistoric ).c_str() );
|
||||
xmlSetProp( node, BAD_CAST "backup_father_container_pos",
|
||||
BAD_CAST toString( _BackupFatherContainerPos ).c_str() );
|
||||
xmlSetProp( node, BAD_CAST "want_return", BAD_CAST toString( _WantReturn ).c_str() );
|
||||
xmlSetProp( node, BAD_CAST "savable", BAD_CAST toString( _Savable ).c_str() );
|
||||
xmlSetProp( node, BAD_CAST "max_float_prec", BAD_CAST toString( _MaxFloatPrec ).c_str() );
|
||||
|
||||
std::string s;
|
||||
s.reserve( _NegativeFilter.size() );
|
||||
|
||||
std::vector< char >::const_iterator itr;
|
||||
for( itr = _NegativeFilter.begin(); itr != _NegativeFilter.end(); ++itr )
|
||||
s.push_back( *itr );
|
||||
|
||||
xmlSetProp( node, BAD_CAST "negative_filter", BAD_CAST s.c_str() );
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
bool CGroupEditBox::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup)
|
||||
{
|
||||
|
|
|
@ -1532,15 +1532,16 @@ namespace NLGUI
|
|||
idParent = _Parent->getId() + ":";
|
||||
else
|
||||
idParent = "ui:";
|
||||
|
||||
CWidgetManager::getInstance()->getParser()->addParentSizeAssociation( this, idParent + Id );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( _Parent != NULL )
|
||||
{
|
||||
idParent = _Parent->getId();
|
||||
CWidgetManager::getInstance()->getParser()->addParentSizeAssociation( this, idParent );
|
||||
}
|
||||
}
|
||||
|
||||
CWidgetManager::getInstance()->getParser()->addParentSizeAssociation( this, idParent + Id );
|
||||
}
|
||||
|
||||
CStringMapper* CStringShared::_UIStringMapper = NULL;
|
||||
|
|
|
@ -673,6 +673,7 @@ namespace NLGUI
|
|||
|
||||
serializeSubGroups( node );
|
||||
serializeControls( node );
|
||||
serializeViews( node );
|
||||
|
||||
return node;
|
||||
}
|
||||
|
@ -739,6 +740,12 @@ namespace NLGUI
|
|||
|
||||
xmlNodePtr CInterfaceGroup::serializeViews( xmlNodePtr parentNode ) const
|
||||
{
|
||||
std::vector< CViewBase* >::const_iterator itr;
|
||||
for( itr = _Views.begin(); itr != _Views.end(); ++itr )
|
||||
{
|
||||
(*itr)->serialize( parentNode, "view" );
|
||||
}
|
||||
|
||||
return parentNode;
|
||||
}
|
||||
|
||||
|
|
|
@ -1353,7 +1353,8 @@ namespace NLGUI
|
|||
if (parentGroup->getElement(view->getId()) != NULL)
|
||||
{
|
||||
// Remove old groupe and replace
|
||||
if (reload)
|
||||
// TODO: Don't save widgets created by complex widgets
|
||||
if ( true /*reload*/)
|
||||
parentGroup->delElement (view->getId());
|
||||
else
|
||||
{
|
||||
|
|
|
@ -546,7 +546,6 @@ namespace NLGUI
|
|||
xmlSetProp( node, BAD_CAST "continuous_update", BAD_CAST toString( _ContinuousUpdate ).c_str() );
|
||||
xmlSetProp( node, BAD_CAST "hardtext", BAD_CAST _Text.toString().c_str() );
|
||||
xmlSetProp( node, BAD_CAST "hardtext_format", BAD_CAST _HardtextFormat.c_str() );
|
||||
xmlSetProp( node, BAD_CAST "", BAD_CAST "" );
|
||||
|
||||
return node;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue