SDL 3.0
|
Include file for SDL clipboard handling. More...
Go to the source code of this file.
Typedefs | |
typedef void *(* | SDL_ClipboardDataCallback) (size_t *size, const char *mime_type, void *userdata) |
Functions | |
int | SDL_SetClipboardText (const char *text) |
char * | SDL_GetClipboardText (void) |
SDL_bool | SDL_HasClipboardText (void) |
int | SDL_SetPrimarySelectionText (const char *text) |
char * | SDL_GetPrimarySelectionText (void) |
SDL_bool | SDL_HasPrimarySelectionText (void) |
int | SDL_SetClipboardData (SDL_ClipboardDataCallback callback, size_t mime_count, const char **mime_types, void *userdata) |
void * | SDL_GetClipboardUserdata (void) |
void * | SDL_GetClipboardData (size_t *length, const char *mime_type) |
SDL_bool | SDL_HasClipboardData (const char *mime_type) |
Include file for SDL clipboard handling.
Definition in file SDL_clipboard.h.
typedef void *(* SDL_ClipboardDataCallback) (size_t *size, const char *mime_type, void *userdata) |
Callback function that will be called when data for the specified mime-type is requested by the OS.
size | The length of the returned data |
mime_type | The requested mime-type |
userdata | A pointer to provided user data |
Definition at line 150 of file SDL_clipboard.h.
void * SDL_GetClipboardData | ( | size_t * | length, |
const char * | mime_type | ||
) |
Get the data from clipboard for a given mime type
mime_type | The mime type to read from the clipboard |
char * SDL_GetClipboardText | ( | void | ) |
Get UTF-8 text from the clipboard, which must be freed with SDL_free().
This functions returns empty string if there was not enough memory left for a copy of the clipboard's content.
void * SDL_GetClipboardUserdata | ( | void | ) |
Retrieve previously set userdata if any.
char * SDL_GetPrimarySelectionText | ( | void | ) |
Get UTF-8 text from the primary selection, which must be freed with SDL_free().
This functions returns empty string if there was not enough memory left for a copy of the primary selection's content.
SDL_bool SDL_HasClipboardData | ( | const char * | mime_type | ) |
Query whether there is data in the clipboard for the provided mime type
mime_type | The mime type to check for data for |
SDL_bool SDL_HasClipboardText | ( | void | ) |
Query whether the clipboard exists and contains a non-empty text string.
SDL_bool SDL_HasPrimarySelectionText | ( | void | ) |
Query whether the primary selection exists and contains a non-empty text string.
int SDL_SetClipboardData | ( | SDL_ClipboardDataCallback | callback, |
size_t | mime_count, | ||
const char ** | mime_types, | ||
void * | userdata | ||
) |
Offer clipboard data to the OS
Tell the operating system that the application is offering clipboard data for each of the proivded mime-types. Once another application requests the data the callback function will be called allowing it to generate and respond with the data for the requested mime-type.
The userdata submitted to this function needs to be freed manually. The following scenarios need to be handled:
callback | A function pointer to the function that provides the clipboard data |
mime_count | The number of mime-types in the mime_types list |
mime_types | A list of mime-types that are being offered |
userdata | An opaque pointer that will be forwarded to the callback |
int SDL_SetClipboardText | ( | const char * | text | ) |
Put UTF-8 text into the clipboard.
text | the text to store in the clipboard |
int SDL_SetPrimarySelectionText | ( | const char * | text | ) |
Put UTF-8 text into the primary selection.
text | the text to store in the primary selection |