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_Common.h"
00028 #include "MyGUI_ISubWidget.h"
00029
00030 namespace MyGUI
00031 {
00032
00033
00034 class MYGUI_EXPORT SubWidgetBinding
00035 {
00036
00037 friend class ResourceSkin;
00038
00039 public:
00040 SubWidgetBinding()
00041 {
00042 clear();
00043 }
00044
00045 SubWidgetBinding(const IntCoord& _coord, Align _aligin, const std::string& _type)
00046 {
00047 create(_coord, _aligin, _type);
00048 }
00049
00050 void create(const IntCoord& _coord, Align _aligin, const std::string& _type)
00051 {
00052 clear();
00053 mOffset = _coord;
00054 mAlign = _aligin;
00055 mType = _type;
00056 }
00057
00058 void clear()
00059 {
00060 mType = "";
00061 mAlign = Align::Default;
00062 mStates.clear();
00063 }
00064
00065 void add(const std::string& _name, IStateInfo* _data, const std::string& _skin)
00066 {
00067
00068 MapStateInfo::const_iterator iter = mStates.find(_name);
00069 if (iter != mStates.end())
00070 {
00071 delete _data;
00072 MYGUI_LOG(Warning, "state with name '" << _name << "' already exist in skin '" << _skin << "'");
00073 return;
00074 }
00075
00076 mStates[_name] = _data;
00077 }
00078
00079 private:
00080 IntCoord mOffset;
00081 Align mAlign;
00082 std::string mType;
00083 MapStateInfo mStates;
00084 };
00085
00086 }
00087
00088
00089 #endif // __MYGUI_SUB_WIDGET_BINDING_H__