![]() |
API 0.9.5
|
#import <CPAlert.h>
Inheritance diagram for CPAlert:Instance Methods | |
| (CPView) | - accessoryView |
| (void) | - addButtonWithTitle: |
| (CPAlertStyle) | - alertStyle |
| (void) | - beginSheetModalForWindow: |
| (void) | - beginSheetModalForWindow:modalDelegate:didEndSelector:contextInfo: |
| (CPArray) | - buttons |
| (id) | - delegate |
| (CPImage) | - icon |
| (CPString) | - informativeText |
| (id) | - init |
| (void) | - layout |
| (CPString) | - messageText |
| (void) | - runModal |
| (void) | - setAccessoryView: |
| (void) | - setAlertStyle: |
| (void) | - setDelegate: |
| (void) | - setIcon: |
| (void) | - setInformativeText: |
| (void) | - setMessageText: |
| (void) | - setShowsHelp: |
| (void) | - setShowsSuppressionButton: |
| (void) | - setTheme: |
| (void) | - setTitle: |
| (void) | - setWindowStyle: |
| (BOOL) | - showsHelp |
| (BOOL) | - showsSuppressionButton |
| (CPCheckBox) | - suppressionButton |
| (CPString) | - title |
| (CPWindow) | - window |
| (int) | - windowStyle |
Class Methods | |
| (CPAlert) | + alertWithError: |
| (CPAlert) | + alertWithMessageText:defaultButton:alternateButton:otherButton:informativeTextWithFormat: |
| (CPString) | + defaultThemeClass |
| (id) | + themeAttributes |
CPAlert is an alert panel that can be displayed modally to present the user with a message and one or more options.
It can be used to display an information message CPInformationalAlertStyle, a warning message CPWarningAlertStyle (the default), or a critical alert CPCriticalAlertStyle. In each case the user can be presented with one or more options by adding buttons using the -addButtonWithTitle: method.
The panel is displayed modally by calling -runModal and once the user has dismissed the panel, a message will be sent to the panel's delegate (if set), informing it which button was clicked (see delegate methods).
-(void)alertDidEnd:(CPAlert)theAlert returnCode:(int)returnCode; Called when the user dismisses the alert by clicking one of the buttons.
| theAlert | the alert panel that the user dismissed |
| returnCode | the index of the button that the user clicked (starting from 0, representing the first button added to the alert which appears on the right, 1 representing the next button to the left and so on) |
| - (void) addButtonWithTitle: | (CPString) | aTitle |
Adds a button with a given title to the receiver. Buttons will be added starting from the right hand side of the CPAlert panel. The first button will have the index 0, the second button 1 and so on.
The first button will automatically be given a key equivalent of Return, and any button titled "Cancel" will be given a key equivalent of Escape.
You really shouldn't need more than 3 buttons.
| title | the title of the button |
| + (CPAlert) alertWithMessageText: | (CPString) | aMessage | |
| defaultButton: | (CPString) | defaultButtonTitle | |
| alternateButton: | (CPString) | alternateButtonTitle | |
| otherButton: | (CPString) | otherButtonTitle | |
| informativeTextWithFormat: | (CPString) | informativeText | |
Returns a CPAlert object with the provided info
| aMessage | the main body text of the alert |
| defaultButton | the title of the default button |
| alternateButton | if not nil, the title of a second button |
| otherButton | if not nil, the title of the third button |
| informativeText | if not nil the informative text of the alert |
| - (void) beginSheetModalForWindow: | (CPWindow) | aWindow |
| - (void) beginSheetModalForWindow: | (CPWindow) | aWindow | |
| modalDelegate: | (id) | modalDelegate | |
| didEndSelector: | (SEL) | alertDidEndSelector | |
| contextInfo: | (id) | contextInfo | |
Runs the receiver modally as an alert sheet attached to a specified window.
| window | The parent window for the sheet. |
| modalDelegate | The delegate for the modal-dialog session. |
| alertDidEndSelector | Message the alert sends to modalDelegate after the sheet is dismissed. |
| contextInfo | Contextual data passed to modalDelegate in didEndSelector message. |
| - (CPString) informativeText |
| - (id) init |
| - (CPString) messageText |
| - (void) runModal |
| - (void) setAccessoryView: | (CPView) | aValue |
| - (void) setAlertStyle: | (CPAlertStyle) | aValue |
| - (void) setDelegate: | (id) | aValue |
| - (void) setIcon: | (CPImage) | aValue |
| - (void) setInformativeText: | (CPString) | aText |
| - (void) setMessageText: | (CPString) | aText |
| - (void) setShowsHelp: | (BOOL) | aValue |
| - (void) setShowsSuppressionButton: | (BOOL) | aValue |
| - (void) setTheme: | (CPTheme) | aTheme |
| - (void) setTitle: | (CPString) | aValue |
| - (void) setWindowStyle: | (int) | aStyle |
| - (BOOL) showsSuppressionButton |
| - (CPCheckBox) suppressionButton |
| - (CPWindow) window |
| - (int) windowStyle |