diff options
Diffstat (limited to 'gui/browser.cpp')
-rw-r--r-- | gui/browser.cpp | 97 |
1 files changed, 0 insertions, 97 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 |