mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:37:46 +00:00
WindowServer+LibGUI: Store a "data type" with the clipboard content
This will allow us to distinguish between different types of data stored on the clipboard.
This commit is contained in:
parent
9d2c4d223a
commit
c543ee5c5b
10 changed files with 94 additions and 15 deletions
|
@ -1,13 +1,29 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Badge.h>
|
||||
#include <AK/Function.h>
|
||||
#include <AK/String.h>
|
||||
|
||||
class GWindowServerConnection;
|
||||
|
||||
class GClipboard {
|
||||
public:
|
||||
static GClipboard& the();
|
||||
|
||||
String data() const;
|
||||
void set_data(const StringView&);
|
||||
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");
|
||||
|
||||
struct DataAndType {
|
||||
String data;
|
||||
String type;
|
||||
};
|
||||
|
||||
DataAndType data_and_type() const;
|
||||
|
||||
void did_receive_clipboard_contents_changed(Badge<GWindowServerConnection>, const String& data_type);
|
||||
|
||||
Function<void(const String& data_type)> on_content_change;
|
||||
|
||||
private:
|
||||
GClipboard();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue