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

Method setWidgetCoord

Tools/LayoutEditor/WorkspaceControl.cpp:655–693  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

653 }
654
655 void WorkspaceControl::setWidgetCoord(MyGUI::Widget* _widget, const MyGUI::IntCoord& _coord) const
656 {
657 if (mFreeChildMode)
658 {
659 using PairWidgetCoord = std::pair<MyGUI::Widget*, MyGUI::IntCoord>;
660 using VectorPairWidgetCoord = std::vector<PairWidgetCoord>;
661 VectorPairWidgetCoord coords;
662
663 // запоминаем позиции детей
664 for (size_t index = 0; index < _widget->getChildCount(); ++index)
665 {
666 MyGUI::Widget* child = _widget->getChildAt(index);
667 if (!child->isRootWidget())
668 coords.emplace_back(child, child->getCoord());
669 }
670
671 // на сколько сдвинут виджет
672 MyGUI::IntCoord coordDiff = _coord - _widget->getCoord();
673 _widget->setCoord(_coord);
674
675 // восттанавливаем обсолютное положение детей
676 for (auto& item : coords)
677 {
678 WidgetContainer* widgetContainer = EditorWidgets::getInstance().find(item.first);
679 if (widgetContainer != nullptr)
680 {
681 MyGUI::IntCoord coord = item.second;
682 item.first
683 ->setCoord(coord.left - coordDiff.left, coord.top - coordDiff.top, coord.width, coord.height);
684 }
685 }
686 }
687 else
688 {
689 _widget->setCoord(_coord);
690 }
691
692 EditorWidgets::getInstance().onSetWidgetCoord(_widget, _coord, "WorkspaceControl");
693 }
694
695 void WorkspaceControl::setRttLayerSize(const MyGUI::IntSize& _size)
696 {

Callers

nothing calls this directly

Calls 6

getChildCountMethod · 0.80
getChildAtMethod · 0.80
isRootWidgetMethod · 0.80
onSetWidgetCoordMethod · 0.80
setCoordMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected