![]() |
API 0.9.5
|
#import <CPWindow.h>
An CPWindow instance represents a window, panel or menu on the screen.
Each window has a style, which determines how the window is decorated; whether it has a border, a title bar, a resize bar, minimise and close buttons.
A window has a frame. This is the frame of the entire window on the screen, including all decorations and borders. The origin of the frame represents its bottom left corner and the frame is expressed in screen coordinates.
A window always contains a content view which is the highest level view available for public (application) use. This view fills the area of the window inside any decoration/border. This is the only part of the window that application programmers are allowed to draw in directly.
You can convert between view coordinates and window base coordinates using the [CPView -convertPoint:fromView:], [CPView -convertPoint:toView:], [CPView -convertRect:fromView:], and [CPView -convertRect:toView:] methods with a nil view argument.
-(void)windowDidResize:(CPNotification)notification; Sent from the notification center when the window has been resized.
notification | contains information about the resize event |
-(CPUndoManager)windowWillReturnUndoManager:(CPWindow)window; Called to obtain the undo manager for a window
window | the window for which to return the undo manager |
-(void)windowDidBecomeMain:(CPNotification)notification; Sent from the notification center when the delegate's window becomes the main window.
notification | contains information about the event |
-(void)windowDidResignMain:(CPNotification)notification; Sent from the notification center when the delegate's window has resigned main window status.
notification | contains information about the event |
-(void)windowDidResignKey:(CPNotification)notification; Sent from the notification center when the delegate's window has resigned key window status.
notification | contains information about the event |
-(BOOL)windowShouldClose:(id)window; Called when the user tries to close the window.
window | the window to close |
YES
allows the window to close. NO
vetoes the close operation and leaves the window open. Definition at line 480 of file CPDragServer.j.
- (BOOL) acceptsFirstResponder |
Returns YES
if the receiver is able to become the first responder. NO
otherwise.
Reimplemented from CPResponder.
Definition at line 1276 of file CPWindow.j.
- (BOOL) acceptsMouseMovedEvents |
Definition at line 1326 of file CPWindow.j.
- (float) alphaValue |
Returns the alpha value of the window.
Definition at line 981 of file CPWindow.j.
- (void) animationDidEnd: | (id) | anim |
Definition at line 2290 of file CPWindow.j.
- (CPTimeInterval) animationResizeTime: | (CGRect) | newWindowFrame |
Definition at line 2212 of file CPWindow.j.
- (CPWindow) attachedSheet |
Returns the window's attached sheet.
Definition at line 2361 of file CPWindow.j.
- (BOOL) autorecalculatesKeyViewLoop |
Definition at line 2501 of file CPWindow.j.
- (void) awakeFromCib |
Reimplemented from CPObject.
Definition at line 507 of file CPWindow.j.
- (CPColor) backgroundColor |
Returns the window's background color.
Definition at line 998 of file CPWindow.j.
- (void) becomeKeyWindow |
Called when the receiver should become the key window. It also sends the -becomeKeyWindow
message to the first responder.
Definition at line 1638 of file CPWindow.j.
- (void) becomeMainWindow |
Called to tell the receiver that it has become the main window.
Definition at line 2040 of file CPWindow.j.
- (BOOL) becomesKeyOnlyIfNeeded |
Reimplemented in CPPanel.
Definition at line 2382 of file CPWindow.j.
- (BOOL) canBecomeKeyWindow |
Determines if the window can become the key window.
YES
means the window can become the key window. Definition at line 1654 of file CPWindow.j.
- (BOOL) canBecomeMainWindow |
Returns YES
if the window can become the main window.
Reimplemented in CPPanel.
Definition at line 2016 of file CPWindow.j.
- (void) center |
Sets the window location to be the center of the screen
Definition at line 1455 of file CPWindow.j.
- (void) close |
Closes the window. Posts a CPWindowWillCloseNotification
to the notification center before closing the window.
Definition at line 1997 of file CPWindow.j.
- (CGRect) contentRectForFrameRect: | (CGRect) | aFrame |
Returns the receiver's content rectangle. A content rectangle does not include toolbars.
aFrame | the window's frame rectangle |
Definition at line 641 of file CPWindow.j.
- (CPView) contentView |
Returns the window's current content view.
Definition at line 964 of file CPWindow.j.
- (CPButton) defaultButton |
Returns the default button of the receiver.
Definition at line 2616 of file CPWindow.j.
- (CPButton) defaultButtonCell |
Returns the default button of the receiver. NOTE: This method is deprecated. Use defaultButton instead.
Definition at line 2588 of file CPWindow.j.
- (id) delegate |
Returns window's delegate
Definition at line 1246 of file CPWindow.j.
- (void) deminiaturize: | (id) | sender |
Restores a minimized window to it's original size.
Definition at line 1903 of file CPWindow.j.
- (void) disableKeyEquivalentForDefaultButton |
Removes the key equivalent for the default button.
Definition at line 2641 of file CPWindow.j.
- (void) disableKeyEquivalentForDefaultButtonCell |
Removes the key equivalent for the default button. Note: this method is deprecated. Use disableKeyEquivalentForDefaultButton instead.
Definition at line 2650 of file CPWindow.j.
- (void) doCommandBySelector: | (SEL) | aSelector |
The receiver will attempt to perform the command, if it responds to it. If not, the -nextResponder
will be called to do it.
aSelector | the command to attempt |
Reimplemented from CPResponder.
Definition at line 1268 of file CPWindow.j.
- (void) dragImage: | (CPImage) | anImage | |
at: | (CGPoint) | imageLocation | |
offset: | (CGSize) | mouseOffset | |
event: | (CPEvent) | anEvent | |
pasteboard: | (CPPasteboard) | aPasteboard | |
source: | (id) | aSourceObject | |
slideBack: | (BOOL) | slideBack | |
Initiates a drag operation from the receiver to another view that accepts dragged data.
anImage | the image to be dragged |
aLocation | the lower-left corner coordinate of anImage |
mouseOffset | the distance from the -mouseDown : location and the current location |
anEvent | the -mouseDown : that triggered the drag |
aPasteboard | the pasteboard that holds the drag data |
aSourceObject | the drag operation controller |
slideBack | Whether the image should 'slide back' if the drag is rejected |
Definition at line 1717 of file CPWindow.j.
- (void) dragView: | (CPView) | aView | |
at: | (CGPoint) | viewLocation | |
offset: | (CGSize) | mouseOffset | |
event: | (CPEvent) | anEvent | |
pasteboard: | (CPPasteboard) | aPasteboard | |
source: | (id) | aSourceObject | |
slideBack: | (BOOL) | slideBack | |
Initiates a drag operation from the receiver to another view that accepts dragged data.
aView | the view to be dragged |
aLocation | the lower-left corner coordinate of aView |
mouseOffset | the distance from the -mouseDown : location and the current location |
anEvent | the -mouseDown : that triggered the drag |
aPasteboard | the pasteboard that holds the drag data |
aSourceObject | the drag operation controller |
slideBack | Whether the view should 'slide back' if the drag is rejected |
Definition at line 1754 of file CPWindow.j.
- (void) enableKeyEquivalentForDefaultButton |
Sets the default button key equivalent to "return".
Definition at line 2624 of file CPWindow.j.
- (void) enableKeyEquivalentForDefaultButtonCell |
Sets the default button key equivalent to "return". NOTE: this method is deprecated. Use enableKeyEquivalentForDefaultButton instead.
Definition at line 2633 of file CPWindow.j.
- (CPResponder) firstResponder |
Returns the window's current first responder.
Definition at line 1321 of file CPWindow.j.
- (CGRect) frame |
Returns the window's frame rectangle
Definition at line 659 of file CPWindow.j.
- (CGRect) frameRectForContentRect: | (CGRect) | aContentRect |
Retrieves the frame rectangle for this window.
aContentRect | the window's content rectangle |
Definition at line 651 of file CPWindow.j.
+ (CGRect) frameRectForContentRect: | (CGRect) | aContentRect | |
styleMask: | (unsigned) | aStyleMask | |
Returns the frame rectangle used by a window. Style masks include:
CPBorderlessWindowMask CPTitledWindowMask CPClosableWindowMask CPMiniaturizableWindowMask (NOTE: only available in NativeHost) CPResizableWindowMask CPTexturedBackgroundWindowMask CPBorderlessBridgeWindowMask CPHUDBackgroundWindowMask
aContentRect | the content rectangle of the window |
aStyleMask | the style mask of the window |
Definition at line 632 of file CPWindow.j.
- (BOOL) hasShadow |
Returns YES
if the window has a drop shadow. NO
otherwise.
Definition at line 1085 of file CPWindow.j.
- (BOOL) ignoresMouseEvents |
Definition at line 1336 of file CPWindow.j.
- (id) init |
Reimplemented in CPColorPanel, and CPSavePanel.
Definition at line 346 of file CPWindow.j.
- (CPView) initialFirstResponder |
Definition at line 1281 of file CPWindow.j.
+ (void) initialize |
Definition at line 336 of file CPWindow.j.
- (id) initWithContentRect: | (CGRect) | aContentRect | |
styleMask: | (unsigned int) | aStyleMask | |
Initializes the window. The method also takes a style bit mask made up of any of the following values:
CPBorderlessWindowMask CPTitledWindowMask CPClosableWindowMask CPMiniaturizableWindowMask CPResizableWindowMask CPTexturedBackgroundWindowMask
aContentRect | the size and location of the window in screen space |
aStyleMask | a style mask |
Definition at line 366 of file CPWindow.j.
- (BOOL) isDocumentEdited |
Returns YES
if the document has been edited.
Definition at line 1819 of file CPWindow.j.
- (BOOL) isDocumentSaving |
Definition at line 1836 of file CPWindow.j.
- (BOOL) isFullPlatformWindow |
Definition at line 601 of file CPWindow.j.
- (BOOL) isKeyWindow |
Returns YES
if the window is the key window.
Definition at line 1662 of file CPWindow.j.
- (BOOL) isMainWindow |
Returns YES
if this the main window.
Definition at line 2008 of file CPWindow.j.
- (void) isMiniaturized |
Returns YES if the window is minimized.
Definition at line 1915 of file CPWindow.j.
- (void) isMovable |
Returns YES
if the window can be moved.
Definition at line 1447 of file CPWindow.j.
- (BOOL) isMovableByWindowBackground |
Returns YES
if the window can be moved by dragging its background.
Definition at line 1430 of file CPWindow.j.
- (BOOL) isSheet |
Returns YES
if the window has ever run as a sheet.
Definition at line 2372 of file CPWindow.j.
- (BOOL) isVisible |
Returns YES
if the window is visible. It does not mean that the window is not obscured by other windows.
Definition at line 891 of file CPWindow.j.
- (void) keyDown: | (CPEvent) | anEvent |
Notifies the receiver that the user has pressed a key.
anEvent | information about the key press |
Reimplemented from CPResponder.
Definition at line 2403 of file CPWindow.j.
- (int) level |
Returns the window's current level
Definition at line 883 of file CPWindow.j.
- (BOOL) makeFirstResponder: | (CPResponder) | aResponder |
Attempts to make the aResponder
the first responder. Before trying to make it the first responder, the receiver will ask the current first responder to resign its first responder status. If it resigns, it will ask aResponder
accept first responder, then finally tell it to become first responder.
YES
if the attempt was successful. NO
otherwise. Definition at line 1298 of file CPWindow.j.
- (void) makeKeyAndOrderFront: | (id) | aSender |
Makes the window the key window and brings it to the front of the screen list.
aSender | the object requesting this |
Definition at line 1671 of file CPWindow.j.
- (void) makeKeyWindow |
Makes this window the key window.
Definition at line 1682 of file CPWindow.j.
- (void) makeMainWindow |
Makes the receiver the main window.
Definition at line 2028 of file CPWindow.j.
- (CGSize) maxSize |
Returns the window's maximum size.
Definition at line 1077 of file CPWindow.j.
- (void) miniaturize: | (id) | sender |
Minimizes the window. Posts a CPWindowWillMiniaturizeNotification
to the notification center before minimizing the window.
Definition at line 1887 of file CPWindow.j.
- (CGSize) minSize |
Returns the windows minimum size.
Definition at line 1037 of file CPWindow.j.
- (void) orderBack: | (id) | aSender |
Definition at line 825 of file CPWindow.j.
- (void) orderFront: | (id) | aSender |
Makes the receiver the front most window in the screen ordering.
aSender | the object that requested this |
Reimplemented in CPColorPanel.
Definition at line 803 of file CPWindow.j.
- (void) orderOut: | (id) | aSender |
Hides the window.
the | object that requested this |
Definition at line 834 of file CPWindow.j.
- (void) orderWindow: | (CPWindowOrderingMode) | aPlace | |
relativeTo: | (int) | otherWindowNumber | |
Relocates the window in the screen list.
aPlace | the positioning relative to otherWindowNumber |
otherWindowNumber | the window relative to which the receiver should be placed |
Definition at line 856 of file CPWindow.j.
- (void) performClose: | (id) | aSender |
Simulates the user closing the window, then closes the window.
aSender | the object making this request |
Definition at line 1926 of file CPWindow.j.
- (BOOL) performKeyEquivalent: | (CPEvent) | anEvent |
Overridden by subclasses to handle a key equivalent.
If the character code or codes in anEvent
match the receiver’s key equivalent, the receiver should respond to the event and return YES
. The default implementation does nothing and returns NO
.
You should extract the characters for a key equivalent using [anEvent charactersIgnoringModifiers].
anEvent | An event object that represents the key equivalent pressed |
YES
if theEvent is a key equivalent that the receiver handled, NO
if it is not a key equivalent that it should handle. Reimplemented from CPResponder.
Definition at line 2396 of file CPWindow.j.
- (void) performMiniaturize: | (id) | aSender |
Simulates the user minimizing the window, then minimizes the window.
aSender | the object making this request |
Definition at line 1877 of file CPWindow.j.
- (CPPlatformWindow) platformWindow |
Definition at line 459 of file CPWindow.j.
- (void) recalculateKeyViewLoop |
Definition at line 2473 of file CPWindow.j.
- (CPArray) registeredDraggedTypes |
Returns an array of all types the receiver accepts for dragging operations.
Definition at line 1779 of file CPWindow.j.
- (void) registerForDraggedTypes: | (CPArray) | pasteboardTypes |
Sets the receiver's list of acceptable data types for a dragging operation.
pasteboardTypes | an array of CPPasteboards |
Definition at line 1763 of file CPWindow.j.
- (CPString) representedFilename |
Returns the path to the file the receiver represents
Definition at line 1390 of file CPWindow.j.
- (CPURL) representedURL |
Returns the URL that the receiver represents
Definition at line 1406 of file CPWindow.j.
- (void) resignKeyWindow |
Causes the window to resign it's key window status.
Definition at line 1694 of file CPWindow.j.
- (void) resignMainWindow |
Called when the window resigns main window status.
Definition at line 2055 of file CPWindow.j.
- (CGSize) resizeIndicatorOffset |
Returns the offset of the window's resize indicator.
Definition at line 922 of file CPWindow.j.
- (CPScreen) screen |
Definition at line 1411 of file CPWindow.j.
- (void) selectKeyViewFollowingView: | (CPView) | aView |
Definition at line 2552 of file CPWindow.j.
- (void) selectKeyViewPrecedingView: | (CPView) | aView |
Definition at line 2563 of file CPWindow.j.
- (void) selectNextKeyView: | (id) | sender |
Definition at line 2506 of file CPWindow.j.
- (void) selectPreviousKeyView: | (id) | sender |
Definition at line 2529 of file CPWindow.j.
- (void) sendEvent: | (CPEvent) | anEvent |
Dispatches events that are sent to it from CPApplication.
anEvent | the event to be dispatched |
Definition at line 1478 of file CPWindow.j.
- (void) setAcceptsMouseMovedEvents: | (BOOL) | shouldAcceptMouseMovedEvents |
Definition at line 1331 of file CPWindow.j.
- (void) setAlphaValue: | (float) | aValue |
Applies an alpha value to the window.
aValue | the alpha value to apply |
Definition at line 973 of file CPWindow.j.
- (void) setAutorecalculatesKeyViewLoop: | (BOOL) | shouldRecalculate |
Definition at line 2488 of file CPWindow.j.
- (void) setBackgroundColor: | (CPColor) | aColor |
Sets the window's background color.
aColor | the new color for the background |
Definition at line 990 of file CPWindow.j.
- (void) setContentView: | (CPView) | aView |
Sets the window's content view. The new view will be resized to fit inside the content rectangle of the window.
aView | the new content view for the receiver |
Definition at line 941 of file CPWindow.j.
- (void) setDefaultButton: | (CPButton) | aButton |
Sets the default button for the window. This is equivalent to setting the the key equivalent of the button to "return". Additionally this will turn your button blue (with the Aristo theme).
aButton | - The button that should become default. |
Definition at line 2599 of file CPWindow.j.
- (void) setDefaultButtonCell: | (CPButton) | aButton |
Sets the default button for the window. Note: this method is deprecated use setDefaultButton: instead.
aButton | - The button that should become default. |
Definition at line 2579 of file CPWindow.j.
- (void) setDelegate: | (id) | aDelegate |
Sets the delegate for the window. Passing nil
will just remove the window's current delegate.
aDelegate | an object to respond to the various delegate methods of CPWindow |
Definition at line 1186 of file CPWindow.j.
- (void) setDocumentEdited: | (BOOL) | isDocumentEdited |
Sets whether the document has been edited.
isDocumentEdited | YES if the document has been edited. |
Definition at line 1804 of file CPWindow.j.
- (void) setDocumentSaving: | (BOOL) | isDocumentSaving |
Definition at line 1824 of file CPWindow.j.
- (void) setFrame: | (CGRect) | aFrame |
Sets the window's frame rectangle
aFrame | - The CGRect of the windows new frame |
Definition at line 776 of file CPWindow.j.
- (void) setFrame: | (CGRect) | aFrame | |
display: | (BOOL) | shouldDisplay | |
Sets the window's frame rect.
aFrame | - The new CGRect of the window. |
shouldDisplay | - YES if the window should call setNeedsDisplay: otherwise NO. |
Definition at line 767 of file CPWindow.j.
- (void) setFrame: | (CGRect) | aFrame | |
display: | (BOOL) | shouldDisplay | |
animate: | (BOOL) | shouldAnimate | |
Sets the frame of the window.
aFrame | - A CGRect of the new frame for the receiver. |
shouldDisplay | - YES if the window should call setNeedsDisplay otherwise NO. |
shouldAnimate | - YES if the window should animate to it's new size and position, otherwise NO. |
Definition at line 685 of file CPWindow.j.
- (void) setFrameOrigin: | (CGPoint) | anOrigin |
Sets the window's location.
anOrigin | the new location for the window |
Definition at line 785 of file CPWindow.j.
- (void) setFrameSize: | (CGSize) | aSize |
Sets the window's size.
aSize | the new size for the window |
Definition at line 794 of file CPWindow.j.
- (void) setFullPlatformWindow: | (BOOL) | shouldBeFullPlatformWindow |
Sets the receiver as a full platform window. If you pass YES the CPWindow instance will fill the entire browser content area, otherwise the CPWindow will be a window inside of your browser window which the user can drag around, and resize (if you allow).
BOOL | - YES if the window should fill the browser window, otherwise NO. |
Definition at line 558 of file CPWindow.j.
- (void) setHasShadow: | (BOOL) | shouldHaveShadow |
Sets whether the window should have a drop shadow.
shouldHaveShadow | YES to have a drop shadow. |
Definition at line 1154 of file CPWindow.j.
- (void) setIgnoresMouseEvents: | (BOOL) | shouldIgnoreMouseEvents |
Definition at line 1341 of file CPWindow.j.
- (void) setInitialFirstResponder: | (CPView) | aView |
Definition at line 1286 of file CPWindow.j.
- (void) setLevel: | (int) | aLevel |
Sets the window's level
the | window's new level |
Definition at line 867 of file CPWindow.j.
- (void) setMaxSize: | (CGSize) | aSize |
Sets the window's maximum size. If the provided size is the same as the current maximum size, the method simply returns.
aSize | the new maximum size |
Definition at line 1048 of file CPWindow.j.
- (void) setMinSize: | (CGSize) | aSize |
Sets the window's minimum size. If the provided size is the same as the current minimum size, the method simply returns.
aSize | the new minimum size for the window |
Definition at line 1008 of file CPWindow.j.
- (void) setMovable: | (BOOL) | shouldBeMovable |
Sets whether the window can be moved.
shouldBeMovable | YES makes the window movable. |
Definition at line 1439 of file CPWindow.j.
- (void) setMovableByWindowBackground: | (BOOL) | shouldBeMovableByWindowBackground |
Sets whether the window can be moved by dragging its background. The default is based on the window style.
shouldBeMovableByWindowBackground | YES makes the window move from a background drag. |
Definition at line 1422 of file CPWindow.j.
- (void) setPlatformWindow: | (CPPlatformWindow) | aPlatformWindow |
Sets the platform window of the reciver. This method will first close the reciever, change the platform window, then reopen the window (if it was originally open).
Definition at line 469 of file CPWindow.j.
- (void) setRepresentedFilename: | (CPString) | aFilePath |
Sets the path to the file the receiver represents
Definition at line 1381 of file CPWindow.j.
- (void) setRepresentedURL: | (CPURL) | aURL |
Sets the URL that the receiver represents
Definition at line 1398 of file CPWindow.j.
- (void) setResizeIndicatorOffset: | (CGSize) | anOffset |
Sets the offset of the window's resize indicator.
aSize | the offset for the resize indicator |
Definition at line 931 of file CPWindow.j.
- (void) setShadowStyle: | (unsigned) | aStyle |
Sets the shadow style of the receiver. Values are:
CPWindowShadowStyleStandard CPWindowShadowStyleMenu CPWindowShadowStylePanel
aStyle | - The new shadow style of the receiver. |
Definition at line 1175 of file CPWindow.j.
- (void) setShowsResizeIndicator: | (BOOL) | shouldShowResizeIndicator |
Sets the window's resize indicator.
shouldShowResizeIndicator | YES sets the window to show its resize indicator. |
Definition at line 908 of file CPWindow.j.
- (void) setTitle: | (CPString) | aTitle |
Sets the window's title bar string
Definition at line 1359 of file CPWindow.j.
- (void) setTitleWithRepresentedFilename: | (CPString) | aFilePath |
Sets the title bar to represent a file path
Definition at line 1372 of file CPWindow.j.
- (void) setToolbar: | (CPToolbar) | aToolbar |
Sets the window's toolbar.
aToolbar | the window's new toolbar |
Definition at line 2151 of file CPWindow.j.
- (void) setWindowController: | (CPWindowController) | aWindowController |
Sets the window's controller
aWindowController | a window controller |
Definition at line 1255 of file CPWindow.j.
- (BOOL) showsResizeIndicator |
Returns YES
if the window's resize indicator is showing. NO
otherwise.
Definition at line 899 of file CPWindow.j.
- (unsigned) styleMask |
Returns the window's style mask.
Definition at line 609 of file CPWindow.j.
- (CPString) title |
Returns the window's title bar string
Definition at line 1351 of file CPWindow.j.
- (void) toggleToolbarShown: | (id) | aSender |
Definition at line 2170 of file CPWindow.j.
- (CPToolbar) toolbar |
Return's the window's toolbar
Definition at line 2142 of file CPWindow.j.
- (void) unregisterDraggedTypes |
Resets the array of acceptable data types for a dragging operation.
Definition at line 1790 of file CPWindow.j.
- (CPWindowController) windowController |
Returns the window's controller.
Definition at line 1263 of file CPWindow.j.
- (int) windowNumber |
Returns the window's number in the desktop's screen list
Definition at line 1629 of file CPWindow.j.
- (BOOL) worksWhenModal |
Returns YES
if the receiver is able to receive input events even when a modal session is active.
Reimplemented in CPPanel.
Definition at line 2391 of file CPWindow.j.