MyGUI  3.2.1
MyGUI_SubWidgetBinding.cpp
Go to the documentation of this file.
00001 /*
00002  * This source file is part of MyGUI. For the latest info, see http://mygui.info/
00003  * Distributed under the MIT License
00004  * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
00005  */
00006 
00007 #include "MyGUI_Precompiled.h"
00008 #include "MyGUI_SubWidgetBinding.h"
00009 
00010 namespace MyGUI
00011 {
00012 
00013     SubWidgetBinding::SubWidgetBinding()
00014     {
00015         clear();
00016     }
00017 
00018     SubWidgetBinding::SubWidgetBinding(const IntCoord& _coord, Align _aligin, const std::string& _type)
00019     {
00020         create(_coord, _aligin, _type);
00021     }
00022 
00023     void SubWidgetBinding::create(const IntCoord& _coord, Align _aligin, const std::string& _type)
00024     {
00025         clear();
00026         mOffset = _coord;
00027         mAlign = _aligin;
00028         mType = _type;
00029     }
00030 
00031     void SubWidgetBinding::clear()
00032     {
00033         mType = "";
00034         mAlign = Align::Default;
00035         mStates.clear();
00036     }
00037 
00038     void SubWidgetBinding::add(const std::string& _name, IStateInfo* _data, const std::string& _skin)
00039     {
00040         // ищем такой же ключ
00041         MapStateInfo::const_iterator iter = mStates.find(_name);
00042         if (iter != mStates.end())
00043         {
00044             delete _data;
00045             MYGUI_LOG(Warning, "state with name '" << _name << "' already exist in skin '" << _skin << "'");
00046             return;
00047         }
00048         // добавляем
00049         mStates[_name] = _data;
00050     }
00051 
00052 } // namespace MyGUI