bool PanelMainProperties::checkTemplate(const std::string& _skinName) { MyGUI::ResourceLayout* templateInfo = MyGUI::LayoutManager::getInstance().getByName(_skinName, false); if (templateInfo != nullptr) { const MyGUI::VectorWidgetInfo& data = templateInfo->getLayoutData(); for (MyGUI::VectorWidgetInfo::const_iterator container = data.begin(); container != data.end(); ++container) { if (container->name == "Root") return true; } } return false; }
//-------------------------------------------------------------------------------------- MyGUI::Widget* BaseLayout::loadLayoutPart(const String& _layoutName, const String& _mainWidgetName, const String& _prefix, MyGUI::Widget* _parent) { // load "*.layout" file MyGUI::ResourceLayout* resourceLayout = MyGUI::LayoutManager::getInstance().getByName(_layoutName, false); if (!resourceLayout) { MyGUI::ResourceManager::getInstance().load(_layoutName); resourceLayout = MyGUI::LayoutManager::getInstance().getByName(_layoutName, false); } GOTHOGRE_ASSERT(resourceLayout != nullptr, "Layout '" << _layoutName << "' couldn't be loaded"); // find main widget's info const MyGUI::WidgetInfo* widgetInfo = findWidgetInfo(_mainWidgetName, resourceLayout->getLayoutData()); GOTHOGRE_ASSERT(widgetInfo != nullptr, "Root widget '" << _mainWidgetName << "' in layout '" << _layoutName << "' not found."); // create main widget and its children MyGUI::Widget* widget = resourceLayout->createWidget(*widgetInfo, _prefix, _parent); GOTHOGRE_ASSERT(widget != nullptr, "Could not create root widget '" << _mainWidgetName << "' in layout '" << _layoutName << "'."); return widget; }