patch2.diff
b/code/nel/src/3d/driver/opengl/mac/cocoa_event_emitter.cpp Sun Sep 18 21:15:34 2011 -1000 | ||
---|---|---|
149 | 149 | |
150 | 150 |
bool CCocoaEventEmitter::pasteTextFromClipboard(ucstring &text) |
151 | 151 |
{ |
152 |
#warning "OpenGL Driver: Missing Mac Implementation for pasteTextFromClipboard" |
|
152 |
NSPasteboard *pasteboard = [NSPasteboard generalPasteboard]; |
|
153 |
NSArray *classArray = [NSArray arrayWithObject:[NSString class]]; |
|
154 |
NSDictionary *options = [NSDictionary dictionary]; |
|
155 |
|
|
156 |
BOOL ok = [pasteboard canReadObjectForClasses:classArray options:options]; |
|
157 |
if (ok) { |
|
158 |
NSArray *objectsToPaste = [pasteboard readObjectsForClasses:classArray options:options]; |
|
159 |
NSString *nstext = [objectsToPaste objectAtIndex:0]; |
|
160 |
text.fromUtf8([nstext UTF8String]); |
|
161 |
return true; |
|
162 |
} |
|
153 | 163 |
return false; |
154 | 164 |
} |
155 | 165 | |
156 | 166 |
bool CCocoaEventEmitter::copyTextToClipboard(const ucstring &text) |
157 | 167 |
{ |
158 |
#warning "OpenGL Driver: Missing Mac Implementation for copyTextToClipboard" |
|
159 |
return false; |
|
168 |
NSPasteboard *pasteboard = [NSPasteboard generalPasteboard]; |
|
169 |
[pasteboard clearContents]; |
|
170 |
NSArray *copiedObjects = [NSArray arrayWithObject:[NSString stringWithUTF8String:text.toUtf8().c_str()]]; |
|
171 |
[pasteboard writeObjects:copiedObjects]; |
|
172 |
return true; |
|
160 | 173 |
} |
161 | 174 | |
162 | 175 |
/// convert modifier key state to nel internal modifier key state |