예제 #1
0
	void StatePropertyControl::updateStateProperties()
	{
		StateItem* state = getCurrentState();
		mPropertyVisibleControl->setProperty(state != nullptr ? state->getPropertySet()->getChild("Visible") : nullptr);
		mPropertyPositionControl->setProperty(state != nullptr ? state->getPropertySet()->getChild("Position") : nullptr);
		mPropertyColourControl->setProperty(state != nullptr ? state->getPropertySet()->getChild("TextColour") : nullptr);
		mPropertyOffsetControl->setProperty(state != nullptr ? state->getPropertySet()->getChild("TextShift") : nullptr);
	}
예제 #2
0
	void StateTextureControl::updateUnselectedStates()
	{
		std::vector<MyGUI::IntCoord> coords;

		if (getCurrentSkin() != nullptr)
		{
			ItemHolder<StateItem>::EnumeratorItem states = getCurrentSkin()->getStates().getChildsEnumerator();
			while (states.next())
			{
				StateItem* item = states.current();
				if (item != getCurrentSkin()->getStates().getItemSelected())
				{
					if (item->getPropertySet()->getPropertyValue("Visible") == "True")
						addCoord(coords,
							getCurrentSkin()->getPropertySet()->getPropertyValue("Coord"),
							item->getPropertySet()->getPropertyValue("Position"));
				}
			}
		}

		drawUnselectedStates(coords);
	}
예제 #3
0
	void StatesListControl::updatePreset()
	{
		mPresets->setEnabled(getCurrentSkin() != nullptr);

		if (getCurrentSkin() != nullptr)
		{
			int currentPreset = 0;
			int bitIndex = 0;

			ItemHolder<StateItem>::EnumeratorItem states = getCurrentSkin()->getStates().getChildsEnumerator();
			while (states.next())
			{
				StateItem* item = states.current();
				bool visible = item->getPropertySet()->getPropertyValue("Visible") == "True";
				if (visible)
					currentPreset |= (1 << bitIndex);

				++ bitIndex;
			}

			size_t indexSelected = MyGUI::ITEM_NONE;

			size_t count = mPresets->getItemCount();
			for (size_t index = 0; index < count; ++index)
			{
				PresetEnum preset = *mPresets->getItemDataAt<PresetEnum>(index);
				if (preset == currentPreset)
				{
					indexSelected = index;
					break;
				}
			}

			mPresets->setIndexSelected(indexSelected);

			mPresets->setEnabled(true);
		}
		else
		{
			mPresets->setEnabled(false);
		}

	}
예제 #4
0
	void StatesListControl::updateList()
	{
		if (getCurrentSkin() != nullptr)
		{
			StateItem* selectedItem = getCurrentSkin()->getStates().getItemSelected();
			size_t selectedIndex = MyGUI::ITEM_NONE;

			size_t index = 0;
			ItemHolder<StateItem>::EnumeratorItem states = getCurrentSkin()->getStates().getChildsEnumerator();
			while (states.next())
			{
				StateItem* item = states.current();

				MyGUI::UString name;
				if (item->getPropertySet()->getPropertyValue("Visible") != "True")
					name = replaceTags("ColourDisabled") + item->getName();
				else
					name = item->getName();

				if (index < mList->getItemCount())
				{
					mList->setItemNameAt(index, name);
					mList->setItemDataAt(index, item);
				}
				else
				{
					mList->addItem(name, item);
				}

				if (item == selectedItem)
					selectedIndex = index;

				index ++;
			}

			while (index < mList->getItemCount())
				mList->removeItemAt(mList->getItemCount() - 1);

			mList->setIndexSelected(selectedIndex);
		}
	}
예제 #5
0
	void StatesListControl::notifyComboChangePosition(MyGUI::ComboBox* _sender, size_t _index)
	{
		if (getCurrentSkin() == nullptr)
			return;

		if (_index == MyGUI::ITEM_NONE)
			return;

		PresetEnum preset = *_sender->getItemDataAt<PresetEnum>(_index);

		size_t index = 0;
		ItemHolder<StateItem>::EnumeratorItem states = getCurrentSkin()->getStates().getChildsEnumerator();
		while (states.next())
		{
			StateItem* item = states.current();
			MyGUI::UString value = ((preset & (1 << index)) != 0) ? "True" : "False";
			item->getPropertySet()->setPropertyValue("Visible", value, mTypeName);

			++index;
		}

		updateList();
	}
