MyGUI
3.2.1
|
00001 /* 00002 * This source file is part of MyGUI. For the latest info, see http://mygui.info/ 00003 * Distributed under the MIT License 00004 * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT) 00005 */ 00006 00007 #include "MyGUI_Precompiled.h" 00008 #include "MyGUI_ResourceManualPointer.h" 00009 #include "MyGUI_ImageBox.h" 00010 #include "MyGUI_CoordConverter.h" 00011 #include "MyGUI_TextureUtility.h" 00012 00013 namespace MyGUI 00014 { 00015 00016 ResourceManualPointer::ResourceManualPointer() 00017 { 00018 } 00019 00020 ResourceManualPointer::~ResourceManualPointer() 00021 { 00022 } 00023 00024 void ResourceManualPointer::deserialization(xml::ElementPtr _node, Version _version) 00025 { 00026 Base::deserialization(_node, _version); 00027 00028 // берем детей и крутимся, основной цикл 00029 xml::ElementEnumerator info = _node->getElementEnumerator(); 00030 while (info.next("Property")) 00031 { 00032 const std::string& key = info->findAttribute("key"); 00033 const std::string& value = info->findAttribute("value"); 00034 00035 if (key == "Point") mPoint = IntPoint::parse(value); 00036 else if (key == "Size") mSize = IntSize::parse(value); 00037 else if (key == "Texture") mTexture = value; 00038 else if (key == "Coord") mTextureCoord = IntCoord::parse(value); 00039 } 00040 } 00041 00042 void ResourceManualPointer::setImage(ImageBox* _image) 00043 { 00044 _image->deleteAllItems(); 00045 _image->setImageInfo(mTexture, mTextureCoord, mTextureCoord.size()); 00046 } 00047 00048 void ResourceManualPointer::setPosition(ImageBox* _image, const IntPoint& _point) 00049 { 00050 _image->setCoord(_point.left - mPoint.left, _point.top - mPoint.top, mSize.width, mSize.height); 00051 } 00052 00053 } // namespace MyGUI