1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:58:11 +00:00

HackStudio: Start implementing basic widget selection in CursorTool

You can now select widgets by clicking on them with the CursorTool,
and toggle the selection state of a widget by Ctrl+clicking it.
This commit is contained in:
Andreas Kling 2019-11-10 22:03:39 +01:00
parent e87756424d
commit f6576c4b7c
4 changed files with 78 additions and 2 deletions

View file

@ -39,6 +39,21 @@ void FormWidget::paint_event(GPaintEvent& event)
}
}
void FormWidget::second_paint_event(GPaintEvent& event)
{
if (editor().selection().is_empty())
return;
GPainter painter(*this);
painter.add_clip_rect(event.rect());
for_each_child_widget([&](auto& child) {
if (editor().selection().contains(child)) {
painter.draw_rect(child.relative_rect(), Color::Blue);
}
return IterationDecision::Continue;
});
}
void FormWidget::mousedown_event(GMouseEvent& event)
{
editor().tool().on_mousedown(event);