MyGUI  3.2.0
MyGUI_SubWidgetBinding.cpp
Go to the documentation of this file.
1 
6 /*
7  This file is part of MyGUI.
8 
9  MyGUI is free software: you can redistribute it and/or modify
10  it under the terms of the GNU Lesser General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  MyGUI is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public License
20  along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
21 */
22 #include "MyGUI_Precompiled.h"
23 #include "MyGUI_SubWidgetBinding.h"
24 
25 namespace MyGUI
26 {
27 
29  {
30  clear();
31  }
32 
33  SubWidgetBinding::SubWidgetBinding(const IntCoord& _coord, Align _aligin, const std::string& _type)
34  {
35  create(_coord, _aligin, _type);
36  }
37 
38  void SubWidgetBinding::create(const IntCoord& _coord, Align _aligin, const std::string& _type)
39  {
40  clear();
41  mOffset = _coord;
42  mAlign = _aligin;
43  mType = _type;
44  }
45 
47  {
48  mType = "";
49  mAlign = Align::Default;
50  mStates.clear();
51  }
52 
53  void SubWidgetBinding::add(const std::string& _name, IStateInfo* _data, const std::string& _skin)
54  {
55  // ищем такой же ключ
56  MapStateInfo::const_iterator iter = mStates.find(_name);
57  if (iter != mStates.end())
58  {
59  delete _data;
60  MYGUI_LOG(Warning, "state with name '" << _name << "' already exist in skin '" << _skin << "'");
61  return;
62  }
63  // добавляем
64  mStates[_name] = _data;
65  }
66 
67 } // namespace MyGUI
void add(const std::string &_name, IStateInfo *_data, const std::string &_skin)
#define MYGUI_LOG(level, text)
void create(const IntCoord &_coord, Align _aligin, const std::string &_type)