diff options
author | Oystein Eftevaag | 2009-12-26 13:35:57 +0000 |
---|---|---|
committer | Oystein Eftevaag | 2009-12-26 13:35:57 +0000 |
commit | 9d70103d9c84c0dc993faafddcf3fd00b02241ea (patch) | |
tree | ecf9dc805223dcf718784a8da86b7f3ebb5466dd /gui | |
parent | 21c6bbc588a981cf8facd63432845a2c81e73e48 (diff) | |
download | scummvm-rg350-9d70103d9c84c0dc993faafddcf3fd00b02241ea.tar.gz scummvm-rg350-9d70103d9c84c0dc993faafddcf3fd00b02241ea.tar.bz2 scummvm-rg350-9d70103d9c84c0dc993faafddcf3fd00b02241ea.zip |
The file selection dialog in OS X now uses Cocoa instead of Carbon, and lives in a separate file due to having to be compiled as Objective-C++. ScummVM can now run in x64 natively on OS X
svn-id: r46581
Diffstat (limited to 'gui')
-rw-r--r-- | gui/browser.cpp | 97 | ||||
-rw-r--r-- | gui/module.mk | 9 |
2 files changed, 8 insertions, 98 deletions
diff --git a/gui/browser.cpp b/gui/browser.cpp index e7be11531c..906ca0dbe0 100644 --- a/gui/browser.cpp +++ b/gui/browser.cpp @@ -37,101 +37,6 @@ enum { kGoUpCmd = 'GoUp' }; -#ifdef MACOSX -/* On Mac OS X, use the native file selector dialog. We could do the same for - * other operating systems. - */ - -BrowserDialog::BrowserDialog(const char *title, bool dirBrowser) - : Dialog("Browser") { - _titleRef = CFStringCreateWithCString(0, title, CFStringGetSystemEncoding()); - _isDirBrowser = dirBrowser; -} - -BrowserDialog::~BrowserDialog() { - CFRelease(_titleRef); -} - -int BrowserDialog::runModal() { - NavDialogRef dialogRef; - WindowRef windowRef = 0; - NavDialogCreationOptions options; - NavUserAction result; - NavReplyRecord reply; - OSStatus err; - bool choiceMade = false; - - // If in fullscreen mode, switch to windowed mode - bool wasFullscreen = g_system->getFeatureState(OSystem::kFeatureFullscreenMode); - if (wasFullscreen) { - g_system->beginGFXTransaction(); - g_system->setFeatureState(OSystem::kFeatureFullscreenMode, false); - g_system->endGFXTransaction(); - } - - // Temporarily show the real mouse - CGDisplayShowCursor(kCGDirectMainDisplay); - - err = NavGetDefaultDialogCreationOptions(&options); - assert(err == noErr); - options.windowTitle = _titleRef; -// options.message = CFSTR("Select your game directory"); - options.modality = kWindowModalityAppModal; - - if (_isDirBrowser) - err = NavCreateChooseFolderDialog(&options, 0, 0, 0, &dialogRef); - else - err = NavCreateChooseFileDialog(&options, 0, 0, 0, 0, 0, &dialogRef); - assert(err == noErr); - - windowRef = NavDialogGetWindow(dialogRef); - - err = NavDialogRun(dialogRef); - assert(err == noErr); - - CGDisplayHideCursor(kCGDirectMainDisplay); - - result = NavDialogGetUserAction(dialogRef); - - if (result == kNavUserActionChoose) { - err = NavDialogGetReply(dialogRef, &reply); - assert(err == noErr); - - if (reply.validRecord && err == noErr) { - long theCount; - AECountItems(&reply.selection, &theCount); - assert(theCount == 1); - - AEKeyword keyword; - FSRef ref; - char buf[4096]; - err = AEGetNthPtr(&reply.selection, 1, typeFSRef, &keyword, NULL, &ref, sizeof(ref), NULL); - assert(err == noErr); - err = FSRefMakePath(&ref, (UInt8*)buf, sizeof(buf)-1); - assert(err == noErr); - - _choice = Common::FSNode(buf); - choiceMade = true; - } - - err = NavDisposeReply(&reply); - assert(err == noErr); - } - - NavDialogDispose(dialogRef); - - // If we were in fullscreen mode, switch back - if (wasFullscreen) { - g_system->beginGFXTransaction(); - g_system->setFeatureState(OSystem::kFeatureFullscreenMode, true); - g_system->endGFXTransaction(); - } - - return choiceMade; -} - -#else - /* We want to use this as a general directory selector at some point... possible uses * - to select the data dir for a game * - to select the place where save games are stored @@ -271,6 +176,4 @@ void BrowserDialog::updateListing() { draw(); } -#endif // MACOSX - } // End of namespace GUI diff --git a/gui/module.mk b/gui/module.mk index cd0c73b1a3..e97a6eb741 100644 --- a/gui/module.mk +++ b/gui/module.mk @@ -2,7 +2,6 @@ MODULE := gui MODULE_OBJS := \ about.o \ - browser.o \ chooser.o \ console.o \ debugger.o \ @@ -27,5 +26,13 @@ MODULE_OBJS := \ ThemeParser.o \ widget.o +ifdef MACOSX +MODULE_OBJS += \ + browser_osx.o +else +MODULE_OBJS += \ + browser.o +endif + # Include common rules include $(srcdir)/rules.mk |