00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __MYGUI_SUB_WIDGET_BINDING_H__
00024 #define __MYGUI_SUB_WIDGET_BINDING_H__
00025
00026 #include "MyGUI_Prerequest.h"
00027 #include "MyGUI_ISubWidget.h"
00028
00029 namespace MyGUI
00030 {
00031
00032
00033 class MYGUI_EXPORT SubWidgetBinding
00034 {
00035
00036 friend class ResourceSkin;
00037
00038 public:
00039 SubWidgetBinding()
00040 {
00041 clear();
00042 }
00043
00044 SubWidgetBinding(const IntCoord& _coord, Align _aligin, const std::string& _type)
00045 {
00046 create(_coord, _aligin, _type);
00047 }
00048
00049 void create(const IntCoord& _coord, Align _aligin, const std::string& _type)
00050 {
00051 clear();
00052 mOffset = _coord;
00053 mAlign = _aligin;
00054 mType = _type;
00055 }
00056
00057 void clear()
00058 {
00059 mType = "";
00060 mAlign = Align::Default;
00061 mStates.clear();
00062 }
00063
00064 void add(const std::string& _name, IStateInfo* _data, const std::string& _skin)
00065 {
00066
00067 MapStateInfo::const_iterator iter = mStates.find(_name);
00068 if (iter != mStates.end())
00069 {
00070 delete _data;
00071 MYGUI_LOG(Warning, "state with name '" << _name << "' already exist in skin '" << _skin << "'");
00072 return;
00073 }
00074
00075 mStates[_name] = _data;
00076 }
00077
00078 private:
00079 IntCoord mOffset;
00080 Align mAlign;
00081 std::string mType;
00082 MapStateInfo mStates;
00083 };
00084
00085 }
00086
00087
00088 #endif // __MYGUI_SUB_WIDGET_BINDING_H__