darling-cocotron/AppKit/NSWindow.h
Christopher Lloyd fcda3ab7d9 - Large number of missing AppKit constant/methods added, most of the simpler ones implemented. Cleanup and instance size changes.
- Some existing implementation updated for new methods, primarily NSDocument
- Removed legacy keyed encoding/decoding functionality in AppKit
2007-11-08 15:58:54 +00:00

452 lines
15 KiB
Objective-C
Executable File

/* Copyright (c) 2006-2007 Christopher J. W. Lloyd
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <AppKit/NSResponder.h>
#import <AppKit/AppKitExport.h>
#import <AppKit/NSView.h>
@class NSView, NSEvent, NSColor, NSCursor, NSImage, NSScreen, NSText, NSTextView, CGWindow, NSPasteboard, NSSheetContext, NSUndoManager, NSButton,NSButtonCell, NSDrawer, NSToolbar, NSWindowAnimationContext, NSTrackingRect, NSWindowBackgroundView,NSWindowController;
enum {
NSBorderlessWindowMask=0x00,
NSTitledWindowMask=0x01,
NSClosableWindowMask=0x02,
NSMiniaturizableWindowMask=0x04,
NSResizableWindowMask=0x08,
NSTexturedBackgroundWindowMask=0x100,
};
typedef enum {
NSBackingStoreRetained=0,
NSBackingStoreNonretained=1,
NSBackingStoreBuffered=2,
} NSBackingStoreType;
typedef enum {
NSWindowCloseButton,
NSWindowMiniaturizeButton,
NSWindowZoomButton,
NSWindowToolbarButton,
NSWindowDocumentIconButton,
} NSWindowButton;
typedef int NSSelectionDirection;
APPKIT_EXPORT NSString *NSWindowDidBecomeKeyNotification;
APPKIT_EXPORT NSString *NSWindowDidResignKeyNotification;
APPKIT_EXPORT NSString *NSWindowDidBecomeMainNotification;
APPKIT_EXPORT NSString *NSWindowDidResignMainNotification;
APPKIT_EXPORT NSString *NSWindowWillMiniaturizeNotification;
APPKIT_EXPORT NSString *NSWindowDidMiniaturizeNotification;
APPKIT_EXPORT NSString *NSWindowDidDeminiaturizeNotification;
APPKIT_EXPORT NSString *NSWindowWillMoveNotification;
APPKIT_EXPORT NSString *NSWindowDidMoveNotification;
APPKIT_EXPORT NSString *NSWindowDidResizeNotification;
APPKIT_EXPORT NSString *NSWindowDidUpdateNotification;
APPKIT_EXPORT NSString *NSWindowWillCloseNotification;
@interface NSWindow : NSResponder {
NSRect _frame;
unsigned _styleMask;
NSBackingStoreType _backingType;
int _level;
NSSize _minSize;
NSSize _maxSize;
NSSize _contentMinSize;
NSSize _contentMaxSize;
NSWindow *_parentWindow;
NSMutableArray *_childWindows;
NSString *_representedFilename;
NSString *_title;
NSString *_miniwindowTitle;
NSImage *_miniwindowImage;
NSWindowBackgroundView *_backgroundView;
NSMenu *_menu;
NSView *_menuView;
NSView *_contentView;
NSColor *_backgroundColor;
id _delegate;
NSResponder *_firstResponder;
NSTextView *_fieldEditor;
NSArray *_draggedTypes;
NSMutableArray *_cursorRects;
NSHashTable *_invalidatedCursorRectViews;
NSMutableArray *_trackingRects;
NSTrackingRectTag _nextTrackingRectTag;
NSSheetContext *_sheetContext;
NSSize _resizeInfo;
int _cursorRectsDisabled;
int _flushDisabled;
BOOL _isOpaque;
BOOL _isVisible;
BOOL _isKeyWindow;
BOOL _isMainWindow;
BOOL _isDocumentEdited;
BOOL _makeSureIsOnAScreen;
BOOL _acceptsMouseMovedEvents;
BOOL _excludedFromWindowsMenu;
BOOL _isDeferred;
BOOL _dynamicDepthLimit;
BOOL _canStoreColor;
BOOL _isOneShot;
BOOL _useOptimizedDrawing;
BOOL _releaseWhenClosed;
BOOL _hidesOnDeactivate;
BOOL _hiddenForDeactivate;
BOOL _isActive;
BOOL _viewsNeedDisplay;
BOOL _flushNeeded;
BOOL _isFlushWindowDisabled;
BOOL _isAutodisplay;
BOOL _canHide;
BOOL _displaysWhenScreenProfileChanges;
BOOL _alphaValue;
BOOL _hasShadow;
BOOL _showsResizeIndicator;
BOOL _showsToolbarButton;
BOOL _ignoresMouseEvents;
BOOL _isMovableByWindowBackground;
BOOL _allowsToolTipsWhenApplicationIsInactive;
BOOL _defaultButtonCellKeyEquivalentDisabled;
BOOL _autorecalculatesKeyViewLoop;
BOOL _preservesContentDuringLiveResize;
BOOL _useAspectRatio;
BOOL _aspectRatioIsContent;
NSSize _aspectRatio;
NSSize _contentAspectRatio;
NSSize _resizeIncrements;
NSSize _contentResizeIncrements;
NSString *_autosaveFrameName;
CGWindow *_platformWindow;
NSUndoManager *_undoManager;
NSView *_initialFirstResponder;
NSButtonCell *_defaultButtonCell;
NSWindowController *_windowController;
NSMutableArray *_drawers;
NSToolbar *_toolbar;
NSWindowAnimationContext *_animationContext;
NSTrackingRect *_trackedRect;
}
+(NSWindowDepth)defaultDepthLimit;
+(NSRect)frameRectForContentRect:(NSRect)contentRect styleMask:(unsigned)styleMask;
+(NSRect)contentRectForFrameRect:(NSRect)frameRect styleMask:(unsigned)styleMask;
+(float)minFrameWidthWithTitle:(NSString *)title styleMask:(unsigned)styleMask;
+(void)removeFrameUsingName:(NSString *)name;
+(NSButton *)standardWindowButton:(NSWindowButton)button forStyleMask:(unsigned)styleMask;
-initWithContentRect:(NSRect)contentRect styleMask:(unsigned)styleMask backing:(unsigned)backing defer:(BOOL)defer;
-initWithContentRect:(NSRect)contentRect styleMask:(unsigned)styleMask backing:(unsigned)backing defer:(BOOL)defer screen:(NSScreen *)screen;
-(NSGraphicsContext *)graphicsContext;
-(NSDictionary *)deviceDescription;
-contentView;
-delegate;
-(NSString *)title;
-(NSString *)representedFilename;
-(int)level;
-(NSRect)frame;
-(unsigned)styleMask;
-(NSBackingStoreType)backingType;
-(NSSize)minSize;
-(NSSize)maxSize;
-(NSSize)contentMinSize;
-(NSSize)contentMaxSize;
-(BOOL)isOneShot;
-(BOOL)isOpaque;
-(BOOL)hasDynamicDepthLimit;
-(BOOL)isReleasedWhenClosed;
-(BOOL)hidesOnDeactivate;
-(BOOL)worksWhenModal;
-(BOOL)isSheet;
-(BOOL)acceptsMouseMovedEvents;
-(BOOL)isExcludedFromWindowsMenu;
-(BOOL)isAutodisplay;
-(BOOL)isFlushWindowDisabled;
-(NSString *)frameAutosaveName;
-(BOOL)hasShadow;
-(BOOL)ignoresMouseEvents;
-(NSSize)aspectRatio;
-(NSSize)contentAspectRatio;
-(BOOL)autorecalculatesKeyViewLoop;
-(BOOL)canHide;
-(BOOL)canStoreColor;
-(BOOL)showsResizeIndicator;
-(BOOL)showsToolbarButton;
-(BOOL)displaysWhenScreenProfileChanges;
-(BOOL)isMovableByWindowBackground;
-(BOOL)allowsToolTipsWhenApplicationIsInactive;
-(NSImage *)miniwindowImage;
-(NSString *)miniwindowTitle;
-(NSColor *)backgroundColor;
-(float)alphaValue;
-(NSWindowDepth)depthLimit;
-(NSSize)resizeIncrements;
-(NSSize)contentResizeIncrements;
-(BOOL)preservesContentDuringLiveResize;
-(NSToolbar *)toolbar;
-(NSView *)initialFirstResponder;
-(void)setDelegate:delegate;
-(void)setFrame:(NSRect)frame display:(BOOL)display;
-(void)setFrame:(NSRect)frame display:(BOOL)display animate:(BOOL)flag;
-(void)setContentSize:(NSSize)contentSize;
-(void)setFrameOrigin:(NSPoint)point;
-(void)setFrameTopLeftPoint:(NSPoint)point;
-(void)setMinSize:(NSSize)size;
-(void)setMaxSize:(NSSize)size;
-(void)setContentMinSize:(NSSize)value;
-(void)setContentMaxSize:(NSSize)value;
-(void)setBackingType:(NSBackingStoreType)value;
-(void)setDynamicDepthLimit:(BOOL)value;
-(void)setOneShot:(BOOL)flag;
-(void)setReleasedWhenClosed:(BOOL)flag;
-(void)setHidesOnDeactivate:(BOOL)flag;
-(void)setAcceptsMouseMovedEvents:(BOOL)flag;
-(void)setExcludedFromWindowsMenu:(BOOL)value;
-(void)setAutodisplay:(BOOL)value;
-(void)setTitle:(NSString *)title;
-(void)setTitleWithRepresentedFilename:(NSString *)filename;
-(void)setContentView:(NSView *)view;
-(void)setInitialFirstResponder:(NSView *)view;
-(void)setMiniwindowImage:(NSImage *)image;
-(void)setMiniwindowTitle:(NSString *)title;
-(void)setBackgroundColor:(NSColor *)color;
-(void)setAlphaValue:(float)value;
-(void)setToolbar:(NSToolbar *)toolbar;
-(void)setDefaultButtonCell:(NSButtonCell *)cell;
-(void)setWindowController:(NSWindowController *)value;
-(void)setDocumentEdited:(BOOL)flag;
-(void)setContentAspectRatio:(NSSize)value;
-(void)setHasShadow:(BOOL)value;
-(void)setIgnoresMouseEvents:(BOOL)value;
-(void)setAspectRatio:(NSSize)value;
-(void)setAutorecalculatesKeyViewLoop:(BOOL)value;
-(void)setCanHide:(BOOL)value;
-(void)setLevel:(int)value;
-(void)setOpaque:(BOOL)value;
-(void)setParentWindow:(NSWindow *)value;
-(void)setPreservesContentDuringLiveResize:(BOOL)value;
-(void)setRepresentedFilename:(NSString *)value;
-(void)setResizeIncrements:(NSSize)value;
-(void)setShowsResizeIndicator:(BOOL)value;
-(void)setShowsToolbarButton:(BOOL)value;
-(void)setContentResizeIncrements:(NSSize)value;
-(void)setDepthLimit:(NSWindowDepth)value;
-(void)setDisplaysWhenScreenProfileChanges:(BOOL)value;
-(void)setMovableByWindowBackground:(BOOL)value;
-(void)setAllowsToolTipsWhenApplicationIsInactive:(BOOL)value;
-(BOOL)setFrameUsingName:(NSString *)name;
-(BOOL)setFrameUsingName:(NSString *)name force:(BOOL)force;
-(BOOL)setFrameAutosaveName:(NSString *)name;
-(void)saveFrameUsingName:(NSString *)name;
-(void)setFrameFromString:(NSString *)value;
-(NSString *)stringWithSavedFrame;
-(int)resizeFlags;
-(float)userSpaceScaleFactor;
-(NSResponder *)firstResponder;
-(NSButton *)standardWindowButton:(NSWindowButton)value;
-(NSButtonCell *)defaultButtonCell;
-(NSWindow *)attachedSheet;
-(NSWindowController *)windowController;
-(NSArray *)drawers;
-(int)windowNumber;
-(int)gState;
-(NSScreen *)screen;
-(NSScreen *)deepestScreen;
-(BOOL)isDocumentEdited;
-(BOOL)isZoomed;
-(BOOL)isVisible;
-(BOOL)isKeyWindow;
-(BOOL)isMainWindow;
-(BOOL)isMiniaturized;
-(BOOL)canBecomeKeyWindow;
-(BOOL)canBecomeMainWindow;
-(NSPoint)convertBaseToScreen:(NSPoint)point;
-(NSPoint)convertScreenToBase:(NSPoint)point;
-(NSRect)frameRectForContentRect:(NSRect)rect;
-(NSRect)contentRectForFrameRect:(NSRect)rect;
-(NSRect)constrainFrameRect:(NSRect)rect toScreen:(NSScreen *)screen;
-(NSWindow *)parentWindow;
-(NSArray *)childWindows;
-(void)addChildWindow:(NSWindow *)child ordered:(NSWindowOrderingMode)ordered;
-(void)removeChildWindow:(NSWindow *)child;
-(BOOL)makeFirstResponder:(NSResponder *)responder;
-(void)makeKeyWindow;
-(void)makeMainWindow;
-(void)becomeKeyWindow;
-(void)resignKeyWindow;
-(void)becomeMainWindow;
-(void)resignMainWindow;
-(NSTimeInterval)animationResizeTime:(NSRect)frame;
-(void)selectNextKeyView:sender;
-(void)selectPreviousKeyView:sender;
-(void)selectKeyViewFollowingView:(NSView *)view;
-(void)selectKeyViewPrecedingView:(NSView *)view;
-(void)recalculateKeyViewLoop;
-(NSSelectionDirection)keyViewSelectionDirection;
-(void)disableKeyEquivalentForDefaultButtonCell;
-(void)enableKeyEquivalentForDefaultButtonCell;
-(NSText *)fieldEditor:(BOOL)create forObject:object;
-(void)endEditingFor:object;
-(void)disableScreenUpdatesUntilFlush;
-(void)useOptimizedDrawing:(BOOL)flag;
-(BOOL)viewsNeedDisplay;
-(void)setViewsNeedDisplay:(BOOL)flag;
-(void)disableFlushWindow;
-(void)enableFlushWindow;
-(void)flushWindow;
-(void)flushWindowIfNeeded;
-(void)displayIfNeeded;
-(void)display;
-(void)invalidateShadow;
-(void)cacheImageInRect:(NSRect)rect;
-(void)restoreCachedImage;
-(void)discardCachedImage;
-(BOOL)areCursorRectsEnabled;
-(void)disableCursorRects;
-(void)enableCursorRects;
-(void)discardCursorRects;
-(void)resetCursorRects;
-(void)invalidateCursorRectsForView:(NSView *)view;
-(void)close;
-(void)center;
-(void)orderWindow:(NSWindowOrderingMode)place relativeTo:(int)relativeTo;
-(void)orderFrontRegardless;
-(NSPoint)mouseLocationOutsideOfEventStream;
-(NSEvent *)currentEvent;
-(NSEvent *)nextEventMatchingMask:(unsigned)mask;
-(NSEvent *)nextEventMatchingMask:(unsigned)mask untilDate:(NSDate *)untilDate inMode:(NSString *)mode dequeue:(BOOL)dequeue;
-(void)discardEventsMatchingMask:(unsigned)mask beforeEvent:(NSEvent *)event;
-(void)sendEvent:(NSEvent *)event;
-(void)postEvent:(NSEvent *)event atStart:(BOOL)atStart;
-(BOOL)tryToPerform:(SEL)selector with:object;
-(NSPoint)cascadeTopLeftFromPoint:(NSPoint)topLeftPoint;
-(NSData *)dataWithEPSInsideRect:(NSRect)rect;
-(NSData *)dataWithPDFInsideRect:(NSRect)rect;
-(void)registerForDraggedTypes:(NSArray *)types;
-(void)unregisterDraggedTypes;
-(void)dragImage:(NSImage *)image at:(NSPoint)location offset:(NSSize)offset event:(NSEvent *)event pasteboard:(NSPasteboard *)pasteboard source:source slideBack:(BOOL)slideBack;
-validRequestorForSendType:(NSString *)sendType returnType:(NSString *)returnType;
-(void)update;
-(void)makeKeyAndOrderFront:sender;
-(void)orderFront:sender;
-(void)orderBack:sender;
-(void)orderOut:sender;
-(void)performClose:sender;
-(void)performMiniaturize:sender;
-(void)performZoom:sender;
-(void)zoom:sender;
-(void)miniaturize:sender;
-(void)deminiaturize:sender;
-(void)print:sender;
-(void)toggleToolbarShown:sender;
-(void)runToolbarCustomizationPalette:sender;
@end
@interface NSObject(NSWindow_delegate)
-(void)windowWillBeginSheet:(NSNotification *)note;
-(void)windowDidEndSheet:(NSNotification *)note;
-(NSRect)window:(NSWindow *)window willPositionSheet:(NSWindow *)sheet usingRect:(NSRect)rect;
-(void)windowDidChangeScreen:(NSNotification *)note;
-(void)windowDidChangeScreenProfile:(NSNotification *)note;
-(void)windowDidExpose:(NSNotification *)note;
-(BOOL)windowShouldZoom:(NSWindow *)sender toFrame:(NSRect)frame;
-windowWillReturnFieldEditor:(NSWindow *)sender toObject:object;
-(NSRect)windowWillUseStandardFrame:(NSWindow *)sender defaultFrame:(NSRect)frame;
-(NSUndoManager *)windowWillReturnUndoManager:(NSWindow *)window;
-(void)windowDidBecomeKey:(NSNotification *)note;
-(void)windowDidResignKey:(NSNotification *)note;
-(void)windowDidBecomeMain:(NSNotification *)note;
-(void)windowDidResignMain:(NSNotification *)note;
-(void)windowWillMiniaturize:(NSNotification *)note;
-(void)windowDidMiniaturize:(NSNotification *)note;
-(void)windowDidDeminiaturize:(NSNotification *)note;
-(void)windowWillMove:(NSNotification *)note;
-(void)windowDidMove:(NSNotification *)note;
-(NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)size;
-(void)windowDidResize:(NSNotification *)note;
-(void)windowDidUpdate:(NSNotification *)note;
-(BOOL)windowShouldClose:sender;
-(void)windowWillClose:(NSNotification *)note;
@end
//private
APPKIT_EXPORT NSString *NSWindowWillAnimateNotification;
APPKIT_EXPORT NSString *NSWindowAnimatingNotification;
APPKIT_EXPORT NSString *NSWindowDidAnimateNotification;