MyGUI  3.0.1
MyGUI_ResourceSkin.h
Go to the documentation of this file.
1 
7 /*
8  This file is part of MyGUI.
9 
10  MyGUI is free software: you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  MyGUI is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
22 */
23 #ifndef __MYGUI_RESOURCE_SKIN_H__
24 #define __MYGUI_RESOURCE_SKIN_H__
25 
26 #include "MyGUI_Prerequest.h"
27 #include "MyGUI_SubWidgetBinding.h"
28 #include "MyGUI_ChildSkinInfo.h"
29 #include "MyGUI_MaskPickInfo.h"
30 #include "MyGUI_IResource.h"
31 #include "MyGUI_SubWidgetInfo.h"
32 
33 namespace MyGUI
34 {
35 
36  // вспомогательный класс для инициализации одного скина
38  public IResource
39  {
41 
42  public:
43  ResourceSkin();
44 
45  virtual void deserialization(xml::ElementPtr _node, Version _version);
46 
47  const IntSize& getSize() const { return mSize; }
48  const std::string& getTextureName() const { return mTexture; }
49  const VectorSubWidgetInfo& getBasisInfo() const { return mBasis; }
50  const MapWidgetStateInfo& getStateInfo() const { return mStates; }
51  const MapString& getProperties() const { return mProperties; }
52  const VectorChildSkinInfo& getChild() const { return mChilds; }
53  MaskPickInfo const * getMask() const { return &mMaskPeek; }
54  const std::string& getSkinName() { return mSkinName; }
55 
56  private:
57  void setInfo(const IntSize& _size, const std::string &_texture);
58  void addInfo(const SubWidgetBinding& _bind);
59  void addProperty(const std::string &_key, const std::string &_value);
60  void addChild(const ChildSkinInfo& _child);
61  bool loadMask(const std::string& _file);
62  void clear();
63 
64  void checkState(const MapStateInfo& _states);
65  void checkState(const std::string& _name);
66  void checkBasis();
67  void fillState(const MapStateInfo& _states, size_t _index);
68 
69  private:
70  IntSize mSize;
71  std::string mTexture;
72  VectorSubWidgetInfo mBasis;
73  MapWidgetStateInfo mStates;
74  // дополнительные параметры скина
75  MapString mProperties;
76  // дети скина
77  VectorChildSkinInfo mChilds;
78  // маска для этого скина для пикинга
79  MaskPickInfo mMaskPeek;
80  std::string mSkinName;
81 
82  };
83 
84 } // namespace MyGUI
85 
86 #endif // __MYGUI_RESOURCE_SKIN_H__