MyGUI 3.4.2
MyGUI_ResourceImageSetPointer.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"
11
12namespace MyGUI
13{
14
16 mImageSet(nullptr)
17 {
18 }
19
21 {
23
24 // берем детей и крутимся, основной цикл
25 xml::ElementEnumerator info = _node->getElementEnumerator();
26 while (info.next("Property"))
27 {
28 const std::string& key = info->findAttribute("key");
29 const std::string& value = info->findAttribute("value");
30
31 if (key == "Point")
32 mPoint = IntPoint::parse(value);
33 else if (key == "Size")
34 mSize = IntSize::parse(value);
35 else if (key == "Resource")
36 mImageSet = ResourceManager::getInstance().getByName(value)->castType<ResourceImageSet>();
37 }
38 }
39
41 {
42 if (mImageSet != nullptr)
43 _image->setItemResourceInfo(mImageSet->getIndexInfo(0, 0));
44 }
45
47 {
48 _image->setCoord(_point.left - mPoint.left, _point.top - mPoint.top, mSize.width, mSize.height);
49 }
50
51} // namespace MyGUI
widget description should be here.
ImageIndexInfo getIndexInfo(const std::string &_group, const std::string &_index) const
void setPosition(ImageBox *_image, const IntPoint &_point) override
void deserialization(xml::ElementPtr _node, Version _version) override
void setImage(ImageBox *_image) override
static ResourceManager & getInstance()
static TPoint< int > parse(const std::string &_value)
static TSize< int > parse(const std::string &_value)