mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 21:07:36 +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
|
@ -117,6 +117,11 @@ public:
|
|||
unsigned buttons() const { return m_buttons; }
|
||||
unsigned modifiers() const { return m_modifiers; }
|
||||
int wheel_delta() const { return m_wheel_delta; }
|
||||
bool is_drag() const { return m_drag; }
|
||||
const String& drag_data_type() const { return m_drag_data_type; }
|
||||
|
||||
void set_drag(bool b) { m_drag = b; }
|
||||
void set_drag_data_type(const String& drag_data_type) { m_drag_data_type = drag_data_type; }
|
||||
|
||||
MouseEvent translated(const Gfx::Point& delta) const { return MouseEvent((Type)type(), m_position.translated(delta), m_buttons, m_button, m_modifiers, m_wheel_delta); }
|
||||
|
||||
|
@ -126,6 +131,8 @@ private:
|
|||
MouseButton m_button { MouseButton::None };
|
||||
unsigned m_modifiers { 0 };
|
||||
int m_wheel_delta { 0 };
|
||||
bool m_drag { false };
|
||||
String m_drag_data_type;
|
||||
};
|
||||
|
||||
class ResizeEvent final : public Event {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue