예제 #1
0
void WeaponCellView::getCellDimension(MyGUI::Widget* _sender, MyGUI::IntCoord& _coord, bool _drop)
{
	if (_drop)
		_coord.set(0, 0,230, 50);
	else
		_coord.set(0, 0,230, 50);
}
예제 #2
0
	void CellView::getCellDimension(MyGUI::Widget* _sender, MyGUI::IntCoord& _coord, bool _drop)
	{
		if (_drop)
			_coord.set(0, 0, 90, 74);
		else
			_coord.set(0, 0, 90, 74);
	}
예제 #3
0
	void Application::setWindowCoord(const MyGUI::IntCoord& _value)
	{
	#if MYGUI_PLATFORM == MYGUI_PLATFORM_WIN32
		if (_value.empty())
			return;

		MyGUI::IntCoord coord = _value;
		if (coord.left < 0)
			coord.left = 0;
		if (coord.top < 0)
			coord.top = 0;
		if (coord.width < 640)
			coord.width = 640;
		if (coord.height < 480)
			coord.height = 480;
		if (coord.width > GetSystemMetrics(SM_CXSCREEN))
			coord.width = GetSystemMetrics(SM_CXSCREEN);
		if (coord.height > GetSystemMetrics(SM_CYSCREEN))
			coord.height = GetSystemMetrics(SM_CYSCREEN);
		if (coord.right() > GetSystemMetrics(SM_CXSCREEN))
			coord.left = GetSystemMetrics(SM_CXSCREEN) - coord.width;
		if (coord.bottom() > GetSystemMetrics(SM_CYSCREEN))
			coord.top = GetSystemMetrics(SM_CYSCREEN) - coord.height;

		size_t handle = getWindowHandle();
		::MoveWindow((HWND)handle, coord.left, coord.top, coord.width, coord.height, true);
	#endif
	}
	void IndexTextureController::updateCoords(const std::string& _value)
	{
		MyGUI::IntCoord coord;
		if (MyGUI::utility::parseComplex(_value, coord.left, coord.top, coord.width, coord.height))
			mSize = coord.size();
		else
			mSize.clear();

		updateFrames();
	}
예제 #5
0
	pugi::xml_node SkinExportSerializer::writeState(pugi::xml_node _parent, DataPtr _data, const MyGUI::IntCoord& _value)
	{
		MyGUI::IntPoint point = MyGUI::IntPoint::parse(_data->getPropertyValue("Point"));
		MyGUI::IntCoord coord = _value + point;

		pugi::xml_node node = _parent.append_child("State");
		node.append_attribute("name").set_value(convertEditorToExportStateName(_data->getPropertyValue("Name")).c_str());
		node.append_attribute("offset").set_value(coord.print().c_str());

		return node;
	}
예제 #6
0
	void RegionTextureControl::notifyChangePosition()
	{
		mCoordValue = mAreaSelectorControl->getCoord();

		// снапим к гриду
		if (!MyGUI::InputManager::getInstance().isShiftPressed())
		{
			MyGUI::IntCoord coord = mCoordValue;
			MyGUI::IntCoord actionScale = mAreaSelectorControl->getActionScale();

			if (actionScale.left != 0 && actionScale.width != 0)
			{
				int right = coord.right();
				coord.left = Grid::getInstance().toGrid(coord.left);
				coord.width = right - coord.left;
			}
			else if (actionScale.width != 0)
			{
				int right = Grid::getInstance().toGrid(coord.right());
				coord.width = right - coord.left;
			}
			else if (actionScale.left != 0)
			{
				coord.left = Grid::getInstance().toGrid(coord.left);
			}

			if (actionScale.top != 0 && actionScale.height != 0)
			{
				int bottom = coord.bottom();
				coord.top = Grid::getInstance().toGrid(coord.top);
				coord.height = bottom - coord.top;
			}
			else if (actionScale.height != 0)
			{
				int bottom = Grid::getInstance().toGrid(coord.bottom());
				coord.height = bottom - coord.top;
			}
			else if (actionScale.top != 0)
			{
				coord.top = Grid::getInstance().toGrid(coord.top);
			}

			if (coord != mCoordValue)
			{
				mCoordValue = coord;
				mAreaSelectorControl->setCoord(mCoordValue);
			}
		}

		if (getCurrentRegion() != nullptr)
			getCurrentRegion()->getPropertySet()->setPropertyValue("Position", mCoordValue.print(), mTypeName);
	}
