tbx
0.7.6
|
Class to handler the global RISC OS clipboard. More...
#include <clipboard.h>
Public Member Functions | |
void | clear () |
Clear all the local clipboard data. | |
void | copy (int file_type, ClipboardData *data, bool add=false) |
Copy the given data to the local clipboard and make if available to the global clipboard. More... | |
void | copy (const std::string &text, int file_type=0xFFF) |
Convenience method to make it easy to copy text to the clipboard. More... | |
void | copy (int file_type, char *bytes, int size, bool copy_bytes=true) |
Convenience method to place bytes on to the clipboard. More... | |
void | paste (int file_type, Gadget &gadget, int x=0, int y=0) |
Paste data from global clipboard. More... | |
void | paste (int *file_types, int num_types, Gadget &gadget, int x=0, int y=0) |
Paste data from global clipboard. More... | |
void | paste (int file_type, Window &window, int x=0, int y=0) |
Paste data from global clipboard. More... | |
void | paste (int *file_types, int num_types, Window &window, int x=0, int y=0) |
Paste data from global clipboard. More... | |
void | check (int file_type, Window &window) |
Check the global clipboard for a given file type. More... | |
void | check (int *file_types, int num_types, Window &window) |
Check the global clipboard for once of thegiven file type. More... | |
void | claim_caret () |
Claim the caret/selection for this application. More... | |
void | add_claimed_listener (ClipboardClaimedListener *listener) |
Add a listener for when the clipboard has been claimed by another application. More... | |
void | remove_claimed_listener (ClipboardClaimedListener *listener) |
Remove a listener for when the clipboard has been claimed by another application. More... | |
void | add_format_listener (ClipboardFormatListener *listener) |
Add a listener for the result of a Clipboard::check call. More... | |
void | remove_format_listener (ClipboardFormatListener *listener) |
Remove a listener for the result of a Clipboard::check call. More... | |
bool | owns_clipboard () const |
Check if global clipboard is currently owned by this application. More... | |
ClipboardData * | data (int file_type) const |
Get data stored locally of the given file type. More... | |
ClipboardData * | native_data () const |
Get the native data from the data stored locally. More... | |
int | native_file_type () const |
Return the native file type. More... | |
Static Public Member Functions | |
static Clipboard * | instance () |
Return the global clipboard instance, creating it if it does not exist. | |
Friends | |
class | MessageHandler |
Class to handler the global RISC OS clipboard.
void tbx::Clipboard::add_claimed_listener | ( | ClipboardClaimedListener * | listener | ) |
Add a listener for when the clipboard has been claimed by another application.
listener | listener to add |
void tbx::Clipboard::add_format_listener | ( | ClipboardFormatListener * | listener | ) |
Add a listener for the result of a Clipboard::check call.
listener | listener to add |
void tbx::Clipboard::check | ( | int * | file_types, |
int | num_types, | ||
Window & | window | ||
) |
Check the global clipboard for once of thegiven file type.
The result of the check is returned via the ClipboardFormatListener.
file_types | an array of file types to check for. |
num_types | the number of types in the array. |
window | a window to use for checking. |
void tbx::Clipboard::check | ( | int | file_type, |
Window & | window | ||
) |
Check the global clipboard for a given file type.
The result of the check is returned via the ClipboardFormatListener.
file_type | the file type to check for |
window | a window to use for checking. |
void tbx::Clipboard::claim_caret | ( | ) |
Claim the caret/selection for this application.
An application should call this when it gains the focus to allow it to paste data and inform other applications they no longer have the input focus
This can be called safely multiple times, the caret is only claimed from the system if this application doesn't already have it.
void tbx::Clipboard::copy | ( | const std::string & | text, |
int | file_type = 0xFFF |
||
) |
Convenience method to make it easy to copy text to the clipboard.
text | the text to copy. |
file_type | (default 0xFFF - Text) |
void tbx::Clipboard::copy | ( | int | file_type, |
char * | bytes, | ||
int | size, | ||
bool | copy_bytes = true |
||
) |
Convenience method to place bytes on to the clipboard.
file_type | file type for the bytes |
bytes | bytes to place on the clipboard |
size | size of the bytes to place on the clipboard |
copy_bytes | true to make a copy of the bytes, false to take ownership and delete them with delete[] bytes when no longer required. |
void tbx::Clipboard::copy | ( | int | file_type, |
ClipboardData * | data, | ||
bool | add = false |
||
) |
Copy the given data to the local clipboard and make if available to the global clipboard.
The data is not copied to another application until, a paste request is received.
file_type | the file type of the data |
data | object to provide the data to the clipboard (the clipboard takes ownership of this object and will delete it when it is no longer required) |
add | if false (the default) the data will replace existing data and the native file type is set to file_type. if true the file_type will be added the list of supported types. |
ClipboardData * tbx::Clipboard::data | ( | int | file_type | ) | const |
Get data stored locally of the given file type.
file_type | file type of data to get |
ClipboardData * tbx::Clipboard::native_data | ( | ) | const |
Get the native data from the data stored locally.
The native data is the first that was copied to the clipboard with copy.
int tbx::Clipboard::native_file_type | ( | ) | const |
Return the native file type.
This is set when the first data is copied to the clipboard
|
inline |
Check if global clipboard is currently owned by this application.
void tbx::Clipboard::paste | ( | int * | file_types, |
int | num_types, | ||
Gadget & | gadget, | ||
int | x = 0 , |
||
int | y = 0 |
||
) |
Paste data from global clipboard.
The Gadget to paste to must have a Loader with add loader to receive the data. To receive data when this application owns the clipboard the loader must support ram transfer.
file_types | list of file type to paste in order of preference. If none of these types are on the clipboard it will try to load the native format stored on the clipboard. This means the gadget loader routine may receive a different format if it is set to load all types. |
num_types | number of file types in the list. |
gadget | gadget to paste to (must be in window or null) |
x | x-coordinate for paste |
y | y-coordinate for paste |
void tbx::Clipboard::paste | ( | int * | file_types, |
int | num_types, | ||
Window & | window, | ||
int | x = 0 , |
||
int | y = 0 |
||
) |
Paste data from global clipboard.
The window to paste to must have a Loader with add loader to receive the data. To receive data when this application owns the clipboard the loader must support ram transfer.
file_type | file type to paste. If this type is not on the clipboard it will try to load the native format stored on the clipboard. This means the gadget loader routine may receive a different format if it is set to load all types. |
num_types | number of file types in the list. |
window | window to paste to |
x | x-coordinate for paste (defaults to 0) |
y | y-coordinate for paste (defaults to 0) |
void tbx::Clipboard::paste | ( | int | file_type, |
tbx::Gadget & | gadget, | ||
int | x = 0 , |
||
int | y = 0 |
||
) |
Paste data from global clipboard.
The Gadget to paste to must have a Loader with add loader to receive the data. To receive data when this application owns the clipboard the loader must support ram transfer.
file_type | file type to paste. If this type is not on the clipboard it will try to load the native format stored on the clipboard. This means the gadget loader routine may receive a different format if it is set to load all types. |
gadget | gadget to paste to |
x | x-coordinate for paste (defaults to 0) |
y | y-coordinate for paste (defaults to 0) |
void tbx::Clipboard::paste | ( | int | file_type, |
Window & | window, | ||
int | x = 0 , |
||
int | y = 0 |
||
) |
Paste data from global clipboard.
The window to paste to must have a Loader with add loader to receive the data. To receive data when this application owns the clipboard the loader must support ram transfer.
file_type | file type to paste. If this type is not on the clipboard it will try to load the native format stored on the clipboard. This means the gadget loader routine may receive a different format if it is set to load all types. |
window | window to paste to |
x | x-coordinate for paste (defaults to 0) |
y | y-coordinate for paste (defaults to 0) |
void tbx::Clipboard::remove_claimed_listener | ( | ClipboardClaimedListener * | listener | ) |
Remove a listener for when the clipboard has been claimed by another application.
listener | listener to remove |
void tbx::Clipboard::remove_format_listener | ( | ClipboardFormatListener * | listener | ) |
Remove a listener for the result of a Clipboard::check call.
listener | listener to remove |