void BaseManager::setupResources() { MyGUI::xml::Document doc; if (!doc.open(std::string("resources.xml"))) doc.getLastError(); MyGUI::xml::ElementPtr root = doc.getRoot(); if (root == nullptr || root->getName() != "Paths") return; MyGUI::xml::ElementEnumerator node = root->getElementEnumerator(); while (node.next()) { if (node->getName() == "Path") { if (node->findAttribute("root") != "") { bool root = MyGUI::utility::parseBool(node->findAttribute("root")); if (root) mRootMedia = node->getContent(); } addResourceLocation(node->getContent(), false); } } addResourceLocation(getRootMedia() + "/Common/Base"); }
void MYGUIManager::setupResources() { MyGUI::xml::Document doc; if ( !_platform || !doc.open(_resourcePathFile) ) doc.getLastError(); MyGUI::xml::ElementPtr root = doc.getRoot(); if ( root==nullptr || root->getName()!="Paths" ) return; MyGUI::xml::ElementEnumerator node = root->getElementEnumerator(); while ( node.next() ) { if ( node->getName()=="Path" ) { bool root = false, recursive = false; if (!node->findAttribute("root").empty()) { root = MyGUI::utility::parseBool( node->findAttribute("root") ); if ( root ) _rootMedia = node->getContent(); } if (!node->findAttribute("recursive").empty()) { recursive = MyGUI::utility::parseBool(node->findAttribute("recursive")); } _platform->getDataManagerPtr()->addResourceLocation(node->getContent(), recursive); } } }
void Framework::loadRigid( MyGUI::xml::ElementPtr node,JointPtr parent ) { ObjectFactory& factory = ObjectFactory::getSingleton(); RigidPtr rgp = boost::dynamic_pointer_cast<Rigid>(factory.createObject("Rigid")); if(rgp) { rgp->load(node); if( parent ) { parent->mRigid[1] = rgp; parent->linkRigid(parent->mRigid[0], parent->mRigid[1]); } MyGUI::xml::ElementEnumerator ce = node->getElementEnumerator(); while(ce.next()) { MyGUI::xml::ElementPtr child = ce.current(); if( child->getName() == "joint" ) { loadJoint( child,rgp ); } } } else { WARNING_LOG("Factory can't make Rigid object!"); } }
bool EditorState::isMetaSolution(const MyGUI::UString& _fileName) { MyGUI::xml::Document doc; if (!doc.open(_fileName)) { return false; } MyGUI::xml::ElementPtr root = doc.getRoot(); if (!root || (root->getName() != "MyGUI")) { return false; } std::string type; if (root->findAttribute("type", type)) { if (type == "MetaSolution") { return true; } } return false; }
void Framework::loadJoint( MyGUI::xml::ElementPtr node,RigidPtr parent ) { ObjectFactory& factory = ObjectFactory::getSingleton(); string typeName = node->findAttribute("type"); JointPtr jpt = boost::dynamic_pointer_cast<Joint>(factory.createObject(typeName)); if(jpt) { if( parent ) { jpt->mRigid[0] = parent; } addJoint(jpt); jpt->load(node); MyGUI::xml::ElementEnumerator ce = node->getElementEnumerator(); while(ce.next()) { MyGUI::xml::ElementPtr child = ce.current(); if( child->getName() == "rigid" ) { loadRigid(child, jpt); } break; } } else { WARNING_LOG("Factory can't make "<<typeName); } }
//-------------------------------------------------------------------------------- void System::Setup() { MyGUI::xml::Document doc; if (!doc.open(std::string("resources.xml"))) doc.getLastError(); MyGUI::xml::ElementPtr root = doc.getRoot(); if (root == nullptr || root->getName() != "Paths") return; MyGUI::xml::ElementEnumerator node = root->getElementEnumerator(); while (node.next()) { if (node->getName() == "Path") { bool root = false; if (node->findAttribute("root") != "") { root = MyGUI::utility::parseBool(node->findAttribute("root")); if (root) mRootMedia = node->getContent(); } mPlatform->getDataManagerPtr()->addResourceLocation(node->getContent(), false); } } }
void HotkeyManager::_load( MyGUI::xml::ElementPtr root,const string xml ) { if( root == nullptr || root->getName() != "HKS" ) { WARNING_LOG("bad Hotkey config file "<<xml); return; } MyGUI::xml::ElementEnumerator node = root->getElementEnumerator(); while( node.next() ) { if( node->getName() == "hotkey" ) { hotkey hk; if( !node->findAttribute("name",hk.mName) ) { WARNING_LOG("Hotkey config file "<<xml<<" invalid hotkey node"); continue; } node->findAttribute("caption",hk.mCaption); node->findAttribute("tip",hk.mTip); node->findAttribute("key",hk.mHotkey); hk.mSHotkey = getStandardHotkeyName(hk.mHotkey); mHotkeys.push_back( hk ); //设置对应Widget的User string,便于其显示出正常的热键 setWidgetHotkey( hk.mName,hk.mHotkey ); } } }
/* 一组递归函数,用来保存 */ void Framework::saveJoint(MyGUI::xml::ElementPtr node,Joint* joint,RigidPtr other) { node->addAttribute("type", joint->getTypeName()); joint->save(node); MyGUI::xml::ElementPtr child = node->createChild("rigid"); RigidPtr rgp = joint->other(other); if( rgp ) saveRigid(child,rgp,joint); }
void EditTextStateInfo::deserialization(MyGUI::xml::ElementPtr _node, MyGUI::Version _version) { mShift = MyGUI::utility::parseBool(_node->findAttribute("shift")); std::string colour = _node->findAttribute("colour"); if (_version >= MyGUI::Version(1, 1)) { colour = MyGUI::LanguageManager::getInstance().replaceTags(colour); } mColour = MyGUI::Colour::parse(colour); }
void PropertiesPanelView::save(MyGUI::xml::ElementPtr root) { root = root->createChild("PropertiesPanelView"); MyGUI::xml::ElementPtr nodeProp; for (VectorPanel::iterator iter = mPanels.begin(); iter != mPanels.end(); ++iter) { nodeProp = root->createChild("Property"); nodeProp->addAttribute("key", MyGUI::utility::toString("Panel","Minimized")); nodeProp->addAttribute("value", (*iter)->getPanelCell()->isMinimized()); } }
void Framework::load( MyGUI::xml::ElementPtr node ) { removeAllJoint(); mName = node->findAttribute("name"); MyGUI::xml::ElementEnumerator e=node->getElementEnumerator(); while(e.next()) { MyGUI::xml::ElementPtr node = e.current(); if( node->getName() == "body" ) { loadRigid(node, JointPtr()); } break; } }
void WidgetTypes::loadValues(MyGUI::xml::ElementPtr _node, const std::string& _file, MyGUI::Version _version) { MyGUI::xml::ElementEnumerator widgets = _node->getElementEnumerator(); while (widgets.next("Value")) { std::string name = widgets->findAttribute("name"); PossibleValue* possible_value = getPossibleValue(name); // тип мерджа переменных std::string merge = widgets->findAttribute("merge"); // дополняем своими данными, по дефолту if (merge == "add") { } // удаляем и добавляем свои else if (merge == "replace") { possible_value->values.clear(); } // берем детей и крутимся MyGUI::xml::ElementEnumerator field = widgets->getElementEnumerator(); while (field.next()) { std::string key, value; if (field->getName() == "Property") { if (!field->findAttribute("key", key)) continue; possible_value->values.push_back(MyGUI::LanguageManager::getInstance().replaceTags(key)); } } } }
MyGUI::UString EditorState::convertProjectName(const MyGUI::UString& _fileName) { size_t pos = mFileName.find_last_of("\\/"); MyGUI::UString shortName = pos == MyGUI::UString::npos ? mFileName : mFileName.substr(pos + 1); addUserTag("ResourceName", shortName); size_t index = _fileName.find("|"); if (index == MyGUI::UString::npos) return _fileName; MyGUI::UString fileName = _fileName.substr(0, index); MyGUI::UString itemIndexName = _fileName.substr(index + 1); size_t itemIndex = MyGUI::utility::parseValue<size_t>(itemIndexName); MyGUI::xml::Document doc; if (!doc.open(fileName)) return _fileName; MyGUI::xml::ElementPtr root = doc.getRoot(); if ((nullptr == root) || (root->getName() != "MyGUI")) return _fileName; if (root->findAttribute("type") == "Resource") { // берем детей и крутимся MyGUI::xml::ElementEnumerator element = root->getElementEnumerator(); while (element.next("Resource")) { if (element->findAttribute("type") == "ResourceLayout") { if (itemIndex == 0) { // поменять на теги std::string resourceName = element->findAttribute("name"); addUserTag("ResourceName", resourceName); return MyGUI::utility::toString(fileName, " [", resourceName, "]"); } else { itemIndex --; } } } } return _fileName; }
/* 注意ElementPtr 就是 Element* setNotifyDelete()在析构的时候被调用 */ static void bindElement(lua_State*L,const MyGUI::xml::ElementPtr& obj) { if( obj ) { obj->setNotifyDelete( notifyDelete ); lua_bind(L,"xml.Element",obj); } }
bool FontExportSerializer::exportData(const MyGUI::UString& _folderName, const MyGUI::UString& _fileName) { MyGUI::xml::Document document; document.createDeclaration(); MyGUI::xml::ElementPtr root = document.createRoot("MyGUI"); root->addAttribute("type", "Resource"); root->addAttribute("version", "1.1"); DataPtr data = DataManager::getInstance().getRoot(); for (Data::VectorData::const_iterator child = data->getChilds().begin(); child != data->getChilds().end(); child ++) { generateFont((*child)); generateFontManualXml(root, _folderName, (*child)); } return document.save(common::concatenatePath(_folderName, _fileName)); }
void SettingsManager::saveSettings(const MyGUI::UString& _fileName) { std::string _instance = "Editor"; MyGUI::xml::Document doc; doc.createDeclaration(); MyGUI::xml::ElementPtr root = doc.createRoot("MyGUI"); root->addAttribute("type", "Settings"); saveSectors(root); if (!doc.save(_fileName)) { MYGUI_LOGGING(LogSection, Error, _instance << " : " << doc.getLastError()); return; } }
void SettingsManager::loadSettings(const MyGUI::UString& _fileName, bool _internal) { std::string _instance = "Editor"; MyGUI::xml::Document doc; if (_internal) { MyGUI::DataStreamHolder data = MyGUI::DataManager::getInstance().getData(_fileName); if (data.getData() != nullptr) { if (!doc.open(data.getData())) { MYGUI_LOGGING(LogSection, Error, _instance << " : " << doc.getLastError()); return; } } } else { if (!doc.open(_fileName)) { MYGUI_LOGGING(LogSection, Error, _instance << " : " << doc.getLastError()); return; } } MyGUI::xml::ElementPtr root = doc.getRoot(); if (!root || (root->getName() != "MyGUI")) { MYGUI_LOGGING(LogSection, Error, _instance << " : '" << _fileName << "', tag 'MyGUI' not found"); return; } std::string type; if (root->findAttribute("type", type)) { if (type == "Settings") { // берем детей и крутимся MyGUI::xml::ElementEnumerator field = root->getElementEnumerator(); while (field.next()) loadSector(field.current()); } } }
void FontPanel::generateFontTTFXml(MyGUI::xml::ElementPtr _root) { _root->addAttribute("type", "Resource"); _root->addAttribute("version", "1.1"); MyGUI::xml::ElementPtr node = _root->createChild("Resource"); node->addAttribute("type", "ResourceTrueTypeFont"); node->addAttribute("name", mFontName); addProperty(node, "Source", mComboFont->getOnlyText()); addProperty(node, "Size", MyGUI::utility::parseValue<int>(mEditSize->getOnlyText())); addProperty(node, "Resolution", MyGUI::utility::parseValue<int>(mEditResolution->getOnlyText())); addProperty(node, "Antialias", MyGUI::utility::parseValue<bool>(mComboAntialias->getOnlyText())); addProperty(node, "SpaceWidth", MyGUI::utility::parseValue<int>(mEditSpace->getOnlyText())); addProperty(node, "TabWidth", MyGUI::utility::parseValue<int>(mEditTab->getOnlyText())); addProperty(node, "CursorWidth", MyGUI::utility::parseValue<int>(mEditCursor->getOnlyText())); addProperty(node, "Distance", MyGUI::utility::parseValue<int>(mEditDistance->getOnlyText())); addProperty(node, "OffsetHeight", MyGUI::utility::parseValue<int>(mEditOffset->getOnlyText())); MyGUI::xml::ElementPtr node_codes = node->createChild("Codes"); //if (mEditRange1->getOnlyText() != "") // node_codes->createChild("Code")->addAttribute("range", mEditRange1->getOnlyText()); //if (mEditRange2->getOnlyText() != "") // node_codes->createChild("Code")->addAttribute("range", mEditRange2->getOnlyText()); for( int i = 1; i <= _countof(mEditRange); ++i ) { if (mEditRange[i]->getOnlyText() != "") node_codes->createChild("Code")->addAttribute("range", mEditRange[i]->getOnlyText()); } if (mEditHide->getOnlyText() != "") node_codes->createChild("Code")->addAttribute("hide", mEditHide->getOnlyText()); }
void MaskSetSubSkinState::deserialization(MyGUI::xml::ElementPtr _node, MyGUI::Version _version) { std::string texture = _node->getParent()->findAttribute("texture"); if (texture.empty()) { texture = _node->getParent()->getParent()->findAttribute("texture"); } // tags replacement support for Skins if (_version >= MyGUI::Version(1, 1)) { texture = MyGUI::LanguageManager::getInstance().replaceTags(texture); } const MyGUI::IntSize& size = MyGUI::texture_utility::getTextureSize(texture); m_texture = MyGUI::RenderManager::getInstance().getTexture(texture); const MyGUI::IntCoord& coord = MyGUI::IntCoord::parse(_node->findAttribute("offset")); setRect(MyGUI::CoordConverter::convertTextureCoord(coord, size)); }
/* 注意:这里要保证没有循环连接 */ void Framework::save( MyGUI::xml::ElementPtr node ) { if( !mName.empty() ) node->addAttribute("name",mName); //这里做检测保证框架没有循环连接的铰链 if(checkCycle()) { WARNING_LOG("Framework have cycle."); return; } RigidPtr body = getBodyRigid(); if(body) { MyGUI::xml::ElementPtr child = node->createChild("body"); saveRigid(child, body,nullptr); } }
void ResourceW32Pointer::deserialization(MyGUI::xml::ElementPtr _node, MyGUI::Version _version) { Base::deserialization(_node, _version); MyGUI::xml::ElementEnumerator info = _node->getElementEnumerator(); while (info.next()) { if (info->getName() == "Property") { const std::string& key = info->findAttribute("key"); if (key == "SourceFile") { std::string path = MyGUI::DataManager::getInstance().getDataPath(info->getContent()); mHandle = (size_t)LoadCursorFromFileA(path.c_str()); } else if (key == "SourceSystem") { std::string value = info->getContent(); if (value == "IDC_ARROW") mHandle = (size_t)::LoadCursor(NULL, IDC_ARROW); else if (value == "IDC_IBEAM") mHandle = (size_t)::LoadCursor(NULL, IDC_IBEAM); else if (value == "IDC_WAIT") mHandle = (size_t)::LoadCursor(NULL, IDC_WAIT); else if (value == "IDC_CROSS") mHandle = (size_t)::LoadCursor(NULL, IDC_CROSS); else if (value == "IDC_UPARROW") mHandle = (size_t)::LoadCursor(NULL, IDC_UPARROW); else if (value == "IDC_SIZE") mHandle = (size_t)::LoadCursor(NULL, IDC_SIZE); else if (value == "IDC_ICON") mHandle = (size_t)::LoadCursor(NULL, IDC_ICON); else if (value == "IDC_SIZENWSE") mHandle = (size_t)::LoadCursor(NULL, IDC_SIZENWSE); else if (value == "IDC_SIZENESW") mHandle = (size_t)::LoadCursor(NULL, IDC_SIZENESW); else if (value == "IDC_SIZEWE") mHandle = (size_t)::LoadCursor(NULL, IDC_SIZEWE); else if (value == "IDC_SIZENS") mHandle = (size_t)::LoadCursor(NULL, IDC_SIZENS); else if (value == "IDC_SIZEALL") mHandle = (size_t)::LoadCursor(NULL, IDC_SIZEALL); else if (value == "IDC_NO") mHandle = (size_t)::LoadCursor(NULL, IDC_NO); else if (value == "IDC_HAND") mHandle = (size_t)::LoadCursor(NULL, IDC_HAND); else if (value == "IDC_APPSTARTING") mHandle = (size_t)::LoadCursor(NULL, IDC_APPSTARTING); else if (value == "IDC_HELP") mHandle = (size_t)::LoadCursor(NULL, IDC_HELP); } } } }
void Rigid::load( MyGUI::xml::ElementPtr node ) { string ms; VisualObject::load(node); if(node->findAttribute("mass", ms)) { mMassDensity = toValue(ms,(dReal)1); } _init(); _visual2physic(); }
void Framework::saveRigid(MyGUI::xml::ElementPtr node,RigidPtr rgd,Joint* parent) { rgd->save(node); for(JointVec::iterator i=rgd->mJoints.begin();i!=rgd->mJoints.end();++i) { if( *i != parent ) { MyGUI::xml::ElementPtr js = node->createChild("joint");//(*i)->getTypeName()); saveJoint(js, *i,rgd); } } }
void WobbleNodeAnimator::deserialization(MyGUI::xml::ElementPtr _node, MyGUI::Version _version) { MyGUI::xml::ElementEnumerator node = _node->getElementEnumerator(); while (node.next("Property")) { const std::string& key = node->findAttribute("key"); const std::string& value = node->findAttribute("value"); if (key == "DragStrength") mDragStrength = MyGUI::utility::parseFloat(value); else if (key == "ResizeStrength") mResizeStrength = MyGUI::utility::parseFloat(value); } }
void FadeNodeAnimator::deserialization(MyGUI::xml::ElementPtr _node, MyGUI::Version _version) { MyGUI::xml::ElementEnumerator node = _node->getElementEnumerator(); while (node.next("Property")) { const std::string& key = node->findAttribute("key"); const std::string& value = node->findAttribute("value"); if (key == "FadeDuration") mFadeDuration = MyGUI::utility::parseFloat(value); else if (key == "FadeType") mFadeType = MyGUI::utility::parseInt(value);//FIXME } }
void FontExportSerializer::generateFontManualXml(MyGUI::xml::ElementPtr _root, const MyGUI::UString& _folderName, DataPtr _data) { MyGUI::IFont* resource = MyGUI::FontManager::getInstance().getByName(_data->getPropertyValue("FontName")); MyGUI::ResourceTrueTypeFont* font = resource != nullptr ? resource->castType<MyGUI::ResourceTrueTypeFont>(false) : nullptr; if (font != nullptr) { std::string textureName = _data->getPropertyValue("Name") + ".png"; MyGUI::ITexture* texture = font->getTextureFont(); if (texture == nullptr) return; texture->saveToFile(MyGUI::UString(common::concatenatePath(_folderName, MyGUI::UString(textureName))).asUTF8()); MyGUI::xml::ElementPtr node = _root->createChild("Resource"); node->addAttribute("type", "ResourceManualFont"); node->addAttribute("name", _data->getPropertyValue("Name")); addProperty(node, "Source", textureName); addProperty(node, "SourceSize", MyGUI::IntSize(texture->getWidth(), texture->getHeight())); addProperty(node, "DefaultHeight", font->getDefaultHeight()); MyGUI::xml::Element* codes = node->createChild("Codes"); std::vector<std::pair<MyGUI::Char, MyGUI::Char> > codePointRanges = font->getCodePointRanges(); MyGUI::Char substituteCodePoint = font->getSubstituteCodePoint(); bool isCustomSubstituteCodePoint = substituteCodePoint != MyGUI::FontCodeType::NotDefined; // Add all of the code points. Skip over the substitute code point -- unless it's been customized, in which case it // needs to be added here as a regular code point and then at the end as a substitute code point. for (std::vector<std::pair<MyGUI::Char, MyGUI::Char> >::const_iterator iter = codePointRanges.begin() ; iter != codePointRanges.end(); ++iter) for (MyGUI::Char code = iter->first; code <= iter->second && code >= iter->first; ++code) if (code != substituteCodePoint || isCustomSubstituteCodePoint) addCode(codes, code, font, false); // Always add the substitute code point last, even if it isn't the last one in the range. addCode(codes, substituteCodePoint, font, true); } }
void PanelControllers::loadControllerTypes(MyGUI::xml::ElementPtr _node, const std::string& _file, MyGUI::Version _version) { MyGUI::xml::ElementEnumerator controller = _node->getElementEnumerator(); while (controller.next("Controller")) { MyGUI::MapString controllerProperties; std::string name = controller->findAttribute("name"); mControllerName->addItem(name); MyGUI::xml::ElementEnumerator prop = controller->getElementEnumerator(); while (prop.next("Property")) controllerProperties[prop->findAttribute("key")] = prop->findAttribute("type"); mControllersProperties[name] = controllerProperties; } }
void EditorState::saveSettings(const MyGUI::UString& _fileName) { std::string _instance = "Editor"; MyGUI::xml::Document doc; doc.createDeclaration(); MyGUI::xml::ElementPtr root = doc.createRoot("MyGUI"); root->addAttribute("type", "Settings"); mPropertiesPanelView->save(root); mSettingsWindow->save(root); mWidgetsWindow->save(root); mMetaSolutionWindow->save(root); // cleanup for duplicates std::reverse(recentFiles.begin(), recentFiles.end()); for (size_t i = 0; i < recentFiles.size(); ++i) recentFiles.erase(std::remove(recentFiles.begin() + i + 1, recentFiles.end(), recentFiles[i]), recentFiles.end()); // remove old files while (recentFiles.size() > MAX_RECENT_FILES) recentFiles.pop_back(); std::reverse(recentFiles.begin(), recentFiles.end()); for (std::vector<MyGUI::UString>::iterator iter = recentFiles.begin(); iter != recentFiles.end(); ++iter) { MyGUI::xml::ElementPtr nodeProp = root->createChild("RecentFile"); nodeProp->addAttribute("name", *iter); } for (std::vector<MyGUI::UString>::iterator iter = additionalPaths.begin(); iter != additionalPaths.end(); ++iter) { MyGUI::xml::ElementPtr nodeProp = root->createChild("AdditionalPath"); nodeProp->addAttribute("name", *iter); } if (!doc.save(_fileName)) { MYGUI_LOGGING(LogSection, Error, _instance << " : " << doc.getLastError()); return; } }
void ResourceSDLPointer::deserialization(MyGUI::xml::ElementPtr _node, MyGUI::Version _version) { Base::deserialization(_node, _version); MyGUI::xml::ElementEnumerator info = _node->getElementEnumerator(); while (info.next()) { if (info->getName() == "Property") { const std::string& key = info->findAttribute("key"); if (key == "SourceFile") { //std::string path = MyGUI::DataManager::getInstance().getDataPath(info->getContent()); //mCursorType = (size_t)LoadCursorFromFileA(path.c_str()); } else if (key == "SourceSystem") { std::string value = info->getContent(); if (value == "SDL_SYSTEM_CURSOR_ARROW") mCursorType = SDL_SYSTEM_CURSOR_ARROW; else if (value == "SDL_SYSTEM_CURSOR_IBEAM") mCursorType = SDL_SYSTEM_CURSOR_IBEAM; else if (value == "SDL_SYSTEM_CURSOR_WAIT") mCursorType = SDL_SYSTEM_CURSOR_WAIT; else if (value == "SDL_SYSTEM_CURSOR_CROSSHAIR") mCursorType = SDL_SYSTEM_CURSOR_CROSSHAIR; else if (value == "SDL_SYSTEM_CURSOR_SIZENWSE") mCursorType = SDL_SYSTEM_CURSOR_SIZENWSE; else if (value == "SDL_SYSTEM_CURSOR_SIZENESW") mCursorType = SDL_SYSTEM_CURSOR_SIZENESW; else if (value == "SDL_SYSTEM_CURSOR_SIZEWE") mCursorType = SDL_SYSTEM_CURSOR_SIZEWE; else if (value == "SDL_SYSTEM_CURSOR_SIZENS") mCursorType = SDL_SYSTEM_CURSOR_SIZENS; else if (value == "SDL_SYSTEM_CURSOR_SIZEALL") mCursorType = SDL_SYSTEM_CURSOR_SIZEALL; else if (value == "SDL_SYSTEM_CURSOR_NO") mCursorType = SDL_SYSTEM_CURSOR_NO; else if (value == "SDL_SYSTEM_CURSOR_HAND") mCursorType = SDL_SYSTEM_CURSOR_HAND; } } } }
void ScalingLayer::deserialization(MyGUI::xml::ElementPtr _node, MyGUI::Version _version) { MyGUI::OverlappedLayer::deserialization(_node, _version); MyGUI::xml::ElementEnumerator info = _node->getElementEnumerator(); while (info.next()) { if (info->getName() == "Property") { const std::string& key = info->findAttribute("key"); const std::string& value = info->findAttribute("value"); if (key == "Size") { mViewSize = MyGUI::IntSize::parse(value); } } } }