Implemented uiOpenFile() and uiSaveFile() on OS X.
This commit is contained in:
parent
03bb30947c
commit
ccd46d11f7
|
@ -1,16 +1,48 @@
|
|||
// 26 june 2015
|
||||
#import "uipriv_darwin.h"
|
||||
|
||||
// TODO is whether extensions are shown a Finder setting?
|
||||
static void setupSavePanel(NSSavePanel *s)
|
||||
{
|
||||
[s setCanCreateDirectories:YES];
|
||||
[s setShowsHiddenFiles:YES];
|
||||
[s setExtensionHidden:NO];
|
||||
[s setCanSelectHiddenExtension:NO];
|
||||
[s setTreatsFilePackagesAsDirectories:YES];
|
||||
}
|
||||
|
||||
static char *runSavePanel(NSSavePanel *s)
|
||||
{
|
||||
char *filename;
|
||||
|
||||
if ([s runModal] != NSFileHandlingPanelOKButton)
|
||||
return NULL;
|
||||
filename = uiDarwinNSStringToText([[s URL] path]);
|
||||
return filename;
|
||||
}
|
||||
|
||||
char *uiOpenFile(void)
|
||||
{
|
||||
// TODO
|
||||
return NULL;
|
||||
NSOpenPanel *o;
|
||||
|
||||
o = [NSOpenPanel openPanel];
|
||||
[o setCanChooseFiles:YES];
|
||||
[o setCanChooseDirectories:NO];
|
||||
[o setResolvesAliases:NO];
|
||||
[o setAllowsMultipleSelection:NO];
|
||||
setupSavePanel(o);
|
||||
// panel is autoreleased
|
||||
return runSavePanel(o);
|
||||
}
|
||||
|
||||
char *uiSaveFile(void)
|
||||
{
|
||||
// TODO
|
||||
return NULL;
|
||||
NSSavePanel *s;
|
||||
|
||||
s = [NSSavePanel savePanel];
|
||||
setupSavePanel(s);
|
||||
// panel is autoreleased
|
||||
return runSavePanel(s);
|
||||
}
|
||||
|
||||
void uiMsgBox(const char *title, const char *description)
|
||||
|
|
Loading…
Reference in New Issue