1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 22:18:12 +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:
AnotherTest 2020-11-07 23:14:21 +03:30 committed by Andreas Kling
parent c930e02624
commit 6d1e47e7dd
15 changed files with 98 additions and 59 deletions

View file

@ -44,13 +44,10 @@ public:
virtual ~DragOperation() override;
void set_text(const String& text) { m_text = text; }
void set_bitmap(const Gfx::Bitmap* bitmap) { m_bitmap = bitmap; }
void set_data(const String& data_type, const String& data)
{
m_data_type = data_type;
m_data = data;
}
void set_mime_data(RefPtr<Core::MimeData> mime_data) { m_mime_data = move(mime_data); }
void set_text(const String& text);
void set_bitmap(const Gfx::Bitmap* bitmap);
void set_data(const String& data_type, const String& data);
Outcome exec();
Outcome outcome() const { return m_outcome; }
@ -66,10 +63,7 @@ private:
OwnPtr<Core::EventLoop> m_event_loop;
Outcome m_outcome { Outcome::None };
String m_text;
String m_data_type;
String m_data;
RefPtr<Gfx::Bitmap> m_bitmap;
RefPtr<Core::MimeData> m_mime_data;
};
}