MyGUI
3.0.1
Main Page
Related Pages
Namespaces
Data Structures
Files
Examples
File List
Globals
MyGUIEngine
include
MyGUI_SubWidgetBinding.h
Go to the documentation of this file.
1
7
/*
8
This file is part of MyGUI.
9
10
MyGUI is free software: you can redistribute it and/or modify
11
it under the terms of the GNU Lesser General Public License as published by
12
the Free Software Foundation, either version 3 of the License, or
13
(at your option) any later version.
14
15
MyGUI is distributed in the hope that it will be useful,
16
but WITHOUT ANY WARRANTY; without even the implied warranty of
17
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
GNU Lesser General Public License for more details.
19
20
You should have received a copy of the GNU Lesser General Public License
21
along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
22
*/
23
#ifndef __MYGUI_SUB_WIDGET_BINDING_H__
24
#define __MYGUI_SUB_WIDGET_BINDING_H__
25
26
#include "
MyGUI_Prerequest.h
"
27
#include "
MyGUI_ISubWidget.h
"
28
29
namespace
MyGUI
30
{
31
32
// вспомогательный класс для инициализации сабскинов
33
class
MYGUI_EXPORT
SubWidgetBinding
34
{
35
// для доступа к внутренним членам
36
friend
class
ResourceSkin
;
37
38
public
:
39
SubWidgetBinding
()
40
{
41
clear();
42
}
43
44
SubWidgetBinding
(
const
IntCoord
& _coord,
Align
_aligin,
const
std::string& _type)
45
{
46
create(_coord, _aligin, _type);
47
}
48
49
void
create(
const
IntCoord
& _coord,
Align
_aligin,
const
std::string& _type)
50
{
51
clear();
52
mOffset = _coord;
53
mAlign = _aligin;
54
mType = _type;
55
}
56
57
void
clear()
58
{
59
mType =
""
;
60
mAlign =
Align::Default
;
61
mStates.clear();
62
}
63
64
void
add(
const
std::string& _name,
IStateInfo
* _data,
const
std::string& _skin)
65
{
66
// ищем такой же ключ
67
MapStateInfo::const_iterator iter = mStates.find(_name);
68
if
(iter != mStates.end())
69
{
70
delete
_data;
71
MYGUI_LOG
(Warning,
"state with name '"
<< _name <<
"' already exist in skin '"
<< _skin <<
"'"
);
72
return
;
73
}
74
// добавляем
75
mStates[_name] = _data;
76
}
77
78
private
:
79
IntCoord
mOffset;
80
Align
mAlign;
81
std::string mType;
82
MapStateInfo
mStates;
83
};
84
85
}
// namespace MyGUI
86
87
88
#endif // __MYGUI_SUB_WIDGET_BINDING_H__
Generated by
1.8.1.2