1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-18 21:35:06 +00:00
serenity/Servers/WindowServer/WSClipboard.h
Andreas Kling c543ee5c5b 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.
2019-09-14 09:19:05 +02:00

32 lines
634 B
C++

#pragma once
#include <AK/Function.h>
#include <AK/String.h>
#include <SharedBuffer.h>
class WSClipboard {
public:
static WSClipboard& the();
~WSClipboard();
bool has_data() const
{
return m_shared_buffer;
}
const String& data_type() const { return m_data_type; }
const u8* data() const;
int size() const;
void clear();
void set_data(NonnullRefPtr<SharedBuffer>&&, int contents_size, const String& data_type);
Function<void()> on_content_change;
private:
WSClipboard();
String m_data_type;
RefPtr<SharedBuffer> m_shared_buffer;
int m_contents_size { 0 };
};