Example #1
0
	void PanelControllers::notifySelectItem(MyGUI::ListBox* _sender, size_t _index)
	{
		destroyPropertyFields();

		mIndexSelected = mList->getIndexSelected();
		if (MyGUI::ITEM_NONE == mIndexSelected)
			return;

		std::string key = mList->getItemNameAt(mIndexSelected);
		mControllerName->setOnlyText(key);

		if (mControllersProperties.find(key) != mControllersProperties.end())
		{
			ControllerInfo* controllerInfo = *mList->getItemDataAt<ControllerInfo*>(mIndexSelected);

			for (MyGUI::MapString::iterator iter = mControllersProperties[key].begin(); iter != mControllersProperties[key].end(); ++iter)
			{
				std::string value = "";
				if (controllerInfo->mProperty.find(iter->first) != controllerInfo->mProperty.end())
					value = controllerInfo->mProperty[iter->first];

				IPropertyField* field = PropertyFieldManager::getInstance().createPropertyField(mWidgetClient, iter->second);
				field->setTarget(mCurrentWidget);
				field->setName(iter->first);
				field->setValue(value);
				field->eventAction = MyGUI::newDelegate(this, &PanelControllers::notifyAction);
				mFields.push_back(field);
			}
		}

		updateSize();
	}
	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();
	}
	void PanelTemplateProperties::AddParametrs(WidgetStyle* widgetType, WidgetContainer* widgetContainer, MyGUI::Widget* _currentWidget)
	{
		if (widgetType != nullptr)
		{
			for (MyGUI::VectorStringPairs::iterator iter = widgetType->templateData.begin(); iter != widgetType->templateData.end(); ++iter)
			{
				std::string value = widgetContainer->getUserData(iter->first);

				IPropertyField* field = PropertyFieldManager::getInstance().createPropertyField(mWidgetClient, iter->second);
				field->setTarget(_currentWidget);
				field->setName(iter->first);
				field->setValue(value);
				field->eventAction = MyGUI::newDelegate(this, &PanelTemplateProperties::notifyAction);
				mFields.push_back(field);
			}
		}
	}
Example #4
0
	size_t PanelProperties::addParametrs(WidgetStyle* widgetType, WidgetContainer* widgetContainer, MyGUI::Widget* _currentWidget)
	{
		size_t result = 0;

		for (MyGUI::VectorStringPairs::iterator iter = widgetType->parameter.begin(); iter != widgetType->parameter.end(); ++iter)
		{
			std::string value = widgetContainer->getProperty(iter->first);

			IPropertyField* field = getPropertyField(mWidgetClient, iter->first, iter->second);
			field->setTarget(_currentWidget);
			field->setValue(value);

			result ++;
		}

		return result;
	}