MyGUI 3.5.3
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"
9#include "MyGUI_ImageBox.h"
12
13#include <pugixml.hpp>
14
15namespace MyGUI
16{
17
18 void ResourceManualPointer::deserialization(xml::ElementPtr _node, Version _version)
19 {
20 Base::deserialization(_node, _version);
21
22 for (auto info : _node.node().children("Property"))
23 {
24 std::string_view key = info.attribute("key").value();
25 std::string_view value = info.attribute("value").value();
26
27 if (key == "Point")
28 mPoint = IntPoint::parse(value);
29 else if (key == "Size")
30 mSize = IntSize::parse(value);
31 else if (key == "Texture")
32 mTexture = value;
33 else if (key == "Coord")
34 mTextureCoord = IntCoord::parse(value);
35 }
36 }
37
38 void ResourceManualPointer::setImage(ImageBox* _image)
39 {
40 _image->deleteAllItems();
41 _image->setImageInfo(mTexture, mTextureCoord, mTextureCoord.size());
42 }
43
44 void ResourceManualPointer::setPosition(ImageBox* _image, const IntPoint& _point)
45 {
46 _image->setCoord(_point.left - mPoint.left, _point.top - mPoint.top, mSize.width, mSize.height);
47 }
48
49} // namespace MyGUI
types::TPoint< int > IntPoint
Definition MyGUI_Types.h:26
static TCoord< int > parse(std::string_view _value)
static TPoint< int > parse(std::string_view _value)
static TSize< int > parse(std::string_view _value)