예제 #7
0
	void TextureControl::loadMouseRelative()
	{
		MyGUI::IntPoint viewOffset = mView->getViewOffset();
		MyGUI::IntCoord viewCoord = mView->getViewCoord();
		MyGUI::IntSize canvasSize = mView->getCanvasSize();
		MyGUI::IntPoint mousePoint = MyGUI::InputManager::getInstance().getMousePositionByLayer();

		// смещение мыши относительно вью
		MyGUI::IntPoint mouseOffset = mousePoint - mView->getAbsolutePosition() - viewCoord.point();
		// смещение нужной точки внутри текстуры в пикселях
		MyGUI::IntPoint canvasPointOffset((int)(mMouseRelative.left * (float)canvasSize.width), (int)(mMouseRelative.top * (float)canvasSize.height));
		// смещение вью в пикселях
		MyGUI::IntPoint canvasOffset = canvasPointOffset - mouseOffset;

		mView->setViewOffset(MyGUI::IntPoint(-canvasOffset.left, -canvasOffset.top));
	}
예제 #8
0
	void StateTextureControl::updateCoord()
	{
		MyGUI::UString value;

		if (getCurrentSkin() != nullptr)
			value = getCurrentSkin()->getPropertySet()->getPropertyValue("Coord");

		MyGUI::IntCoord coord;
		if (MyGUI::utility::parseComplex(value, coord.left, coord.top, coord.width, coord.height))
		{
			if (mSizeValue != coord.size())
			{
				mSizeValue = coord.size();
				updateSelectorsSize();
			}
		}
	}
예제 #9
0
	void BaseManager::setWindowCoord(const MyGUI::IntCoord& _value)
	{
		if (_value.empty())
			return;

		MyGUI::IntCoord coord = _value;

		SDL_SetWindowPosition(mWindow, coord.left, coord.top);
	}
예제 #10
0
파일: TestWindow.cpp 프로젝트: chhawk/MyGUI
	void TestWindow::createSkin()
	{
		if (mSkinItem == nullptr)
			return;

		MyGUI::IntSize canvasSize = mBackgroundControl->getCanvas()->getSize();

		generateSkin();

		mSkinButton = mBackgroundControl->getCanvas()->createWidget<MyGUI::Button>(mSkinName, MyGUI::IntCoord(0, 0, canvasSize.width, canvasSize.height), MyGUI::Align::Stretch);
		mSkinButton->setFontName(mDefaultFontName);
		mSkinButton->setTextAlign(MyGUI::Align::Center);
		mSkinButton->setCaption("Caption");
		mSkinButton->eventMouseButtonPressed += MyGUI::newDelegate(this, &TestWindow::notifyMouseButtonPressed);

		MyGUI::IntCoord coord = mSkinItem->getPropertyValue<MyGUI::IntCoord>("Size");
		MyGUI::IntSize windowSize = coord.size() + mMainWidget->getSize() - canvasSize;
		MyGUI::IntSize parentSize = mMainWidget->getParentSize();

		mMainWidget->setCoord((parentSize.width - windowSize.width) / 2, (parentSize.height - windowSize.height) / 2, windowSize.width, windowSize.height);
	}
예제 #11
0
	void ListBox::notifyDrawItem(MyGUI::ListCtrl* _sender, MyGUI::Widget* _item, const MyGUI::IBDrawItemInfo& _info, MyGUI::IntCoord& _coord)
	{
		MyGUI::Button* text = *_item->getUserData<MyGUI::Button*>();

		if (_info.update)
		{
			text->setCaption(mItemsInfo[_info.index]);

			MyGUI::IntSize size = text->getTextSize() + (text->getSize() - text->getTextRegion().size());
			size.height = mHeightLine;
			_coord.set(0, 0, size.width, size.height);
		}

		text->setButtonPressed(_info.select);
		text->_setMouseFocus(_info.active);
	}
예제 #12
0
	void SeparatePanel::moveSeparator(const MyGUI::IntPoint& _mousePosition)
	{
		MyGUI::IntPoint offset = _mousePosition - mMousePressedOffset - mMainWidget->getAbsolutePosition();

		// сбрасываем дефолтный размер панели
		mDefaultPanelSize.clear();

		MyGUI::IntCoord firstPanel = mFirstPanel->getCoord();
		MyGUI::IntCoord separatorH = mSeparatorH->getCoord();
		MyGUI::IntCoord separatorV = mSeparatorV->getCoord();
		MyGUI::IntCoord secondPanel = mSecondPanel->getCoord();

		if (mPanelAlign.isLeft())
		{
			firstPanel.width = offset.left - firstPanel.left;
			separatorH.left = offset.left;
			secondPanel.width = secondPanel.right() - (offset.left + separatorH.width);
			secondPanel.left = offset.left + separatorH.width;
		}
		else if (mPanelAlign.isRight())
		{
			secondPanel.width = offset.left - secondPanel.left;
			separatorH.left = offset.left;
			firstPanel.width = firstPanel.right() - (offset.left + separatorH.width);
			firstPanel.left = offset.left + separatorH.width;
		}
		else if (mPanelAlign.isTop())
		{
			firstPanel.height = offset.top - firstPanel.top;
			separatorV.top = offset.top;
			secondPanel.height = secondPanel.bottom() - (offset.top + separatorV.height);
			secondPanel.top = offset.top + separatorV.height;
		}
		else if (mPanelAlign.isBottom())
		{
			secondPanel.height = offset.top - secondPanel.top;
			separatorV.top = offset.top;
			firstPanel.height = firstPanel.bottom() - (offset.top + separatorV.height);
			firstPanel.top = offset.top + separatorV.height;
		}

		invalidateSize(firstPanel, separatorH, separatorV, secondPanel);

		// запоминаем дефолтный размер панели
		mDefaultPanelSize = mFirstPanel->getSize();
	}
예제 #13
0
	void WorkspaceControl::notifyChangePosition()
	{
		if (!mMoveableWidget)
			return;

		mCoordValue = mAreaSelectorControl->getCoord();

		// конвертируем в локальные координаты
		if (mCurrentWidget != nullptr)
		{
			MyGUI::Widget* parent = mCurrentWidget->getParent();
			if (parent != nullptr && !mCurrentWidget->isRootWidget())
				mCoordValue = mCoordValue - parent->getAbsolutePosition();
		}

		// снапим к гриду
		if (!MyGUI::InputManager::getInstance().isShiftPressed())
		{
			MyGUI::IntCoord coord = mCoordValue;
			MyGUI::IntCoord actionScale = mAreaSelectorControl->getActionScale();

			if (actionScale.left != 0 && actionScale.width != 0)
			{
				int right = coord.right();
				coord.width = toGrid(coord.width + (mGridStep / 2));
				coord.left = right - coord.width;
			}
			else if (actionScale.width != 0)
			{
				int right = toGrid(coord.right() + (mGridStep / 2));
				coord.width = right - coord.left;
			}
			else if (actionScale.left != 0)
			{
				coord.left = toGrid(coord.left + (mGridStep / 2));
			}

			if (actionScale.top != 0 && actionScale.height != 0)
			{
				int bottom = coord.bottom();
				coord.height = toGrid(coord.height + (mGridStep / 2));
				coord.top = bottom - coord.height;
			}
			else if (actionScale.height != 0)
			{
				int bottom = toGrid(coord.bottom() + (mGridStep / 2));
				coord.height = bottom - coord.top;
			}
			else if (actionScale.top != 0)
			{
				coord.top = toGrid(coord.top + (mGridStep / 2));
			}

			if (coord != mCoordValue)
			{
				mCoordValue = coord;
				updateSelectionFromValue();
			}
		}

		if (mCurrentWidget != nullptr)
			setWidgetCoord(mCurrentWidget, mCoordValue);

		UndoManager::getInstance().addValue(PR_POSITION);
	}
예제 #14
0
void ColourWindowCellView::getCellDimension(MyGUI::Widget* _sender, MyGUI::IntCoord& _coord, bool _drop)
{
    _coord.set(0, 0, _sender->getClientCoord().width, 20);
}
예제 #15
0
	void SeparatePanel::invalidateSize(const MyGUI::IntCoord& _firstPanel, const MyGUI::IntCoord& _separatorH, const MyGUI::IntCoord& _separatorV, const MyGUI::IntCoord& _secondPanel)
	{
		if (mMainWidget->getWidth() <= 0 ||
			mMainWidget->getHeight() <= 0)
			return;

		MyGUI::IntCoord firstPanel = _firstPanel;
		MyGUI::IntCoord separatorH = _separatorH;
		MyGUI::IntCoord separatorV = _separatorV;
		MyGUI::IntCoord secondPanel = _secondPanel;

		if (mPanelAlign.isLeft())
		{
			updateSize(firstPanel.width, secondPanel.width, separatorH.width, mMainWidget->getWidth(), mDefaultPanelSize.width);
			firstPanel.top = separatorH.top = secondPanel.top = 0;
			firstPanel.height = separatorH.height = secondPanel.height = mMainWidget->getHeight();
			firstPanel.left = 0;
			separatorH.left = firstPanel.right();
			secondPanel.left = separatorH.right();
		}
		else if (mPanelAlign.isRight())
		{
			updateSize(firstPanel.width, secondPanel.width, separatorH.width, mMainWidget->getWidth(), mDefaultPanelSize.width);
			firstPanel.top = separatorH.top = secondPanel.top = 0;
			firstPanel.height = separatorH.height = secondPanel.height = mMainWidget->getHeight();
			secondPanel.left = 0;
			separatorH.left = secondPanel.right();
			firstPanel.left = separatorH.right();
		}
		else if (mPanelAlign.isTop())
		{
			updateSize(firstPanel.height, secondPanel.height, separatorV.height, mMainWidget->getHeight(), mDefaultPanelSize.height);
			firstPanel.left = separatorV.left = secondPanel.left = 0;
			firstPanel.width = separatorV.width = secondPanel.width = mMainWidget->getWidth();
			firstPanel.top = 0;
			separatorV.top = firstPanel.bottom();
			secondPanel.top = separatorV.bottom();
		}
		else if (mPanelAlign.isBottom())
		{
			updateSize(firstPanel.height, secondPanel.height, separatorV.height, mMainWidget->getHeight(), mDefaultPanelSize.height);
			firstPanel.left = separatorV.left = secondPanel.left = 0;
			firstPanel.width = separatorV.width = secondPanel.width = mMainWidget->getWidth();
			secondPanel.top = 0;
			separatorV.top = secondPanel.bottom();
			firstPanel.top = separatorV.bottom();
		}

		if (firstPanel != mFirstPanel->getCoord())
			mFirstPanel->setCoord(firstPanel);

		if (separatorH != mSeparatorH->getCoord())
			mSeparatorH->setCoord(separatorH);

		if (separatorV != mSeparatorV->getCoord())
			mSeparatorV->setCoord(separatorV);

		if (secondPanel != mSecondPanel->getCoord())
			mSecondPanel->setCoord(secondPanel);
	}
예제 #16
0
파일: DemoKeeper.cpp 프로젝트: chhawk/MyGUI
	void requestCoordItem(MyGUI::ItemBox* _sender, MyGUI::IntCoord& _coord, bool _drag)
	{
		_coord.set(0, 0, 100, 100);
	}
예제 #17
0
	void ToolControl::requestCoordItem(MyGUI::ItemBox* _sender, MyGUI::IntCoord& _coord, bool _drag)
	{
		_coord.set(0, 0, 120, 25);
	}
예제 #18
0
	void TextureBrowseCell::getCellDimension(MyGUI::Widget* _sender, MyGUI::IntCoord& _coord, bool _drop)
	{
		_coord.set(0, 0, 180, 180);
	}
예제 #19
0
	void SkinExportSerializer::writeRegion(pugi::xml_node _parent, DataPtr _parentData, DataPtr _data, bool _text)
	{
		bool isVisible = MyGUI::utility::parseValue<bool>(_data->getPropertyValue("Visible")) &&
			MyGUI::utility::parseValue<bool>(_data->getPropertyValue("Enable"));

		if (!isVisible)
			return;

		MyGUI::IntCoord coord = MyGUI::IntCoord::parse(_data->getPropertyValue("Coord"));

		std::string type = _data->getPropertyValue("Type");
		bool tileVert = true;
		bool tileHorz = true;

		if (type == "TileRect Vert")
		{
			type = "TileRect";
			tileHorz = false;
		}
		else if (type == "TileRect Horz")
		{
			type = "TileRect";
			tileVert = false;
		}

		pugi::xml_node node = _parent.append_child("BasisSkin");
		node.append_attribute("type").set_value(type.c_str());
		node.append_attribute("offset").set_value(coord.print().c_str());
		node.append_attribute("align").set_value(convertEditorToExportAlign(_data->getPropertyValue("Name")).c_str());

		for (Data::VectorData::const_iterator child = _parentData->getChilds().begin(); child != _parentData->getChilds().end(); child ++)
		{
			if ((*child)->getType()->getName() != "State")
				continue;

			bool visible = MyGUI::utility::parseValue<bool>((*child)->getPropertyValue("Visible"));
			if (!visible)
				continue;

			if (_text)
			{
				writeStateText(node, (*child), coord);
			}
			else
			{
				pugi::xml_node stateNode = writeState(node, (*child), coord);
				if (type == "TileRect")
				{
					pugi::xml_node propertyNode = stateNode.append_child("Property");
					propertyNode.append_attribute("key").set_value("TileSize");
					propertyNode.append_attribute("value").set_value(coord.size().print().c_str());

					propertyNode = stateNode.append_child("Property");
					propertyNode.append_attribute("key").set_value("TileH");
					propertyNode.append_attribute("value").set_value(MyGUI::utility::toString(tileHorz).c_str());

					propertyNode = stateNode.append_child("Property");
					propertyNode.append_attribute("key").set_value("TileV");
					propertyNode.append_attribute("value").set_value(MyGUI::utility::toString(tileVert).c_str());
				}
			}
		}
	}
예제 #20
0
	size_t WobbleNodeAnimator::animate(
		bool _update,
		size_t _quad_count,
		MyGUI::VectorQuadData& _data,
		float _time,
		MyGUI::IVertexBuffer* _buffer,
		MyGUI::ITexture* _texture,
		const MyGUI::RenderTargetInfo& _info,
		const MyGUI::IntCoord& _coord,
		bool& _isAnimate
		)
	{
		if (mDestroy)
		{
			return _quad_count;
		}

		// проверяем смещения виджета
		if (mOldCoord.empty())
		{
			mOldCoord = _coord;
		}
		else if (mOldCoord.size() != _coord.size() && mOldCoord.point() != _coord.point())
		{
			mInertiaPoint.set(0.5, 0.5);
			mInertiaMode = false;

			addInertia(MyGUI::FloatPoint(_coord.left-mOldCoord.left, _coord.top-mOldCoord.top));
		}
		else if (mOldCoord.size() != _coord.size())
		{
			mInertiaMode = true;

			addInertia(MyGUI::FloatPoint(_coord.width - mOldCoord.width, _coord.height-mOldCoord.height));
		}
		else if (mOldCoord.point() != _coord.point())
		{
			const MyGUI::IntPoint& point = MyGUI::InputManager::getInstance().getMousePosition();
			mInertiaPoint = MyGUI::FloatPoint((float)(point.left - _coord.left) / (float)_coord.width , (float)(point.top - _coord.top) / (float)_coord.height);
			mInertiaMode = false;

			addInertia(MyGUI::FloatPoint(_coord.left-mOldCoord.left, _coord.top-mOldCoord.top));
		}

		mOldCoord = _coord;

		addTime(_time);

		bool anim_update = squaredLength(mDragOffset) >= 0.3f;

		if (!anim_update)
		{
			return _quad_count;
		}

		_isAnimate = true;

		_quad_count = tesselation(
			_quad_count,
			_data,
			_texture,
			_info,
			_coord);

		buildQuadVertex(_data);

		return _quad_count;
	}
예제 #21
0
	bool ControllerEdgeHide::addTime(Widget* _widget, float _time)
	{
		const IntSize& view_size = _widget->getParentSize();
		// do nothing if we have minimized window
		if (view_size.width <= 1 && view_size.height <= 1)
			return true;

		Widget* keyFocus = InputManager::getInstance().getKeyFocusWidget();
		Widget* mouseFocus = InputManager::getInstance().getMouseFocusWidget();

		while ((keyFocus != nullptr) && (_widget != keyFocus))
			keyFocus = keyFocus->getParent();
		while ((mouseFocus != nullptr) && (_widget != mouseFocus))
			mouseFocus = mouseFocus->getParent();

		// if our widget or its children have focus
		bool haveFocus = ((keyFocus != nullptr) || (mouseFocus != nullptr)) || (_widget->getVisible() == false);

		mElapsedTime += haveFocus ? -_time : _time;

		if (mElapsedTime >= mTime)
		{
			mElapsedTime = mTime;
		}
		if (mElapsedTime <= 0)
		{
			mElapsedTime = 0.0f;
			return true;
		}

		float k = sin(M_PI * mElapsedTime / mTime - M_PI / 2);
		if (k < 0) k = (-pow(-k, 0.7f) + 1) / 2;
		else k = (pow(k, 0.7f) + 1) / 2;

		MyGUI::IntCoord coord = _widget->getCoord();
		// if widget was moved
		if (coord != mLastCoord)
		{
			// if still moving - leave it alone
			if (haveFocus)
				return true;
			else
				recalculateTime(_widget);
		}

		bool nearBorder = false;

		if ((coord.left <= 0) && !(coord.right() >= view_size.width - 1))
		{
			coord.left = - int( float(coord.width - mRemainPixels - mShadowSize) * k);
			nearBorder = true;
		}
		if ((coord.top <= 0) && !(coord.bottom() >= view_size.height - 1))
		{
			coord.top = - int( float(coord.height - mRemainPixels - mShadowSize) * k);
			nearBorder = true;
		}
		if ((coord.right() >= view_size.width - 1) && !(coord.left <= 0))
		{
			coord.left = int(float(view_size.width - 1) - float(mRemainPixels) * k - float(coord.width) * (1.f - k));
			nearBorder = true;
		}
		if ((coord.bottom() >= view_size.height - 1) && !(coord.top <= 0))
		{
			coord.top = int(float(view_size.height - 1) - float(mRemainPixels) * k - float(coord.height) * (1.f - k));
			nearBorder = true;
		}

		if (nearBorder)
		{
			_widget->setCoord(coord);
		}
		else
		{
			mElapsedTime = 0;
		}
		mLastCoord = coord;

		eventUpdateAction(_widget, this);

		return true;
	}
예제 #22
0
	void WidgetsWindow::requestCoordItem(MyGUI::ItemBox* _sender, MyGUI::IntCoord& _coord, bool _drag)
	{
		_coord.set(0, 0, mWidgetsButtonWidth + mWidgetsButtonOffset + mWidgetsButtonOffset, mWidgetsButtonHeight + mWidgetsButtonOffset + mWidgetsButtonOffset);
	}
