Ejemplo n.º 1
0
	void PropertyFieldSkin::onFillValues()
	{
		WidgetStyle::VectorString values = WidgetTypes::getInstance().findWidgetStyle(mCurrentWidget->getTypeName())->skin;

		// добавляем скины и шаблоны
		MyGUI::ResourceManager::EnumeratorPtr resource = MyGUI::ResourceManager::getInstance().getEnumerator();
		while (resource.next())
		{
			MyGUI::ResourceSkin* resourceSkin = resource.current().second->castType<MyGUI::ResourceSkin>(false);
			if (resourceSkin != nullptr)
			{
				if (!MyGUI::utility::startWith(resourceSkin->getResourceName(), "LE_"))
					values.push_back(replaceTags("ColourDefault") + resourceSkin->getResourceName());
			}

			MyGUI::ResourceLayout* resourceLayout = resource.current().second->castType<MyGUI::ResourceLayout>(false);
			if (resourceLayout != nullptr)
			{
				if (!MyGUI::utility::endWith(resourceLayout->getResourceName(), ".layout"))
				{
					if (!MyGUI::utility::startWith(resourceLayout->getResourceName(), "LE_"))
						values.push_back(replaceTags("ColourDefault") + resourceLayout->getResourceName());
				}
			}
		}

		mField->removeAllItems();
		for (WidgetStyle::VectorString::iterator iter = values.begin(); iter != values.end(); ++iter)
			mField->addItem(*iter);
		mField->beginToItemFirst();
	}
	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;
	}
Ejemplo n.º 3
0
//--------------------------------------------------------------------------------------
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;
}