summaryrefslogtreecommitdiff
path: root/dialog_darwin.m
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-06-30 22:48:12 -0400
committerPietro Gagliardi <[email protected]>2014-06-30 22:48:12 -0400
commitffa1bbe0b91a8c812ddcea5c5d65e55f60d07f33 (patch)
tree000fadd9af11843d92e7f0eee49fa90cca1379cd /dialog_darwin.m
parent990d50e9a153681a091a23734f8962e728fde1b0 (diff)
Restored the previous new API. I'm going to change it so that events are callbacks rather than using a window handler, but other than that... yeah.
Diffstat (limited to 'dialog_darwin.m')
-rw-r--r--dialog_darwin.m21
1 files changed, 13 insertions, 8 deletions
diff --git a/dialog_darwin.m b/dialog_darwin.m
index d38e7af..226ad4b 100644
--- a/dialog_darwin.m
+++ b/dialog_darwin.m
@@ -9,7 +9,7 @@
#define to(T, x) ((T *) (x))
#define toNSWindow(x) to(NSWindow, (x))
-static void alert(id parent, NSString *primary, NSString *secondary, NSAlertStyle style, void *chan)
+static intptr_t alert(id parent, NSString *primary, NSString *secondary, NSAlertStyle style)
{
NSAlert *box;
@@ -21,20 +21,25 @@ 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)
- dialog_send(chan, (intptr_t) [box runModal]);
- else
+ return (intptr_t) [box runModal];
+ else {
+ NSInteger ret;
+
[box beginSheetModalForWindow:toNSWindow(parent)
modalDelegate:[NSApp delegate]
didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:)
- contextInfo:chan];
+ contextInfo:&ret];
+ // TODO
+ return (intptr_t) ret;
+ }
}
-void msgBox(id parent, id primary, id secondary, void *chan)
+void msgBox(id parent, id primary, id secondary)
{
- alert(parent, (NSString *) primary, (NSString *) secondary, NSInformationalAlertStyle, chan);
+ alert(parent, (NSString *) primary, (NSString *) secondary, NSInformationalAlertStyle);
}
-void msgBoxError(id parent, id primary, id secondary, void *chan)
+void msgBoxError(id parent, id primary, id secondary)
{
- alert(parent, (NSString *) primary, (NSString *) secondary, NSCriticalAlertStyle, chan);
+ alert(parent, (NSString *) primary, (NSString *) secondary, NSCriticalAlertStyle);
}