MyGUI 3.2.2

MyGUI_ResourceManualPointer.cpp
Go to the documentation of this file.
1 /*
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)
5 */
6
7 #include "MyGUI_Precompiled.h"
8 #include "MyGUI_ResourceManualPointer.h"
9 #include "MyGUI_ImageBox.h"
10 #include "MyGUI_CoordConverter.h"
11 #include "MyGUI_TextureUtility.h"
12
13 namespace MyGUI
14 {
15
16 ResourceManualPointer::ResourceManualPointer()
17 {
18 }
19
20 ResourceManualPointer::~ResourceManualPointer()
21 {
22 }
23
24 void ResourceManualPointer::deserialization(xml::ElementPtr _node, Version _version)
25 {
26 Base::deserialization(_node, _version);
27
28 // берем детей и крутимся, основной цикл
29 xml::ElementEnumerator info = _node->getElementEnumerator();
30 while (info.next("Property"))
31 {
32 const std::string& key = info->findAttribute("key");
33 const std::string& value = info->findAttribute("value");
34
35 if (key == "Point") mPoint = IntPoint::parse(value);
36 else if (key == "Size") mSize = IntSize::parse(value);
37 else if (key == "Texture") mTexture = value;
38 else if (key == "Coord") mTextureCoord = IntCoord::parse(value);
39 }
40 }
41
42 void ResourceManualPointer::setImage(ImageBox* _image)
43 {
44 _image->deleteAllItems();
45 _image->setImageInfo(mTexture, mTextureCoord, mTextureCoord.size());
46 }
47
48 void ResourceManualPointer::setPosition(ImageBox* _image, const IntPoint& _point)
49 {
50 _image->setCoord(_point.left - mPoint.left, _point.top - mPoint.top, mSize.width, mSize.height);
51 }
52
53 } // namespace MyGUI
MyGUI_TextureUtility.h
MyGUI::ImageBox
ImageBox properties. ImageBox_skin_childs Skin childs. ImageBox widget description should be here...
Definition: MyGUI_ImageBox.h:21
MyGUI::types::TPoint< int >
MyGUI_ResourceManualPointer.h
MyGUI_Precompiled.h
MyGUI::ResourceManualPointer::ResourceManualPointer
ResourceManualPointer()
Definition: MyGUI_ResourceManualPointer.cpp:16
MyGUI::ImageBox::deleteAllItems
void deleteAllItems()
Delete all items.
Definition: MyGUI_ImageBox.cpp:188
MyGUI::xml::Element::findAttribute
bool findAttribute(const std::string &_name, std::string &_value)
Definition: MyGUI_XmlDocument.cpp:246
MyGUI::ResourceManualPointer::~ResourceManualPointer
virtual ~ResourceManualPointer()
Definition: MyGUI_ResourceManualPointer.cpp:20
MyGUI::ResourceManualPointer::setPosition
virtual void setPosition(ImageBox *_image, const IntPoint &_point)
Definition: MyGUI_ResourceManualPointer.cpp:48
MyGUI::ResourceManualPointer::deserialization
virtual void deserialization(xml::ElementPtr _node, Version _version)
Definition: MyGUI_ResourceManualPointer.cpp:24
MyGUI::types::TSize< int >::parse
static TSize< int > parse(const std::string &_value)
Definition: MyGUI_TSize.h:120
MyGUI::types::TPoint::top
T top
Definition: MyGUI_TPoint.h:21
MyGUI::Widget::setCoord
virtual void setCoord(const IntCoord &_value)
Definition: MyGUI_Widget.cpp:689
MyGUI::xml::ElementEnumerator
Definition: MyGUI_XmlDocument.h:114
MyGUI
Definition: MyGUI_ActionController.h:14
MyGUI_CoordConverter.h
MyGUI::types::TPoint::left
T left
Definition: MyGUI_TPoint.h:20
MyGUI::xml::ElementEnumerator::next
bool next()
Definition: MyGUI_XmlDocument.cpp:100
MyGUI::types::TSize::width
T width
Definition: MyGUI_TSize.h:20
MyGUI::xml::Element
Definition: MyGUI_XmlDocument.h:158
MyGUI::Version
Definition: MyGUI_Version.h:17
MyGUI::types::TPoint< int >::parse
static TPoint< int > parse(const std::string &_value)
Definition: MyGUI_TPoint.h:120
MyGUI::xml::Element::getElementEnumerator
ElementEnumerator getElementEnumerator()
Definition: MyGUI_XmlDocument.cpp:352
MyGUI_ImageBox.h
MyGUI::types::TCoord::size
TSize< T > size() const
Definition: MyGUI_TCoord.h:190
MyGUI::types::TCoord< int >::parse
static TCoord< int > parse(const std::string &_value)
Definition: MyGUI_TCoord.h:207
MyGUI::types::TSize::height
T height
Definition: MyGUI_TSize.h:21
MyGUI::ResourceManualPointer::setImage
virtual void setImage(ImageBox *_image)
Definition: MyGUI_ResourceManualPointer.cpp:42
MyGUI::ImageBox::setImageInfo
void setImageInfo(const std::string &_texture, const IntCoord &_coord, const IntSize &_tile)
Definition: MyGUI_ImageBox.cpp:37