| 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 | { |
nothing calls this directly
no test coverage detected