36 for (MapWidgetStateInfo::iterator item = mStates.begin(); item != mStates.end(); ++ item)
38 for (VectorStateInfo::iterator info = (*item).second.begin(); info != (*item).second.end(); ++ info)
46 Base::deserialization(_node, _version);
49 std::string name, texture, tmp;
66 setInfo(size, texture);
70 addProperty(
"MaskPick", tmp);
76 if (basis->
getName() ==
"Property")
79 std::string key, value;
90 addProperty(key, value);
92 else if (basis->
getName() ==
"Child")
105 while (child_params.next(
"Property"))
106 child.addParam(child_params->findAttribute(
"key"), child_params->findAttribute(
"value"));
111 else if (basis->
getName() ==
"BasisSkin")
114 std::string basisSkinType, tmp_str;
121 bind.
create(offset, align, basisSkinType);
127 bool new_format =
false;
133 if (state->
getName() ==
"State")
135 const std::string& name_state = state->
findAttribute(
"name");
136 if ((name_state ==
"normal_checked") || (state->
findAttribute(
"name") ==
"normal_check"))
149 if (state->
getName() ==
"State")
152 std::string basisStateName;
159 if (basisStateName ==
"disable_check") basisStateName =
"disabled_checked";
160 else if (basisStateName ==
"normal_check") basisStateName =
"normal_checked";
161 else if (basisStateName ==
"active_check") basisStateName =
"highlighted_checked";
162 else if (basisStateName ==
"pressed_check") basisStateName =
"pushed_checked";
163 else if (basisStateName ==
"disable") basisStateName =
"disabled";
164 else if (basisStateName ==
"active") basisStateName =
"highlighted";
165 else if (basisStateName ==
"select") basisStateName =
"pushed";
166 else if (basisStateName ==
"pressed")
168 if (new_format) basisStateName =
"pushed";
169 else basisStateName =
"normal_checked";
176 if (
object !=
nullptr)
183 bind.
add(basisStateName, data, name);
194 void ResourceSkin::setInfo(
const IntSize& _size,
const std::string& _texture)
200 void ResourceSkin::addInfo(
const SubWidgetBinding& _bind)
202 checkState(_bind.mStates);
203 mBasis.push_back(SubWidgetInfo(_bind.mType, _bind.mOffset, _bind.mAlign));
205 fillState(_bind.mStates, mBasis.size() - 1);
208 void ResourceSkin::addProperty(
const std::string& _key,
const std::string& _value)
210 mProperties[_key] = _value;
213 void ResourceSkin::addChild(
const ChildSkinInfo& _child)
215 mChilds.push_back(_child);
218 void ResourceSkin::clear()
220 for (MapWidgetStateInfo::iterator iter = mStates.begin(); iter != mStates.end(); ++iter)
222 for (VectorStateInfo::iterator iter2 = iter->second.begin(); iter2 != iter->second.end(); ++iter2)
229 void ResourceSkin::checkState(
const MapStateInfo& _states)
231 for (MapStateInfo::const_iterator iter = _states.begin(); iter != _states.end(); ++iter)
233 checkState(iter->first);
237 void ResourceSkin::checkState(
const std::string& _name)
240 MapWidgetStateInfo::const_iterator iter = mStates.find(_name);
241 if (iter == mStates.end())
248 void ResourceSkin::checkBasis()
251 for (MapWidgetStateInfo::iterator iter = mStates.begin(); iter != mStates.end(); ++iter)
253 iter->second.resize(mBasis.size());
257 void ResourceSkin::fillState(
const MapStateInfo& _states,
size_t _index)
259 for (MapStateInfo::const_iterator iter = _states.begin(); iter != _states.end(); ++iter)
261 mStates[iter->first][_index] = iter->second;
std::map< std::string, VectorStateInfo > MapWidgetStateInfo
const MapString & getProperties() const
virtual void deserialization(xml::ElementPtr _node, Version _version)
const std::string & getTextureName() const
static LanguageManager & getInstance()
bool findAttribute(const std::string &_name, std::string &_value)
static Align parse(const std::string &_value)
const VectorChildSkinInfo & getChild() const
const IntSize & getSize() const
static TSize< int > parse(const std::string &_value)
virtual void deserialization(xml::ElementPtr _node, Version _version)
const VectorSubWidgetInfo & getBasisInfo() const
std::map< std::string, IStateInfo * > MapStateInfo
std::vector< IStateInfo * > VectorStateInfo
const MapWidgetStateInfo & getStateInfo() const
std::map< std::string, std::string > MapString
std::vector< SubWidgetInfo > VectorSubWidgetInfo
Type * castType(bool _throw=true)
ElementEnumerator getElementEnumerator()
const std::string & getSkinName() const
const std::string & getName() const
UString replaceTags(const UString &_line)
std::vector< ChildSkinInfo > VectorChildSkinInfo
static TCoord< int > parse(const std::string &_value)
IObject * createObject(const std::string &_category, const std::string &_type)