MyGUI  3.0.3
MyGUI_ResourceSkin.h
Go to the documentation of this file.
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         virtual ~ResourceSkin();
00045 
00046         virtual void deserialization(xml::ElementPtr _node, Version _version);
00047 
00048         const IntSize& getSize() const { return mSize; }
00049         const std::string& getTextureName() const { return mTexture; }
00050         const VectorSubWidgetInfo& getBasisInfo() const { return mBasis; }
00051         const MapWidgetStateInfo& getStateInfo() const { return mStates; }
00052         const MapString& getProperties() const { return mProperties; }
00053         const VectorChildSkinInfo& getChild() const { return mChilds; }
00054         MaskPickInfo const * getMask() const { return &mMaskPeek; }
00055         const std::string& getSkinName() { return mSkinName; }
00056 
00057     private:
00058         void setInfo(const IntSize& _size, const std::string &_texture);
00059         void addInfo(const SubWidgetBinding& _bind);
00060         void addProperty(const std::string &_key, const std::string &_value);
00061         void addChild(const ChildSkinInfo& _child);
00062         bool loadMask(const std::string& _file);
00063         void clear();
00064 
00065         void checkState(const MapStateInfo& _states);
00066         void checkState(const std::string& _name);
00067         void checkBasis();
00068         void fillState(const MapStateInfo& _states, size_t _index);
00069 
00070     private:
00071         IntSize mSize;
00072         std::string mTexture;
00073         VectorSubWidgetInfo mBasis;
00074         MapWidgetStateInfo mStates;
00075         // дополнительные параметры скина
00076         MapString mProperties;
00077         // дети скина
00078         VectorChildSkinInfo mChilds;
00079         // маска для этого скина для пикинга
00080         MaskPickInfo mMaskPeek;
00081         std::string mSkinName;
00082 
00083     };
00084 
00085 } // namespace MyGUI
00086 
00087 #endif // __MYGUI_RESOURCE_SKIN_H__