src/video/SDL_clipboard.c
changeset 4493 f0b7c8d169f5
child 4495 dbbfdb9ea716
equal deleted inserted replaced
4492:bff93336121e 4493:f0b7c8d169f5
       
     1 /*
       
     2     SDL - Simple DirectMedia Layer
       
     3     Copyright (C) 1997-2010 Sam Lantinga
       
     4 
       
     5     This library is free software; you can redistribute it and/or
       
     6     modify it under the terms of the GNU Lesser General Public
       
     7     License as published by the Free Software Foundation; either
       
     8     version 2.1 of the License, or (at your option) any later version.
       
     9 
       
    10     This library is distributed in the hope that it will be useful,
       
    11     but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    13     Lesser General Public License for more details.
       
    14 
       
    15     You should have received a copy of the GNU Lesser General Public
       
    16     License along with this library; if not, write to the Free Software
       
    17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
       
    18 
       
    19     Sam Lantinga
       
    20     slouken@libsdl.org
       
    21 */
       
    22 #include "SDL_config.h"
       
    23 
       
    24 #include "SDL_clipboard.h"
       
    25 #include "SDL_sysvideo.h"
       
    26 
       
    27 /* FOURCC values for text and image clipboard formats */
       
    28 #define TEXT_DATA  SDL_FOURCC('T', 'E', 'X', 'T')
       
    29 #define IMAGE_DATA SDL_FOURCC('B', 'M', 'P', ' ')
       
    30 
       
    31 int
       
    32 SDL_SetClipboardText(const char *text)
       
    33 {
       
    34     return SDL_SetClipboard(TEXT_DATA, text, SDL_strlen(text)+1);
       
    35 }
       
    36 
       
    37 char *
       
    38 SDL_GetClipboardText()
       
    39 {
       
    40     void *data;
       
    41     size_t length;
       
    42 
       
    43     if (SDL_GetClipboard(TEXT_DATA, &data, &length) == 0) {
       
    44         return SDL_static_cast(char*, data);
       
    45     } else {
       
    46         return NULL;
       
    47     }
       
    48 }
       
    49 
       
    50 SDL_bool
       
    51 SDL_HasClipboardText()
       
    52 {
       
    53     return SDL_HasClipboardFormat(TEXT_DATA);
       
    54 }
       
    55 
       
    56 int
       
    57 SDL_SetClipboardImage(SDL_Surface *image)
       
    58 {
       
    59     SDL_Unsupported();
       
    60     return -1;
       
    61 }
       
    62 
       
    63 SDL_Surface *
       
    64 SDL_GetClipboardImage()
       
    65 {
       
    66     SDL_Unsupported();
       
    67     return NULL;
       
    68 }
       
    69 
       
    70 SDL_bool
       
    71 SDL_HasClipboardImage()
       
    72 {
       
    73     return SDL_FALSE;
       
    74 }
       
    75 
       
    76 int
       
    77 SDL_SetClipboard(Uint32 format, void *data, size_t length)
       
    78 {
       
    79     SDL_Unsupported();
       
    80     return -1;
       
    81 }
       
    82 
       
    83 int
       
    84 SDL_GetClipboard(Uint32 format, void **data, size_t *length)
       
    85 {
       
    86     SDL_Unsupported();
       
    87     return -1;
       
    88 }
       
    89 
       
    90 SDL_bool
       
    91 SDL_HasClipboardFormat(Uint32 format)
       
    92 {
       
    93     return SDL_FALSE;
       
    94 }
       
    95 
       
    96 void
       
    97 SDL_ClearClipboard(void)
       
    98 {
       
    99 }
       
   100 
       
   101 /* vi: set ts=4 sw=4 expandtab: */