示例#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 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);
			}
		}
	}
示例#3
0
	IPropertyField* PanelProperties::getPropertyField(MyGUI::Widget* _client, const std::string& _name, const std::string& _type)
	{
		MapPropertyField::iterator item = mFields.find(_name);
		if (item != mFields.end())
		{
			(*item).second->setVisible(true);
			return (*item).second;
		}

		IPropertyField* result = PropertyFieldManager::getInstance().createPropertyField(_client, _type);
		result->setName(_name);
		result->eventAction = MyGUI::newDelegate(this, &PanelProperties::notifyAction);

		mFields[_name] = result;

		return result;
	}
	void PanelExtensionProperties::AddParametrs(WidgetStyle* widgetType, WidgetContainer* widgetContainer, MyGUI::Widget* _currentWidget)
	{
		if (widgetType != nullptr)
		{
			for (MyGUI::VectorStringPairs::iterator iter = widgetType->parameterData.begin(); iter != widgetType->parameterData.end(); ++iter)
			{
				std::string value = "";
				for (MyGUI::VectorStringPairs::iterator iterProperty = widgetContainer->mUserString.begin(); iterProperty != widgetContainer->mUserString.end(); ++iterProperty)
				{
					if (iterProperty->first == iter->first)
					{
						value = iterProperty->second;
						break;
					}
				}

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