class EE::Window::Clipboard

Overview

#include <clipboard.hpp>

class Clipboard {
public:
    // typedefs

    typedef std::vector<Uint8> Data;
    typedef std::function<const void*(const char*mimeType, size_t*size)> DataCallback;
    typedef std::function<void()> CleanupCallback;

    // construction

    virtual ~Clipboard();

    // methods

    virtual std::string getText() = 0;
    virtual String getWideText() = 0;
    virtual void setText(const std::string& Text) = 0;
    EE::Window::Window* getWindow() const;
    virtual bool hasPrimarySelection() const;
    virtual std::string getPrimarySelectionText();
    virtual void setPrimarySelectionText(const std::string& text);
    virtual bool setData(DataCallback callback, CleanupCallback cleanup, const std::vector<std::string>& mimeTypes);
    virtual bool clearData();
    virtual Data getData(const std::string& mimeType);
    virtual std::vector<std::string> getMimeTypes();
    virtual bool hasData(const std::string& mimeType) const;
};

Detailed Documentation

Methods

virtual std::string getText() = 0

Returns:

The Clipboard Text if available

virtual String getWideText() = 0

Returns:

The Clipboard Text if available ( as String)

virtual void setText(const std::string& Text) = 0

Set the current clipboard text

EE::Window::Window* getWindow() const

Returns:

The parent window of the clipboard

virtual bool hasPrimarySelection() const

Returns:

True if primary selection is available

virtual std::string getPrimarySelectionText()

Returns:

The Clipboard Primary Selection Text if available

virtual void setPrimarySelectionText(const std::string& text)

Set the current clipboard primary selection text

virtual bool setData(DataCallback callback, CleanupCallback cleanup, const std::vector<std::string>& mimeTypes)

Offer non-text clipboard data in one or more MIME types. The data callback is invoked lazily when the operating system requests a format, and with a null MIME type when the offer is cleared or replaced. The returned data must remain valid until the cleanup callback is invoked. Only implemented by the SDL3 backend.

virtual bool clearData()

Clear all clipboard data. Only implemented by the SDL3 backend.

virtual Data getData(const std::string& mimeType)

Get clipboard data for a MIME type. Only implemented by the SDL3 backend.

virtual std::vector<std::string> getMimeTypes()

Returns:

The MIME types currently offered by the clipboard. SDL3 backend only.

virtual bool hasData(const std::string& mimeType) const

Returns:

Whether clipboard data is available for a MIME type. SDL3 backend only.