|
Ultralight C++ API 2.0.0
|
#include <Ultralight/platform/Clipboard.h>
User-defined clipboard interface.
The library uses this to read and write data to the system's clipboard, as whole multi-format payloads (see ClipboardData).
A platform-specific implementation of Clipboard that cuts, copies, and pastes to the OS clipboard is provided for you when you call App::Create().
If you are using Renderer::Create() instead of App::Create(), you will need to provide your own implementation of this.
The library currently reads and writes these well-known types: text/plain, text/html, and text/uri-list. Your implementation should map each type it supports to the matching OS clipboard format and simply skip types it doesn't recognize (a backend that only supports text is fine– write the text/plain entry and ignore the rest).
Public Member Functions | |
| virtual | ~Clipboard () |
| virtual void | Clear ()=0 |
| Clear the clipboard. | |
| virtual RefPtr< ClipboardData > | Read ()=0 |
| Read the clipboard's current contents. | |
| virtual void | Write (RefPtr< ClipboardData > data)=0 |
| Write a payload to the clipboard, replacing its previous contents. | |
|
virtual |
|
pure virtual |
|
pure virtual |
Read the clipboard's current contents.
This is called when the library wants to paste from the OS clipboard. You should return one entry per format you can read (at minimum the text/plain entry, if the clipboard holds text).
|
pure virtual |
Write a payload to the clipboard, replacing its previous contents.
This is called when the library wants to copy to the OS clipboard. All of the payload's entries should be written in one atomic clipboard transaction (on Windows: one OpenClipboard / EmptyClipboard / SetClipboardData per entry / CloseClipboard cycle), so a multi-format copy can never partially replace an earlier write.
| data | The payload to write (never null; may hold types you don't support, which you should skip). |