API  1.0.0
CPAlert Class Reference

#import <CPAlert.h>

+ Inheritance diagram for CPAlert:

Instance Methods

(id< CPAlertDelegate > _delegate) - accessors
 
(CPView- accessoryView
 
(void) - addButtonWithTitle:
 
(CPAlertStyle) - alertStyle
 
(void) - beginSheetModalForWindow:
 
(void) - beginSheetModalForWindow:didEndBlock:
 
(void) - beginSheetModalForWindow:modalDelegate:didEndSelector:contextInfo:
 
(CPArray) - buttons
 
(SEL) - didEndSelector
 
(CPImage- icon
 
(CPString- informativeText
 
(id) - init
 
(void) - layout
 
(CPString- messageText
 
(void) - runModal
 
(void) - runModalWithDidEndBlock:
 
(void) - setAccessoryView:
 
(void) - setAlertStyle:
 
(void) - setDelegate:
 
(void) - setDidEndSelector:
 
(void) - setIcon:
 
(void) - setInformativeText:
 
(void) - setMessageText:
 
(void) - setShowsHelp:
 
(void) - setShowsSuppressionButton:
 
(void) - setTheme:
 
(void) - setTitle:
 
(void) - setValue:forThemeAttribute:
 
(void) - setValue:forThemeAttribute:inState:
 
(void) - setWindowStyle:
 
(BOOL) - showsHelp
 
(BOOL) - showsSuppressionButton
 
(CPCheckBox- suppressionButton
 
(CPTheme- theme
 
(_CPAlertThemeView) - themeView
 
(CPString- title
 
(CPWindow- window
 
(int) - windowStyle
 
- Instance Methods inherited from CPObject
(void) - addObserver:forKeyPath:options:context:
 
(void) - applyChange:toKeyPath:
 
(id) - autorelease
 
(id) - awakeAfterUsingCoder:
 
(void) - awakeFromCib
 
(void) - bind:toObject:withKeyPath:options:
 
(Class) - classForCoder
 
(Class) - classForKeyedArchiver
 
(CPString- className
 
(id) - copy
 
(void) - dealloc
 
(CPString- description
 
(CPDictionary- dictionaryWithValuesForKeys:
 
(void) - didChange:valuesAtIndexes:forKey:
 
(void) - didChangeValueForKey:
 
(void) - didChangeValueForKey:withSetMutation:usingObjects:
 
(void) - doesNotRecognizeSelector:
 
(CPArray) - exposedBindings
 
(id) - forwardingTargetForSelector:
 
(void) - forwardInvocation:
 
(unsigned) - hash
 
(BOOL) - implementsSelector:
 
(CPDictionary- infoForBinding:
 
(BOOL) - isEqual:
 
(BOOL) - isKindOfClass:
 
(BOOL) - isMemberOfClass:
 
(BOOL) - isProxy
 
(IMP) - methodForSelector:
 
(CPMethodSignature) - methodSignatureForSelector:
 
(id) - mutableArrayValueForKey:
 
(id) - mutableArrayValueForKeyPath:
 
(id) - mutableCopy
 
(id) - mutableSetValueForKey:
 
(id) - mutableSetValueForKeyPath:
 
(id) - performSelector:
 
(id) - performSelector:withObject:
 
(void) - performSelector:withObject:afterDelay:
 
(void) - performSelector:withObject:afterDelay:inModes:
 
(id) - performSelector:withObject:withObject:
 
(id) - performSelector:withObjects:
 
(void) - release
 
(void) - removeObserver:forKeyPath:
 
(id) - replacementObjectForArchiver:
 
(id) - replacementObjectForCoder:
 
(id) - replacementObjectForKeyedArchiver:
 
(BOOL) - respondsToSelector:
 
(id) - retain
 
(id) - self
 
(void) - setValue:forKey:
 
(void) - setValue:forKeyPath:
 
(void) - setValue:forUndefinedKey:
 
(void) - setValuesForKeysWithDictionary:
 
(CPString- UID
 
(void) - unbind:
 
(Class) - valueClassForBinding:
 
(id) - valueForKey:
 
(id) - valueForKeyPath:
 
(id) - valueForUndefinedKey:
 
(void) - willChange:valuesAtIndexes:forKey:
 
(void) - willChangeValueForKey:
 
(void) - willChangeValueForKey:withSetMutation:usingObjects:
 

Class Methods

(CPAlert+ alertWithError:
 
(CPAlert+ alertWithMessageText:defaultButton:alternateButton:otherButton:informativeTextWithFormat:
 
- Class Methods inherited from CPObject
(BOOL) + accessInstanceVariablesDirectly
 
(id) + alloc
 
(id) + allocWithCoder:
 
(BOOL) + automaticallyNotifiesObserversForKey:
 
(void) + cancelPreviousPerformRequestsWithTarget:
 
(void) + cancelPreviousPerformRequestsWithTarget:selector:object:
 
(Class) + class
 
(BOOL) + conformsToProtocol:
 
(void) + exposeBinding:
 
(void) + initialize
 
(IMP) + instanceMethodForSelector:
 
(BOOL) + instancesImplementSelector:
 
(BOOL) + instancesRespondToSelector:
 
(BOOL) + isBindingExclusive:
 
(BOOL) + isSubclassOfClass:
 
(CPSet) + keyPathsForValuesAffectingValueForKey:
 
(void) + load
 
(id) + new
 
(void) + object:performSelector:withObject:afterDelay:inModes:
 
(void) + setVersion:
 
(Class) + superclass
 
(int) + version
 

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

◆ accessors()

- (id< CPAlertDelegate > _delegate) accessors (property)  = delegate
implementation

◆ accessoryView()

- (CPView) accessoryView
implementation

Synthesized accessor method.

Provided by category CPAlert(CPSynthesizedAccessors).

Definition at line 925 of file CPAlert.j.

◆ addButtonWithTitle:()

- (void) addButtonWithTitle: (CPString aTitle
implementation

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 409 of file CPAlert.j.

◆ alertStyle()

- (CPAlertStyle) alertStyle
implementation

Synthesized accessor method.

Provided by category CPAlert(CPSynthesizedAccessors).

Definition at line 893 of file CPAlert.j.

◆ alertWithError:()

+ (CPAlert) alertWithError: (CPString anErrorMessage
implementation

Return an CPAlert with type error

Parameters
anErrorMessagethe message of the alert
Returns
fully initialized CPAlert

Definition at line 202 of file CPAlert.j.

◆ alertWithMessageText:defaultButton:alternateButton:otherButton:informativeTextWithFormat:()

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

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 177 of file CPAlert.j.

◆ beginSheetModalForWindow:()

- (void) beginSheetModalForWindow: (CPWindow aWindow
implementation

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

Parameters
windowThe parent window for the sheet.

Definition at line 716 of file CPAlert.j.

◆ beginSheetModalForWindow:didEndBlock:()

- (void) beginSheetModalForWindow: (CPWindow aWindow
didEndBlock: (Function /*(CPAlert alert, int returnCode)*/)  block 
implementation

Runs the receiver modally as an alert sheet attached to a specified window. Executes the code in block when the alert is dismissed.

Parameters
windowThe parent window for the sheet.
blockCode block to execute on dismissal

Definition at line 728 of file CPAlert.j.

◆ beginSheetModalForWindow:modalDelegate:didEndSelector:contextInfo:()

- (void) beginSheetModalForWindow: (CPWindow aWindow
modalDelegate: (id)  modalDelegate
didEndSelector: (SEL)  alertDidEndSelector
contextInfo: (id)  contextInfo 
implementation

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 695 of file CPAlert.j.

◆ buttons()

- (CPArray) buttons
implementation

Synthesized accessor method.

Provided by category CPAlert(CPSynthesizedAccessors).

Definition at line 957 of file CPAlert.j.

◆ didEndSelector()

- (SEL) didEndSelector
implementation

Synthesized accessor method.

Provided by category CPAlert(CPSynthesizedAccessors).

Definition at line 973 of file CPAlert.j.

◆ icon()

- (CPImage) icon
implementation

Synthesized accessor method.

Provided by category CPAlert(CPSynthesizedAccessors).

Definition at line 941 of file CPAlert.j.

◆ informativeText()

- (CPString) informativeText
implementation

return the content of the message text

Returns
CPString containing the message text

Definition at line 356 of file CPAlert.j.

◆ init()

- (id) init
implementation

Initializes a CPAlert panel with the default alert style CPWarningAlertStyle.

Reimplemented from CPObject.

Definition at line 215 of file CPAlert.j.

◆ layout()

- (void) layout
implementation

Definition at line 599 of file CPAlert.j.

◆ messageText()

- (CPString) messageText
implementation

Return the content of the message text.

Returns
CPString containing the message text

Definition at line 335 of file CPAlert.j.

◆ runModal()

- (void) runModal
implementation

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 664 of file CPAlert.j.

◆ runModalWithDidEndBlock:()

- (void) runModalWithDidEndBlock: (Function /*(CPAlert alert, int returnCode)*/)  block
implementation

The same as runModal, but executes the code in block when the alert is dismissed.

Definition at line 680 of file CPAlert.j.

◆ setAccessoryView:()

- (void) setAccessoryView: (CPView aView
implementation

Set the accessory view.

Parameters
aViewthe accessory view

Provided by category CPAlert(CPSynthesizedAccessors).

Definition at line 378 of file CPAlert.j.

◆ setAlertStyle:()

- (void) setAlertStyle: (CPAlertStyle)  aValue
implementation

Synthesized accessor method.

Provided by category CPAlert(CPSynthesizedAccessors).

Definition at line 901 of file CPAlert.j.

◆ setDelegate:()

- (void) setDelegate: (id <CPAlertDelegate>)  aDelegate
implementation

Set the delegate of the receiver

Parameters
aDelegatethe delegate object for the alert.

Definition at line 249 of file CPAlert.j.

◆ setDidEndSelector:()

- (void) setDidEndSelector: (SEL)  aValue
implementation

Synthesized accessor method.

Provided by category CPAlert(CPSynthesizedAccessors).

Definition at line 981 of file CPAlert.j.

◆ setIcon:()

- (void) setIcon: (CPImage aValue
implementation

Synthesized accessor method.

Provided by category CPAlert(CPSynthesizedAccessors).

Definition at line 949 of file CPAlert.j.

◆ setInformativeText:()

- (void) setInformativeText: (CPString text
implementation

Set the text of the alert's informative text.

Parameters
aTextCPString containing the informative text

Definition at line 345 of file CPAlert.j.

◆ setMessageText:()

- (void) setMessageText: (CPString text
implementation

Set the text of the alert's message.

Parameters
aTextCPString containing the text

Definition at line 324 of file CPAlert.j.

◆ setShowsHelp:()

- (void) setShowsHelp: (BOOL)  aValue
implementation

Synthesized accessor method.

Provided by category CPAlert(CPSynthesizedAccessors).

Definition at line 869 of file CPAlert.j.

◆ setShowsSuppressionButton:()

- (void) setShowsSuppressionButton: (BOOL)  shouldShowSuppressionButton
implementation

Set if the alert shows the suppression button.

Parameters
shouldShowSuppressionButtonYES or NO

Provided by category CPAlert(CPSynthesizedAccessors).

Definition at line 389 of file CPAlert.j.

◆ setTheme:()

- (void) setTheme: (CPTheme aTheme
implementation

set the theme to use

Parameters
thetheme to use

Definition at line 277 of file CPAlert.j.

◆ setTitle:()

- (void) setTitle: (CPString aTitle
implementation

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

Parameters
aTitleCPString containing the window title

Provided by category CPAlert(CPSynthesizedAccessors).

Definition at line 367 of file CPAlert.j.

◆ setValue:forThemeAttribute:()

- (void) setValue: (id)  aValue
forThemeAttribute: (CPString aName 
implementation

Definition at line 292 of file CPAlert.j.

◆ setValue:forThemeAttribute:inState:()

- (void) setValue: (id)  aValue
forThemeAttribute: (CPString aName
inState: (ThemeState aState 
implementation

Definition at line 297 of file CPAlert.j.

◆ setWindowStyle:()

- (void) setWindowStyle: (int)  style
implementation
Deprecated:

Definition at line 304 of file CPAlert.j.

◆ showsHelp()

- (BOOL) showsHelp
implementation

Synthesized accessor method.

Provided by category CPAlert(CPSynthesizedAccessors).

Definition at line 861 of file CPAlert.j.

◆ showsSuppressionButton()

- (BOOL) showsSuppressionButton
implementation

Synthesized accessor method.

Provided by category CPAlert(CPSynthesizedAccessors).

Definition at line 877 of file CPAlert.j.

◆ suppressionButton()

- (CPCheckBox) suppressionButton
implementation

Synthesized accessor method.

Provided by category CPAlert(CPSynthesizedAccessors).

Definition at line 965 of file CPAlert.j.

◆ theme()

- (CPTheme) theme
implementation

Definition at line 267 of file CPAlert.j.

◆ themeView()

- (_CPAlertThemeView) themeView
implementation

Synthesized accessor method.

Provided by category CPAlert(CPSynthesizedAccessors).

Definition at line 989 of file CPAlert.j.

◆ title()

- (CPString) title
implementation

Synthesized accessor method.

Provided by category CPAlert(CPSynthesizedAccessors).

Definition at line 909 of file CPAlert.j.

◆ window()

- (CPWindow) window
implementation

Synthesized accessor method.

Provided by category CPAlert(CPSynthesizedAccessors).

Definition at line 997 of file CPAlert.j.

◆ windowStyle()

- (int) windowStyle
implementation
Deprecated:

Definition at line 312 of file CPAlert.j.


The documentation for this class was generated from the following files: