mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:47:35 +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
|
@ -60,6 +60,7 @@ public:
|
|||
WindowCloseRequest,
|
||||
ContextMenu,
|
||||
EnabledChange,
|
||||
DragMove,
|
||||
Drop,
|
||||
|
||||
__Begin_WM_Events,
|
||||
|
@ -306,6 +307,23 @@ private:
|
|||
int m_wheel_delta { 0 };
|
||||
};
|
||||
|
||||
class DragEvent final : public Event {
|
||||
public:
|
||||
DragEvent(Type type, const Gfx::Point& position, const String& data_type)
|
||||
: Event(type)
|
||||
, m_position(position)
|
||||
, m_data_type(data_type)
|
||||
{
|
||||
}
|
||||
|
||||
const Gfx::Point& position() const { return m_position; }
|
||||
const String& data_type() const { return m_data_type; }
|
||||
|
||||
private:
|
||||
Gfx::Point m_position;
|
||||
String m_data_type;
|
||||
};
|
||||
|
||||
class DropEvent final : public Event {
|
||||
public:
|
||||
DropEvent(const Gfx::Point& position, const String& text, const String& data_type, const String& data)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue