diff options
-rw-r--r-- | indra/llwindow/llopenglview-objc.mm | 2 | ||||
-rwxr-xr-x | indra/llwindow/llwindowmacosx-objc.h | 1 | ||||
-rwxr-xr-x | indra/llwindow/llwindowmacosx-objc.mm | 35 | ||||
-rwxr-xr-x | indra/llwindow/llwindowmacosx.cpp | 23 |
4 files changed, 38 insertions, 23 deletions
diff --git a/indra/llwindow/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm index e5b7681435..42ad4f8723 100644 --- a/indra/llwindow/llopenglview-objc.mm +++ b/indra/llwindow/llopenglview-objc.mm @@ -668,7 +668,7 @@ attributedStringInfo getSegments(NSAttributedString *str) - (BOOL) resignFirstResponder { - callFocus(); + callFocusLost(); return true; } diff --git a/indra/llwindow/llwindowmacosx-objc.h b/indra/llwindow/llwindowmacosx-objc.h index 020e2bff5b..32b3bfb078 100755 --- a/indra/llwindow/llwindowmacosx-objc.h +++ b/indra/llwindow/llwindowmacosx-objc.h @@ -69,6 +69,7 @@ void hideNSCursor(); void showNSCursor(); void hideNSCursorTillMove(bool hide); void requestUserAttention(); +long showAlert(std::string title, std::string text, int type); NSWindowRef createNSWindow(int x, int y, int width, int height); diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index ef29515403..3703dcf28d 100755 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -395,6 +395,41 @@ void requestUserAttention() [[NSApplication sharedApplication] requestUserAttention:NSInformationalRequest]; } +long showAlert(std::string text, std::string title, int type) +{ + NSAlert *alert = [[NSAlert alloc] init]; + + [alert setMessageText:[NSString stringWithCString:title.c_str() encoding:[NSString defaultCStringEncoding]]]; + [alert setInformativeText:[NSString stringWithCString:text.c_str() encoding:[NSString defaultCStringEncoding]]]; + if (type == 0) + { + [alert addButtonWithTitle:@"Okay"]; + } else if (type == 1) + { + [alert addButtonWithTitle:@"Okay"]; + [alert addButtonWithTitle:@"Cancel"]; + } else if (type == 2) + { + [alert addButtonWithTitle:@"Yes"]; + [alert addButtonWithTitle:@"No"]; + } + long ret = [alert runModal]; + [alert dealloc]; + + if (ret == NSAlertFirstButtonReturn) + { + ret = 0; + } else if (ret == NSAlertSecondButtonReturn) + { + ret = 1; + } else if (ret == NSAlertThirdButtonReturn) + { + ret = 2; + } + + return ret; +} + /* GLViewRef getGLView() { diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index d657c629b9..beb9ebe8e0 100755 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -1597,24 +1597,6 @@ LLSplashScreenMacOSX::~LLSplashScreenMacOSX() void LLSplashScreenMacOSX::showImpl() { // This code _could_ be used to display a spash screen... -#if 0 - IBNibRef nib = NULL; - S32 err; - - err = CreateNibReference(CFSTR("SecondLife"), &nib); - - if(err == noErr) - { - CreateWindowFromNib(nib, CFSTR("Splash Screen"), &mWindow); - - DisposeNibReference(nib); - } - - if(mWindow != NULL) - { - ShowWindow(mWindow); - } -#endif } void LLSplashScreenMacOSX::updateImpl(const std::string& mesg) @@ -1636,12 +1618,9 @@ void LLSplashScreenMacOSX::hideImpl() } } - - S32 OSMessageBoxMacOSX(const std::string& text, const std::string& caption, U32 type) { - // TODO: Implement a native NSAlert function that replicates all of this. - return 0; + return showAlert(text, caption, type); } // Open a URL with the user's default web browser. |