MyGUI  3.4.1
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"
10 #include "MyGUI_ResourceManager.h"
11 
12 namespace MyGUI
13 {
14 
16  mImageSet(nullptr)
17  {
18  }
19 
21  {
22  Base::deserialization(_node, _version);
23 
24  // берем детей и крутимся, основной цикл
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")
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
Type * castType(bool _throw=true)
Definition: MyGUI_IObject.h:18
widget description should be here.
void setItemResourceInfo(const ImageIndexInfo &_info)
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
IResource * getByName(const std::string &_name, bool _throw=true) const
static ResourceManager & getInstance()
void setCoord(const IntCoord &_value) override
ElementEnumerator getElementEnumerator()
bool findAttribute(const std::string &_name, std::string &_value)
static TPoint< int > parse(const std::string &_value)
Definition: MyGUI_TPoint.h:120
static TSize< int > parse(const std::string &_value)
Definition: MyGUI_TSize.h:120