Using Alert Panels(Chapter 15 of Cocoa Programming for Mac OS X)
The NSRunAlertPanel() function returns an int that indicates which button the user clicked. There are global variables for these constants: NSAlertDefaultReturn, NSAlertAlternateReturn, and NSAlertOtherReturn.
int NSRunAlertPanel(NSString *title, NSString *msg,
NSString *defaultButton, NSString *alternateButton,
NSString *otherButton, ...);