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

Method initialiseByAttributes

Common/BaseLayout/BaseLayout.h:161–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

159
160 template<typename Type>
161 void initialiseByAttributes(
162 Type* _owner,
163 MyGUI::Widget* _parent = nullptr,
164 bool _throw = true,
165 bool _createFakeWidgets = true)
166 {
167 initialise(attribute::AttributeLayout<Type>::getData(), _parent, _throw, _createFakeWidgets);
168
169 typename attribute::AttributeFieldWidgetName<Type>::VectorBindPair& data =
170 attribute::AttributeFieldWidgetName<Type>::getData();
171 for (typename attribute::AttributeFieldWidgetName<Type>::VectorBindPair::iterator item = data.begin();
172 item != data.end();
173 ++item)
174 {
175 MyGUI::Widget* value = nullptr;
176 assignWidget(value, item->second, _throw, false);
177
178 bool result = item->first->set(_owner, value);
179
180 if (!result && _createFakeWidgets)
181 {
182 value = _createFakeWidgetT(item->first->getFieldTypeName(), mMainWidget);
183 item->first->set(_owner, value);
184 }
185 }
186 }
187
188 private:
189 std::string FindParentPrefix(MyGUI::Widget* _parent)

Callers

nothing calls this directly

Calls 5

assignWidgetFunction · 0.85
getFieldTypeNameMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected