mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:37:35 +00:00
LibGUI+WindowServer: Make DragOperation hold a MimeData instance
...instead of maybe bitmap + a single mime type and its corresponding data. This allows drag&drop operations to hold multiple different kinds of data, and the views/applications to choose between those. For instance, Spreadsheet can keep the structure of the dragged cells, and still provide text-only data to be passed to different unrelated editors.
This commit is contained in:
parent
c930e02624
commit
6d1e47e7dd
15 changed files with 98 additions and 59 deletions
|
@ -29,6 +29,7 @@
|
|||
#include <AK/String.h>
|
||||
#include <Kernel/API/KeyCode.h>
|
||||
#include <LibCore/Event.h>
|
||||
#include <LibCore/MimeData.h>
|
||||
#include <LibGfx/Rect.h>
|
||||
#include <WindowServer/Cursor.h>
|
||||
#include <WindowServer/WindowType.h>
|
||||
|
@ -128,7 +129,7 @@ public:
|
|||
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; }
|
||||
void set_mime_data(const Core::MimeData& mime_data) { m_mime_data = mime_data; }
|
||||
|
||||
MouseEvent translated(const Gfx::IntPoint& delta) const { return MouseEvent((Type)type(), m_position.translated(delta), m_buttons, m_button, m_modifiers, m_wheel_delta); }
|
||||
|
||||
|
@ -140,6 +141,7 @@ private:
|
|||
int m_wheel_delta { 0 };
|
||||
bool m_drag { false };
|
||||
String m_drag_data_type;
|
||||
RefPtr<const Core::MimeData> m_mime_data;
|
||||
};
|
||||
|
||||
class ResizeEvent final : public Event {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue