7
This file is part of MyGUI.
9
MyGUI is free software: you can redistribute it and/or modify
10
it under the terms of the GNU Lesser General Public License as published by
11
the Free Software Foundation, either version 3 of the License, or
12
(at your option) any later version.
14
MyGUI is distributed in the hope that it will be useful,
15
but WITHOUT ANY WARRANTY; without even the implied warranty of
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
GNU Lesser General Public License for more details.
19
You should have received a copy of the GNU Lesser General Public License
20
along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
22
#ifndef __MYGUI_COMMON_STATE_INFO_H__
23
#define __MYGUI_COMMON_STATE_INFO_H__
25
#include "MyGUI_Prerequest.h"
26
#include "MyGUI_IStateInfo.h"
27
#include "MyGUI_CoordConverter.h"
28
#include "MyGUI_LanguageManager.h"
29
#include "MyGUI_TextureUtility.h"
34
class MYGUI_EXPORT SubSkinStateInfo :
37
MYGUI_RTTI_DERIVED( SubSkinStateInfo )
40
virtual ~SubSkinStateInfo() { }
42
const FloatRect& getRect() const
48
virtual void deserialization(xml::ElementPtr _node, Version _version)
50
std::string texture = _node->getParent()->getParent()->findAttribute("texture");
52
// поддержка замены тегов в скинах
53
if (_version >= Version(1, 1))
55
texture = LanguageManager::getInstance().replaceTags(texture);
58
const IntSize& size = texture_utility::getTextureSize(texture);
59
const IntCoord& coord = IntCoord::parse(_node->findAttribute("offset"));
60
mRect = CoordConverter::convertTextureCoord(coord, size);
67
class MYGUI_EXPORT TileRectStateInfo :
70
MYGUI_RTTI_DERIVED( TileRectStateInfo )
79
virtual ~TileRectStateInfo() { }
81
const FloatRect& getRect() const
86
const IntSize& getTileSize() const
102
virtual void deserialization(xml::ElementPtr _node, Version _version)
104
std::string texture = _node->getParent()->getParent()->findAttribute("texture");
106
// поддержка замены тегов в скинах
107
if (_version >= Version(1, 1))
109
texture = LanguageManager::getInstance().replaceTags(texture);
112
const IntSize& size = texture_utility::getTextureSize(texture);
113
const IntCoord& coord = IntCoord::parse(_node->findAttribute("offset"));
114
mRect = CoordConverter::convertTextureCoord(coord, size);
116
xml::ElementEnumerator prop = _node->getElementEnumerator();
117
while (prop.next("Property"))
119
const std::string& key = prop->findAttribute("key");
120
const std::string& value = prop->findAttribute("value");
121
if (key == "TileH") mTileH = utility::parseBool(value);
122
else if (key == "TileV") mTileV = utility::parseBool(value);
123
else if (key == "TileSize") mTileSize = IntSize::parse(value);
134
class MYGUI_EXPORT EditTextStateInfo :
137
MYGUI_RTTI_DERIVED( EditTextStateInfo )
140
EditTextStateInfo() :
141
mColour(Colour::White),
146
virtual ~EditTextStateInfo() { }
148
const Colour& getColour() const
153
bool getShift() const
159
virtual void deserialization(xml::ElementPtr _node, Version _version)
161
mShift = utility::parseBool(_node->findAttribute("shift"));
163
std::string colour = _node->findAttribute("colour");
164
if (_version >= Version(1, 1))
166
colour = LanguageManager::getInstance().replaceTags(colour);
169
mColour = Colour::parse(colour);
179
#endif // __MYGUI_COMMON_STATE_INFO_H__
2
* This source file is part of MyGUI. For the latest info, see http://mygui.info/
3
* Distributed under the MIT License
4
* (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
7
#ifndef __MYGUI_COMMON_STATE_INFO_H__
8
#define __MYGUI_COMMON_STATE_INFO_H__
10
#include "MyGUI_Prerequest.h"
11
#include "MyGUI_IStateInfo.h"
12
#include "MyGUI_CoordConverter.h"
13
#include "MyGUI_LanguageManager.h"
14
#include "MyGUI_TextureUtility.h"
19
class MYGUI_EXPORT SubSkinStateInfo :
22
MYGUI_RTTI_DERIVED( SubSkinStateInfo )
25
virtual ~SubSkinStateInfo() { }
27
const FloatRect& getRect() const
33
virtual void deserialization(xml::ElementPtr _node, Version _version)
35
std::string texture = _node->getParent()->getParent()->findAttribute("texture");
37
// tags replacement support for Skins
38
if (_version >= Version(1, 1))
40
texture = LanguageManager::getInstance().replaceTags(texture);
43
const IntSize& size = texture_utility::getTextureSize(texture);
44
const IntCoord& coord = IntCoord::parse(_node->findAttribute("offset"));
45
mRect = CoordConverter::convertTextureCoord(coord, size);
52
class MYGUI_EXPORT TileRectStateInfo :
55
MYGUI_RTTI_DERIVED( TileRectStateInfo )
64
virtual ~TileRectStateInfo() { }
66
const FloatRect& getRect() const
71
const IntSize& getTileSize() const
87
virtual void deserialization(xml::ElementPtr _node, Version _version)
89
std::string texture = _node->getParent()->getParent()->findAttribute("texture");
91
// tags replacement support for Skins
92
if (_version >= Version(1, 1))
94
texture = LanguageManager::getInstance().replaceTags(texture);
97
const IntSize& size = texture_utility::getTextureSize(texture);
98
const IntCoord& coord = IntCoord::parse(_node->findAttribute("offset"));
99
mRect = CoordConverter::convertTextureCoord(coord, size);
101
xml::ElementEnumerator prop = _node->getElementEnumerator();
102
while (prop.next("Property"))
104
const std::string& key = prop->findAttribute("key");
105
const std::string& value = prop->findAttribute("value");
106
if (key == "TileH") mTileH = utility::parseBool(value);
107
else if (key == "TileV") mTileV = utility::parseBool(value);
108
else if (key == "TileSize") mTileSize = IntSize::parse(value);
119
class MYGUI_EXPORT RotatingSkinStateInfo :
122
MYGUI_RTTI_DERIVED( RotatingSkinStateInfo )
125
RotatingSkinStateInfo() :
131
virtual ~RotatingSkinStateInfo() { }
133
float getAngle() const
138
const IntPoint& getCenter() const
143
const FloatRect& getRect() const
149
virtual void deserialization(xml::ElementPtr _node, Version _version)
151
xml::ElementEnumerator prop = _node->getElementEnumerator();
152
while (prop.next("Property"))
154
const std::string& key = prop->findAttribute("key");
155
const std::string& value = prop->findAttribute("value");
156
if (key == "Angle") mAngle = utility::parseFloat(value);
157
if (key == "Center") mCenter = IntPoint::parse(value);
160
std::string texture = _node->getParent()->getParent()->findAttribute("texture");
162
// tags replacement support for Skins
163
if (_version >= Version(1, 1))
165
texture = LanguageManager::getInstance().replaceTags(texture);
168
const IntSize& size = texture_utility::getTextureSize(texture);
169
const IntCoord& coord = IntCoord::parse(_node->findAttribute("offset"));
170
mRect = CoordConverter::convertTextureCoord(coord, size);
176
float mAngle; // Angle in radians
180
class MYGUI_EXPORT EditTextStateInfo :
183
MYGUI_RTTI_DERIVED( EditTextStateInfo )
186
EditTextStateInfo() :
187
mColour(Colour::White),
192
virtual ~EditTextStateInfo() { }
194
const Colour& getColour() const
199
bool getShift() const
205
virtual void deserialization(xml::ElementPtr _node, Version _version)
207
mShift = utility::parseBool(_node->findAttribute("shift"));
209
std::string colour = _node->findAttribute("colour");
210
if (_version >= Version(1, 1))
212
colour = LanguageManager::getInstance().replaceTags(colour);
215
mColour = Colour::parse(colour);
225
#endif // __MYGUI_COMMON_STATE_INFO_H__