Class Clipboard
Definition
- Assembly:
- Tizen.NUI.dll
Clipboard.
public class Clipboard : BaseHandle, IDynamicResourceHandler, INameScope, System.IDisposable
- Inheritance
- Implements
-
System.IDisposable
Properties
View SourceInstance
Gets the singleton instance of Clipboard.
Declaration
public static Clipboard Instance { get; }
Property Value
Type | Description |
---|---|
Clipboard |
Methods
View SourceDispose(DisposeTypes)
Dispose.
Declaration
protected override void Dispose(DisposeTypes type)
Parameters
Type | Name | Description |
---|---|---|
DisposeTypes | type |
Overrides
View SourceGetData(string, ClipboardCallback)
Request get data of the specified mime type from clipboard
and invokes the given callback with the received clipboard data.
Declaration
public void GetData(string mimeType, Clipboard.ClipboardCallback dataReceivedCallback)
Parameters
Type | Name | Description |
---|---|---|
string | mimeType | The mime type of data to request. |
Clipboard.ClipboardCallback | dataReceivedCallback | The callback method to handle the received clipboard data. |
Remarks
GetData() method is introduced to fetch data of the specified mime type,
and it expects a callback function as a parameter.
The given callback is invoked with received clipboard data.
The callback is designed to be used only once for handling the data.
Examples
The following example demonstrates how to use the GetData and ClipboardCallback.
string MIME_TYPE_PLAIN_TEXT = "text/plain;charset=utf-8";
Clipboard.Instance.GetData(MIME_TYPE_PLAIN_TEXT, OnClipboardDataReceived);
...
public void OnClipboardDataReceived(bool success, ClipEvent clipEvent)
{
if (!success) return;
string mimeType = clipEvent.MimeType;
string data = clipEvent.Data;
}
View Source
SetData(string, string)
Request set the given data to the clipboard.
Declaration
public bool SetData(string mimeType, string data)
Parameters
Type | Name | Description |
---|---|---|
string | mimeType | The mime type of the data. |
string | data | The data to be set on the clipboard. |
Returns
Type | Description |
---|---|
bool | True if the internal clipboard sending request is successful. |
Examples
The following example demonstrates how to use the SetData.
string MIME_TYPE_PLAIN_TEXT = "text/plain;charset=utf-8";
Clipboard.Instance.SetData(MIME_TYPE_PLAIN_TEXT, "Hello Clipboard");
Events
View SourceDataSelected
The DataSelected event is emitted when a copy event occurs somewhere.
In order for this event to operate normally,
the process using this event must be Secondary Selection.
Declaration
public event EventHandler<ClipboardDataSelectedEventArgs> DataSelected
Event Type
Type | Description |
---|---|
EventHandler<><ClipboardDataSelectedEventArgs> |
Examples
The following example demonstrates how to use the DataSelected.
kvmService.SetSecondarySelection(); // precondition
Clipboard.Instance.DataSelected += (s, e) =>
{
string selectedType = e.MimeType;
};