40 std::string name, texture, tmp;
57 setInfo(size, texture);
64 MYGUI_LOG(Error,
"Skin: mask not load '" << tmp <<
"'");
72 if (basis->
getName() ==
"Property")
75 std::string key, value;
86 addProperty(key, value);
88 else if (basis->
getName() ==
"Child")
101 while (child_params.next(
"Property"))
102 child.addParam(child_params->findAttribute(
"key"), child_params->findAttribute(
"value"));
107 else if (basis->
getName() ==
"BasisSkin")
110 std::string basisSkinType, tmp_str;
117 bind.
create(offset, align, basisSkinType);
123 bool new_format =
false;
129 if (state->
getName() ==
"State")
131 const std::string& name_state = state->
findAttribute(
"name");
132 if ((name_state ==
"normal_checked") || (state->
findAttribute(
"name") ==
"normal_check"))
145 if (state->
getName() ==
"State")
148 std::string basisStateName;
155 if (basisStateName ==
"disable_check") basisStateName =
"disabled_checked";
156 else if (basisStateName ==
"normal_check") basisStateName =
"normal_checked";
157 else if (basisStateName ==
"active_check") basisStateName =
"highlighted_checked";
158 else if (basisStateName ==
"pressed_check") basisStateName =
"pushed_checked";
159 else if (basisStateName ==
"disable") basisStateName =
"disabled";
160 else if (basisStateName ==
"active") basisStateName =
"highlighted";
161 else if (basisStateName ==
"select") basisStateName =
"pushed";
162 else if (basisStateName ==
"pressed")
164 if (new_format) basisStateName =
"pushed";
165 else basisStateName =
"normal_checked";
172 if (
object !=
nullptr)
179 bind.
add(basisStateName, data, name);
190 void ResourceSkin::setInfo(
const IntSize& _size,
const std::string &_texture)
196 void ResourceSkin::addInfo(
const SubWidgetBinding& _bind)
198 checkState(_bind.mStates);
199 mBasis.push_back(SubWidgetInfo(_bind.mType, _bind.mOffset, _bind.mAlign));
201 fillState(_bind.mStates, mBasis.size()-1);
204 void ResourceSkin::addProperty(
const std::string &_key,
const std::string &_value)
206 mProperties[_key] = _value;
209 void ResourceSkin::addChild(
const ChildSkinInfo& _child)
211 mChilds.push_back(_child);
214 bool ResourceSkin::loadMask(
const std::string& _file)
216 return mMaskPeek.
load(_file);
219 void ResourceSkin::clear()
221 for (MapWidgetStateInfo::iterator iter = mStates.begin(); iter!=mStates.end(); ++iter)
223 for (VectorStateInfo::iterator iter2=iter->second.begin(); iter2!=iter->second.end(); ++iter2)
230 void ResourceSkin::checkState(
const MapStateInfo& _states)
232 for (MapStateInfo::const_iterator iter = _states.begin(); iter != _states.end(); ++iter)
234 checkState(iter->first);
238 void ResourceSkin::checkState(
const std::string& _name)
241 MapWidgetStateInfo::const_iterator iter = mStates.find(_name);
242 if (iter == mStates.end())
249 void ResourceSkin::checkBasis()
252 for (MapWidgetStateInfo::iterator iter = mStates.begin(); iter!=mStates.end(); ++iter)
254 iter->second.resize(mBasis.size());
258 void ResourceSkin::fillState(
const MapStateInfo& _states,
size_t _index)
260 for (MapStateInfo::const_iterator iter = _states.begin(); iter != _states.end(); ++iter)
262 mStates[iter->first][_index] = iter->second;