author | bjarni |
Sat, 10 Dec 2005 23:03:59 +0000 | |
changeset 2741 | 65d4de069014 |
parent 2736 | 3d6487cbbb69 |
child 2827 | 12c9eda7edcd |
permissions | -rw-r--r-- |
2188
640a0a5f77ea
(svn r2703) - Feature: [OSX] Added a native alert window to show whatever error() needs to print (Tobin made this, while I fixed some issued in it)
bjarni
parents:
diff
changeset
|
1 |
#include <AppKit/AppKit.h> |
640a0a5f77ea
(svn r2703) - Feature: [OSX] Added a native alert window to show whatever error() needs to print (Tobin made this, while I fixed some issued in it)
bjarni
parents:
diff
changeset
|
2 |
|
640a0a5f77ea
(svn r2703) - Feature: [OSX] Added a native alert window to show whatever error() needs to print (Tobin made this, while I fixed some issued in it)
bjarni
parents:
diff
changeset
|
3 |
/* |
640a0a5f77ea
(svn r2703) - Feature: [OSX] Added a native alert window to show whatever error() needs to print (Tobin made this, while I fixed some issued in it)
bjarni
parents:
diff
changeset
|
4 |
* This file contains objective C |
640a0a5f77ea
(svn r2703) - Feature: [OSX] Added a native alert window to show whatever error() needs to print (Tobin made this, while I fixed some issued in it)
bjarni
parents:
diff
changeset
|
5 |
* Apple uses objective C instead of plain C to interact with OS specific/native functions |
640a0a5f77ea
(svn r2703) - Feature: [OSX] Added a native alert window to show whatever error() needs to print (Tobin made this, while I fixed some issued in it)
bjarni
parents:
diff
changeset
|
6 |
* |
640a0a5f77ea
(svn r2703) - Feature: [OSX] Added a native alert window to show whatever error() needs to print (Tobin made this, while I fixed some issued in it)
bjarni
parents:
diff
changeset
|
7 |
* Note: TrueLight's crosscompiler can handle this, but it likely needs a manual modification for each change in this file. |
640a0a5f77ea
(svn r2703) - Feature: [OSX] Added a native alert window to show whatever error() needs to print (Tobin made this, while I fixed some issued in it)
bjarni
parents:
diff
changeset
|
8 |
* To insure that the crosscompiler still works, let him try any changes before they are committed |
640a0a5f77ea
(svn r2703) - Feature: [OSX] Added a native alert window to show whatever error() needs to print (Tobin made this, while I fixed some issued in it)
bjarni
parents:
diff
changeset
|
9 |
*/ |
640a0a5f77ea
(svn r2703) - Feature: [OSX] Added a native alert window to show whatever error() needs to print (Tobin made this, while I fixed some issued in it)
bjarni
parents:
diff
changeset
|
10 |
|
640a0a5f77ea
(svn r2703) - Feature: [OSX] Added a native alert window to show whatever error() needs to print (Tobin made this, while I fixed some issued in it)
bjarni
parents:
diff
changeset
|
11 |
void ShowMacDialog ( const char *title, const char *message, const char *buttonLabel ) |
640a0a5f77ea
(svn r2703) - Feature: [OSX] Added a native alert window to show whatever error() needs to print (Tobin made this, while I fixed some issued in it)
bjarni
parents:
diff
changeset
|
12 |
{ |
640a0a5f77ea
(svn r2703) - Feature: [OSX] Added a native alert window to show whatever error() needs to print (Tobin made this, while I fixed some issued in it)
bjarni
parents:
diff
changeset
|
13 |
NSRunAlertPanel([NSString stringWithCString: title], [NSString stringWithCString: message], [NSString stringWithCString: buttonLabel], nil, nil); |
640a0a5f77ea
(svn r2703) - Feature: [OSX] Added a native alert window to show whatever error() needs to print (Tobin made this, while I fixed some issued in it)
bjarni
parents:
diff
changeset
|
14 |
} |
640a0a5f77ea
(svn r2703) - Feature: [OSX] Added a native alert window to show whatever error() needs to print (Tobin made this, while I fixed some issued in it)
bjarni
parents:
diff
changeset
|
15 |
|
2223
b9564d70ec3d
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2188
diff
changeset
|
16 |
void ShowMacAssertDialog ( const char *function, const char *file, const int line, const char *expression ) |
b9564d70ec3d
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2188
diff
changeset
|
17 |
{ |
2736
3d6487cbbb69
(svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
2223
diff
changeset
|
18 |
const char *buffer = |
2223
b9564d70ec3d
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2188
diff
changeset
|
19 |
[[NSString stringWithFormat:@"An assertion has failed and OpenTTD must quit.\n%s in %s (line %d)\n\"%s\"\n\nYou should report this error the OpenTTD developers if you think you found a bug.", |
2741
65d4de069014
(svn r3286) -Fix: [OSX] 10.2 works again and universal binaries got 10.2 as target by default
bjarni
parents:
2736
diff
changeset
|
20 |
function, file, line, expression] cString]; |
2223
b9564d70ec3d
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2188
diff
changeset
|
21 |
NSLog(@"%s", buffer); |
b9564d70ec3d
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2188
diff
changeset
|
22 |
ShowMacDialog( "Assertion Failed", buffer, "Quit" ); |
2736
3d6487cbbb69
(svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
2223
diff
changeset
|
23 |
|
2223
b9564d70ec3d
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2188
diff
changeset
|
24 |
// abort so that a debugger has a chance to notice |
b9564d70ec3d
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2188
diff
changeset
|
25 |
abort(); |
b9564d70ec3d
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2188
diff
changeset
|
26 |
} |