mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:07:35 +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
|
@ -34,7 +34,7 @@
|
|||
#include <LibGUI/Forward.h>
|
||||
#include <LibGUI/Shortcut.h>
|
||||
#include <LibGUI/Widget.h>
|
||||
#include <LibGfx/Forward.h>
|
||||
#include <LibGfx/Point.h>
|
||||
|
||||
namespace GUI {
|
||||
|
||||
|
@ -83,12 +83,23 @@ public:
|
|||
void window_did_become_active(Badge<Window>, Window&);
|
||||
void window_did_become_inactive(Badge<Window>, Window&);
|
||||
|
||||
Widget* drag_hovered_widget() { return m_drag_hovered_widget.ptr(); }
|
||||
const Widget* drag_hovered_widget() const { return m_drag_hovered_widget.ptr(); }
|
||||
|
||||
void set_drag_hovered_widget(Badge<Window>, Widget* widget, const Gfx::IntPoint& position = {}, const String& mime_type = {})
|
||||
{
|
||||
set_drag_hovered_widget_impl(widget, position, mime_type);
|
||||
}
|
||||
void notify_drag_cancelled(Badge<WindowServerConnection>);
|
||||
|
||||
private:
|
||||
Application(int argc, char** argv);
|
||||
|
||||
void tooltip_show_timer_did_fire();
|
||||
void tooltip_hide_timer_did_fire();
|
||||
|
||||
void set_drag_hovered_widget_impl(Widget*, const Gfx::IntPoint& = {}, const String& = {});
|
||||
|
||||
OwnPtr<Core::EventLoop> m_event_loop;
|
||||
RefPtr<MenuBar> m_menubar;
|
||||
RefPtr<Gfx::PaletteImpl> m_palette;
|
||||
|
@ -104,6 +115,7 @@ private:
|
|||
bool m_focus_debugging_enabled { false };
|
||||
String m_invoked_as;
|
||||
Vector<String> m_args;
|
||||
WeakPtr<Widget> m_drag_hovered_widget;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue