Package limn.backend.lwjgl.transfer
Class PlatformClipboard
java.lang.Object
limn.backend.lwjgl.transfer.PlatformClipboard
- All Implemented Interfaces:
Clipboard
The clipboard an application sees, over one system's
NativeClipboard: a transfer going
out becomes type names and, when a program asks, bytes; what another program offers comes back
as formats and, when the application asks, values.
While this process owns the clipboard, what it reads is the transfer it set, as it is: no encoding, no round trip, and the in-process formats with it.
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Lets go of the system's clipboard; called once, as the backend closes.content()What the clipboard holds now.static OfferWhat another program offers, as an offer: the clipboard's content, or what a drag carries.Hears the clipboard's content change, whoever changed it, where the platform tells.What makes the bytes of one of a transfer's types, once, for a system that asks for them: as a copy's are made, on the UI thread for the value and where it is asked for the rest.voidReplaces what the clipboard holds.text()The clipboard's text, now.The types a transfer offers another program, best first: what a copy announces and what a drag carries.
-
Constructor Details
-
PlatformClipboard
- Parameters:
system- the windowing system's clipboardui- the runtime whose thread lazy values are made on and results arrive on
-
-
Method Details
-
text
Description copied from interface:ClipboardThe clipboard's text, now. A paste in a key handler and a menu that greys its Paste item both want the answer in the same breath, so this one read does not wait: where the text has to come from another program through a pipe, it gives up after a second. -
set
Description copied from interface:ClipboardReplaces what the clipboard holds. A lazy value of the transfer is asked for when a program, this one included, first reads that format.- Specified by:
setin interfaceClipboard- Parameters:
content- what to offer;Transfer.EMPTYempties the clipboard
-
types
The types a transfer offers another program, best first: what a copy announces and what a drag carries. A format that never leaves the process is not among them.- Parameters:
content- the transfer- Returns:
- the canonical type names
-
provider
What makes the bytes of one of a transfer's types, once, for a system that asks for them: as a copy's are made, on the UI thread for the value and where it is asked for the rest.- Parameters:
content- the transferui- the runtime whose thread a lazy value is made on- Returns:
- from a canonical type to its bytes, or null for what cannot be made
-
content
Description copied from interface:ClipboardWhat the clipboard holds now. The formats are answered from what the platform last reported, without a round trip, so a menu can ask on every opening; a read of something that has been replaced meanwhile fails withTransferGoneException.- Specified by:
contentin interfaceClipboard- Returns:
- the offer;
Offer.EMPTY's equal when the clipboard is empty
-
offer
public static Offer offer(List<String> offered, Function<String, CompletableFuture<byte[]>> read, UiRuntime ui) What another program offers, as an offer: the clipboard's content, or what a drag carries.- Parameters:
offered- the canonical types on offerread- asks for the bytes of one of themui- the runtime whose thread the values arrive on- Returns:
- the offer
-
onChange
Description copied from interface:ClipboardHears the clipboard's content change, whoever changed it, where the platform tells. -
close
public void close()Lets go of the system's clipboard; called once, as the backend closes.
-