mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-25 14:05:15 +00:00
You can now select widgets by clicking on them with the CursorTool, and toggle the selection state of a widget by Ctrl+clicking it.
31 lines
922 B
C++
31 lines
922 B
C++
#include "CursorTool.h"
|
|
#include "FormEditorWidget.h"
|
|
#include "FormWidget.h"
|
|
#include <AK/LogStream.h>
|
|
|
|
void CursorTool::on_mousedown(GMouseEvent& event)
|
|
{
|
|
dbg() << "CursorTool::on_mousedown";
|
|
auto& form_widget = m_editor.form_widget();
|
|
auto result = form_widget.hit_test(event.position(), GWidget::ShouldRespectGreediness::No);
|
|
if (result.widget && result.widget != &form_widget) {
|
|
if (event.modifiers() & Mod_Ctrl)
|
|
m_editor.selection().toggle(*result.widget);
|
|
else
|
|
m_editor.selection().set(*result.widget);
|
|
// FIXME: Do we need to update any part of the FormEditorWidget outside the FormWidget?
|
|
form_widget.update();
|
|
}
|
|
}
|
|
|
|
void CursorTool::on_mouseup(GMouseEvent& event)
|
|
{
|
|
(void)event;
|
|
dbg() << "CursorTool::on_mouseup";
|
|
}
|
|
|
|
void CursorTool::on_mousemove(GMouseEvent& event)
|
|
{
|
|
(void)event;
|
|
dbg() << "CursorTool::on_mousemove";
|
|
}
|