diff options
Diffstat (limited to 'libraries/irrlicht-1.8/source/Irrlicht/MacOSX/OSXClipboard.mm')
-rw-r--r-- | libraries/irrlicht-1.8/source/Irrlicht/MacOSX/OSXClipboard.mm | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/MacOSX/OSXClipboard.mm b/libraries/irrlicht-1.8/source/Irrlicht/MacOSX/OSXClipboard.mm new file mode 100644 index 0000000..d549911 --- /dev/null +++ b/libraries/irrlicht-1.8/source/Irrlicht/MacOSX/OSXClipboard.mm | |||
@@ -0,0 +1,36 @@ | |||
1 | // Copyright (C) 2005-2006 Etienne Petitjean | ||
2 | // Copyright (C) 2007-2012 Christian Stehno | ||
3 | // This file is part of the "Irrlicht Engine". | ||
4 | // For conditions of distribution and use, see copyright notice in Irrlicht.h | ||
5 | |||
6 | #include "OSXClipboard.h" | ||
7 | #import <Cocoa/Cocoa.h> | ||
8 | |||
9 | void OSXCopyToClipboard(const char *text) | ||
10 | { | ||
11 | NSString *str; | ||
12 | NSPasteboard *board; | ||
13 | |||
14 | if ((text != NULL) && (strlen(text) > 0)) | ||
15 | { | ||
16 | str = [NSString stringWithCString:text encoding:NSWindowsCP1252StringEncoding]; | ||
17 | board = [NSPasteboard generalPasteboard]; | ||
18 | [board declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:NSApp]; | ||
19 | [board setString:str forType:NSStringPboardType]; | ||
20 | } | ||
21 | } | ||
22 | |||
23 | char* OSXCopyFromClipboard() | ||
24 | { | ||
25 | NSString* str; | ||
26 | NSPasteboard* board; | ||
27 | char* result; | ||
28 | |||
29 | result = NULL; | ||
30 | board = [NSPasteboard generalPasteboard]; | ||
31 | str = [board stringForType:NSStringPboardType]; | ||
32 | if (str != nil) | ||
33 | result = (char*)[str cStringUsingEncoding:NSWindowsCP1252StringEncoding]; | ||
34 | return (result); | ||
35 | } | ||
36 | |||