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

Method unbind

Tools/LayoutEditor/EditorWidgets.cpp:323–369  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

321 }
322
323 bool EditorWidgets::unbind(WidgetContainer* _container)
324 {
325 bool result = false;
326
327 if (nullptr != _container)
328 {
329 std::vector<WidgetContainer*>::reverse_iterator iter;
330 while (!_container->childContainers.empty())
331 {
332 iter = _container->childContainers.rbegin();
333 if (unbind(*iter))
334 result = true;
335 }
336
337 if (nullptr == _container->getWidget()->getParent())
338 {
339 mWidgets.erase(std::find(mWidgets.begin(), mWidgets.end(), _container));
340 }
341 else
342 {
343 MyGUI::Widget* parent = _container->getWidget()->getParent();
344 WidgetContainer* containerParent = find(parent);
345 while (nullptr == containerParent)
346 {
347 parent = parent->getParent();
348 if (parent == nullptr)
349 {
350 // такого не должно быть, или утечка памяти,
351 // так как удалять нельзя им пользуется код вызывающий данную функцию
352 return result;
353 }
354 containerParent = find(parent);
355 }
356
357 containerParent->childContainers.erase(std::find(
358 containerParent->childContainers.begin(),
359 containerParent->childContainers.end(),
360 _container));
361 }
362
363 delete _container;
364 result = true;
365 }
366
367 mWidgetsChanged = true;
368 return result;
369 }
370
371 void EditorWidgets::clear()
372 {

Callers

nothing calls this directly

Calls 7

rbeginMethod · 0.80
getWidgetMethod · 0.80
emptyMethod · 0.45
getParentMethod · 0.45
eraseMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected