MyGUI
3.0.1
|
00001 00007 /* 00008 This file is part of MyGUI. 00009 00010 MyGUI is free software: you can redistribute it and/or modify 00011 it under the terms of the GNU Lesser General Public License as published by 00012 the Free Software Foundation, either version 3 of the License, or 00013 (at your option) any later version. 00014 00015 MyGUI is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 GNU Lesser General Public License for more details. 00019 00020 You should have received a copy of the GNU Lesser General Public License 00021 along with MyGUI. If not, see <http://www.gnu.org/licenses/>. 00022 */ 00023 #ifndef __MYGUI_RESOURCE_SKIN_H__ 00024 #define __MYGUI_RESOURCE_SKIN_H__ 00025 00026 #include "MyGUI_Prerequest.h" 00027 #include "MyGUI_SubWidgetBinding.h" 00028 #include "MyGUI_ChildSkinInfo.h" 00029 #include "MyGUI_MaskPickInfo.h" 00030 #include "MyGUI_IResource.h" 00031 #include "MyGUI_SubWidgetInfo.h" 00032 00033 namespace MyGUI 00034 { 00035 00036 // вспомогательный класс для инициализации одного скина 00037 class MYGUI_EXPORT ResourceSkin : 00038 public IResource 00039 { 00040 MYGUI_RTTI_DERIVED( ResourceSkin ) 00041 00042 public: 00043 ResourceSkin(); 00044 00045 virtual void deserialization(xml::ElementPtr _node, Version _version); 00046 00047 const IntSize& getSize() const { return mSize; } 00048 const std::string& getTextureName() const { return mTexture; } 00049 const VectorSubWidgetInfo& getBasisInfo() const { return mBasis; } 00050 const MapWidgetStateInfo& getStateInfo() const { return mStates; } 00051 const MapString& getProperties() const { return mProperties; } 00052 const VectorChildSkinInfo& getChild() const { return mChilds; } 00053 MaskPickInfo const * getMask() const { return &mMaskPeek; } 00054 const std::string& getSkinName() { return mSkinName; } 00055 00056 private: 00057 void setInfo(const IntSize& _size, const std::string &_texture); 00058 void addInfo(const SubWidgetBinding& _bind); 00059 void addProperty(const std::string &_key, const std::string &_value); 00060 void addChild(const ChildSkinInfo& _child); 00061 bool loadMask(const std::string& _file); 00062 void clear(); 00063 00064 void checkState(const MapStateInfo& _states); 00065 void checkState(const std::string& _name); 00066 void checkBasis(); 00067 void fillState(const MapStateInfo& _states, size_t _index); 00068 00069 private: 00070 IntSize mSize; 00071 std::string mTexture; 00072 VectorSubWidgetInfo mBasis; 00073 MapWidgetStateInfo mStates; 00074 // дополнительные параметры скина 00075 MapString mProperties; 00076 // дети скина 00077 VectorChildSkinInfo mChilds; 00078 // маска для этого скина для пикинга 00079 MaskPickInfo mMaskPeek; 00080 std::string mSkinName; 00081 00082 }; 00083 00084 } // namespace MyGUI 00085 00086 #endif // __MYGUI_RESOURCE_SKIN_H__