|
|
@ -152,7 +152,7 @@ static NLMISC::TKey virtualKeycodeToNelKey(unsigned short keycode)
|
|
|
|
return NLMISC::KeyNOKEY;
|
|
|
|
return NLMISC::KeyNOKEY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool CCocoaEventEmitter::pasteTextFromClipboard(ucstring &text)
|
|
|
|
bool CCocoaEventEmitter::pasteTextFromClipboard(std::string &text)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
|
|
|
|
NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
|
|
|
|
NSArray *classArray = [NSArray arrayWithObject:[NSString class]];
|
|
|
|
NSArray *classArray = [NSArray arrayWithObject:[NSString class]];
|
|
|
@ -163,17 +163,17 @@ bool CCocoaEventEmitter::pasteTextFromClipboard(ucstring &text)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
NSArray *objectsToPaste = [pasteboard readObjectsForClasses:classArray options:options];
|
|
|
|
NSArray *objectsToPaste = [pasteboard readObjectsForClasses:classArray options:options];
|
|
|
|
NSString *nstext = [objectsToPaste objectAtIndex:0];
|
|
|
|
NSString *nstext = [objectsToPaste objectAtIndex:0];
|
|
|
|
text.fromUtf8([nstext UTF8String]);
|
|
|
|
text = [nstext UTF8String];
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool CCocoaEventEmitter::copyTextToClipboard(const ucstring &text)
|
|
|
|
bool CCocoaEventEmitter::copyTextToClipboard(const std::string &text)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
|
|
|
|
NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
|
|
|
|
[pasteboard clearContents];
|
|
|
|
[pasteboard clearContents];
|
|
|
|
NSArray *copiedObjects = [NSArray arrayWithObject:[NSString stringWithUTF8String:text.toUtf8().c_str()]];
|
|
|
|
NSArray *copiedObjects = [NSArray arrayWithObject:[NSString stringWithUTF8String:text.c_str()]];
|
|
|
|
[pasteboard writeObjects:copiedObjects];
|
|
|
|
[pasteboard writeObjects:copiedObjects];
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|