MyGUI: MyGUI_ResourceManualPointer.cpp Source File

MyGUI 3.4.2

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files
- Examples

- File List
- Globals

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
13namespace MyGUI
14{
15
16 void ResourceManualPointer::deserialization(xml::ElementPtr _node, Version _version)
17 {
18 Base::deserialization(_node, _version);
19
20 // берем детей и крутимся, основной цикл
21 xml::ElementEnumerator info = _node->getElementEnumerator();
22 while (info.next("Property"))
23 {
24 const std::string& key = info->findAttribute("key");
25 const std::string& value = info->findAttribute("value");
26
27 if (key == "Point") mPoint = IntPoint::parse(value);
28 else if (key == "Size") mSize = IntSize::parse(value);
29 else if (key == "Texture") mTexture = value;
30 else if (key == "Coord") mTextureCoord = IntCoord::parse(value);
31 }
32 }
33
34 void ResourceManualPointer::setImage(ImageBox* _image)
35 {
36 _image->deleteAllItems();
37 _image->setImageInfo(mTexture, mTextureCoord, mTextureCoord.size());
38 }
39
40 void ResourceManualPointer::setPosition(ImageBox* _image, const IntPoint& _point)
41 {
42 _image->setCoord(_point.left - mPoint.left, _point.top - mPoint.top, mSize.width, mSize.height);
43 }
44
45} // namespace MyGUI
MyGUI_CoordConverter.h
MyGUI_ImageBox.h
MyGUI_Precompiled.h
MyGUI_ResourceManualPointer.h
MyGUI_TextureUtility.h
MyGUI::ImageBox
widget description should be here.
Definition MyGUI_ImageBox.h:24
MyGUI::ImageBox::setImageInfo
void setImageInfo(const std::string &_texture, const IntCoord &_coord, const IntSize &_tile)
Definition MyGUI_ImageBox.cpp:37
MyGUI::ImageBox::deleteAllItems
void deleteAllItems()
Delete all items.
Definition MyGUI_ImageBox.cpp:188
MyGUI::ResourceManualPointer::deserialization
void deserialization(xml::ElementPtr _node, Version _version) override
Definition MyGUI_ResourceManualPointer.cpp:16
MyGUI::ResourceManualPointer::setImage
void setImage(ImageBox *_image) override
Definition MyGUI_ResourceManualPointer.cpp:34
MyGUI::ResourceManualPointer::setPosition
void setPosition(ImageBox *_image, const IntPoint &_point) override
Definition MyGUI_ResourceManualPointer.cpp:40
MyGUI::Version
Definition MyGUI_Version.h:18
MyGUI::Widget::setCoord
void setCoord(const IntCoord &_value) override
Definition MyGUI_Widget.cpp:686
MyGUI::xml::ElementEnumerator
Definition MyGUI_XmlDocument.h:115
MyGUI::xml::ElementEnumerator::next
bool next()
Definition MyGUI_XmlDocument.cpp:100
MyGUI::xml::Element
Definition MyGUI_XmlDocument.h:159
MyGUI::xml::Element::getElementEnumerator
ElementEnumerator getElementEnumerator()
Definition MyGUI_XmlDocument.cpp:352
MyGUI::xml::Element::findAttribute
bool findAttribute(const std::string &_name, std::string &_value)
Definition MyGUI_XmlDocument.cpp:246
MyGUI
Definition MyGUI_ActionController.h:15
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::TPoint< int >
MyGUI::types::TPoint::left
T left
Definition MyGUI_TPoint.h:20
MyGUI::types::TPoint< int >::parse
static TPoint< int > parse(const std::string &_value)
Definition MyGUI_TPoint.h:120
MyGUI::types::TPoint::top
T top
Definition MyGUI_TPoint.h:21
MyGUI::types::TSize::width
T width
Definition MyGUI_TSize.h:20
MyGUI::types::TSize< int >::parse
static TSize< int > parse(const std::string &_value)
Definition MyGUI_TSize.h:120
MyGUI::types::TSize::height
T height
Definition MyGUI_TSize.h:21