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

Method _forcePick

MyGUIEngine/src/MyGUI_Widget.cpp:547–573  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

545 }
546
547 void Widget::_forcePick(Widget* _widget)
548 {
549 if (mWidgetClient != nullptr)
550 {
551 mWidgetClient->_forcePick(_widget);
552 return;
553 }
554
555 auto iter = std::find(mWidgetChild.begin(), mWidgetChild.end(), _widget);
556 if (iter == mWidgetChild.end())
557 return;
558
559 for (auto& widget : mWidgetChild)
560 {
561 if (widget == _widget)
562 widget->mDepth = -1;
563 else if (widget->getDepth() == -1)
564 widget->mDepth = 0;
565 }
566 // code below is an optimized way to setDepth for multiple widgets
567 // without calling slow Windget::_updateChilds multiple times
568 std::stable_sort(
569 mWidgetChild.begin(),
570 mWidgetChild.end(),
571 [](Widget* lhs, Widget* rhs) { return lhs->getDepth() > rhs->getDepth(); });
572 _updateChilds();
573 }
574
575 Widget* Widget::findWidget(std::string_view _name)
576 {

Callers 1

injectMousePressMethod · 0.80

Calls 3

beginMethod · 0.45
endMethod · 0.45
getDepthMethod · 0.45

Tested by

no test coverage detected