Open files from Finder in Skia/OSX port

This commit is contained in:
David Capello 2016-01-29 16:07:39 -03:00
parent e985227d95
commit 40c834f50a
2 changed files with 17 additions and 3 deletions

View File

@ -1,5 +1,5 @@
// SHE library // SHE library
// Copyright (C) 2012-2015 David Capello // Copyright (C) 2012-2016 David Capello
// //
// This file is released under the terms of the MIT license. // This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information. // Read LICENSE.txt for more information.
@ -14,6 +14,7 @@
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)sender; - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)sender;
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)app; - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)app;
- (void)applicationWillTerminate:(NSNotification*)notification; - (void)applicationWillTerminate:(NSNotification*)notification;
- (BOOL)application:(NSApplication*)app openFile:(NSString*)filename;
@end @end
#endif #endif

View File

@ -1,5 +1,5 @@
// SHE library // SHE library
// Copyright (C) 2012-2015 David Capello // Copyright (C) 2012-2016 David Capello
// //
// This file is released under the terms of the MIT license. // This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information. // Read LICENSE.txt for more information.
@ -33,7 +33,20 @@
{ {
she::Event ev; she::Event ev;
ev.setType(she::Event::CloseDisplay); ev.setType(she::Event::CloseDisplay);
she::instance()->eventQueue()->queueEvent(ev); she::queue_event(ev);
}
- (BOOL)application:(NSApplication*)app openFile:(NSString*)filename
{
she::Event ev;
ev.setType(she::Event::DropFiles);
std::vector<std::string> files;
files.push_back([filename UTF8String]);
ev.setFiles(files);
she::queue_event(ev);
return YES;
} }
@end @end