mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:28:11 +00:00
WindowServer+LibGUI: Add a "drag move" event
This allows windows/widgets to learn when something is being dragged over them. They can then repaint themselves somehow to indicate that they are willing to accept a drop. Currently this is piggybacking somewhat on the mouse event mechanism in WindowServer. I'm not sure that's the best design but it seemed easier to do it this way right now.
This commit is contained in:
parent
7590270e13
commit
3ce80bec97
9 changed files with 71 additions and 8 deletions
|
@ -26,8 +26,6 @@
|
|||
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/JsonObject.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/Palette.h>
|
||||
#include <LibGUI/Action.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/Button.h>
|
||||
|
@ -46,6 +44,8 @@
|
|||
#include <LibGUI/Widget.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibGUI/WindowServerConnection.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/Palette.h>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace GUI {
|
||||
|
@ -182,6 +182,8 @@ void Widget::event(Core::Event& event)
|
|||
return handle_mouseup_event(static_cast<MouseEvent&>(event));
|
||||
case Event::MouseWheel:
|
||||
return mousewheel_event(static_cast<MouseEvent&>(event));
|
||||
case Event::DragMove:
|
||||
return drag_move_event(static_cast<DragEvent&>(event));
|
||||
case Event::Drop:
|
||||
return drop_event(static_cast<DropEvent&>(event));
|
||||
case Event::Enter:
|
||||
|
@ -379,6 +381,12 @@ void Widget::change_event(Event&)
|
|||
{
|
||||
}
|
||||
|
||||
void Widget::drag_move_event(DragEvent& event)
|
||||
{
|
||||
dbg() << class_name() << "{" << this << "} DRAG MOVE position: " << event.position() << ", data_type: '" << event.data_type() << "'";
|
||||
event.ignore();
|
||||
}
|
||||
|
||||
void Widget::drop_event(DropEvent& event)
|
||||
{
|
||||
dbg() << class_name() << "{" << this << "} DROP position: " << event.position() << ", text: '" << event.text() << "'";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue