MyGUI  3.4.1
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"
10 #include "MyGUI_CoordConverter.h"
11 #include "MyGUI_TextureUtility.h"
12 
13 namespace MyGUI
14 {
15 
17  {
18  Base::deserialization(_node, _version);
19 
20  // берем детей и крутимся, основной цикл
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 
35  {
36  _image->deleteAllItems();
37  _image->setImageInfo(mTexture, mTextureCoord, mTextureCoord.size());
38  }
39 
41  {
42  _image->setCoord(_point.left - mPoint.left, _point.top - mPoint.top, mSize.width, mSize.height);
43  }
44 
45 } // namespace MyGUI
widget description should be here.
void setImageInfo(const std::string &_texture, const IntCoord &_coord, const IntSize &_tile)
void deleteAllItems()
Delete all items.
void deserialization(xml::ElementPtr _node, Version _version) override
void setImage(ImageBox *_image) override
void setPosition(ImageBox *_image, const IntPoint &_point) override
void setCoord(const IntCoord &_value) override
ElementEnumerator getElementEnumerator()
bool findAttribute(const std::string &_name, std::string &_value)
TSize< T > size() const
Definition: MyGUI_TCoord.h:190
static TCoord< int > parse(const std::string &_value)
Definition: MyGUI_TCoord.h:207
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