src/video/SDL_clipboard.c
changeset 4493 f0b7c8d169f5
child 4495 dbbfdb9ea716
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/video/SDL_clipboard.c	Wed Jul 07 23:24:04 2010 -0700
     1.3 @@ -0,0 +1,101 @@
     1.4 +/*
     1.5 +    SDL - Simple DirectMedia Layer
     1.6 +    Copyright (C) 1997-2010 Sam Lantinga
     1.7 +
     1.8 +    This library is free software; you can redistribute it and/or
     1.9 +    modify it under the terms of the GNU Lesser General Public
    1.10 +    License as published by the Free Software Foundation; either
    1.11 +    version 2.1 of the License, or (at your option) any later version.
    1.12 +
    1.13 +    This library is distributed in the hope that it will be useful,
    1.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1.16 +    Lesser General Public License for more details.
    1.17 +
    1.18 +    You should have received a copy of the GNU Lesser General Public
    1.19 +    License along with this library; if not, write to the Free Software
    1.20 +    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    1.21 +
    1.22 +    Sam Lantinga
    1.23 +    slouken@libsdl.org
    1.24 +*/
    1.25 +#include "SDL_config.h"
    1.26 +
    1.27 +#include "SDL_clipboard.h"
    1.28 +#include "SDL_sysvideo.h"
    1.29 +
    1.30 +/* FOURCC values for text and image clipboard formats */
    1.31 +#define TEXT_DATA  SDL_FOURCC('T', 'E', 'X', 'T')
    1.32 +#define IMAGE_DATA SDL_FOURCC('B', 'M', 'P', ' ')
    1.33 +
    1.34 +int
    1.35 +SDL_SetClipboardText(const char *text)
    1.36 +{
    1.37 +    return SDL_SetClipboard(TEXT_DATA, text, SDL_strlen(text)+1);
    1.38 +}
    1.39 +
    1.40 +char *
    1.41 +SDL_GetClipboardText()
    1.42 +{
    1.43 +    void *data;
    1.44 +    size_t length;
    1.45 +
    1.46 +    if (SDL_GetClipboard(TEXT_DATA, &data, &length) == 0) {
    1.47 +        return SDL_static_cast(char*, data);
    1.48 +    } else {
    1.49 +        return NULL;
    1.50 +    }
    1.51 +}
    1.52 +
    1.53 +SDL_bool
    1.54 +SDL_HasClipboardText()
    1.55 +{
    1.56 +    return SDL_HasClipboardFormat(TEXT_DATA);
    1.57 +}
    1.58 +
    1.59 +int
    1.60 +SDL_SetClipboardImage(SDL_Surface *image)
    1.61 +{
    1.62 +    SDL_Unsupported();
    1.63 +    return -1;
    1.64 +}
    1.65 +
    1.66 +SDL_Surface *
    1.67 +SDL_GetClipboardImage()
    1.68 +{
    1.69 +    SDL_Unsupported();
    1.70 +    return NULL;
    1.71 +}
    1.72 +
    1.73 +SDL_bool
    1.74 +SDL_HasClipboardImage()
    1.75 +{
    1.76 +    return SDL_FALSE;
    1.77 +}
    1.78 +
    1.79 +int
    1.80 +SDL_SetClipboard(Uint32 format, void *data, size_t length)
    1.81 +{
    1.82 +    SDL_Unsupported();
    1.83 +    return -1;
    1.84 +}
    1.85 +
    1.86 +int
    1.87 +SDL_GetClipboard(Uint32 format, void **data, size_t *length)
    1.88 +{
    1.89 +    SDL_Unsupported();
    1.90 +    return -1;
    1.91 +}
    1.92 +
    1.93 +SDL_bool
    1.94 +SDL_HasClipboardFormat(Uint32 format)
    1.95 +{
    1.96 +    return SDL_FALSE;
    1.97 +}
    1.98 +
    1.99 +void
   1.100 +SDL_ClearClipboard(void)
   1.101 +{
   1.102 +}
   1.103 +
   1.104 +/* vi: set ts=4 sw=4 expandtab: */