1 /** <title>NSAlert</title> 2 3 <abstract>Encapsulate an alert panel</abstract> 4 5 Copyright <copy>(C) 2004 Free Software Foundation, Inc.</copy> 6 7 Author: Fred Kiefer <FredKiefer@gmx.de> 8 Date: July 2004 9 10 This file is part of the GNUstep GUI Library. 11 12 This library is free software; you can redistribute it and/or 13 modify it under the terms of the GNU Lesser General Public 14 License as published by the Free Software Foundation; either 15 version 2 of the License, or (at your option) any later version. 16 17 This library is distributed in the hope that it will be useful, 18 but WITHOUT ANY WARRANTY; without even the implied warranty of 19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 Lesser General Public License for more details. 21 22 You should have received a copy of the GNU Lesser General Public 23 License along with this library; see the file COPYING.LIB. 24 If not, see <http://www.gnu.org/licenses/> or write to the 25 Free Software Foundation, 51 Franklin Street, Fifth Floor, 26 Boston, MA 02110-1301, USA. 27 */ 28 29 #ifndef _GNUstep_H_NSAlert 30 #define _GNUstep_H_NSAlert 31 #import <GNUstepBase/GSVersionMacros.h> 32 33 #import <Foundation/NSObject.h> 34 35 @class NSArray; 36 @class NSError; 37 @class NSString; 38 @class NSMutableArray; 39 @class NSButton; 40 @class NSImage; 41 @class NSWindow; 42 43 #if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST) 44 45 enum _NSAlertStyle { 46 NSWarningAlertStyle = 0, 47 NSInformationalAlertStyle = 1, 48 NSCriticalAlertStyle = 2 49 }; 50 typedef NSUInteger NSAlertStyle; 51 52 enum { 53 NSAlertFirstButtonReturn = 1000, 54 NSAlertSecondButtonReturn = 1001, 55 NSAlertThirdButtonReturn = 1002 56 }; 57 58 @interface NSAlert : NSObject 59 { 60 @private 61 NSString *_informative_text; 62 NSString *_message_text; 63 NSImage *_icon; 64 NSMutableArray *_buttons; 65 NSString *_help_anchor; 66 NSWindow *_window; 67 id _delegate; 68 NSAlertStyle _style; 69 BOOL _shows_help; 70 id _modalDelegate; 71 SEL _didEndSelector; 72 NSInteger _result; 73 } 74 75 #if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST) 76 + (NSAlert *) alertWithError: (NSError *)error; 77 #endif 78 + (NSAlert *) alertWithMessageText: (NSString *)messageTitle 79 defaultButton: (NSString *)defaultButtonTitle 80 alternateButton: (NSString *)alternateButtonTitle 81 otherButton: (NSString *)otherButtonTitle 82 informativeTextWithFormat: (NSString *)format, ...; 83 84 85 - (NSButton *) addButtonWithTitle: (NSString *)aTitle; 86 - (NSAlertStyle) alertStyle; 87 - (void) beginSheetModalForWindow: (NSWindow *)window 88 modalDelegate: (id)delegate 89 didEndSelector: (SEL)didEndSelector 90 contextInfo: (void *)contextInfo; 91 - (NSArray *) buttons; 92 - (id) delegate; 93 - (NSString *) helpAnchor; 94 - (NSImage *) icon; 95 - (NSString *) informativeText; 96 - (NSString *) messageText; 97 - (NSInteger) runModal; 98 - (void) setAlertStyle: (NSAlertStyle)style; 99 - (void) setDelegate: (id)delegate; 100 - (void) setHelpAnchor: (NSString *)anchor; 101 - (void) setIcon: (NSImage *)icon; 102 - (void) setInformativeText: (NSString *)informativeText; 103 - (void) setMessageText: (NSString *)messageText; 104 - (void) setShowsHelp: (BOOL)showsHelp; 105 - (BOOL) showsHelp; 106 - (id) window; 107 108 @end 109 110 111 /* 112 * Implemented by the delegate 113 */ 114 115 #if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) 116 @protocol NSAlertDelegate <NSObject> 117 #if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST) && GS_PROTOCOLS_HAVE_OPTIONAL 118 @optional 119 #else 120 @end 121 @interface NSObject (NSAlertDelegate) 122 #endif 123 - (BOOL) alertShowHelp: (NSAlert *)alert; 124 @end 125 #endif 126 127 #endif /* MAC_OS_X_VERSION_10_3 */ 128 #endif /* _GNUstep_H_NSAlert */ 129