mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:37:35 +00:00
LibGUI: Make the Clipboard API deal in raw byte buffers a bit more
To open up for putting not just text/plain content on the clipboard, let's make the GUI::Clipboard API a bit more raw-data-friendly. :^)
This commit is contained in:
parent
802f541184
commit
51146e3075
12 changed files with 43 additions and 38 deletions
|
@ -36,18 +36,23 @@ class Clipboard {
|
|||
public:
|
||||
static Clipboard& the();
|
||||
|
||||
String data() const { return data_and_type().data; }
|
||||
String type() const { return data_and_type().type; }
|
||||
void set_data(const StringView&, const String& data_type = "text/plain");
|
||||
ByteBuffer data() const { return data_and_type().data; }
|
||||
String mime_type() const { return data_and_type().mime_type; }
|
||||
void set_data(ReadonlyBytes, const String& mime_type = "text/plain");
|
||||
|
||||
void set_plain_text(const String& text)
|
||||
{
|
||||
set_data(text.bytes());
|
||||
}
|
||||
|
||||
struct DataAndType {
|
||||
String data;
|
||||
String type;
|
||||
ByteBuffer data;
|
||||
String mime_type;
|
||||
};
|
||||
|
||||
DataAndType data_and_type() const;
|
||||
|
||||
Function<void(const String& data_type)> on_change;
|
||||
Function<void(const String& mime_type)> on_change;
|
||||
|
||||
static void initialize(Badge<Application>);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue