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