MyGUI  3.4.0
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
MyGUI::types::TCoord< int >::parse
static TCoord< int > parse(const std::string &_value)
Definition: MyGUI_TCoord.h:207
MyGUI::types::TSize::height
T height
Definition: MyGUI_TSize.h:21
MyGUI::ImageBox
ImageBox properties. Skin childs. ImageBox widget description should be here.
Definition: MyGUI_ImageBox.h:24
MyGUI::types::TPoint::top
T top
Definition: MyGUI_TPoint.h:21
MyGUI::ImageBox::deleteAllItems
void deleteAllItems()
Delete all items.
Definition: MyGUI_ImageBox.cpp:188
MyGUI::types::TPoint< int >
MyGUI::types::TSize::width
T width
Definition: MyGUI_TSize.h:20
MyGUI_CoordConverter.h
MyGUI::xml::Element
Definition: MyGUI_XmlDocument.h:159
MyGUI::xml::Element::findAttribute
bool findAttribute(const std::string &_name, std::string &_value)
Definition: MyGUI_XmlDocument.cpp:246
MyGUI_Precompiled.h
MyGUI_ResourceManualPointer.h
MyGUI::Version
Definition: MyGUI_Version.h:18
MyGUI_ImageBox.h
MyGUI::types::TPoint< int >::parse
static TPoint< int > parse(const std::string &_value)
Definition: MyGUI_TPoint.h:120
MyGUI::types::TPoint::left
T left
Definition: MyGUI_TPoint.h:20
MyGUI::xml::ElementEnumerator
Definition: MyGUI_XmlDocument.h:115
MyGUI_TextureUtility.h
MyGUI::Widget::setCoord
void setCoord(const IntCoord &_value) override
Definition: MyGUI_Widget.cpp:684
MyGUI::ResourceManualPointer::setPosition
void setPosition(ImageBox *_image, const IntPoint &_point) override
Definition: MyGUI_ResourceManualPointer.cpp:40
MyGUI::types::TSize< int >::parse
static TSize< int > parse(const std::string &_value)
Definition: MyGUI_TSize.h:120
MyGUI::ImageBox::setImageInfo
void setImageInfo(const std::string &_texture, const IntCoord &_coord, const IntSize &_tile)
Definition: MyGUI_ImageBox.cpp:37
MyGUI::ResourceManualPointer::setImage
void setImage(ImageBox *_image) override
Definition: MyGUI_ResourceManualPointer.cpp:34
MyGUI::xml::Element::getElementEnumerator
ElementEnumerator getElementEnumerator()
Definition: MyGUI_XmlDocument.cpp:352
MyGUI::ResourceManualPointer::deserialization
void deserialization(xml::ElementPtr _node, Version _version) override
Definition: MyGUI_ResourceManualPointer.cpp:16
MyGUI
Definition: MyGUI_ActionController.h:15
MyGUI::xml::ElementEnumerator::next
bool next()
Definition: MyGUI_XmlDocument.cpp:100
MyGUI::types::TCoord::size
TSize< T > size() const
Definition: MyGUI_TCoord.h:190