void PanelMainProperties::notifyActionSkin(const std::string& _type, const std::string& _value, bool _final)
	{
		if (_final)
		{
			WidgetContainer* widgetContainer = EditorWidgets::getInstance().find(mCurrentWidget);

			widgetContainer->setSkin(_value);
			if (isSkinExist(widgetContainer->getSkin()) || widgetContainer->getSkin().empty())
			{
				WidgetSelectorManager::getInstance().saveSelectedWidget();

				MyGUI::xml::Document* savedDoc = EditorWidgets::getInstance().savexmlDocument();
				EditorWidgets::getInstance().clear();
				EditorWidgets::getInstance().loadxmlDocument(savedDoc);
				delete savedDoc;

				WidgetSelectorManager::getInstance().restoreSelectedWidget();
			}
			else
			{
				std::string mess = MyGUI::utility::toString("Skin '", widgetContainer->getSkin(), "' not found. This value will be saved.");
				GroupMessage::getInstance().addMessage(mess, MyGUI::LogLevel::Error);
			}

			UndoManager::getInstance().addValue(PR_PROPERTIES);
		}
	}
	void PanelMainProperties::update(MyGUI::Widget* _currentWidget)
	{
		hidePropertyFields();

		mCurrentWidget = _currentWidget;
		if (mCurrentWidget == nullptr)
			return;

		WidgetStyle* widgetType = WidgetTypes::getInstance().findWidgetStyle(mCurrentWidget->getTypeName());
		WidgetContainer* widgetContainer = EditorWidgets::getInstance().find(mCurrentWidget);
		bool existTargetType = widgetContainer->existUserData(mUserDataTargetType);

		IPropertyField* field = getPropertyField(mWidgetClient, "Name", "Name");
		field->setTarget(_currentWidget);
		field->setValue(widgetContainer->getName());

		if (widgetType->resizeable)
		{
			field = getPropertyField(mWidgetClient, "Position", "Position");
			field->setTarget(_currentWidget);
			field->setValue(widgetContainer->position());
		}

		field = getPropertyField(mWidgetClient, "Type", "Type");
		field->setTarget(_currentWidget);
		if (existTargetType)
		{
			std::string targetType = widgetContainer->getUserData(mUserDataTargetType);
			field->setValue(targetType);
		}
		else
		{
			field->setValue(widgetContainer->getType());
		}

		field = getPropertyField(mWidgetClient, "Align", "Align");
		field->setTarget(_currentWidget);
		field->setValue(widgetContainer->getAlign());

		if (mCurrentWidget->isRootWidget())
		{
			field = getPropertyField(mWidgetClient, "Layer", "Layer");
			field->setTarget(_currentWidget);
			field->setValue(widgetContainer->getLayerName());

			field = getPropertyField(mWidgetClient, "Template", "Bool");
			field->setTarget(_currentWidget);
			field->setValue(existTargetType ? "true" : "false");
		}

		field = getPropertyField(mWidgetClient, "Skin", "Skin");
		field->setTarget(_currentWidget);
		field->setValue(widgetContainer->getSkin());

		updateSize();
	}
Exemplo n.º 3
0
	std::string MainMenuControlLE::getDescriptionString(MyGUI::Widget* _widget, bool _print_name, bool _print_type, bool _print_skin)
	{
		WidgetContainer* widgetContainer = EditorWidgets::getInstance().find(_widget);

		addUserTag("WidgetName", _print_name ? widgetContainer->getName() : "");
		addUserTag("WidgetType", _print_type ? _widget->getTypeName() : "");
		addUserTag("WidgetSkin", _print_skin ? widgetContainer->getSkin() : "");

		addUserTag("FormatWidgetName", (_print_name && !widgetContainer->getName().empty()) ? "#{PatternWidgetName}" : "");
		addUserTag("FormatWidgetType", _print_type ? "#{PatternWidgetType}" : "");
		addUserTag("FormatWidgetSkin", _print_skin ? "#{PatternWidgetSkin}" : "");

		return replaceTags("MenuItemWidgetInfo");
	}