diff options
| author | Geenz <geenz@geenzo.com> | 2013-07-11 21:31:17 -0400 |
|---|---|---|
| committer | Geenz <geenz@geenzo.com> | 2013-07-11 21:31:17 -0400 |
| commit | a787e272c31d8e535dae75e4d95365d17cec78db (patch) | |
| tree | dd8f3acfbc1fb0901a3f8442dd49456507d51ec5 /indra/llwindow/llwindowmacosx-objc.mm | |
| parent | 3a8ad62d9b13335b29bcc5a1419ac8712bc3626b (diff) | |
Alert box support!
Diffstat (limited to 'indra/llwindow/llwindowmacosx-objc.mm')
| -rwxr-xr-x | indra/llwindow/llwindowmacosx-objc.mm | 35 |
1 files changed, 35 insertions, 0 deletions
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() { |
