mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 04:45:09 +00:00
LibGUI+WindowServer: Start fleshing out drag&drop functionality
This patch enables basic drag&drop between applications. You initiate a drag by creating a GDragOperation object and calling exec() on it. This creates a nested event loop in the calling program that only returns once the drag operation has ended. On the receiving side, you get a call to GWidget::drop_event() with a GDropEvent containing information about the dropped data. The only data passed right now is a piece of text that's also used to visually indicate that a drag is happening (by showing the text in a little box that follows the mouse cursor around.) There are things to fix here, but we're off to a nice start. :^)
This commit is contained in:
parent
e09a02ad3f
commit
a7f414bba7
19 changed files with 318 additions and 3 deletions
|
@ -156,6 +156,8 @@ void GWidget::event(CEvent& event)
|
|||
return handle_mouseup_event(static_cast<GMouseEvent&>(event));
|
||||
case GEvent::MouseWheel:
|
||||
return mousewheel_event(static_cast<GMouseEvent&>(event));
|
||||
case GEvent::Drop:
|
||||
return drop_event(static_cast<GDropEvent&>(event));
|
||||
case GEvent::Enter:
|
||||
return handle_enter_event(event);
|
||||
case GEvent::Leave:
|
||||
|
@ -350,6 +352,11 @@ void GWidget::change_event(GEvent&)
|
|||
{
|
||||
}
|
||||
|
||||
void GWidget::drop_event(GDropEvent& event)
|
||||
{
|
||||
dbg() << class_name() << "{" << this << "} DROP position: " << event.position() << ", text: '" << event.text() << "'";
|
||||
}
|
||||
|
||||
void GWidget::update()
|
||||
{
|
||||
if (rect().is_empty())
|
||||
|
@ -686,4 +693,3 @@ Vector<GWidget*> GWidget::child_widgets() const
|
|||
}
|
||||
return widgets;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue