mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:38:10 +00:00
LibGUI: Add "drag enter" and "drag leave" events
These events allow widgets to react when a drag enters/leaves their rectangle. The enter event carries position + mime type, while the leave event has no information.
This commit is contained in:
parent
4728d0dd6a
commit
9acb72e804
7 changed files with 60 additions and 3 deletions
|
@ -446,12 +446,14 @@ void Window::handle_drag_move_event(DragEvent& event)
|
|||
auto result = m_main_widget->hit_test(event.position());
|
||||
auto local_event = make<DragEvent>(static_cast<Event::Type>(event.type()), result.local_position, event.data_type());
|
||||
ASSERT(result.widget);
|
||||
Application::the()->set_drag_hovered_widget({}, result.widget, result.local_position, event.data_type());
|
||||
return result.widget->dispatch_event(*local_event, this);
|
||||
}
|
||||
|
||||
void Window::handle_left_event()
|
||||
{
|
||||
set_hovered_widget(nullptr);
|
||||
Application::the()->set_drag_hovered_widget({}, nullptr);
|
||||
}
|
||||
|
||||
void Window::event(Core::Event& event)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue