summaryrefslogtreecommitdiff
path: root/Servers/WindowServer/WSClipboard.h
blob: 2d22beb6f3959192d0b2f2e2168064736076903a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#pragma once

#include <AK/AKString.h>
#include <WindowServer/WSMessageReceiver.h>
#include <SharedBuffer.h>

class WSClipboard final : public WSMessageReceiver {
public:
    static WSClipboard& the();
    virtual ~WSClipboard() override;

    bool has_data() const
    {
        return m_shared_buffer;
    }

    const byte* data() const;
    int size() const;

    void clear();
    void set_data(Retained<SharedBuffer>&&, int contents_size);

private:
    WSClipboard();
    virtual void on_message(const WSMessage&) override;

    RetainPtr<SharedBuffer> m_shared_buffer;
    int m_contents_size { 0 };
};