Example #1
0
	void PropertyPanelControl::InitialiseProperty(PropertyPtr _property, int& _height)
	{
		std::string type = _property->getType()->getType();
		PropertyControl* control = nullptr;

		for (VectorPairControl::iterator child = mPropertyControls.begin(); child != mPropertyControls.end(); child ++)
		{
			if ((*child).first == type && !(*child).second->getRoot()->getVisible())
			{
				control = (*child).second;
				control->getRoot()->setVisible(true);
				break;
			}
		}

		if (control == nullptr)
		{
			control = components::FactoryManager::GetInstance().CreateItem<PropertyControl>(_property->getType()->getType());
			if (control != nullptr)
			{
				control->Initialise(this, mScrollView, "");

				mPropertyControls.push_back(std::make_pair(_property->getType()->getType(), control));
			}
		}

		if (control != nullptr)
		{
			control->setProperty(_property);
			control->getRoot()->setPosition(0, _height);

			_height += control->getRoot()->getHeight() + mDistance;
		}
	}
	void GroupTextureController::notifyChangeProperty(PropertyPtr _sender)
	{
		if (!mActivated || !PropertyUtility::isDataSelected(_sender->getOwner()))
			return;

		if (_sender->getOwner()->getType()->getName() == "Group")
		{
			if (_sender->getType()->getName() == "Texture")
				mControl->setTextureValue(_sender->getValue());
			else if (_sender->getType()->getName() == "Size")
				updateCoords(_sender->getValue());
		}
	}
	void FontTextureController::notifyChangeProperty(PropertyPtr _sender)
	{
		if (!mActivated || !PropertyUtility::isDataSelected(_sender->getOwner()))
			return;

		if (_sender->getOwner()->getType()->getName() == "Font")
		{
			if (_sender->getType()->getName() == "FontName")
				updateTexture(_sender->getValue());
		}
	}
Example #4
0
	void PropertyBoolControl::updateProperty()
	{
		PropertyPtr proper = getProperty();
		if (proper != nullptr)
		{
			mComboBox->setEnabled(!proper->getType()->getReadOnly());
			size_t index = getComboIndex(proper->getValue());
			mComboBox->setIndexSelected(index);
		}
		else
		{
			mComboBox->setIndexSelected(MyGUI::ITEM_NONE);
			mComboBox->setEnabled(false);
		}
	}
 void PropertyInt2ListControl::updateProperty()
 {
   PropertyPtr proper = getProperty();
   if (proper != nullptr)
   {
     mList->setEnabled(!proper->getType()->getReadOnly());
     std::string value = getValue();
     if (value != proper->getValue())
       setValue(proper->getValue());
   }
   else
   {
     mList->removeAllItems();
     mList->setEnabled(false);
   }
 }
	void PropertyIntControl::updateProperty()
	{
		PropertyPtr proper = getProperty();
		if (proper != nullptr)
		{
			mEdit->setEnabled(!proper->getType()->getReadOnly());
			if (mEdit->getOnlyText() != proper->getValue())
				mEdit->setCaption(proper->getValue());

			bool validate = isValidate();
			setColour(validate);
		}
		else
		{
			mEdit->setCaption("");
			mEdit->setEnabled(false);
		}
	}
	void PropertyFontSourceControl::updateCaption()
	{
		PropertyPtr proper = getProperty();
		if (proper != nullptr)
			mName->setCaption(proper->getType()->getName());
	}