API 0.9.5
CPAlert Class Reference

#import <CPAlert.h>

Inheritance diagram for CPAlert:

List of all members.

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

Detailed Description

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.

Parameters:
theAlertthe alert panel that the user dismissed
returnCodethe 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)

Definition at line 2 of file CPAlert.h.


Method Documentation

- (CPView) accessoryView

Synthesized accessor method.

Definition at line 767 of file CPAlert.j.

- (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.

Parameters:
titlethe title of the button

Definition at line 298 of file CPAlert.j.

- (CPAlertStyle) alertStyle

Synthesized accessor method.

Definition at line 735 of file CPAlert.j.

+ (CPAlert) alertWithError: (CPString anErrorMessage

Return an CPAlert with type error

Parameters:
anErrorMessagethe message of the alert
Returns:
fully initialized CPAlert

Definition at line 133 of file CPAlert.j.

+ (CPAlert) alertWithMessageText: (CPString aMessage
defaultButton: (CPString defaultButtonTitle
alternateButton: (CPString alternateButtonTitle
otherButton: (CPString otherButtonTitle
informativeTextWithFormat: (CPString informativeText 

Returns a CPAlert object with the provided info

Parameters:
aMessagethe main body text of the alert
defaultButtonthe title of the default button
alternateButtonif not nil, the title of a second button
otherButtonif not nil, the title of the third button
informativeTextif not nil the informative text of the alert
Returns:
fully initialized CPAlert

Definition at line 108 of file CPAlert.j.

- (void) beginSheetModalForWindow: (CPWindow aWindow

Runs the receiver modally as an alert sheet attached to a specified window.

Parameters:
windowThe parent window for the sheet.

Definition at line 572 of file CPAlert.j.

- (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.

Parameters:
windowThe parent window for the sheet.
modalDelegateThe delegate for the modal-dialog session.
alertDidEndSelectorMessage the alert sends to modalDelegate after the sheet is dismissed.
contextInfoContextual data passed to modalDelegate in didEndSelector message.

Definition at line 551 of file CPAlert.j.

- (CPArray) buttons

Synthesized accessor method.

Definition at line 799 of file CPAlert.j.

+ (CPString) defaultThemeClass

Reimplemented from CPView.

Definition at line 651 of file CPAlert.j.

- (id) delegate

Synthesized accessor method.

Definition at line 815 of file CPAlert.j.

- (CPImage) icon

Synthesized accessor method.

Definition at line 783 of file CPAlert.j.

- (CPString) informativeText

return the content of the message text

Returns:
CPString containing the message text

Definition at line 246 of file CPAlert.j.

- (id) init

Initializes a CPAlert panel with the default alert style CPWarningAlertStyle.

Reimplemented from CPView.

Definition at line 146 of file CPAlert.j.

- (void) layout

Definition at line 472 of file CPAlert.j.

- (CPString) messageText

return the content of the message text

Returns:
CPString containing the message text

Definition at line 225 of file CPAlert.j.

- (void) runModal

Displays the CPAlert panel as a modal dialog. The user will not be able to interact with any other controls until s/he has dismissed the alert by clicking on one of the buttons.

Definition at line 531 of file CPAlert.j.

- (void) setAccessoryView: (CPView aValue

set the accessory view

Parameters:
aViewthe accessory view

Synthesized accessor method.

Definition at line 267 of file CPAlert.j.

- (void) setAlertStyle: (CPAlertStyle)  aValue

Synthesized accessor method.

Definition at line 743 of file CPAlert.j.

- (void) setDelegate: (id)  aValue

Synthesized accessor method.

Definition at line 823 of file CPAlert.j.

- (void) setIcon: (CPImage aValue

Synthesized accessor method.

Definition at line 791 of file CPAlert.j.

- (void) setInformativeText: (CPString aText

set the text of the alert's informative text

Parameters:
aTextCPString containing the informative text

Definition at line 235 of file CPAlert.j.

- (void) setMessageText: (CPString aText

set the text of the alert's message

Parameters:
aTextCPString containing the text

Definition at line 215 of file CPAlert.j.

- (void) setShowsHelp: (BOOL)  aValue

Synthesized accessor method.

Definition at line 711 of file CPAlert.j.

- (void) setShowsSuppressionButton: (BOOL)  aValue

set if alert shows the suppression button

Parameters:
shouldShowSuppressionButtonYES or NO

Synthesized accessor method.

Definition at line 278 of file CPAlert.j.

- (void) setTheme: (CPTheme aTheme

set the theme to use

Parameters:
thetheme to use

Reimplemented from CPView.

Definition at line 178 of file CPAlert.j.

- (void) setTitle: (CPString aValue

Sets the title of the alert window. This API is not present in Cocoa.

Parameters:
aTitleCPString containing the window title

Synthesized accessor method.

Definition at line 256 of file CPAlert.j.

- (void) setWindowStyle: (int)  aStyle
Deprecated:

Definition at line 195 of file CPAlert.j.

- (BOOL) showsHelp

Synthesized accessor method.

Definition at line 703 of file CPAlert.j.

- (BOOL) showsSuppressionButton

Synthesized accessor method.

Definition at line 719 of file CPAlert.j.

- (CPCheckBox) suppressionButton

Synthesized accessor method.

Definition at line 807 of file CPAlert.j.

+ (id) themeAttributes

Reimplemented from CPView.

Definition at line 656 of file CPAlert.j.

- (CPString) title

Synthesized accessor method.

Definition at line 751 of file CPAlert.j.

- (CPWindow) window

Synthesized accessor method.

Reimplemented from CPView.

Definition at line 831 of file CPAlert.j.

- (int) windowStyle
Deprecated:

Definition at line 203 of file CPAlert.j.


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Defines