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

Method initialise

Common/BaseLayout/BaseLayout.h:92–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90 }
91
92 void initialise(
93 std::string_view _layout,
94 MyGUI::Widget* _parent = nullptr,
95 bool _throw = true,
96 bool _createFakeWidgets = true)
97 {
98 mLayoutName = _layout;
99
100 // оборачиваем
101 if (mLayoutName.empty())
102 {
103 mMainWidget = _parent;
104 if (mMainWidget != nullptr)
105 {
106 mListWindowRoot.push_back(mMainWidget);
107 mPrefix = FindParentPrefix(mMainWidget);
108 }
109 }
110 // загружаем лейаут на виджет
111 else
112 {
113 mPrefix = MyGUI::utility::toString(this, "_");
114 mListWindowRoot = MyGUI::LayoutManager::getInstance().loadLayout(mLayoutName, mPrefix, _parent);
115
116 const std::string MAIN_WINDOW1 = "_Main";
117 const std::string MAIN_WINDOW2 = "Root";
118 const std::string mainName1 = mPrefix + MAIN_WINDOW1;
119 const std::string mainName2 = mPrefix + MAIN_WINDOW2;
120 for (const auto& iter : mListWindowRoot)
121 {
122 if (iter->getName() == mainName1 || iter->getName() == mainName2)
123 {
124 mMainWidget = iter;
125
126 snapToParent(mMainWidget);
127
128 break;
129 }
130 }
131
132 if (mMainWidget == nullptr)
133 {
134 MYGUI_LOG(
135 Warning,
136 "Root widget with name '"
137 << MAIN_WINDOW1 << "' or '" << MAIN_WINDOW2 << "' not found. [" << mLayoutName << "]");
138 MYGUI_ASSERT(!_throw, "No root widget. ['" << mLayoutName << "]");
139 if (_createFakeWidgets)
140 mMainWidget = _createFakeWidget<MyGUI::Widget>(_parent);
141 }
142
143 mMainWidget->setUserString("BaseLayoutPrefix", mPrefix);
144 }
145 }
146
147 void shutdown()
148 {

Callers 9

createGuiMethod · 0.45
createGuiPlatformMethod · 0.45
createGuiPlatformMethod · 0.45
createGuiPlatformMethod · 0.45
createGuiPlatformMethod · 0.45
createGuiPlatformMethod · 0.45
createRenderMethod · 0.45
createGuiPlatformMethod · 0.45
createGuiPlatformMethod · 0.45

Calls 5

toStringFunction · 0.85
loadLayoutMethod · 0.80
setUserStringMethod · 0.80
emptyMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected