MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / ShowOpenFileDialog

Method ShowOpenFileDialog

Source/Engine/Platform/Mac/MacFileSystem.cpp:65–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65bool MacFileSystem::ShowOpenFileDialog(Window* parentWindow, const StringView& initialDirectory, const StringView& filter, bool multiSelect, const StringView& title, Array<String>& filenames)
66{
67 bool result = true;
68 @autoreleasepool {
69 NSWindow* focusedWindow = [[NSApplication sharedApplication] keyWindow];
70
71 NSOpenPanel* dialog = [NSOpenPanel openPanel];
72 [dialog setCanChooseFiles:YES];
73 [dialog setCanChooseDirectories:NO];
74 [dialog setAllowsMultipleSelection:multiSelect ? YES : NO];
75 InitMacDialog(dialog, initialDirectory, filter, title);
76
77 if ([dialog runModal] == NSModalResponseOK)
78 {
79 if (multiSelect)
80 {
81 const NSArray* urls = [dialog URLs];
82 for (int32 i = 0; i < [urls count]; i++)
83 filenames.Add(AppleUtils::ToString((CFStringRef)[[urls objectAtIndex:i] path]));
84 }
85 else
86 {
87 const NSURL* url = [dialog URL];
88 filenames.Add(AppleUtils::ToString((CFStringRef)[url path]));
89 }
90 result = false;
91 }
92
93 [focusedWindow makeKeyAndOrderFront:nil];
94 }
95 return result;
96}
97

Callers 4

ShowImportFileDialogMethod · 0.45
GetReimportPathMethod · 0.45
OpenProjectMethod · 0.45
LoadLogFileMethod · 0.45

Calls 3

InitMacDialogFunction · 0.85
ToStringFunction · 0.50
AddMethod · 0.45

Tested by

no test coverage detected