MyGUI: MyGUI_ResourceManualPointer.cpp Source File

MyGUI 3.4.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"
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 std::string_view key = info->findAttribute("key");
25 std::string_view value = info->findAttribute("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
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:22
MyGUI::ImageBox::setImageInfo
void setImageInfo(std::string_view _texture, const IntCoord &_coord, const IntSize &_tile)
Definition MyGUI_ImageBox.cpp:28
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:38
MyGUI::ResourceManualPointer::setPosition
void setPosition(ImageBox *_image, const IntPoint &_point) override
Definition MyGUI_ResourceManualPointer.cpp:44
MyGUI::Version
Definition MyGUI_Version.h:18
MyGUI::Widget::setCoord
void setCoord(const IntCoord &_coord) override
Definition MyGUI_Widget.cpp:730
MyGUI::xml::ElementEnumerator
Definition MyGUI_XmlDocument.h:121
MyGUI::xml::ElementEnumerator::next
bool next()
Definition MyGUI_XmlDocument.cpp:107
MyGUI::xml::Element::findAttribute
bool findAttribute(std::string_view _name, std::string &_value)
Definition MyGUI_XmlDocument.cpp:242
MyGUI::xml::Element::getElementEnumerator
ElementEnumerator getElementEnumerator()
Definition MyGUI_XmlDocument.cpp:348
MyGUI::xml::ElementPtr
Element * ElementPtr
Definition MyGUI_XmlDocument.h:112
MyGUI
Definition MyGUI_ActionController.h:15
MyGUI::IntPoint
types::TPoint< int > IntPoint
Definition MyGUI_Types.h:27
MyGUI::types::TCoord< int >::parse
static TCoord< int > parse(std::string_view _value)
Definition MyGUI_TCoord.h:183
MyGUI::types::TPoint< int >::parse
static TPoint< int > parse(std::string_view _value)
Definition MyGUI_TPoint.h:102
MyGUI::types::TPoint::left
T left
Definition MyGUI_TPoint.h:19
MyGUI::types::TPoint::top
T top
Definition MyGUI_TPoint.h:20
MyGUI::types::TSize< int >::parse
static TSize< int > parse(std::string_view _value)
Definition MyGUI_TSize.h:102