MCPcopy Create free account
hub / github.com/MyGUI/mygui / _initialise

Method _initialise

MyGUIEngine/src/MyGUI_Widget.cpp:31–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29{
30
31 void Widget::_initialise(
32 WidgetStyle _style,
33 const IntCoord& _coord,
34 std::string_view _skinName,
35 Widget* _parent,
36 ICroppedRectangle* _croppedParent,
37 std::string_view _name)
38 {
39 ResourceSkin* skinInfo = nullptr;
40 ResourceLayout* templateInfo = nullptr;
41
42 if (LayoutManager::getInstance().isExist(_skinName))
43 templateInfo = LayoutManager::getInstance().getByName(_skinName);
44 else
45 skinInfo = SkinManager::getInstance().getByName(_skinName);
46
47 mCoord = _coord;
48
49 mAlign = Align::Default;
50 mWidgetStyle = _style;
51 mName = _name;
52
53 mCroppedParent = _croppedParent;
54 mParent = _parent;
55
56
57#if MYGUI_DEBUG_MODE == 1
58 // проверяем соответсвие входных данных
59 if (mWidgetStyle == WidgetStyle::Child)
60 {
61 MYGUI_ASSERT(mCroppedParent, "must be cropped");
62 MYGUI_ASSERT(mParent, "must be parent");
63 }
64 else if (mWidgetStyle == WidgetStyle::Overlapped)
65 {
66 MYGUI_ASSERT((mParent == nullptr) == (mCroppedParent == nullptr), "error cropped");
67 }
68 else if (mWidgetStyle == WidgetStyle::Popup)
69 {
70 MYGUI_ASSERT(!mCroppedParent, "cropped must be nullptr");
71 MYGUI_ASSERT(mParent, "must be parent");
72 }
73#endif
74
75 // корректируем абсолютные координаты
76 mAbsolutePosition = _coord.point();
77
78 if (nullptr != mCroppedParent)
79 mAbsolutePosition += mCroppedParent->getAbsolutePosition();
80
81 const WidgetInfo* root = initialiseWidgetSkinBase(skinInfo, templateInfo);
82
83 // дочернее окно обыкновенное
84 if (mWidgetStyle == WidgetStyle::Child)
85 {
86 if (mParent)
87 mParent->addChildItem(this);
88 }

Callers 1

createWidgetMethod · 0.45

Calls 6

setPropertyFunction · 0.85
addChildItemMethod · 0.80
addChildNodeMethod · 0.80
isExistMethod · 0.45
getByNameMethod · 0.45
pointMethod · 0.45

Tested by

no test coverage detected