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 13 namespace MyGUI 14 { 15 deserialization(xml::ElementPtr _node,Version _version)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 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 setImage(ImageBox * _image)34 void ResourceManualPointer::setImage(ImageBox* _image) 35 { 36 _image->deleteAllItems(); 37 _image->setImageInfo(mTexture, mTextureCoord, mTextureCoord.size()); 38 } 39 setPosition(ImageBox * _image,const IntPoint & _point)40 void ResourceManualPointer::setPosition(ImageBox* _image, const IntPoint& _point) 41 { 42 _image->setCoord(_point.left - mPoint.left, _point.top - mPoint.top, mSize.width, mSize.height); 43 } 44 45 } // namespace MyGUI 46