예제 #6
0
	SkinItem::SkinItem() :
		mPropertySet(nullptr)
	{
		mPropertySet = new PropertySet();
		mPropertySet->createChild("Texture", "Texture");
		mPropertySet->createChild("Coord", "IntCoord", "0 0 32 32");

		StateItem* skin = nullptr;

		skin = mStates.createChild();
		skin->setName("Disabled");
		skin->getPropertySet()->setPropertyValue("Visible", "False", "");

		skin = mStates.createChild();
		skin->setName("Normal");
		skin->getPropertySet()->setPropertyValue("Visible", "True", "");

		skin = mStates.createChild();
		skin->setName("Over");
		skin->getPropertySet()->setPropertyValue("Visible", "False", "");

		skin = mStates.createChild();
		skin->setName("Pressed");
		skin->getPropertySet()->setPropertyValue("Visible", "False", "");

		skin = mStates.createChild();
		skin->setName("Selected Disabled");
		skin->getPropertySet()->setPropertyValue("Visible", "False", "");

		skin = mStates.createChild();
		skin->setName("Selected Normal");
		skin->getPropertySet()->setPropertyValue("Visible", "False", "");

		skin = mStates.createChild();
		skin->setName("Selected Over");
		skin->getPropertySet()->setPropertyValue("Visible", "False", "");

		skin = mStates.createChild();
		skin->setName("Selected Pressed");
		skin->getPropertySet()->setPropertyValue("Visible", "False", "");


		SeparatorItem* separator = nullptr;

		separator = mSeparators.createChild();
		separator->setName("Top");
		separator->setCorner(MyGUI::Align::Top);
		separator->getPropertySet()->setPropertyValue("Offset", "1", "");

		separator = mSeparators.createChild();
		separator->setName("Bottom");
		separator->setCorner(MyGUI::Align::Bottom);
		separator->getPropertySet()->setPropertyValue("Offset", "1", "");

		separator = mSeparators.createChild();
		separator->setName("Left");
		separator->setCorner(MyGUI::Align::Left);
		separator->getPropertySet()->setPropertyValue("Offset", "1", "");

		separator = mSeparators.createChild();
		separator->setName("Right");
		separator->setCorner(MyGUI::Align::Right);
		separator->getPropertySet()->setPropertyValue("Offset", "1", "");


		RegionItem* region = nullptr;

		region = mRegions.createChild();
		region->setName("Left Top");
		region->setSeparator(MyGUI::Align::Left | MyGUI::Align::Top);
		region->getPropertySet()->setPropertyValue("Align", "Left Top", "");
		region->getPropertySet()->setPropertyReadOnly("Enabled", true);
		region->getPropertySet()->setPropertyReadOnly("Position", true);
		region->getPropertySet()->setPropertyReadOnly("Align", true);

		region = mRegions.createChild();
		region->setName("Top");
		region->setSeparator(MyGUI::Align::Top);
		region->getPropertySet()->setPropertyValue("Align", "HStretch Top", "");
		region->getPropertySet()->setPropertyReadOnly("Enabled", true);
		region->getPropertySet()->setPropertyReadOnly("Position", true);
		region->getPropertySet()->setPropertyReadOnly("Align", true);

		region = mRegions.createChild();
		region->setName("Right Top");
		region->setSeparator(MyGUI::Align::Right | MyGUI::Align::Top);
		region->getPropertySet()->setPropertyValue("Align", "Right Top", "");
		region->getPropertySet()->setPropertyReadOnly("Enabled", true);
		region->getPropertySet()->setPropertyReadOnly("Position", true);
		region->getPropertySet()->setPropertyReadOnly("Align", true);

		region = mRegions.createChild();
		region->setName("Right");
		region->setSeparator(MyGUI::Align::Right);
		region->getPropertySet()->setPropertyValue("Align", "Right VStretch", "");
		region->getPropertySet()->setPropertyReadOnly("Enabled", true);
		region->getPropertySet()->setPropertyReadOnly("Position", true);
		region->getPropertySet()->setPropertyReadOnly("Align", true);

		region = mRegions.createChild();
		region->setName("Right Bottom");
		region->setSeparator(MyGUI::Align::Right | MyGUI::Align::Bottom);
		region->getPropertySet()->setPropertyValue("Align", "Right Bottom", "");
		region->getPropertySet()->setPropertyReadOnly("Enabled", true);
		region->getPropertySet()->setPropertyReadOnly("Position", true);
		region->getPropertySet()->setPropertyReadOnly("Align", true);

		region = mRegions.createChild();
		region->setName("Bottom");
		region->setSeparator(MyGUI::Align::Bottom);
		region->getPropertySet()->setPropertyValue("Align", "HStretch Bottom", "");
		region->getPropertySet()->setPropertyReadOnly("Enabled", true);
		region->getPropertySet()->setPropertyReadOnly("Position", true);
		region->getPropertySet()->setPropertyReadOnly("Align", true);

		region = mRegions.createChild();
		region->setName("Left Bottom");
		region->setSeparator(MyGUI::Align::Left | MyGUI::Align::Bottom);
		region->getPropertySet()->setPropertyValue("Align", "Left Bottom", "");
		region->getPropertySet()->setPropertyReadOnly("Enabled", true);
		region->getPropertySet()->setPropertyReadOnly("Position", true);
		region->getPropertySet()->setPropertyReadOnly("Align", true);

		region = mRegions.createChild();
		region->setName("Left");
		region->setSeparator(MyGUI::Align::Left);
		region->getPropertySet()->setPropertyValue("Align", "Left VStretch", "");
		region->getPropertySet()->setPropertyReadOnly("Enabled", true);
		region->getPropertySet()->setPropertyReadOnly("Position", true);
		region->getPropertySet()->setPropertyReadOnly("Align", true);

		region = mRegions.createChild();
		region->setName("Center");
		region->setSeparator(MyGUI::Align::Center);
		region->getPropertySet()->setPropertyValue("Align", "Stretch", "");
		region->getPropertySet()->setPropertyReadOnly("Enabled", true);
		region->getPropertySet()->setPropertyReadOnly("Position", true);
		region->getPropertySet()->setPropertyReadOnly("Align", true);

		region = mRegions.createChild();
		region->setName("Text");
		region->setSeparator(MyGUI::Align::Center);
		region->getPropertySet()->setPropertyValue("Align", "Stretch", "");
		region->getPropertySet()->setPropertyValue("RegionType", "SimpleText", "");
		region->getPropertySet()->setPropertyValue("Visible", "False", "");
		region->getPropertySet()->setPropertyReadOnly("Enabled", true);
	}