예제 #23
0
	void ExportManager::convertSkin(MyGUI::xml::Element* _from, MyGUI::xml::Element* _to)
	{
		_to->addAttribute("type", "ResourceSkin");
		_to->addAttribute("name", _from->findAttribute("name"));

		MyGUI::xml::ElementEnumerator nodes = _from->getElementEnumerator();
		while (nodes.next())
		{
			MyGUI::UString coordValue;
			MyGUI::UString textureValue;

			MyGUI::xml::Element* node = nodes.current();
			if (node->getName() == "PropertySet")
			{
				MyGUI::xml::ElementEnumerator propertyNodes = node->getElementEnumerator();
				while (propertyNodes.next("Property"))
				{
					MyGUI::xml::Element* propertyNode = propertyNodes.current();

					std::string name;
					if (propertyNode->findAttribute("name", name))
					{
						if (name == "Coord")
						{
							MyGUI::IntCoord coord = MyGUI::IntCoord::parse(propertyNode->getContent());
							coordValue = coord.size().print();
						}
						else if (name == "Texture")
						{
							textureValue = propertyNode->getContent();
						}
					}
				}

				_to->addAttribute("size", coordValue);
				_to->addAttribute("texture", textureValue);

				break;
			}
			else if (node->getName() == "RegionItem")
			{
				bool regionVisible = true;

				MyGUI::xml::ElementEnumerator regionNodes = node->getElementEnumerator();
				while (regionNodes.next("PropertySet"))
				{
					MyGUI::xml::ElementEnumerator propertyNodes = regionNodes->getElementEnumerator();
					while (propertyNodes.next("Property"))
					{
						MyGUI::xml::Element* propertyNode = propertyNodes.current();

						std::string name;
						if (propertyNode->findAttribute("name", name))
						{
							if (name == "Visible")
							{
								if (propertyNode->getContent() != "True")
									regionVisible = false;
							}
							else if (name == "Enabled")
							{
								if (propertyNode->getContent() != "True")
									regionVisible = false;
							}
						}
					}
					break;
				}

				if (!regionVisible)
					continue;

				MyGUI::xml::Element* region = _to->createChild("BasisSkin");
				MyGUI::IntCoord regionCoord;

				MyGUI::UString regionTypeValue;
				MyGUI::UString regionOffsetValue;
				MyGUI::UString alignValue;

				regionNodes = node->getElementEnumerator();
				while (regionNodes.next("PropertySet"))
				{
					MyGUI::xml::ElementEnumerator regionPropertyNode = regionNodes->getElementEnumerator();
					while (regionPropertyNode.next("Property"))
					{
						std::string name;
						if (regionPropertyNode->findAttribute("name", name))
						{
							if (name == "RegionType")
							{
								regionTypeValue = regionPropertyNode->getContent();
							}
							else if (name == "Position")
							{
								regionCoord = MyGUI::IntCoord::parse(regionPropertyNode->getContent());
								regionOffsetValue = regionCoord.print();
							}
							else if (name == "Align")
							{
								alignValue = regionPropertyNode->getContent();
							}
						}
					}

					bool tileHor = true;
					bool tileVer = true;

					if (regionTypeValue == "TileRect Hor")
					{
						regionTypeValue = "TileRect";
						tileVer = false;
					}
					else if (regionTypeValue == "TileRect Ver")
					{
						regionTypeValue = "TileRect";
						tileHor = false;
					}

					region->addAttribute("type", regionTypeValue);
					region->addAttribute("offset", regionOffsetValue);
					region->addAttribute("align", alignValue);

					MyGUI::xml::ElementEnumerator stateNodes = _from->getElementEnumerator();
					while (stateNodes.next("StateItem"))
					{
						bool stateVisible = true;

						MyGUI::xml::ElementEnumerator propertySetNodes = stateNodes->getElementEnumerator();
						while (propertySetNodes.next("PropertySet"))
						{
							MyGUI::xml::ElementEnumerator statePropertyNode = propertySetNodes->getElementEnumerator();
							while (statePropertyNode.next("Property"))
							{
								std::string name;
								if (statePropertyNode->findAttribute("name", name))
								{
									if (name == "Visible")
									{
										if (statePropertyNode->getContent() != "True")
											stateVisible = false;
									}
								}
							}
							break;
						}

						if (!stateVisible)
							continue;

						MyGUI::xml::Element* state = region->createChild("State");

						MyGUI::UString stateOffsetValue;
						MyGUI::UString textColourValue;
						MyGUI::UString textShiftValue;

						propertySetNodes = stateNodes->getElementEnumerator();
						while (propertySetNodes.next("PropertySet"))
						{
							MyGUI::xml::ElementEnumerator propertyNodes = propertySetNodes->getElementEnumerator();
							while (propertyNodes.next("Property"))
							{
								MyGUI::xml::Element* propertyNode = propertyNodes.current();

								std::string name;
								if (propertyNode->findAttribute("name", name))
								{
									if (name == "Position")
									{
										MyGUI::IntCoord coord = regionCoord + MyGUI::IntPoint::parse(propertyNode->getContent());
										stateOffsetValue = coord.print();
									}
									else if (name == "TextColour")
									{
										textColourValue = propertyNode->getContent();
									}
									else if (name == "TextShift")
									{
										textShiftValue = propertyNode->getContent();
									}
								}
							}
							break;
						}

						MyGUI::UString stateNameValue = stateNodes->findAttribute("name");
						state->addAttribute("name", convertStateName(stateNameValue));

						if (regionTypeValue == "SimpleText" || regionTypeValue == "EditText")
						{
							state->addAttribute("colour", textColourValue);
							state->addAttribute("shift", textShiftValue);
						}
						else
						{
							state->addAttribute("offset", stateOffsetValue);

							if (stateNameValue == "Normal")
							{
								if (regionTypeValue == "TileRect")
								{
									MyGUI::xml::Element* prop = state->createChild("Property");
									prop->addAttribute("key", "TileSize");
									prop->addAttribute("value", regionCoord.size().print());
									prop = state->createChild("Property");
									prop->addAttribute("key", "TileH");
									prop->addAttribute("value", MyGUI::utility::toString(tileHor));
									prop = state->createChild("Property");
									prop->addAttribute("key", "TileV");
									prop->addAttribute("value", MyGUI::utility::toString(tileVer));
								}
							}
						}
					}
					break;
				}
			}
		}
	}