diff options
| author | Pietro Gagliardi <[email protected]> | 2014-06-08 12:36:55 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-06-08 12:36:55 -0400 |
| commit | b172ab2e37896d36292660f6cc15987fb88ddf57 (patch) | |
| tree | d00035f9d8b26941ac6913468135d2f34f57fe83 /dialog_darwin.m | |
| parent | 10f55564d0770ca5d5803026f6c3190c3b2fdd69 (diff) | |
Added new MsgBox() behavior on Mac OS X. Now we can finally remove MsgBox() from the TODOs! :D
Diffstat (limited to 'dialog_darwin.m')
| -rw-r--r-- | dialog_darwin.m | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/dialog_darwin.m b/dialog_darwin.m index 6bbad61..d37956f 100644 --- a/dialog_darwin.m +++ b/dialog_darwin.m @@ -1,6 +1,7 @@ // 15 may 2014 #include "objc_darwin.h" +#include "_cgo_export.h" #import <AppKit/NSAlert.h> // see delegateuitask_darwin.m @@ -23,7 +24,7 @@ #define to(T, x) ((T *) (x)) #define toNSWindow(x) to(NSWindow, (x)) -static void alert(id parent, NSString *primary, NSString *secondary, NSAlertStyle style) +static void alert(id parent, NSString *primary, NSString *secondary, NSAlertStyle style, void *chan) { NSAlert *box; @@ -35,20 +36,20 @@ static void alert(id parent, NSString *primary, NSString *secondary, NSAlertStyl // TODO is there a named constant? will also need to be changed when we add different dialog types [box addButtonWithTitle:@"OK"]; if (parent == nil) - [box runModal]; + dialog_send(chan, (intptr_t) [box runModal]); else [box beginSheetModalForWindow:toNSWindow(parent) modalDelegate:[NSApp delegate] didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) - contextInfo:NULL]; + contextInfo:chan]; } -void msgBox(id parent, id primary, id secondary) +void msgBox(id parent, id primary, id secondary, void *chan) { - alert(parent, (NSString *) primary, (NSString *) secondary, NSInformationalAlertStyle); + alert(parent, (NSString *) primary, (NSString *) secondary, NSInformationalAlertStyle, chan); } -void msgBoxError(id parent, id primary, id secondary) +void msgBoxError(id parent, id primary, id secondary, void *chan) { - alert(parent, (NSString *) primary, (NSString *) secondary, NSCriticalAlertStyle); + alert(parent, (NSString *) primary, (NSString *) secondary, NSCriticalAlertStyle, chan); } |
