MyGUI
3.2.2
MyGUIEngine
src
MyGUI_Widget.cpp
Go to the documentation of this file.
1
/*
2
* This source file is part of MyGUI. For the latest info, see http://mygui.info/
3
* Distributed under the MIT License
4
* (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
5
*/
6
7
#include "
MyGUI_Precompiled.h
"
8
#include "
MyGUI_Widget.h
"
9
#include "
MyGUI_Gui.h
"
10
#include "
MyGUI_InputManager.h
"
11
#include "
MyGUI_SkinManager.h
"
12
#include "
MyGUI_SubWidgetManager.h
"
13
#include "
MyGUI_WidgetManager.h
"
14
#include "
MyGUI_ResourceSkin.h
"
15
#include "
MyGUI_WidgetDefines.h
"
16
#include "
MyGUI_LayerItem.h
"
17
#include "
MyGUI_LayerManager.h
"
18
#include "
MyGUI_RenderItem.h
"
19
#include "
MyGUI_ISubWidget.h
"
20
#include "
MyGUI_ISubWidgetText.h
"
21
#include "
MyGUI_TextBox.h
"
22
#include "
MyGUI_FactoryManager.h
"
23
#include "
MyGUI_CoordConverter.h
"
24
#include "
MyGUI_RenderManager.h
"
25
#include "
MyGUI_ToolTipManager.h
"
26
#include "
MyGUI_LayoutManager.h
"
27
28
namespace
MyGUI
29
{
30
31
Widget::Widget
() :
32
mWidgetClient(
nullptr
),
33
mEnabled(true),
34
mInheritsEnabled(true),
35
mInheritsVisible(true),
36
mAlpha(
ALPHA_MAX
),
37
mRealAlpha(
ALPHA_MAX
),
38
mInheritsAlpha(true),
39
mParent(
nullptr
),
40
mWidgetStyle(
WidgetStyle
::Child),
41
mContainer(
nullptr
),
42
mAlign(
Align
::Default),
43
mVisible(true),
44
mDepth(0)
45
{
46
}
47
48
Widget::~Widget
()
49
{
50
}
51
52
void
Widget::_initialise
(
WidgetStyle
_style,
const
IntCoord
& _coord,
const
std::string& _skinName,
Widget
* _parent,
ICroppedRectangle
* _croppedParent,
const
std::string& _name)
53
{
54
ResourceSkin
* skinInfo =
nullptr
;
55
ResourceLayout
* templateInfo =
nullptr
;
56
57
if
(
LayoutManager::getInstance
().isExist(_skinName))
58
templateInfo =
LayoutManager::getInstance
().
getByName
(_skinName);
59
else
60
skinInfo =
SkinManager::getInstance
().
getByName
(_skinName);
61
62
mCoord
= _coord;
63
64
mAlign =
Align::Default
;
65
mWidgetStyle = _style;
66
mName = _name;
67
68
mCroppedParent
= _croppedParent;
69
mParent = _parent;
70
71
72
#if MYGUI_DEBUG_MODE == 1
73
// проверяем соответсвие входных данных
74
if
(mWidgetStyle ==
WidgetStyle::Child
)
75
{
76
MYGUI_ASSERT
(
mCroppedParent
,
"must be cropped"
);
77
MYGUI_ASSERT
(mParent,
"must be parent"
);
78
}
79
else
if
(mWidgetStyle ==
WidgetStyle::Overlapped
)
80
{
81
MYGUI_ASSERT
((mParent ==
nullptr
) == (
mCroppedParent
==
nullptr
),
"error cropped"
);
82
}
83
else
if
(mWidgetStyle ==
WidgetStyle::Popup
)
84
{
85
MYGUI_ASSERT
(!
mCroppedParent
,
"cropped must be nullptr"
);
86
MYGUI_ASSERT
(mParent,
"must be parent"
);
87
}
88
#endif
89
90
// корректируем абсолютные координаты
91
mAbsolutePosition
= _coord.
point
();
92
93
if
(
nullptr
!=
mCroppedParent
)
94
mAbsolutePosition
+=
mCroppedParent
->
getAbsolutePosition
();
95
96
const
WidgetInfo
* root = initialiseWidgetSkinBase(skinInfo, templateInfo);
97
98
// дочернее окно обыкновенное
99
if
(mWidgetStyle ==
WidgetStyle::Child
)
100
{
101
if
(mParent)
102
mParent->
addChildItem
(
this
);
103
}
104
// дочернее нуно перекрывающееся
105
else
if
(mWidgetStyle ==
WidgetStyle::Overlapped
)
106
{
107
// дочернее перекрывающееся
108
if
(mParent)
109
mParent->
addChildNode
(
this
);
110
}
111
112
// витр метод для наследников
113
initialiseOverride
();
114
115
if
(skinInfo !=
nullptr
)
116
setSkinProperty(skinInfo);
117
118
if
(root !=
nullptr
)
119
{
120
for
(VectorStringPairs::const_iterator iter = root->
properties
.begin(); iter != root->
properties
.end(); ++iter)
121
{
122
setProperty
(iter->first, iter->second);
123
}
124
}
125
}
MyGUI_TextView.cpp:383
78
factory.
unregisterFactory
371
}
79
factory.
unregisterFactory
<
mClient
->
getWidth<)be( 502sace_my_g_u_i.html#af84521af8b9258c1616b505fa15cf1e9">ase.html#accf29da5e730508c48b4924343b6b2d2">mVScroll
->
getWidth
(),
mClient
->
22
mEmptyView(false),
nullptr clearNewLine(
if (owner !=
1 is closed by doxygen! -->
MyGUI::types::TRect::operator=
Tf869b777800b0d351112e69">setProperty(iter->first, iter->second);
>
const
bool isBottom() const
nullptr cleab0d351112e69">setProperty(iter->first, iter->second);<