void TabSet::ProtoDeSerializeButtonBindings(const XML::Node& SelfRoot) { this->SubSetBindings.clear(); XML::Attribute CurrAttrib; XML::Node BindingsNode = SelfRoot.GetChild( "SubSetBindings" ); if( !BindingsNode.Empty() ) { if( BindingsNode.GetAttribute("Version").AsInt() == 1 ) { for( XML::NodeIterator BindingNodeIt = BindingsNode.begin() ; BindingNodeIt != BindingsNode.end() ; ++BindingNodeIt ) { if( (*BindingNodeIt).GetAttribute("Version").AsInt() == 1 ) { UInt16 ConfigID = 0; String ButtonName; CurrAttrib = (*BindingNodeIt).GetAttribute("ConfigID"); if( !CurrAttrib.Empty() ) ConfigID = static_cast<UInt16>( CurrAttrib.AsUint() ); CurrAttrib = (*BindingNodeIt).GetAttribute("ButtonName"); if( !CurrAttrib.Empty() ) ButtonName = CurrAttrib.AsString(); if( !ButtonName.empty() ) { Widget* NamedButton = this->ParentScreen->GetWidget(ButtonName); if( NamedButton != NULL && NamedButton->GetTypeName() == StackButton::TypeName ) { this->SetButtonConfig(ConfigID,static_cast<StackButton*>(NamedButton)); }else{ StringStream ExceptionStream; ExceptionStream << "Named StackButton \"" << ButtonName << "\" not found when deserializing Widget named \"" << this->GetName() << "\"."; MEZZ_EXCEPTION(ExceptionBase::PARAMETERS_EXCEPTION,ExceptionStream.str()); } } }else{ MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + String("SubSetBindings") + ": Not Version 1."); } } }else{ MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + String("SubSetBindings") + ": Not Version 1."); } } }
void RadioButton::ProtoDeSerializeGroupButtons(const XML::Node& SelfRoot) { this->RemoveFromButtonGroup(); XML::Attribute CurrAttrib; XML::Node ButtonsNode = SelfRoot.GetChild( "GroupButtons" ); if( !ButtonsNode.Empty() ) { if( ButtonsNode.GetAttribute("Version").AsInt() == 1 ) { for( XML::NodeIterator ButtonNodeIt = ButtonsNode.begin() ; ButtonNodeIt != ButtonsNode.end() ; ++ButtonNodeIt ) { if( (*ButtonNodeIt).GetAttribute("Version").AsInt() == 1 ) { String GroupButtonName; CurrAttrib = (*ButtonNodeIt).GetAttribute("GroupButtonName"); if( !CurrAttrib.Empty() ) GroupButtonName = CurrAttrib.AsString(); if( !GroupButtonName.empty() ) { Widget* NamedButton = this->ParentScreen->GetWidget(GroupButtonName); if( NamedButton != NULL && NamedButton->GetTypeName() == RadioButton::TypeName ) { this->AddToButtonGroup( static_cast<RadioButton*>( NamedButton ) ); }else{ StringStream ExceptionStream; ExceptionStream << "Named Widget \"" << GroupButtonName << "\" not found or not a RadioButton when deserializing Widget named \"" << this->GetName() << "\"."; MEZZ_EXCEPTION(ExceptionBase::PARAMETERS_EXCEPTION,ExceptionStream.str()); } } }else{ MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + String("GroupButtons") + ": Not Version 1."); } } }else{ MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + String("GroupButtons") + ": Not Version 1."); } } }