VisualBuilder: Emit on_widget_selected() when appropriate.

This allows the properties window to stay in sync with what's happening.
For multi-widget selections, we don't show any properties.
This commit is contained in:
Andreas Kling 2019-04-19 23:09:38 +02:00
parent b64408a564
commit 986f5806d7
2 changed files with 4 additions and 3 deletions

View file

@ -106,7 +106,7 @@ VBWidget* VBForm::widget_at(const Point& position)
return m_gwidget_map.get(gwidget);
}
void VBForm::grabber_mousedown_event(GMouseEvent& event, VBWidget& widget, Direction grabber)
void VBForm::grabber_mousedown_event(GMouseEvent& event, Direction grabber)
{
m_transform_event_origin = event.position();
for_each_selected_widget([] (auto& widget) { widget.capture_transform_origin_rect(); });
@ -198,7 +198,7 @@ void VBForm::mousedown_event(GMouseEvent& event)
auto grabber = widget.grabber_at(event.position());
if (grabber != Direction::None) {
hit_grabber = true;
return grabber_mousedown_event(event, widget, grabber);
return grabber_mousedown_event(event, grabber);
}
});
if (hit_grabber)
@ -218,6 +218,7 @@ void VBForm::mousedown_event(GMouseEvent& event)
else if (!m_selected_widgets.contains(widget))
set_single_selected_widget(widget);
for_each_selected_widget([] (auto& widget) { widget.capture_transform_origin_rect(); });
on_widget_selected(single_selected_widget());
}
}

View file

@ -35,7 +35,7 @@ protected:
virtual void keydown_event(GKeyEvent&) override;
private:
void grabber_mousedown_event(GMouseEvent&, VBWidget&, Direction grabber);
void grabber_mousedown_event(GMouseEvent&, Direction grabber);
void set_single_selected_widget(VBWidget*);
void add_to_selection(VBWidget&);
void remove_from_selection(VBWidget&);