diff --git a/client/gui/CIntObject.cpp b/client/gui/CIntObject.cpp index 3f136151e..cd768b033 100644 --- a/client/gui/CIntObject.cpp +++ b/client/gui/CIntObject.cpp @@ -258,6 +258,15 @@ void CIntObject::redraw() } } +void CIntObject::moveChildForeground(const CIntObject * childToMove) +{ + for(auto child = children.begin(); child != children.end(); child++) + if(*child == childToMove && child != children.end()) + { + std::rotate(child, child + 1, children.end()); + } +} + bool CIntObject::receiveEvent(const Point & position, int eventType) const { return pos.isInside(position); diff --git a/client/gui/CIntObject.h b/client/gui/CIntObject.h index a2afaea54..3a8760c4c 100644 --- a/client/gui/CIntObject.h +++ b/client/gui/CIntObject.h @@ -102,6 +102,8 @@ public: void showAll(Canvas & to) override; //request complete redraw of this object void redraw() override; + // Move child object to foreground + void moveChildForeground(const CIntObject * childToMove); /// returns true if this element is a popup window /// called only for windows diff --git a/client/widgets/CArtPlace.cpp b/client/widgets/CArtPlace.cpp index d4d57d785..bd0a39cc3 100644 --- a/client/widgets/CArtPlace.cpp +++ b/client/widgets/CArtPlace.cpp @@ -90,6 +90,7 @@ CArtPlace::CArtPlace(Point position, const CArtifactInstance * art) image = std::make_shared(AnimationPath::builtin("artifact"), imageIndex); image->disable(); + moveSelectionForeground(); } const CArtifactInstance * CArtPlace::getArt() const diff --git a/client/widgets/MiscWidgets.cpp b/client/widgets/MiscWidgets.cpp index fcaefaa86..403dba07d 100644 --- a/client/widgets/MiscWidgets.cpp +++ b/client/widgets/MiscWidgets.cpp @@ -714,3 +714,8 @@ void SelectableSlot::setSelectionWidth(int width) selection = std::make_shared( selection->pos - pos.topLeft(), Colors::TRANSPARENCY, Colors::YELLOW, width); selectSlot(selected); } + +void SelectableSlot::moveSelectionForeground() +{ + moveChildForeground(selection.get()); +} diff --git a/client/widgets/MiscWidgets.h b/client/widgets/MiscWidgets.h index 36a741755..926d54f32 100644 --- a/client/widgets/MiscWidgets.h +++ b/client/widgets/MiscWidgets.h @@ -261,4 +261,5 @@ public: void selectSlot(bool on); bool isSelected() const; void setSelectionWidth(int width); + void moveSelectionForeground(); };