1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

moveChildForeground

This commit is contained in:
SoundSSGood 2024-08-03 17:04:27 +03:00
parent 257fb8c70c
commit 34b824f9ea
5 changed files with 18 additions and 0 deletions

View File

@ -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);

View File

@ -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

View File

@ -90,6 +90,7 @@ CArtPlace::CArtPlace(Point position, const CArtifactInstance * art)
image = std::make_shared<CAnimImage>(AnimationPath::builtin("artifact"), imageIndex);
image->disable();
moveSelectionForeground();
}
const CArtifactInstance * CArtPlace::getArt() const

View File

@ -714,3 +714,8 @@ void SelectableSlot::setSelectionWidth(int width)
selection = std::make_shared<TransparentFilledRectangle>( selection->pos - pos.topLeft(), Colors::TRANSPARENCY, Colors::YELLOW, width);
selectSlot(selected);
}
void SelectableSlot::moveSelectionForeground()
{
moveChildForeground(selection.get());
}

View File

@ -261,4 +261,5 @@ public:
void selectSlot(bool on);
bool isSelected() const;
void setSelectionWidth(int width);
void moveSelectionForeground();
};