summaryrefslogtreecommitdiff
path: root/dialog_darwin.m
blob: 7bd7a8fe0e691c84846924ca97314f3543d267ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// 15 may 2014

#include "objc_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);
}