diff options
| author | Pietro Gagliardi <[email protected]> | 2014-05-15 19:08:24 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-05-15 19:08:24 -0400 |
| commit | 5b5c76021eda98783f1611da66f4b2f10f09f590 (patch) | |
| tree | 8a8b6eedc66d2673766e52f866a4ea7b8f6f9fce /dialog_darwin.m | |
| parent | 93914ecb8cc7bf4bf6eb8199f96fc3a685fc44cf (diff) | |
Migrated dialog_darwin.go to use Objective-C directly.
Diffstat (limited to 'dialog_darwin.m')
| -rw-r--r-- | dialog_darwin.m | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/dialog_darwin.m b/dialog_darwin.m new file mode 100644 index 0000000..73f5a18 --- /dev/null +++ b/dialog_darwin.m @@ -0,0 +1,29 @@ +// 15 may 2014 + +#include "objc_darwin.h" +#include "dialog_darwin.h" +#include <AppKit/NSAlert.h> + +static void alert(NSString *primary, NSString *secondary, NSAlertStyle style) +{ + NSAlert *box; + + box = [NSAlert new]; + [box setMessageText:primary]; + if (secondary != nil) + [box setInformativeText:secondary]; + [box setAlertStyle:style]; + // TODO is there a named constant? will also need to be changed when we add different dialog types + [box addButtonWithTitle:@"OK"]; + [box runModal]; +} + +void msgBox(id primary, id secondary) +{ + alert((NSString *) primary, (NSString *) secondary, NSInformationalAlertStyle); +} + +void msgBoxError(id primary, id secondary) +{ + alert((NSString *) primary, (NSString *) secondary, NSCriticalAlertStyle); +} |
