API  1.0.0
CPApplication Class Reference

#import <CPApplication.h>

+ Inheritance diagram for CPApplication:

Instance Methods

(void) - abortModal
 
(void) - activateIgnoringOtherApps:
 
(CPImage- applicationIconImage
 
(CPArray) - arguments
 
(CPModalSession) - beginModalSessionForWindow:
 
(void) - beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo:
 
(CPEvent- currentEvent
 
(void) - deactivate
 
(id) - delegate
 
(void) - doCommandBySelector:
 
(void) - endSheet:
 
(void) - endSheet:returnCode:
 
(void) - finishLaunching
 
(void) - hide:
 
(void) - hideOtherApplications:
 
(id) - init
 
(void) - isActive
 
(CPWindow- keyWindow
 
(CPMenu- mainMenu
 
(CPWindow- mainWindow
 
(CPWindow- modalWindow
 
(CPDictionary- namedArguments
 
(CPArray) - orderedWindows
 
(void) - orderFrontColorPanel:
 
(void) - orderFrontStandardAboutPanel:
 
(void) - orderFrontStandardAboutPanelWithOptions:
 
(void) - replyToApplicationShouldTerminate:
 
(void) - run
 
(void) - runModalForWindow:
 
(void) - runModalSession:
 
(BOOL) - sendAction:to:from:
 
(void) - sendEvent:
 
(void) - setApplicationIconImage:
 
(void) - setArguments:
 
(void) - setCallback:forNextEventMatchingMask:untilDate:inMode:dequeue:
 
(void) - setDelegate:
 
(void) - setMainMenu:
 
(void) - setMenu:
 
(void) - setTarget:selector:forNextEventMatchingMask:untilDate:inMode:dequeue:
 
(void) - setThemeBlend:
 
(void) - stopModal
 
(void) - stopModalWithCode:
 
(id) - targetForAction:
 
(id) - targetForAction:to:from:
 
(void) - terminate:
 
(CPThemeBlend- themeBlend
 
(BOOL) - tryToPerform:with:
 
(CPArray) - windows
 
(CPWindow- windowWithWindowNumber:
 
- Instance Methods inherited from CPResponder
(BOOL) - acceptsFirstResponder
 
(BOOL) - becomeFirstResponder
 
(void) - cursorUpdate:
 
(void) - encodeWithCoder:
 
(void) - flagsChanged:
 
(id) - initWithCoder:
 
(void) - insertBackTab:
 
(void) - insertLineBreak:
 
(void) - insertNewline:
 
(void) - insertTab:
 
(void) - insertText:
 
(void) - interpretKeyEvents:
 
(void) - keyDown:
 
(void) - keyUp:
 
(CPMenu- menu
 
(void) - mouseDown:
 
(void) - mouseDragged:
 
(void) - mouseEntered:
 
(void) - mouseExited:
 
(void) - mouseMoved:
 
(void) - mouseUp:
 
(CPResponder- nextResponder
 
(void) - noResponderFor:
 
(BOOL) - performKeyEquivalent:
 
(BOOL) - resignFirstResponder
 
(void) - rightMouseDown:
 
(void) - rightMouseUp:
 
(void) - scrollWheel:
 
(void) - setNextResponder:
 
(CPUndoManager- undoManager
 
- 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

(CPString+ defaultThemeName
 
(CPApplication+ sharedApplication
 
- 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

CPApplication is THE way to start up the Cappuccino framework for your application to use. Every GUI application has exactly one instance of CPApplication (or of a custom subclass of CPApplication). Your program's main() function can create that instance by calling the CPApplicationMain function. A simple example looks like this:

function main(args, namedArgs)
{
    CPApplicationMain(args, namedArgs);
}

-(void)applicationDidFinishLaunching:(CPNotification)aNotification; Sent from the notification center after the app initializes, but before receiving events.

Parameters
aNotificationcontains information about the event

-(void)applicationWillFinishLaunching:(CPNotification)aNotification; Sent from the notification center before the app is initialized.

Parameters
aNotificationcontains information about the event

Definition at line 2 of file CPApplication.h.

Method Documentation

◆ abortModal()

- (void) abortModal
implementation

Aborts the event loop started by -runModalForWindow:

Definition at line 551 of file CPApplication.j.

◆ activateIgnoringOtherApps:()

- (void) activateIgnoringOtherApps: (BOOL)  shouldIgnoreOtherApps
implementation

Definition at line 440 of file CPApplication.j.

◆ applicationIconImage()

- (CPImage) applicationIconImage
implementation

Returns the application icon image. By default this is pulled from the CPApplicationIcon key of info.plist.

Returns
CPImage - Your application icon image.

Definition at line 320 of file CPApplication.j.

◆ arguments()

- (CPArray) arguments
implementation

Returns and array of slash seperated arugments to your application. These values are pulled from your window location hash.

For exampled if your application loaded:

index.html#280north/cappuccino/issues

The follow array would be returned:

["280north", "cappuccino", "issues"]
Returns
CPArray - The array of arguments.

Definition at line 1062 of file CPApplication.j.

◆ beginModalSessionForWindow:()

- (CPModalSession) beginModalSessionForWindow: (CPWindow aWindow
implementation

Sets up a modal session with theWindow.

Parameters
aWindowthe window to set up the modal session for

Definition at line 560 of file CPApplication.j.

◆ beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo:()

- (void) beginSheet: (CPWindow aSheet
modalForWindow: (CPWindow aWindow
modalDelegate: (id)  aModalDelegate
didEndSelector: (SEL)  didEndSelector
contextInfo: (id)  contextInfo 
implementation

Displays a window as a sheet.

Parameters
aSheetthe window to display as a sheet
aWindowthe window that will hold the sheet as a child
aModalDelegate
didEndSelector
contextInfo

Definition at line 992 of file CPApplication.j.

◆ currentEvent()

- (CPEvent) currentEvent
implementation

Returns the last event recieved by your application.

Definition at line 977 of file CPApplication.j.

◆ deactivate()

- (void) deactivate
implementation

Definition at line 453 of file CPApplication.j.

◆ defaultThemeName()

+ (CPString) defaultThemeName
implementation

Definition at line 1245 of file CPApplication.j.

◆ delegate()

- (id) delegate
implementation

Returns the application's delegate. The app can only have one delegate at a time.

Definition at line 212 of file CPApplication.j.

◆ doCommandBySelector:()

- (void) doCommandBySelector: (SEL)  aSelector
implementation

If the delegate responds to the given selector it will call the method on the delegate, otherwise the method will be passed to CPResponder.

Reimplemented from CPResponder.

Definition at line 664 of file CPApplication.j.

◆ endSheet:()

- (void) endSheet: (CPWindow sheet
implementation

Ends a sheet and sends the return code "0".

Parameters
sheet- The CPWindow object (sheet) that should be dismissed.

Definition at line 1041 of file CPApplication.j.

◆ endSheet:returnCode:()

- (void) endSheet: (CPWindow sheet
returnCode: (int)  returnCode 
implementation

Ends a sheet modal. The following are predefined return codes:

CPRunStoppedResponse
CPRunAbortedResponse
CPRunContinuesResponse
Parameters
sheet- The window object (sheet) to dismiss.
returnCode- The return code to send to the delegate. You can use one of the return codes above or a custom value that you define.

Definition at line 1019 of file CPApplication.j.

◆ finishLaunching()

- (void) finishLaunching
implementation

This method is called by -run before the event loop begins. When it successfully completes, it posts the notification CPApplicationDidFinishLaunchingNotification. If you override -finishLaunching, the subclass method should invoke the superclass method.

Definition at line 223 of file CPApplication.j.

◆ hide:()

- (void) hide: (id)  aSender
implementation

Definition at line 721 of file CPApplication.j.

◆ hideOtherApplications:()

- (void) hideOtherApplications: (id)  aSender
implementation

Definition at line 471 of file CPApplication.j.

◆ init()

- (id) init
implementation

Initializes the Document based application with basic menu functions. Functions are New, Open, Undo, Redo, Save, Cut, Copy, Paste.

Returns
the initialized application

Reimplemented from CPObject.

Definition at line 129 of file CPApplication.j.

◆ isActive()

- (void) isActive
implementation

Definition at line 466 of file CPApplication.j.

◆ keyWindow()

- (CPWindow) keyWindow
implementation

Returns the key window.

Definition at line 675 of file CPApplication.j.

◆ mainMenu()

- (CPMenu) mainMenu
implementation

Returns the application's main menu

Definition at line 730 of file CPApplication.j.

◆ mainWindow()

- (CPWindow) mainWindow
implementation

Returns the main window.

Definition at line 683 of file CPApplication.j.

◆ modalWindow()

- (CPWindow) modalWindow
implementation

Returns the window for the current modal session. If there is no modal session, it returns nil.

Definition at line 589 of file CPApplication.j.

◆ namedArguments()

- (CPDictionary) namedArguments
implementation

Returns a dictionary of the window location named arguments. For example if your location was:

index.html?owner=280north&repo=cappuccino&type=issues

a CPDictionary with the keys:

owner, repo, type

and respective values:

280north, cappuccino, issues

Will be returned.

Definition at line 1149 of file CPApplication.j.

◆ orderedWindows()

- (CPArray) orderedWindows
implementation

Returns an array of visible CPWindow objects, ordered by their front to back order on the screen.

Definition at line 712 of file CPApplication.j.

◆ orderFrontColorPanel:()

- (void) orderFrontColorPanel: (id)  aSender
implementation

Opens the shared color panel.

Parameters
aSender

Definition at line 764 of file CPApplication.j.

◆ orderFrontStandardAboutPanel:()

- (void) orderFrontStandardAboutPanel: (id)  sender
implementation

Opens the standard about panel with no options.

Definition at line 335 of file CPApplication.j.

◆ orderFrontStandardAboutPanelWithOptions:()

- (void) orderFrontStandardAboutPanelWithOptions: (CPDictionary options
implementation

Opens the standard about panel. This method takes a single argument options. Options is a dictionary that can contain any of the following keys:

ApplicationName - The name of your application.
ApplicationIcon - Application icon image.
Version - The full version of your application
ApplicationVersion - The shorter version number of your application.
Copyright - Human readable copyright information.

If you choose not the include any of the above keys, they will default to the following respective keys in your info.plist file.

CPBundleName
CPApplicationIcon (through a call to -applicationIconImage, see documentation for that method for more details)
CPBundleVersion
CPBundleShortVersionString
CPHumanReadableCopyright
Parameters
options- A dictionary with the aboe listed keys. You can pass nil to default to your plist values.

Definition at line 364 of file CPApplication.j.

◆ replyToApplicationShouldTerminate:()

- (void) replyToApplicationShouldTerminate: (BOOL)  terminate
implementation

Definition at line 431 of file CPApplication.j.

◆ run()

- (void) run
implementation

Calls -finishLaunching method which results in starting the main event loop.

Definition at line 480 of file CPApplication.j.

◆ runModalForWindow:()

- (void) runModalForWindow: (CPWindow aWindow
implementation

Starts a modal event loop for aWindow

Parameters
aWindowthe window to start the event loop for

Definition at line 499 of file CPApplication.j.

◆ runModalSession:()

- (void) runModalSession: (CPModalSession)  aModalSession
implementation

Runs a modal session

Parameters
CPModalSessionthe session to run

Definition at line 569 of file CPApplication.j.

◆ sendAction:to:from:()

- (BOOL) sendAction: (SEL)  anAction
to: (id)  aTarget
from: (id)  aSender 
implementation

Sends an action to a target.

Parameters
anActionthe action to send
aTargetthe target for the action
aSenderthe action sender
Returns
YES

Definition at line 804 of file CPApplication.j.

◆ sendEvent:()

- (void) sendEvent: (CPEvent anEvent
implementation

Dispatches events to other objects.

Parameters
anEventthe event to dispatch

Definition at line 608 of file CPApplication.j.

◆ setApplicationIconImage:()

- (void) setApplicationIconImage: (CPImage anImage
implementation

Sets the applications icon image. This image is used in the default "About" window. By default this value is pulled from the CPApplicationIcon key in your info.plist file.

Parameters
anImage- The image to set.

Definition at line 311 of file CPApplication.j.

◆ setArguments:()

- (void) setArguments: (CPArray)  args
implementation

Sets the arguments of your application. That is, set the slash seperated values of an array as the window location hash.

For example if you pass an array:

["280north", "cappuccino", "issues"]

The new window location would be

index.html#280north/cappuccino/issues
Parameters
args- An array of arguments.

Definition at line 1087 of file CPApplication.j.

◆ setCallback:forNextEventMatchingMask:untilDate:inMode:dequeue:()

- (void) setCallback: (Function)  aCallback
forNextEventMatchingMask: (unsigned int)  aMask
untilDate: (CPDate anExpiration
inMode: (CPString aMode
dequeue: (BOOL)  shouldDequeue 
implementation

Fires a callback function when an event matching a given mask occurs.

If multiple callbacks are set which match the same event, later callbacks take priority over earlier callbacks, unless a new callback is set while an existing callback is being processed in which case it's given the same priority as the currently processing callback.

Parameters
aCallbackA js function to be fired. aMask An event mask for the next event.
anExpirationThe date for which this callback expires (not implemented).
inMode(not implemented).
shouldDequeueYES to remove the event from the queue after calling the callback, NO to deliver it normally.

Definition at line 947 of file CPApplication.j.

◆ setDelegate:()

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

Sets the delegate for this application. The delegate will receive various notifications caused by user interactions during the application's run. The delegate can choose to react to these events.

Parameters
aDelegatethe delegate object

Definition at line 154 of file CPApplication.j.

◆ setMainMenu:()

- (void) setMainMenu: (CPMenu aMenu
implementation

Sets the main menu for the application

Parameters
aMenuthe menu to set for the application

Definition at line 739 of file CPApplication.j.

◆ setMenu:()

- (void) setMenu: (CPMenu aMenu
implementation

Reimplemented from CPResponder.

Definition at line 744 of file CPApplication.j.

◆ setTarget:selector:forNextEventMatchingMask:untilDate:inMode:dequeue:()

- (void) setTarget: (id)  aTarget
selector: (SEL)  aSelector
forNextEventMatchingMask: (unsigned int)  aMask
untilDate: (CPDate anExpiration
inMode: (CPString aMode
dequeue: (BOOL)  shouldDequeue 
implementation

Assigns a target and action for the next event matching a given event mask. The callback method called will be passed the CPEvent when it fires.

If multiple callbacks are set which match the same event, later callbacks take priority over earlier callbacks, unless a new callback is set while an existing callback is being processed in which case it's given the same priority as the currently processing callback.

Parameters
aTargetThe target object for the callback.
aSelectorThe selector which should be called on the target object.
aMaskThe mask for a given event which should trigger the callback.
anExpirationThe date for which the callback expires (not implemented).
aMode(not implemented).
shouldDequeueYES to remove the event from the queue after calling the callback, NO to deliver it normally.

Definition at line 969 of file CPApplication.j.

◆ setThemeBlend:()

- (void) setThemeBlend: (CPThemeBlend aValue
implementation

Synthesized accessor method.

Provided by category CPApplication(CPSynthesizedAccessors).

Definition at line 1502 of file CPApplication.j.

◆ sharedApplication()

+ (CPApplication) sharedApplication
implementation

Returns the singleton instance of the running application. If it doesn't exist, it will be created, and then returned.

Returns
the application singleton

Definition at line 116 of file CPApplication.j.

◆ stopModal()

- (void) stopModal
implementation

Stops the modal event loop

Definition at line 543 of file CPApplication.j.

◆ stopModalWithCode:()

- (void) stopModalWithCode: (int)  aCode
implementation

Stops the event loop started by -runModalForWindow: and sets the code that -runModalForWindow: will return.

Parameters
aCodethe return code for the modal event

Definition at line 509 of file CPApplication.j.

◆ targetForAction:()

- (id) targetForAction: (SEL)  anAction
implementation

Looks for a target that can handle the specified action. Checks for a target in the following order:

  1. a responder from the key window
  2. a responder from the main window
  3. the CPApplication instance
  4. the application delegate
  5. the document controller
Parameters
anActionthe action to handle
Returns
a target that can respond, or nil if no match could be found

Definition at line 905 of file CPApplication.j.

◆ targetForAction:to:from:()

- (id) targetForAction: (SEL)  anAction
to: (id)  aTarget
from: (id)  aSender 
implementation

Finds a target for the specified action. If the action is nil, returns nil. If the target is not nil, aTarget is returned. Otherwise, it calls -targetForAction: to search for a target.

Parameters
anActionthe action to find a target for
aTargetif not nil, this will be returned not used
Returns
a target for the action

Definition at line 827 of file CPApplication.j.

◆ terminate:()

- (void) terminate: (id)  aSender
implementation

Definition at line 287 of file CPApplication.j.

◆ themeBlend()

- (CPThemeBlend) themeBlend
implementation

Synthesized accessor method.

Provided by category CPApplication(CPSynthesizedAccessors).

Definition at line 1494 of file CPApplication.j.

◆ tryToPerform:with:()

- (BOOL) tryToPerform: (SEL)  anAction
with: (id)  anObject 
implementation

Tries to perform the action with an argument. Performs the action on itself (if it responds to it), then tries to perform the action on the delegate.

Parameters
anActionthe action to perform.
anObjectthe argument for the action method
Returns
YES if the action was performed

Reimplemented from CPResponder.

Definition at line 779 of file CPApplication.j.

◆ windows()

- (CPArray) windows
implementation

Returns an array of the application's CPWindows

Definition at line 703 of file CPApplication.j.

◆ windowWithWindowNumber:()

- (CPWindow) windowWithWindowNumber: (int)  aWindowNumber
implementation

Returns the CPWindow object corresponding to aWindowNumber.

Definition at line 691 of file CPApplication.j.


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