From 7765a88ee8c9772fb6ea255a16e47f7ce16c2a1c Mon Sep 17 00:00:00 2001 From: sekelsenmat Date: Fri, 22 Feb 2008 22:39:15 +0000 Subject: [PATCH] Improves the structure of the Cocoa bindings and merges the include files to have only one per .h header. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@359 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- bindings/pascocoa/appkit/AppKit.inc | 7 - bindings/pascocoa/appkit/AppKit_impl.inc | 158 ------- bindings/pascocoa/appkit/NSApplication.inc | 292 +++++++++++- .../pascocoa/appkit/NSApplication_impl.inc | 26 -- .../pascocoa/appkit/NSApplication_type.inc | 262 ----------- bindings/pascocoa/appkit/NSGraphics.inc | 8 + bindings/pascocoa/appkit/NSPanel.inc | 10 +- bindings/pascocoa/appkit/NSWindow.inc | 434 +++++++++++++++++- bindings/pascocoa/appkit/NSWindow_impl.inc | 32 -- bindings/pascocoa/appkit/NSWindow_type.inc | 393 ---------------- bindings/pascocoa/appkit/appkit.pas | 14 +- .../examples/simplewindow/simplewindow.lpi | 168 +++---- bindings/pascocoa/foundation/Foundation.inc | 4 +- .../pascocoa/foundation/Foundation_impl.inc | 147 ------ .../pascocoa/foundation/NSAutoreleasePool.inc | 29 +- .../foundation/NSAutoreleasePool_impl.inc | 9 - bindings/pascocoa/foundation/NSGeometry.inc | 7 + bindings/pascocoa/foundation/NSObject.inc | 50 +- .../pascocoa/foundation/NSObject_impl.inc | 11 - bindings/pascocoa/foundation/foundation.pas | 11 +- 20 files changed, 889 insertions(+), 1183 deletions(-) delete mode 100644 bindings/pascocoa/appkit/AppKit_impl.inc delete mode 100644 bindings/pascocoa/appkit/NSApplication_impl.inc delete mode 100644 bindings/pascocoa/appkit/NSApplication_type.inc delete mode 100644 bindings/pascocoa/appkit/NSWindow_impl.inc delete mode 100644 bindings/pascocoa/appkit/NSWindow_type.inc delete mode 100644 bindings/pascocoa/foundation/Foundation_impl.inc delete mode 100644 bindings/pascocoa/foundation/NSAutoreleasePool_impl.inc delete mode 100644 bindings/pascocoa/foundation/NSObject_impl.inc diff --git a/bindings/pascocoa/appkit/AppKit.inc b/bindings/pascocoa/appkit/AppKit.inc index 699c3f120..2ea754f12 100644 --- a/bindings/pascocoa/appkit/AppKit.inc +++ b/bindings/pascocoa/appkit/AppKit.inc @@ -164,11 +164,4 @@ #import } -type -{$include NSApplication_type.inc} -{$include NSWindow_type.inc} - -var - NSApp: NSApplication; - diff --git a/bindings/pascocoa/appkit/AppKit_impl.inc b/bindings/pascocoa/appkit/AppKit_impl.inc deleted file mode 100644 index 65a75a802..000000000 --- a/bindings/pascocoa/appkit/AppKit_impl.inc +++ /dev/null @@ -1,158 +0,0 @@ - -{#import -#import -#import -#import -#import } -{.$include NSAlert.inc} -//#import -{$include NSApplication_impl.inc} -{#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import } -{.$include NSPanel.inc} -{#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import } -{$include NSWindow_impl.inc} -{#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -} - diff --git a/bindings/pascocoa/appkit/NSApplication.inc b/bindings/pascocoa/appkit/NSApplication.inc index e741db0cf..c637f52e2 100644 --- a/bindings/pascocoa/appkit/NSApplication.inc +++ b/bindings/pascocoa/appkit/NSApplication.inc @@ -5,12 +5,13 @@ All rights reserved. } +{$ifdef HEADER} +{$ifndef NSAPPLICATION_PAS_H} +{$define NSAPPLICATION_PAS_H} + //#import //#import -//@class NSDate, NSDictionary, NSError, NSException, NSNotification; -//@class NSGraphicsContext, NSImage, NSPasteboard, NSWindow; - { The version of the AppKit framework } //APPKIT_EXTERN const double NSAppKitVersionNumber; @@ -92,3 +93,288 @@ APPKIT_EXTERN NSString *NSApplicationWillUpdateNotification; APPKIT_EXTERN NSString *NSApplicationWillTerminateNotification; APPKIT_EXTERN NSString *NSApplicationDidChangeScreenParametersNotification; } +{$endif} +{$endif} +{$ifdef CLASSES} +{$ifndef NSAPPLICATION_PAS_C} +{$define NSAPPLICATION_PAS_C} + +//@class NSDate, NSDictionary, NSError, NSException, NSNotification; +//@class NSGraphicsContext, NSImage, NSPasteboard, NSWindow; + NSWindow = class; + +{ The version of the AppKit framework } +//APPKIT_EXTERN const double NSAppKitVersionNumber; + + NSApplication = class(NSObject) //: NSResponder } + public + constructor sharedApplication; + +{- (void)setDelegate:(id)anObject; +- (id)delegate; +- (NSGraphicsContext*)context; +- (void)hide:(id)sender; +- (void)unhide:(id)sender; +- (void)unhideWithoutActivation; +- (NSWindow *)windowWithWindowNumber:(int)windowNum; +- (NSWindow *)mainWindow; +- (NSWindow *)keyWindow; +- (BOOL)isActive; +- (BOOL)isHidden; +- (BOOL)isRunning; +- (void)deactivate; +- (void)activateIgnoringOtherApps:(BOOL)flag; + +- (void)hideOtherApplications:(id)sender; +- (void)unhideAllApplications:(id)sender; + +- (void)finishLaunching;} + procedure run; + function runModalForWindow(theWindow: NSWindow): cint; +{- (void)stop:(id)sender; +- (void)stopModal; +- (void)stopModalWithCode:(int)returnCode; +- (void)abortModal; +- (NSWindow *)modalWindow; +- (NSModalSession)beginModalSessionForWindow:(NSWindow *)theWindow; +- (int)runModalSession:(NSModalSession)session; +- (void)endModalSession:(NSModalSession)session; +- (void)terminate:(id)sender; } + +//typedef enum { +// NSCriticalRequest = 0, +// NSInformationalRequest = 10 +//} NSRequestUserAttentionType; + +// inform the user that this application needs attention - call this method only if your application is not already active +{- (int)requestUserAttention:(NSRequestUserAttentionType)requestType; +- (void)cancelUserAttentionRequest:(int)request; + +/* +** Present a sheet on the given window. When the modal session is ended, +** the didEndSelector will be invoked in the modalDelegate. The didEndSelector +** should have the following signature, and will be invoked when the modal session ends. +** This method should dimiss the sheet using orderOut: +** - (void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo; +** +*/ +- (void)beginSheet:(NSWindow *)sheet modalForWindow:(NSWindow *)docWindow modalDelegate:(id)modalDelegate didEndSelector:(SEL)didEndSelector contextInfo:(void *)contextInfo; +- (void)endSheet:(NSWindow *)sheet; +- (void)endSheet:(NSWindow *)sheet returnCode:(int)returnCode; + +/* +** runModalForWindow:relativeToWindow: is deprecated. +** Please use beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo: +*/ +- (int)runModalForWindow:(NSWindow *)theWindow relativeToWindow:(NSWindow *)docWindow; + +/* +** beginModalSessionForWindow:relativeToWindow: is deprecated. +** Please use beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo: +*/ +- (NSModalSession)beginModalSessionForWindow:(NSWindow *)theWindow relativeToWindow:(NSWindow *)docWindow; +- (NSEvent *)nextEventMatchingMask:(unsigned int)mask untilDate:(NSDate *)expiration inMode:(NSString *)mode dequeue:(BOOL)deqFlag; +- (void)discardEventsMatchingMask:(unsigned int)mask beforeEvent:(NSEvent *)lastEvent; +- (void)postEvent:(NSEvent *)event atStart:(BOOL)flag; +- (NSEvent *)currentEvent; + +- (void)sendEvent:(NSEvent *)theEvent; +- (void)preventWindowOrdering; +- (NSWindow *)makeWindowsPerform:(SEL)aSelector inOrder:(BOOL)flag; +- (NSArray *)windows; +- (void)setWindowsNeedUpdate:(BOOL)needUpdate; +- (void)updateWindows; + +- (void)setMainMenu:(NSMenu *)aMenu; +- (NSMenu *)mainMenu; + +- (void)setApplicationIconImage:(NSImage *)image; +- (NSImage *)applicationIconImage; + +- (BOOL)sendAction:(SEL)theAction to:(id)theTarget from:(id)sender; +- (id)targetForAction:(SEL)theAction; +- (id)targetForAction:(SEL)theAction to:(id)theTarget from:(id)sender; +- (BOOL)tryToPerform:(SEL)anAction with:(id)anObject; +- (id)validRequestorForSendType:(NSString *)sendType returnType:(NSString *)returnType; + +- (void)reportException:(NSException *)theException; ++ (void)detachDrawingThread:(SEL)selector toTarget:(id)target withObject:(id)argument; + +/* If an application delegate returns NSTerminateLater from -applicationShouldTerminate:, -replyToApplicationShouldTerminate: must be called with YES or NO once the application decides if it can terminate */ +- (void)replyToApplicationShouldTerminate:(BOOL)shouldTerminate; } +//#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 + +//typedef enum NSApplicationDelegateReply { +// NSApplicationDelegateReplySuccess = 0, +// NSApplicationDelegateReplyCancel = 1, +// NSApplicationDelegateReplyFailure = 2 +//} NSApplicationDelegateReply; + +{ If an application delegate encounters an error while handling -application:openFiles: or -application:printFiles:, -replyToOpenOrPrint: should be called with NSApplicationDelegateReplyFailure. If the user cancels the operation, NSApplicationDelegateReplyCancel should be used, and if the operation succeeds, NSApplicationDelegateReplySuccess should be used */ +- (void)replyToOpenOrPrint:(NSApplicationDelegateReply)reply; + +/* Opens the character palette +*/ +- (void)orderFrontCharacterPalette:(id)sender; +#endif} + +{@interface NSApplication(NSWindowsMenu) +- (void)setWindowsMenu:(NSMenu *)aMenu; +- (NSMenu *)windowsMenu; +- (void)arrangeInFront:(id)sender; +- (void)removeWindowsItem:(NSWindow *)win; +- (void)addWindowsItem:(NSWindow *)win title:(NSString *)aString filename:(BOOL)isFilename; +- (void)changeWindowsItem:(NSWindow *)win title:(NSString *)aString filename:(BOOL)isFilename; +- (void)updateWindowsItem:(NSWindow *)win; +- (void)miniaturizeAll:(id)sender; +@end + +@interface NSObject(NSApplicationNotifications) +- (void)applicationWillFinishLaunching:(NSNotification *)notification; +- (void)applicationDidFinishLaunching:(NSNotification *)notification; +- (void)applicationWillHide:(NSNotification *)notification; +- (void)applicationDidHide:(NSNotification *)notification; +- (void)applicationWillUnhide:(NSNotification *)notification; +- (void)applicationDidUnhide:(NSNotification *)notification; +- (void)applicationWillBecomeActive:(NSNotification *)notification; +- (void)applicationDidBecomeActive:(NSNotification *)notification; +- (void)applicationWillResignActive:(NSNotification *)notification; +- (void)applicationDidResignActive:(NSNotification *)notification; +- (void)applicationWillUpdate:(NSNotification *)notification; +- (void)applicationDidUpdate:(NSNotification *)notification; +- (void)applicationWillTerminate:(NSNotification *)notification; +- (void)applicationDidChangeScreenParameters:(NSNotification *)notification; +@end } + +// return values for -applicationShouldTerminate: +//typedef enum NSApplicationTerminateReply { +// NSTerminateCancel = 0, +// NSTerminateNow = 1, +// NSTerminateLater = 2 +//} NSApplicationTerminateReply; + +//#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 +// return values for -application:printFiles:withSettings:showPrintPanels:. +//typedef enum NSApplicationPrintReply { +// NSPrintingCancelled = 0, +// NSPrintingSuccess = 1, +// NSPrintingFailure = 3, +// NSPrintingReplyLater = 2 +//} NSApplicationPrintReply; +//#endif + +{@interface NSObject(NSApplicationDelegate) +/* + Allowable return values are: + NSTerminateNow - it is ok to proceed with termination + NSTerminateCancel - the application should not be terminated + NSTerminateLater - it may be ok to proceed with termination later. The application must call -replyToApplicationShouldTerminate: with YES or NO once the answer is known + this return value is for delegates who need to provide document modal alerts (sheets) in order to decide whether to quit. +*/ +- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender; +- (BOOL)application:(NSApplication *)sender openFile:(NSString *)filename; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 +- (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames; +#endif +- (BOOL)application:(NSApplication *)sender openTempFile:(NSString *)filename; +- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender; +- (BOOL)applicationOpenUntitledFile:(NSApplication *)sender; +- (BOOL)application:(id)sender openFileWithoutUI:(NSString *)filename; +- (BOOL)application:(NSApplication *)sender printFile:(NSString *)filename; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 +- (NSApplicationPrintReply)application:(NSApplication *)application printFiles:(NSArray *)fileNames withSettings:(NSDictionary *)printSettings showPrintPanels:(BOOL)showPrintPanels; +#endif +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 +// -application:printFiles: is now deprecated. Implement application:printFiles:withSettings:showPrintPanels: in your application delegate instead. +- (void)application:(NSApplication *)sender printFiles:(NSArray *)filenames; +#endif +- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender; +- (BOOL)applicationShouldHandleReopen:(NSApplication *)sender hasVisibleWindows:(BOOL)flag; +- (NSMenu *)applicationDockMenu:(NSApplication *)sender; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 +- (NSError *)application:(NSApplication *)application willPresentError:(NSError *)error; +#endif +@end + +@interface NSApplication(NSServicesMenu) +- (void)setServicesMenu:(NSMenu *)aMenu; +- (NSMenu *)servicesMenu; +- (void)registerServicesMenuSendTypes:(NSArray *)sendTypes returnTypes:(NSArray *)returnTypes; +@end + +@interface NSObject(NSServicesRequests) +- (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pboard types:(NSArray *)types; +- (BOOL)readSelectionFromPasteboard:(NSPasteboard *)pboard; +@end + +@interface NSApplication(NSServicesHandling) +- (void)setServicesProvider:(id)provider; +- (id)servicesProvider; +@end} + +{@interface NSApplication(NSStandardAboutPanel)} +//- (void)orderFrontStandardAboutPanel:(id)sender; + procedure orderFrontStandardAboutPanelWithOptions(optionsDictionary: Pointer); //:(NSDictionary *)optionsDictionary; + +{ Optional keys in optionsDictionary: + +@"Credits": NSAttributedString displayed in the info area of the panel. If +not specified, contents obtained from "Credits.rtf" in [NSBundle mainBundle]; +if not available, blank. + +@"ApplicationName": NSString displayed in place of the default app name. If +not specified, uses the value of CFBundleName (localizable). Fallback is [[NSProcessInfo processInfo] processName]. + +@"ApplicationIcon": NSImage displayed in place of NSApplicationIcon. If not +specified, use [NSImage imageNamed:@"NSApplicationIcon"]; if not available, generic icon. + +@"Copyright": NSString containing the copyright string. If not specified, +obtain from the value of NSHumanReadableCopyright (localizable) in infoDictionary; if not available, leave blank. + +@"Version": NSString containing the build version number of the application +("58.4", "1.2d3"); displayed as "Version 58.4" or "Version 1.0 (58.4) depending on the presence of ApplicationVersion. +If not specified, obtain from the CFBundleVersion key in infoDictionary; if not specified or empty string, leave blank. + +@"ApplicationVersion": NSString displayed as the marketing version ("1.0", "Mac OS X", "3", "WebObjects 3.5", ...), before the build version. +If not specified, obtain from CFBundleShortVersionString key in infoDictionary. Prefixed with word "Version" if it looks like a number. +} + +{@end} + +{#ifdef WIN32 +@interface NSApplication (NSWindowsExtensions) ++ (void)setApplicationHandle:(void * /*HINSTANCE*/)hInstance previousHandle:(void * /*HINSTANCE*/)PrevInstance commandLine:(NSString *)cmdLine show:(int)cmdShow; ++ (void)useRunningCopyOfApplication; +- (void * /*HINSTANCE*/)applicationHandle; +- (NSWindow *)windowWithWindowHandle:(void * /*HWND*/)hWnd; // does not create a new NSWindow +@end +#endif} + end; + +{$endif} +{$endif} +{$ifdef IMPLEMENTATION} + +constructor NSApplication.sharedApplication; +begin + ClassId := objc_getClass(PChar(Str_NSApplication)); + Handle := objc_msgSend(ClassId, sel_registerName(PChar(Str_sharedApplication)), []); +end; + +procedure NSApplication.run; +begin + objc_msgSend(Handle, sel_registerName(PChar(Str_run)), []); +end; + +function NSApplication.runModalForWindow(theWindow: NSWindow): cint; +begin + Result := cint(objc_msgSend(Handle, sel_registerName(PChar(Str_runModalForWindow)), [theWindow.Handle])); +end; + +procedure NSApplication.orderFrontStandardAboutPanelWithOptions(optionsDictionary: Pointer); +begin + objc_msgSend(Handle, sel_registerName(PChar(Str_orderFrontStandardAboutPanelWithOptions)), [optionsDictionary]); +end; + +{$endif} + diff --git a/bindings/pascocoa/appkit/NSApplication_impl.inc b/bindings/pascocoa/appkit/NSApplication_impl.inc deleted file mode 100644 index 5b232484d..000000000 --- a/bindings/pascocoa/appkit/NSApplication_impl.inc +++ /dev/null @@ -1,26 +0,0 @@ - -constructor NSApplication.sharedApplication; -begin - ClassId := objc_getClass(PChar(Str_NSApplication)); - Handle := objc_msgSend(ClassId, sel_registerName(PChar(Str_sharedApplication)), []); -end; - -procedure NSApplication.run; -begin - objc_msgSend(Handle, sel_registerName(PChar(Str_run)), []); -end; - -function NSApplication.runModalForWindow(theWindow: NSWindow): cint; -begin - Result := cint(objc_msgSend(Handle, sel_registerName(PChar(Str_runModalForWindow)), [theWindow.Handle])); -end; - -{@interface NSApplication(NSStandardAboutPanel)} - -procedure NSApplication.orderFrontStandardAboutPanelWithOptions(optionsDictionary: Pointer); -begin - objc_msgSend(Handle, sel_registerName(PChar(Str_orderFrontStandardAboutPanelWithOptions)), [optionsDictionary]); -end; - -{@end} - diff --git a/bindings/pascocoa/appkit/NSApplication_type.inc b/bindings/pascocoa/appkit/NSApplication_type.inc deleted file mode 100644 index cf1842827..000000000 --- a/bindings/pascocoa/appkit/NSApplication_type.inc +++ /dev/null @@ -1,262 +0,0 @@ -{ - NSApplication.h - Application Kit - Copyright (c) 1994-2005, Apple Computer, Inc. - All rights reserved. -} - -//#import -//#import - -//@class NSDate, NSDictionary, NSError, NSException, NSNotification; -//@class NSGraphicsContext, NSImage, NSPasteboard, NSWindow; - NSWindow = class; - -{ The version of the AppKit framework } -//APPKIT_EXTERN const double NSAppKitVersionNumber; - - NSApplication = class(NSObject) //: NSResponder } - public - constructor sharedApplication; - -{- (void)setDelegate:(id)anObject; -- (id)delegate; -- (NSGraphicsContext*)context; -- (void)hide:(id)sender; -- (void)unhide:(id)sender; -- (void)unhideWithoutActivation; -- (NSWindow *)windowWithWindowNumber:(int)windowNum; -- (NSWindow *)mainWindow; -- (NSWindow *)keyWindow; -- (BOOL)isActive; -- (BOOL)isHidden; -- (BOOL)isRunning; -- (void)deactivate; -- (void)activateIgnoringOtherApps:(BOOL)flag; - -- (void)hideOtherApplications:(id)sender; -- (void)unhideAllApplications:(id)sender; - -- (void)finishLaunching;} - procedure run; - function runModalForWindow(theWindow: NSWindow): cint; -{- (void)stop:(id)sender; -- (void)stopModal; -- (void)stopModalWithCode:(int)returnCode; -- (void)abortModal; -- (NSWindow *)modalWindow; -- (NSModalSession)beginModalSessionForWindow:(NSWindow *)theWindow; -- (int)runModalSession:(NSModalSession)session; -- (void)endModalSession:(NSModalSession)session; -- (void)terminate:(id)sender; } - -//typedef enum { -// NSCriticalRequest = 0, -// NSInformationalRequest = 10 -//} NSRequestUserAttentionType; - -// inform the user that this application needs attention - call this method only if your application is not already active -{- (int)requestUserAttention:(NSRequestUserAttentionType)requestType; -- (void)cancelUserAttentionRequest:(int)request; - -/* -** Present a sheet on the given window. When the modal session is ended, -** the didEndSelector will be invoked in the modalDelegate. The didEndSelector -** should have the following signature, and will be invoked when the modal session ends. -** This method should dimiss the sheet using orderOut: -** - (void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo; -** -*/ -- (void)beginSheet:(NSWindow *)sheet modalForWindow:(NSWindow *)docWindow modalDelegate:(id)modalDelegate didEndSelector:(SEL)didEndSelector contextInfo:(void *)contextInfo; -- (void)endSheet:(NSWindow *)sheet; -- (void)endSheet:(NSWindow *)sheet returnCode:(int)returnCode; - -/* -** runModalForWindow:relativeToWindow: is deprecated. -** Please use beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo: -*/ -- (int)runModalForWindow:(NSWindow *)theWindow relativeToWindow:(NSWindow *)docWindow; - -/* -** beginModalSessionForWindow:relativeToWindow: is deprecated. -** Please use beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo: -*/ -- (NSModalSession)beginModalSessionForWindow:(NSWindow *)theWindow relativeToWindow:(NSWindow *)docWindow; -- (NSEvent *)nextEventMatchingMask:(unsigned int)mask untilDate:(NSDate *)expiration inMode:(NSString *)mode dequeue:(BOOL)deqFlag; -- (void)discardEventsMatchingMask:(unsigned int)mask beforeEvent:(NSEvent *)lastEvent; -- (void)postEvent:(NSEvent *)event atStart:(BOOL)flag; -- (NSEvent *)currentEvent; - -- (void)sendEvent:(NSEvent *)theEvent; -- (void)preventWindowOrdering; -- (NSWindow *)makeWindowsPerform:(SEL)aSelector inOrder:(BOOL)flag; -- (NSArray *)windows; -- (void)setWindowsNeedUpdate:(BOOL)needUpdate; -- (void)updateWindows; - -- (void)setMainMenu:(NSMenu *)aMenu; -- (NSMenu *)mainMenu; - -- (void)setApplicationIconImage:(NSImage *)image; -- (NSImage *)applicationIconImage; - -- (BOOL)sendAction:(SEL)theAction to:(id)theTarget from:(id)sender; -- (id)targetForAction:(SEL)theAction; -- (id)targetForAction:(SEL)theAction to:(id)theTarget from:(id)sender; -- (BOOL)tryToPerform:(SEL)anAction with:(id)anObject; -- (id)validRequestorForSendType:(NSString *)sendType returnType:(NSString *)returnType; - -- (void)reportException:(NSException *)theException; -+ (void)detachDrawingThread:(SEL)selector toTarget:(id)target withObject:(id)argument; - -/* If an application delegate returns NSTerminateLater from -applicationShouldTerminate:, -replyToApplicationShouldTerminate: must be called with YES or NO once the application decides if it can terminate */ -- (void)replyToApplicationShouldTerminate:(BOOL)shouldTerminate; } -//#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 - -//typedef enum NSApplicationDelegateReply { -// NSApplicationDelegateReplySuccess = 0, -// NSApplicationDelegateReplyCancel = 1, -// NSApplicationDelegateReplyFailure = 2 -//} NSApplicationDelegateReply; - -{ If an application delegate encounters an error while handling -application:openFiles: or -application:printFiles:, -replyToOpenOrPrint: should be called with NSApplicationDelegateReplyFailure. If the user cancels the operation, NSApplicationDelegateReplyCancel should be used, and if the operation succeeds, NSApplicationDelegateReplySuccess should be used */ -- (void)replyToOpenOrPrint:(NSApplicationDelegateReply)reply; - -/* Opens the character palette -*/ -- (void)orderFrontCharacterPalette:(id)sender; -#endif} - -{@interface NSApplication(NSWindowsMenu) -- (void)setWindowsMenu:(NSMenu *)aMenu; -- (NSMenu *)windowsMenu; -- (void)arrangeInFront:(id)sender; -- (void)removeWindowsItem:(NSWindow *)win; -- (void)addWindowsItem:(NSWindow *)win title:(NSString *)aString filename:(BOOL)isFilename; -- (void)changeWindowsItem:(NSWindow *)win title:(NSString *)aString filename:(BOOL)isFilename; -- (void)updateWindowsItem:(NSWindow *)win; -- (void)miniaturizeAll:(id)sender; -@end - -@interface NSObject(NSApplicationNotifications) -- (void)applicationWillFinishLaunching:(NSNotification *)notification; -- (void)applicationDidFinishLaunching:(NSNotification *)notification; -- (void)applicationWillHide:(NSNotification *)notification; -- (void)applicationDidHide:(NSNotification *)notification; -- (void)applicationWillUnhide:(NSNotification *)notification; -- (void)applicationDidUnhide:(NSNotification *)notification; -- (void)applicationWillBecomeActive:(NSNotification *)notification; -- (void)applicationDidBecomeActive:(NSNotification *)notification; -- (void)applicationWillResignActive:(NSNotification *)notification; -- (void)applicationDidResignActive:(NSNotification *)notification; -- (void)applicationWillUpdate:(NSNotification *)notification; -- (void)applicationDidUpdate:(NSNotification *)notification; -- (void)applicationWillTerminate:(NSNotification *)notification; -- (void)applicationDidChangeScreenParameters:(NSNotification *)notification; -@end } - -// return values for -applicationShouldTerminate: -//typedef enum NSApplicationTerminateReply { -// NSTerminateCancel = 0, -// NSTerminateNow = 1, -// NSTerminateLater = 2 -//} NSApplicationTerminateReply; - -//#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 -// return values for -application:printFiles:withSettings:showPrintPanels:. -//typedef enum NSApplicationPrintReply { -// NSPrintingCancelled = 0, -// NSPrintingSuccess = 1, -// NSPrintingFailure = 3, -// NSPrintingReplyLater = 2 -//} NSApplicationPrintReply; -//#endif - -{@interface NSObject(NSApplicationDelegate) -/* - Allowable return values are: - NSTerminateNow - it is ok to proceed with termination - NSTerminateCancel - the application should not be terminated - NSTerminateLater - it may be ok to proceed with termination later. The application must call -replyToApplicationShouldTerminate: with YES or NO once the answer is known - this return value is for delegates who need to provide document modal alerts (sheets) in order to decide whether to quit. -*/ -- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender; -- (BOOL)application:(NSApplication *)sender openFile:(NSString *)filename; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 -- (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames; -#endif -- (BOOL)application:(NSApplication *)sender openTempFile:(NSString *)filename; -- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender; -- (BOOL)applicationOpenUntitledFile:(NSApplication *)sender; -- (BOOL)application:(id)sender openFileWithoutUI:(NSString *)filename; -- (BOOL)application:(NSApplication *)sender printFile:(NSString *)filename; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 -- (NSApplicationPrintReply)application:(NSApplication *)application printFiles:(NSArray *)fileNames withSettings:(NSDictionary *)printSettings showPrintPanels:(BOOL)showPrintPanels; -#endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 -// -application:printFiles: is now deprecated. Implement application:printFiles:withSettings:showPrintPanels: in your application delegate instead. -- (void)application:(NSApplication *)sender printFiles:(NSArray *)filenames; -#endif -- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender; -- (BOOL)applicationShouldHandleReopen:(NSApplication *)sender hasVisibleWindows:(BOOL)flag; -- (NSMenu *)applicationDockMenu:(NSApplication *)sender; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 -- (NSError *)application:(NSApplication *)application willPresentError:(NSError *)error; -#endif -@end - -@interface NSApplication(NSServicesMenu) -- (void)setServicesMenu:(NSMenu *)aMenu; -- (NSMenu *)servicesMenu; -- (void)registerServicesMenuSendTypes:(NSArray *)sendTypes returnTypes:(NSArray *)returnTypes; -@end - -@interface NSObject(NSServicesRequests) -- (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pboard types:(NSArray *)types; -- (BOOL)readSelectionFromPasteboard:(NSPasteboard *)pboard; -@end - -@interface NSApplication(NSServicesHandling) -- (void)setServicesProvider:(id)provider; -- (id)servicesProvider; -@end} - -{@interface NSApplication(NSStandardAboutPanel)} -//- (void)orderFrontStandardAboutPanel:(id)sender; - procedure orderFrontStandardAboutPanelWithOptions(optionsDictionary: Pointer); //:(NSDictionary *)optionsDictionary; - -{ Optional keys in optionsDictionary: - -@"Credits": NSAttributedString displayed in the info area of the panel. If -not specified, contents obtained from "Credits.rtf" in [NSBundle mainBundle]; -if not available, blank. - -@"ApplicationName": NSString displayed in place of the default app name. If -not specified, uses the value of CFBundleName (localizable). Fallback is [[NSProcessInfo processInfo] processName]. - -@"ApplicationIcon": NSImage displayed in place of NSApplicationIcon. If not -specified, use [NSImage imageNamed:@"NSApplicationIcon"]; if not available, generic icon. - -@"Copyright": NSString containing the copyright string. If not specified, -obtain from the value of NSHumanReadableCopyright (localizable) in infoDictionary; if not available, leave blank. - -@"Version": NSString containing the build version number of the application -("58.4", "1.2d3"); displayed as "Version 58.4" or "Version 1.0 (58.4) depending on the presence of ApplicationVersion. -If not specified, obtain from the CFBundleVersion key in infoDictionary; if not specified or empty string, leave blank. - -@"ApplicationVersion": NSString displayed as the marketing version ("1.0", "Mac OS X", "3", "WebObjects 3.5", ...), before the build version. -If not specified, obtain from CFBundleShortVersionString key in infoDictionary. Prefixed with word "Version" if it looks like a number. -} - -{@end} - -{#ifdef WIN32 -@interface NSApplication (NSWindowsExtensions) -+ (void)setApplicationHandle:(void * /*HINSTANCE*/)hInstance previousHandle:(void * /*HINSTANCE*/)PrevInstance commandLine:(NSString *)cmdLine show:(int)cmdShow; -+ (void)useRunningCopyOfApplication; -- (void * /*HINSTANCE*/)applicationHandle; -- (NSWindow *)windowWithWindowHandle:(void * /*HWND*/)hWnd; // does not create a new NSWindow -@end -#endif} - end; - diff --git a/bindings/pascocoa/appkit/NSGraphics.inc b/bindings/pascocoa/appkit/NSGraphics.inc index cbd6ad3df..677d2665e 100644 --- a/bindings/pascocoa/appkit/NSGraphics.inc +++ b/bindings/pascocoa/appkit/NSGraphics.inc @@ -1,3 +1,4 @@ +{%mainunit appkit.pas} { NSGraphics.h Application Kit @@ -5,6 +6,10 @@ All rights reserved. } +{$ifdef HEADER} +{$ifndef NSGRAPHICS_PAS_H} +{$define NSGRAPHICS_PAS_H} + //#import //#import @@ -183,4 +188,7 @@ APPKIT_EXTERN void NSShowAnimationEffect(NSAnimationEffect animationEffect, NSPo #endif *) +{$endif} +{$endif} + diff --git a/bindings/pascocoa/appkit/NSPanel.inc b/bindings/pascocoa/appkit/NSPanel.inc index 5629ac019..e468f9e96 100644 --- a/bindings/pascocoa/appkit/NSPanel.inc +++ b/bindings/pascocoa/appkit/NSPanel.inc @@ -1,3 +1,4 @@ +{%mainunit appkit.pas} { NSPanel.h Application Kit @@ -5,6 +6,10 @@ All rights reserved. } +{$ifdef HEADER} +{$ifndef NSPANEL_PAS_H} +{$define NSPANEL_PAS_H} + //#import { @@ -87,4 +92,7 @@ enum { @end *) - + +{$endif} +{$endif} + diff --git a/bindings/pascocoa/appkit/NSWindow.inc b/bindings/pascocoa/appkit/NSWindow.inc index a376f41c8..e3a906362 100644 --- a/bindings/pascocoa/appkit/NSWindow.inc +++ b/bindings/pascocoa/appkit/NSWindow.inc @@ -1,3 +1,4 @@ +{%mainunit appkit.pas} { NSWindow.h Application Kit @@ -5,16 +6,16 @@ All rights reserved. } -{#import -#import +{$ifdef HEADER} +{$ifndef NSWINDOW_PAS_H} +{$define NSWINDOW_PAS_H} + +{#import #import #import #import #import - -@class NSButton, NSButtonCell, NSColor, NSImage, NSPasteboard, NSScreen; -@class NSNotification, NSText, NSView, NSMutableSet, NSSet, NSDate; -@class NSToolbar, NSGraphicsContext;} +} const NSAppKitVersionNumberWithCustomSheetPosition = 686.0; @@ -63,6 +64,22 @@ const Str_initWithContentRect = 'initWithContentRect:styleMask:backing:defer:'; Str_orderFrontRegardless = 'orderFrontRegardless'; +type + NSSelectionDirection = ( + NSDirectSelection = 0, + NSSelectingNext, + NSSelectingPrevious); + +//#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2 +// standard window buttons + NSWindowButton = ( + NSWindowCloseButton, + NSWindowMiniaturizeButton, + NSWindowZoomButton, + NSWindowToolbarButton, + NSWindowDocumentIconButton); +//#endif + { Notifications } {APPKIT_EXTERN NSString *NSWindowDidBecomeKeyNotification; APPKIT_EXTERN NSString *NSWindowDidBecomeMainNotification; @@ -83,3 +100,408 @@ APPKIT_EXTERN NSString *NSWindowDidEndSheetNotification; APPKIT_EXTERN NSString *NSWindowDidChangeScreenProfileNotification AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; } +{$endif} +{$endif} +{$ifdef CLASSES} +{$ifndef NSWINDOW_PAS_C} +{$define NSWINDOW_PAS_C} + +{@class NSButton, NSButtonCell, NSColor, NSImage, NSPasteboard, NSScreen; +@class NSNotification, NSText, NSView, NSMutableSet, NSSet, NSDate; +@class NSToolbar, NSGraphicsContext;} + +{@class NSWindowAuxiliary; +@class NSEvent; +@class NSWindowController; } + + NSWindow = class(NSObject) //: NSResponder + public + + +{+ (NSRect)frameRectForContentRect:(NSRect)cRect styleMask:(unsigned int)aStyle; ++ (NSRect)contentRectForFrameRect:(NSRect)fRect styleMask:(unsigned int)aStyle; ++ (float)minFrameWidthWithTitle:(NSString *)aTitle styleMask:(unsigned int)aStyle; ++ (NSWindowDepth)defaultDepthLimit; + +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 +- (NSRect)frameRectForContentRect:(NSRect)contentRect; +- (NSRect)contentRectForFrameRect:(NSRect)frameRect; +#endif} + + constructor initWithContentRect(contentRect: NSRect; aStyle: cuint; bufferingType: NSBackingStoreType; defer: CBOOL); +{- (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag screen:(NSScreen *)screen; + +- (NSString *)title; +- (void)setTitle:(NSString *)aString; +- (NSString *)representedFilename; +- (void)setRepresentedFilename:(NSString *)aString; +- (void)setTitleWithRepresentedFilename:(NSString *)filename; +- (void)setExcludedFromWindowsMenu:(BOOL)flag; +- (BOOL)isExcludedFromWindowsMenu; +- (void)setContentView:(NSView *)aView; +- (id)contentView; +- (void)setDelegate:(id)anObject; +- (id)delegate; +- (int)windowNumber; +- (unsigned int)styleMask; +- (NSText *)fieldEditor:(BOOL)createFlag forObject:(id)anObject; +- (void)endEditingFor:(id)anObject; + +- (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen; +- (void)setFrame:(NSRect)frameRect display:(BOOL)flag; +- (void)setContentSize:(NSSize)aSize; +- (void)setFrameOrigin:(NSPoint)aPoint; +- (void)setFrameTopLeftPoint:(NSPoint)aPoint; +- (NSPoint)cascadeTopLeftFromPoint:(NSPoint)topLeftPoint; +- (NSRect)frame; + +// smooth resize +// subclasses can override animationResizeTime: to control the total time for the frame change. +// newFrame is the rect passed into setFrame:display:animate: +- (NSTimeInterval)animationResizeTime:(NSRect)newFrame; +// setFrame:display:animate: is equivalent to setFrame:display: if animateFlag is NO +// If animationFlag is YES, this method will perform a smooth resize of the window, where the total time for the resize is specified by -animationResizeTime: +- (void)setFrame:(NSRect)frameRect display:(BOOL)displayFlag animate:(BOOL)animateFlag; + +// show/hide resize corner (does not affect whether window is resizable) +- (void)setShowsResizeIndicator:(BOOL)show; +- (BOOL)showsResizeIndicator; + +- (void)setResizeIncrements:(NSSize)increments; +- (NSSize)resizeIncrements; +- (void)setAspectRatio:(NSSize)ratio; +- (NSSize)aspectRatio; + +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 +- (void)setContentResizeIncrements:(NSSize)increments; +- (NSSize)contentResizeIncrements; +- (void)setContentAspectRatio:(NSSize)ratio; +- (NSSize)contentAspectRatio; +#endif + +- (void)useOptimizedDrawing:(BOOL)flag; +- (void)disableFlushWindow; +- (void)enableFlushWindow; +- (BOOL)isFlushWindowDisabled; +- (void)flushWindow; +- (void)flushWindowIfNeeded; +- (void)setViewsNeedDisplay:(BOOL)flag; +- (BOOL)viewsNeedDisplay; +- (void)displayIfNeeded; +- (void)display; +- (void)setAutodisplay:(BOOL)flag; +- (BOOL)isAutodisplay; + +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 +- (BOOL)preservesContentDuringLiveResize; +- (void)setPreservesContentDuringLiveResize:(BOOL)flag; +#endif + +- (void)update; +- (BOOL)makeFirstResponder:(NSResponder *)aResponder; +- (NSResponder *)firstResponder; +- (int)resizeFlags; +- (void)keyDown:(NSEvent *)theEvent; +- (void)close; +- (void)setReleasedWhenClosed:(BOOL)flag; +- (BOOL)isReleasedWhenClosed; +- (void)miniaturize:(id)sender; +- (void)deminiaturize:(id)sender; +- (BOOL)isZoomed; +- (void)zoom:(id)sender; +- (BOOL)isMiniaturized; +- (BOOL)tryToPerform:(SEL)anAction with:(id)anObject; +- (id)validRequestorForSendType:(NSString *)sendType returnType:(NSString *)returnType; +- (void)setBackgroundColor:(NSColor *)color; +- (NSColor *)backgroundColor; + +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2 +- (void)setMovableByWindowBackground:(BOOL)flag; +- (BOOL)isMovableByWindowBackground; +#endif + +- (void)setHidesOnDeactivate:(BOOL)flag; +- (BOOL)hidesOnDeactivate; + +// indicate whether a window can be hidden during -[NSApplication hide:]. Default is YES +- (void)setCanHide:(BOOL)flag; +- (BOOL)canHide; + +- (void)center; +- (void)makeKeyAndOrderFront:(id)sender; +- (void)orderFront:(id)sender; +- (void)orderBack:(id)sender; +- (void)orderOut:(id)sender; +- (void)orderWindow:(NSWindowOrderingMode)place relativeTo:(int)otherWin;} + procedure orderFrontRegardless; + +{- (void)setMiniwindowImage:(NSImage *)image; +- (void)setMiniwindowTitle:(NSString *)title; +- (NSImage *)miniwindowImage; +- (NSString *)miniwindowTitle; + +- (void)setDocumentEdited:(BOOL)flag; +- (BOOL)isDocumentEdited; +- (BOOL)isVisible; +- (BOOL)isKeyWindow; +- (BOOL)isMainWindow; +- (BOOL)canBecomeKeyWindow; +- (BOOL)canBecomeMainWindow; +- (void)makeKeyWindow; +- (void)makeMainWindow; +- (void)becomeKeyWindow; +- (void)resignKeyWindow; +- (void)becomeMainWindow; +- (void)resignMainWindow; + +- (BOOL)worksWhenModal; +- (NSPoint)convertBaseToScreen:(NSPoint)aPoint; +- (NSPoint)convertScreenToBase:(NSPoint)aPoint; +- (void)performClose:(id)sender; +- (void)performMiniaturize:(id)sender; +- (void)performZoom:(id)sender; +- (int)gState; +- (void)setOneShot:(BOOL)flag; +- (BOOL)isOneShot; +- (NSData *)dataWithEPSInsideRect:(NSRect)rect; +- (NSData *)dataWithPDFInsideRect:(NSRect)rect; +- (void)print:(id)sender; + +- (void)disableCursorRects; +- (void)enableCursorRects; +- (void)discardCursorRects; +- (BOOL)areCursorRectsEnabled; +- (void)invalidateCursorRectsForView:(NSView *)aView; +- (void)resetCursorRects; + +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 +- (void)setAllowsToolTipsWhenApplicationIsInactive:(BOOL)allowWhenInactive; + // Default is NO. Set to YES to allow a window to display tooltips even when the application is in the background. Note that, enabling tooltips in an inactive application will cause the app to do work any time the mouse passes over the window. This can degrade system performance. + +- (BOOL)allowsToolTipsWhenApplicationIsInactive; + // Returns YES if this window displays tooltips even when the application is in the background. To configure this setting you should call setAllowsToolTipsWhenApplicationIsInactive: instead of overriding -allowsToolTipsWhenApplicationIsInactive. +#endif + +- (void)setBackingType:(NSBackingStoreType)bufferingType; +- (NSBackingStoreType)backingType; +- (void)setLevel:(int)newLevel; +- (int)level; +- (void)setDepthLimit:(NSWindowDepth)limit; +- (NSWindowDepth)depthLimit; +- (void)setDynamicDepthLimit:(BOOL)flag; +- (BOOL)hasDynamicDepthLimit; +- (NSScreen *)screen; +- (NSScreen *)deepestScreen; +- (BOOL)canStoreColor; +- (void)setHasShadow:(BOOL)hasShadow; +- (BOOL)hasShadow; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2 +- (void)invalidateShadow; +#endif +- (void)setAlphaValue:(float)windowAlpha; +- (float)alphaValue; +- (void)setOpaque:(BOOL)isOpaque; +- (BOOL)isOpaque; + +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 +- (BOOL)displaysWhenScreenProfileChanges; +- (void)setDisplaysWhenScreenProfileChanges:(BOOL)flag; + +- (void)disableScreenUpdatesUntilFlush; +#endif + + +- (NSString *)stringWithSavedFrame; +- (void)setFrameFromString:(NSString *)string; +- (void)saveFrameUsingName:(NSString *)name; +// Set force=YES to use setFrameUsingName on a non-resizable window +- (BOOL)setFrameUsingName:(NSString *)name force:(BOOL)force; +- (BOOL)setFrameUsingName:(NSString *)name; +- (BOOL)setFrameAutosaveName:(NSString *)name; +- (NSString *)frameAutosaveName; ++ (void)removeFrameUsingName:(NSString *)name; + + +- (void)cacheImageInRect:(NSRect)aRect; +- (void)restoreCachedImage; +- (void)discardCachedImage; + +- (NSSize)minSize; +- (NSSize)maxSize; +- (void)setMinSize:(NSSize)size; +- (void)setMaxSize:(NSSize)size; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 +- (NSSize)contentMinSize; +- (NSSize)contentMaxSize; +- (void)setContentMinSize:(NSSize)size; +- (void)setContentMaxSize:(NSSize)size; +#endif +- (NSEvent *)nextEventMatchingMask:(unsigned int)mask; +- (NSEvent *)nextEventMatchingMask:(unsigned int)mask untilDate:(NSDate *)expiration inMode:(NSString *)mode dequeue:(BOOL)deqFlag; +- (void)discardEventsMatchingMask:(unsigned int)mask beforeEvent:(NSEvent *)lastEvent; +- (void)postEvent:(NSEvent *)event atStart:(BOOL)flag; +- (NSEvent *)currentEvent; +- (void)setAcceptsMouseMovedEvents:(BOOL)flag; +- (BOOL)acceptsMouseMovedEvents; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2 +- (void)setIgnoresMouseEvents:(BOOL)flag; +- (BOOL)ignoresMouseEvents; +#endif +- (NSDictionary *)deviceDescription; +- (void)sendEvent:(NSEvent *)theEvent; +- (NSPoint)mouseLocationOutsideOfEventStream; ++ (void)menuChanged:(NSMenu *)menu; + +- (id)windowController; +- (void)setWindowController:(NSWindowController *)windowController; + +- (BOOL)isSheet; +- (NSWindow *)attachedSheet; + +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2 ++ (NSButton *)standardWindowButton:(NSWindowButton)b forStyleMask:(unsigned int)styleMask; +- (NSButton *)standardWindowButton:(NSWindowButton)b; +#endif + +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2 +- (void)addChildWindow:(NSWindow *)childWin ordered:(NSWindowOrderingMode)place; +- (void)removeChildWindow:(NSWindow *)childWin; +- (NSArray *)childWindows; + +- (NSWindow *)parentWindow; +- (void)setParentWindow:(NSWindow *)window; +#endif + +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 +/* Returns NSGraphicsContext used to render the receiver's content on the screen for the calling thread. +*/ +- (NSGraphicsContext *)graphicsContext; + +/* Returns scale factor applied to view coordinate system to get to base coordinate system of window +*/ +- (float)userSpaceScaleFactor; + +#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 */} + +{@interface NSWindow(NSKeyboardUI) +- (void)setInitialFirstResponder:(NSView *)view; +- (NSView *)initialFirstResponder; +- (void)selectNextKeyView:(id)sender; +- (void)selectPreviousKeyView:(id)sender; +- (void)selectKeyViewFollowingView:(NSView *)aView; +- (void)selectKeyViewPrecedingView:(NSView *)aView; +- (NSSelectionDirection)keyViewSelectionDirection; +- (void)setDefaultButtonCell:(NSButtonCell *)defButt; +- (NSButtonCell *)defaultButtonCell; +- (void)disableKeyEquivalentForDefaultButtonCell; +- (void)enableKeyEquivalentForDefaultButtonCell; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 +- (void)setAutorecalculatesKeyViewLoop:(BOOL)flag; +- (BOOL)autorecalculatesKeyViewLoop; +- (void)recalculateKeyViewLoop; +#endif +@end + +@interface NSWindow (NSToolbarSupport) +- (void)setToolbar:(NSToolbar*)toolbar; +- (NSToolbar *)toolbar; +- (void)toggleToolbarShown:(id)sender; +- (void)runToolbarCustomizationPalette:(id)sender; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 +- (void)setShowsToolbarButton:(BOOL)show; +- (BOOL)showsToolbarButton; +#endif +@end + +@interface NSWindow(NSDrag) +- (void)dragImage:(NSImage *)anImage at:(NSPoint)baseLocation offset:(NSSize)initialOffset event:(NSEvent *)event pasteboard:(NSPasteboard *)pboard source:(id)sourceObj slideBack:(BOOL)slideFlag; + +- (void)registerForDraggedTypes:(NSArray *)newTypes; +- (void)unregisterDraggedTypes; +@end + +#ifdef WIN32 +@interface NSWindow (NSWindowsExtensions) +- (void * /*HWND*/)windowHandle; +@end +#else +@interface NSWindow(NSCarbonExtensions) +// create an NSWindow for a Carbon window - windowRef must be a Carbon WindowRef - see MacWindows.h +- (NSWindow *)initWithWindowRef:(void * /* WindowRef */)windowRef; +// return the Carbon WindowRef for this window, creating if necessary: - see MacWindows.h +- (void * /* WindowRef */)windowRef; +@end + +#endif + +@interface NSObject(NSWindowNotifications) +- (void)windowDidResize:(NSNotification *)notification; +- (void)windowDidExpose:(NSNotification *)notification; +- (void)windowWillMove:(NSNotification *)notification; +- (void)windowDidMove:(NSNotification *)notification; +- (void)windowDidBecomeKey:(NSNotification *)notification; +- (void)windowDidResignKey:(NSNotification *)notification; +- (void)windowDidBecomeMain:(NSNotification *)notification; +- (void)windowDidResignMain:(NSNotification *)notification; +- (void)windowWillClose:(NSNotification *)notification; +- (void)windowWillMiniaturize:(NSNotification *)notification; +- (void)windowDidMiniaturize:(NSNotification *)notification; +- (void)windowDidDeminiaturize:(NSNotification *)notification; +- (void)windowDidUpdate:(NSNotification *)notification; +- (void)windowDidChangeScreen:(NSNotification *)notification; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 +- (void)windowDidChangeScreenProfile:(NSNotification *)notification; +#endif +- (void)windowWillBeginSheet:(NSNotification *)notification; +- (void)windowDidEndSheet:(NSNotification *)notification; +@end + +@interface NSObject(NSWindowDelegate) +- (BOOL)windowShouldClose:(id)sender; +- (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)client; +- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)frameSize; +- (NSRect)windowWillUseStandardFrame:(NSWindow *)window defaultFrame:(NSRect)newFrame; +- (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame; +- (NSUndoManager *)windowWillReturnUndoManager:(NSWindow *)window; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 +- (NSRect)window:(NSWindow *)window willPositionSheet:(NSWindow *)sheet usingRect:(NSRect)rect; +#endif +@end} + end; + +{$endif} +{$endif} +{$ifdef IMPLEMENTATION} + +constructor NSWindow.initWithContentRect( + contentRect: NSRect; + aStyle: cuint; + bufferingType: NSBackingStoreType; + defer: CBOOL); +type + initWithContentRect_t = function (param1: objc.id; param2: SEL; + param3, param4, param5, param6: cfloat; + param7: cuint; + param8: NSBackingStoreType; param9: BOOL): objc.id; cdecl; +var + vinit: initWithContentRect_t; +begin +{ NSWindow* MainWindow = [[NSWindow alloc] initWithContentRect: MainWindowRect + styleMask: NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask + backing: NSBackingStoreBuffered + defer: NO]; } + ClassId := objc_getClass(PChar(Str_NSWindow)); + allocbuf := objc_msgSend(ClassId, sel_registerName(PChar(Str_alloc)), []); + vinit := initWithContentRect_t(@objc_msgSend); + Handle := vinit(allocbuf, sel_registerName(PChar(Str_initWithContentRect)), + contentRect.origin.x, contentRect.origin.y, contentRect.size.width, contentRect.size.height, + aStyle, bufferingType, defer); +end; + +procedure NSWindow.orderFrontRegardless; +begin + objc_msgSend(Handle, sel_registerName(PChar(Str_orderFrontRegardless)), []); +end; + +{$endif} + diff --git a/bindings/pascocoa/appkit/NSWindow_impl.inc b/bindings/pascocoa/appkit/NSWindow_impl.inc deleted file mode 100644 index b81efa771..000000000 --- a/bindings/pascocoa/appkit/NSWindow_impl.inc +++ /dev/null @@ -1,32 +0,0 @@ -{%mainunit appkit.pas} - -constructor NSWindow.initWithContentRect( - contentRect: NSRect; - aStyle: cuint; - bufferingType: NSBackingStoreType; - defer: CBOOL); -type - initWithContentRect_t = function (param1: objc.id; param2: SEL; - param3, param4, param5, param6: cfloat; - param7: cuint; - param8: NSBackingStoreType; param9: BOOL): objc.id; cdecl; -var - vinit: initWithContentRect_t; -begin -{ NSWindow* MainWindow = [[NSWindow alloc] initWithContentRect: MainWindowRect - styleMask: NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask - backing: NSBackingStoreBuffered - defer: NO]; } - ClassId := objc_getClass(PChar(Str_NSWindow)); - allocbuf := objc_msgSend(ClassId, sel_registerName(PChar(Str_alloc)), []); - vinit := initWithContentRect_t(@objc_msgSend); - Handle := vinit(allocbuf, sel_registerName(PChar(Str_initWithContentRect)), - contentRect.origin.x, contentRect.origin.y, contentRect.size.width, contentRect.size.height, - aStyle, bufferingType, defer); -end; - -procedure NSWindow.orderFrontRegardless; -begin - objc_msgSend(Handle, sel_registerName(PChar(Str_orderFrontRegardless)), []); -end; - diff --git a/bindings/pascocoa/appkit/NSWindow_type.inc b/bindings/pascocoa/appkit/NSWindow_type.inc deleted file mode 100644 index 70d9d2911..000000000 --- a/bindings/pascocoa/appkit/NSWindow_type.inc +++ /dev/null @@ -1,393 +0,0 @@ -{%MainUnit appkit.pas} -{ - NSWindow.h - Application Kit - Copyright (c) 1994-2005, Apple Computer, Inc. - All rights reserved. -} - -{#import -#import -#import -#import -#import -#import - -@class NSButton, NSButtonCell, NSColor, NSImage, NSPasteboard, NSScreen; -@class NSNotification, NSText, NSView, NSMutableSet, NSSet, NSDate; -@class NSToolbar, NSGraphicsContext;} - - NSSelectionDirection = ( - NSDirectSelection = 0, - NSSelectingNext, - NSSelectingPrevious); - -//#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2 -// standard window buttons - NSWindowButton = ( - NSWindowCloseButton, - NSWindowMiniaturizeButton, - NSWindowZoomButton, - NSWindowToolbarButton, - NSWindowDocumentIconButton); -//#endif - -{@class NSWindowAuxiliary; -@class NSEvent; -@class NSWindowController; } - - NSWindow = class(NSObject) //: NSResponder - public - - -{+ (NSRect)frameRectForContentRect:(NSRect)cRect styleMask:(unsigned int)aStyle; -+ (NSRect)contentRectForFrameRect:(NSRect)fRect styleMask:(unsigned int)aStyle; -+ (float)minFrameWidthWithTitle:(NSString *)aTitle styleMask:(unsigned int)aStyle; -+ (NSWindowDepth)defaultDepthLimit; - -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 -- (NSRect)frameRectForContentRect:(NSRect)contentRect; -- (NSRect)contentRectForFrameRect:(NSRect)frameRect; -#endif} - - constructor initWithContentRect(contentRect: NSRect; aStyle: cuint; bufferingType: NSBackingStoreType; defer: CBOOL); -{- (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag screen:(NSScreen *)screen; - -- (NSString *)title; -- (void)setTitle:(NSString *)aString; -- (NSString *)representedFilename; -- (void)setRepresentedFilename:(NSString *)aString; -- (void)setTitleWithRepresentedFilename:(NSString *)filename; -- (void)setExcludedFromWindowsMenu:(BOOL)flag; -- (BOOL)isExcludedFromWindowsMenu; -- (void)setContentView:(NSView *)aView; -- (id)contentView; -- (void)setDelegate:(id)anObject; -- (id)delegate; -- (int)windowNumber; -- (unsigned int)styleMask; -- (NSText *)fieldEditor:(BOOL)createFlag forObject:(id)anObject; -- (void)endEditingFor:(id)anObject; - -- (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen; -- (void)setFrame:(NSRect)frameRect display:(BOOL)flag; -- (void)setContentSize:(NSSize)aSize; -- (void)setFrameOrigin:(NSPoint)aPoint; -- (void)setFrameTopLeftPoint:(NSPoint)aPoint; -- (NSPoint)cascadeTopLeftFromPoint:(NSPoint)topLeftPoint; -- (NSRect)frame; - -// smooth resize -// subclasses can override animationResizeTime: to control the total time for the frame change. -// newFrame is the rect passed into setFrame:display:animate: -- (NSTimeInterval)animationResizeTime:(NSRect)newFrame; -// setFrame:display:animate: is equivalent to setFrame:display: if animateFlag is NO -// If animationFlag is YES, this method will perform a smooth resize of the window, where the total time for the resize is specified by -animationResizeTime: -- (void)setFrame:(NSRect)frameRect display:(BOOL)displayFlag animate:(BOOL)animateFlag; - -// show/hide resize corner (does not affect whether window is resizable) -- (void)setShowsResizeIndicator:(BOOL)show; -- (BOOL)showsResizeIndicator; - -- (void)setResizeIncrements:(NSSize)increments; -- (NSSize)resizeIncrements; -- (void)setAspectRatio:(NSSize)ratio; -- (NSSize)aspectRatio; - -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 -- (void)setContentResizeIncrements:(NSSize)increments; -- (NSSize)contentResizeIncrements; -- (void)setContentAspectRatio:(NSSize)ratio; -- (NSSize)contentAspectRatio; -#endif - -- (void)useOptimizedDrawing:(BOOL)flag; -- (void)disableFlushWindow; -- (void)enableFlushWindow; -- (BOOL)isFlushWindowDisabled; -- (void)flushWindow; -- (void)flushWindowIfNeeded; -- (void)setViewsNeedDisplay:(BOOL)flag; -- (BOOL)viewsNeedDisplay; -- (void)displayIfNeeded; -- (void)display; -- (void)setAutodisplay:(BOOL)flag; -- (BOOL)isAutodisplay; - -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 -- (BOOL)preservesContentDuringLiveResize; -- (void)setPreservesContentDuringLiveResize:(BOOL)flag; -#endif - -- (void)update; -- (BOOL)makeFirstResponder:(NSResponder *)aResponder; -- (NSResponder *)firstResponder; -- (int)resizeFlags; -- (void)keyDown:(NSEvent *)theEvent; -- (void)close; -- (void)setReleasedWhenClosed:(BOOL)flag; -- (BOOL)isReleasedWhenClosed; -- (void)miniaturize:(id)sender; -- (void)deminiaturize:(id)sender; -- (BOOL)isZoomed; -- (void)zoom:(id)sender; -- (BOOL)isMiniaturized; -- (BOOL)tryToPerform:(SEL)anAction with:(id)anObject; -- (id)validRequestorForSendType:(NSString *)sendType returnType:(NSString *)returnType; -- (void)setBackgroundColor:(NSColor *)color; -- (NSColor *)backgroundColor; - -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2 -- (void)setMovableByWindowBackground:(BOOL)flag; -- (BOOL)isMovableByWindowBackground; -#endif - -- (void)setHidesOnDeactivate:(BOOL)flag; -- (BOOL)hidesOnDeactivate; - -// indicate whether a window can be hidden during -[NSApplication hide:]. Default is YES -- (void)setCanHide:(BOOL)flag; -- (BOOL)canHide; - -- (void)center; -- (void)makeKeyAndOrderFront:(id)sender; -- (void)orderFront:(id)sender; -- (void)orderBack:(id)sender; -- (void)orderOut:(id)sender; -- (void)orderWindow:(NSWindowOrderingMode)place relativeTo:(int)otherWin;} - procedure orderFrontRegardless; - -{- (void)setMiniwindowImage:(NSImage *)image; -- (void)setMiniwindowTitle:(NSString *)title; -- (NSImage *)miniwindowImage; -- (NSString *)miniwindowTitle; - -- (void)setDocumentEdited:(BOOL)flag; -- (BOOL)isDocumentEdited; -- (BOOL)isVisible; -- (BOOL)isKeyWindow; -- (BOOL)isMainWindow; -- (BOOL)canBecomeKeyWindow; -- (BOOL)canBecomeMainWindow; -- (void)makeKeyWindow; -- (void)makeMainWindow; -- (void)becomeKeyWindow; -- (void)resignKeyWindow; -- (void)becomeMainWindow; -- (void)resignMainWindow; - -- (BOOL)worksWhenModal; -- (NSPoint)convertBaseToScreen:(NSPoint)aPoint; -- (NSPoint)convertScreenToBase:(NSPoint)aPoint; -- (void)performClose:(id)sender; -- (void)performMiniaturize:(id)sender; -- (void)performZoom:(id)sender; -- (int)gState; -- (void)setOneShot:(BOOL)flag; -- (BOOL)isOneShot; -- (NSData *)dataWithEPSInsideRect:(NSRect)rect; -- (NSData *)dataWithPDFInsideRect:(NSRect)rect; -- (void)print:(id)sender; - -- (void)disableCursorRects; -- (void)enableCursorRects; -- (void)discardCursorRects; -- (BOOL)areCursorRectsEnabled; -- (void)invalidateCursorRectsForView:(NSView *)aView; -- (void)resetCursorRects; - -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 -- (void)setAllowsToolTipsWhenApplicationIsInactive:(BOOL)allowWhenInactive; - // Default is NO. Set to YES to allow a window to display tooltips even when the application is in the background. Note that, enabling tooltips in an inactive application will cause the app to do work any time the mouse passes over the window. This can degrade system performance. - -- (BOOL)allowsToolTipsWhenApplicationIsInactive; - // Returns YES if this window displays tooltips even when the application is in the background. To configure this setting you should call setAllowsToolTipsWhenApplicationIsInactive: instead of overriding -allowsToolTipsWhenApplicationIsInactive. -#endif - -- (void)setBackingType:(NSBackingStoreType)bufferingType; -- (NSBackingStoreType)backingType; -- (void)setLevel:(int)newLevel; -- (int)level; -- (void)setDepthLimit:(NSWindowDepth)limit; -- (NSWindowDepth)depthLimit; -- (void)setDynamicDepthLimit:(BOOL)flag; -- (BOOL)hasDynamicDepthLimit; -- (NSScreen *)screen; -- (NSScreen *)deepestScreen; -- (BOOL)canStoreColor; -- (void)setHasShadow:(BOOL)hasShadow; -- (BOOL)hasShadow; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2 -- (void)invalidateShadow; -#endif -- (void)setAlphaValue:(float)windowAlpha; -- (float)alphaValue; -- (void)setOpaque:(BOOL)isOpaque; -- (BOOL)isOpaque; - -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 -- (BOOL)displaysWhenScreenProfileChanges; -- (void)setDisplaysWhenScreenProfileChanges:(BOOL)flag; - -- (void)disableScreenUpdatesUntilFlush; -#endif - - -- (NSString *)stringWithSavedFrame; -- (void)setFrameFromString:(NSString *)string; -- (void)saveFrameUsingName:(NSString *)name; -// Set force=YES to use setFrameUsingName on a non-resizable window -- (BOOL)setFrameUsingName:(NSString *)name force:(BOOL)force; -- (BOOL)setFrameUsingName:(NSString *)name; -- (BOOL)setFrameAutosaveName:(NSString *)name; -- (NSString *)frameAutosaveName; -+ (void)removeFrameUsingName:(NSString *)name; - - -- (void)cacheImageInRect:(NSRect)aRect; -- (void)restoreCachedImage; -- (void)discardCachedImage; - -- (NSSize)minSize; -- (NSSize)maxSize; -- (void)setMinSize:(NSSize)size; -- (void)setMaxSize:(NSSize)size; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 -- (NSSize)contentMinSize; -- (NSSize)contentMaxSize; -- (void)setContentMinSize:(NSSize)size; -- (void)setContentMaxSize:(NSSize)size; -#endif -- (NSEvent *)nextEventMatchingMask:(unsigned int)mask; -- (NSEvent *)nextEventMatchingMask:(unsigned int)mask untilDate:(NSDate *)expiration inMode:(NSString *)mode dequeue:(BOOL)deqFlag; -- (void)discardEventsMatchingMask:(unsigned int)mask beforeEvent:(NSEvent *)lastEvent; -- (void)postEvent:(NSEvent *)event atStart:(BOOL)flag; -- (NSEvent *)currentEvent; -- (void)setAcceptsMouseMovedEvents:(BOOL)flag; -- (BOOL)acceptsMouseMovedEvents; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2 -- (void)setIgnoresMouseEvents:(BOOL)flag; -- (BOOL)ignoresMouseEvents; -#endif -- (NSDictionary *)deviceDescription; -- (void)sendEvent:(NSEvent *)theEvent; -- (NSPoint)mouseLocationOutsideOfEventStream; -+ (void)menuChanged:(NSMenu *)menu; - -- (id)windowController; -- (void)setWindowController:(NSWindowController *)windowController; - -- (BOOL)isSheet; -- (NSWindow *)attachedSheet; - -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2 -+ (NSButton *)standardWindowButton:(NSWindowButton)b forStyleMask:(unsigned int)styleMask; -- (NSButton *)standardWindowButton:(NSWindowButton)b; -#endif - -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2 -- (void)addChildWindow:(NSWindow *)childWin ordered:(NSWindowOrderingMode)place; -- (void)removeChildWindow:(NSWindow *)childWin; -- (NSArray *)childWindows; - -- (NSWindow *)parentWindow; -- (void)setParentWindow:(NSWindow *)window; -#endif - -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 -/* Returns NSGraphicsContext used to render the receiver's content on the screen for the calling thread. -*/ -- (NSGraphicsContext *)graphicsContext; - -/* Returns scale factor applied to view coordinate system to get to base coordinate system of window -*/ -- (float)userSpaceScaleFactor; - -#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 */} - -{@interface NSWindow(NSKeyboardUI) -- (void)setInitialFirstResponder:(NSView *)view; -- (NSView *)initialFirstResponder; -- (void)selectNextKeyView:(id)sender; -- (void)selectPreviousKeyView:(id)sender; -- (void)selectKeyViewFollowingView:(NSView *)aView; -- (void)selectKeyViewPrecedingView:(NSView *)aView; -- (NSSelectionDirection)keyViewSelectionDirection; -- (void)setDefaultButtonCell:(NSButtonCell *)defButt; -- (NSButtonCell *)defaultButtonCell; -- (void)disableKeyEquivalentForDefaultButtonCell; -- (void)enableKeyEquivalentForDefaultButtonCell; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 -- (void)setAutorecalculatesKeyViewLoop:(BOOL)flag; -- (BOOL)autorecalculatesKeyViewLoop; -- (void)recalculateKeyViewLoop; -#endif -@end - -@interface NSWindow (NSToolbarSupport) -- (void)setToolbar:(NSToolbar*)toolbar; -- (NSToolbar *)toolbar; -- (void)toggleToolbarShown:(id)sender; -- (void)runToolbarCustomizationPalette:(id)sender; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 -- (void)setShowsToolbarButton:(BOOL)show; -- (BOOL)showsToolbarButton; -#endif -@end - -@interface NSWindow(NSDrag) -- (void)dragImage:(NSImage *)anImage at:(NSPoint)baseLocation offset:(NSSize)initialOffset event:(NSEvent *)event pasteboard:(NSPasteboard *)pboard source:(id)sourceObj slideBack:(BOOL)slideFlag; - -- (void)registerForDraggedTypes:(NSArray *)newTypes; -- (void)unregisterDraggedTypes; -@end - -#ifdef WIN32 -@interface NSWindow (NSWindowsExtensions) -- (void * /*HWND*/)windowHandle; -@end -#else -@interface NSWindow(NSCarbonExtensions) -// create an NSWindow for a Carbon window - windowRef must be a Carbon WindowRef - see MacWindows.h -- (NSWindow *)initWithWindowRef:(void * /* WindowRef */)windowRef; -// return the Carbon WindowRef for this window, creating if necessary: - see MacWindows.h -- (void * /* WindowRef */)windowRef; -@end - -#endif - -@interface NSObject(NSWindowNotifications) -- (void)windowDidResize:(NSNotification *)notification; -- (void)windowDidExpose:(NSNotification *)notification; -- (void)windowWillMove:(NSNotification *)notification; -- (void)windowDidMove:(NSNotification *)notification; -- (void)windowDidBecomeKey:(NSNotification *)notification; -- (void)windowDidResignKey:(NSNotification *)notification; -- (void)windowDidBecomeMain:(NSNotification *)notification; -- (void)windowDidResignMain:(NSNotification *)notification; -- (void)windowWillClose:(NSNotification *)notification; -- (void)windowWillMiniaturize:(NSNotification *)notification; -- (void)windowDidMiniaturize:(NSNotification *)notification; -- (void)windowDidDeminiaturize:(NSNotification *)notification; -- (void)windowDidUpdate:(NSNotification *)notification; -- (void)windowDidChangeScreen:(NSNotification *)notification; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 -- (void)windowDidChangeScreenProfile:(NSNotification *)notification; -#endif -- (void)windowWillBeginSheet:(NSNotification *)notification; -- (void)windowDidEndSheet:(NSNotification *)notification; -@end - -@interface NSObject(NSWindowDelegate) -- (BOOL)windowShouldClose:(id)sender; -- (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)client; -- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)frameSize; -- (NSRect)windowWillUseStandardFrame:(NSWindow *)window defaultFrame:(NSRect)newFrame; -- (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame; -- (NSUndoManager *)windowWillReturnUndoManager:(NSWindow *)window; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 -- (NSRect)window:(NSWindow *)window willPositionSheet:(NSWindow *)sheet usingRect:(NSRect)rect; -#endif -@end} - end; - diff --git a/bindings/pascocoa/appkit/appkit.pas b/bindings/pascocoa/appkit/appkit.pas index b5c6c175f..1e94de4c7 100644 --- a/bindings/pascocoa/appkit/appkit.pas +++ b/bindings/pascocoa/appkit/appkit.pas @@ -17,11 +17,23 @@ interface uses ctypes, FPCMacOSAll, objc, foundation; +{$define HEADER} {$include AppKit.inc} +{$undef HEADER} + +type +{$define CLASSES} +{$include AppKit.inc} +{$undef CLASSES} + +var + NSApp: NSApplication; implementation -{$include AppKit_impl.inc} +{$define IMPLEMENTATION} +{$include AppKit.inc} +{$undef IMPLEMENTATION} end. diff --git a/bindings/pascocoa/examples/simplewindow/simplewindow.lpi b/bindings/pascocoa/examples/simplewindow/simplewindow.lpi index f8638da4b..3c2be467f 100644 --- a/bindings/pascocoa/examples/simplewindow/simplewindow.lpi +++ b/bindings/pascocoa/examples/simplewindow/simplewindow.lpi @@ -11,7 +11,7 @@ - <ActiveEditorIndexAtStart Value="0"/> + <ActiveEditorIndexAtStart Value="2"/> </General> <VersionInfo> <ProjectVersion Value=""/> @@ -33,38 +33,40 @@ <Filename Value="simplewindow.pas"/> <IsPartOfProject Value="True"/> <UnitName Value="simplewindow"/> - <CursorPos X="3" Y="53"/> - <TopLine Value="41"/> + <CursorPos X="45" Y="21"/> + <TopLine Value="43"/> <EditorIndex Value="0"/> - <UsageCount Value="47"/> + <UsageCount Value="48"/> <Loaded Value="True"/> </Unit0> <Unit1> <Filename Value="../../appkit/appkit.pas"/> <UnitName Value="appkit"/> - <CursorPos X="9" Y="10"/> - <TopLine Value="5"/> + <CursorPos X="15" Y="21"/> + <TopLine Value="12"/> + <EditorIndex Value="1"/> <UsageCount Value="13"/> + <Loaded Value="True"/> </Unit1> <Unit2> <Filename Value="../../appkit/NSPanel.inc"/> - <CursorPos X="44" Y="7"/> - <TopLine Value="4"/> - <UsageCount Value="9"/> + <CursorPos X="14" Y="89"/> + <TopLine Value="79"/> + <UsageCount Value="10"/> </Unit2> <Unit3> <Filename Value="../../appkit/NSApplication_impl.inc"/> - <CursorPos X="1" Y="4"/> - <TopLine Value="4"/> - <EditorIndex Value="4"/> + <CursorPos X="73" Y="11"/> + <TopLine Value="8"/> <UsageCount Value="19"/> - <Loaded Value="True"/> </Unit3> <Unit4> <Filename Value="../../appkit/AppKit.inc"/> - <CursorPos X="11" Y="157"/> - <TopLine Value="152"/> - <UsageCount Value="9"/> + <CursorPos X="15" Y="92"/> + <TopLine Value="148"/> + <EditorIndex Value="2"/> + <UsageCount Value="10"/> + <Loaded Value="True"/> </Unit4> <Unit5> <Filename Value="../../../fpc/packages/extra/univint/FPCMacOSAll.pas"/> @@ -101,8 +103,8 @@ </Unit9> <Unit10> <Filename Value="../../foundation/Foundation.inc"/> - <CursorPos X="22" Y="31"/> - <TopLine Value="27"/> + <CursorPos X="33" Y="3"/> + <TopLine Value="1"/> <UsageCount Value="11"/> </Unit10> <Unit11> @@ -113,21 +115,21 @@ </Unit11> <Unit12> <Filename Value="../../foundation/NSAutoreleasePool.inc"/> - <CursorPos X="49" Y="12"/> - <TopLine Value="2"/> + <CursorPos X="26" Y="15"/> + <TopLine Value="13"/> <UsageCount Value="26"/> </Unit12> <Unit13> <Filename Value="../../foundation/NSAutoreleasePool_impl.inc"/> - <CursorPos X="23" Y="3"/> + <CursorPos X="22" Y="9"/> <TopLine Value="1"/> <UsageCount Value="20"/> </Unit13> <Unit14> <Filename Value="../../foundation/foundation.pas"/> <UnitName Value="foundation"/> - <CursorPos X="12" Y="6"/> - <TopLine Value="1"/> + <CursorPos X="24" Y="7"/> + <TopLine Value="6"/> <UsageCount Value="25"/> </Unit14> <Unit15> @@ -139,25 +141,21 @@ </Unit15> <Unit16> <Filename Value="../../foundation/NSObject.inc"/> - <CursorPos X="37" Y="59"/> - <TopLine Value="56"/> + <CursorPos X="24" Y="89"/> + <TopLine Value="87"/> <UsageCount Value="21"/> </Unit16> <Unit17> <Filename Value="../../foundation/NSObject_impl.inc"/> - <CursorPos X="6" Y="11"/> + <CursorPos X="1" Y="11"/> <TopLine Value="1"/> - <EditorIndex Value="3"/> <UsageCount Value="33"/> - <Loaded Value="True"/> </Unit17> <Unit18> <Filename Value="../../appkit/NSApplication.inc"/> - <CursorPos X="1" Y="55"/> - <TopLine Value="57"/> - <EditorIndex Value="5"/> + <CursorPos X="44" Y="355"/> + <TopLine Value="352"/> <UsageCount Value="18"/> - <Loaded Value="True"/> </Unit18> <Unit19> <Filename Value="/System/Library/Frameworks/AppKit.framework/Versions/C/Headers/NSWindow.h"/> @@ -168,19 +166,17 @@ </Unit19> <Unit20> <Filename Value="../../appkit/NSWindow.inc"/> - <CursorPos X="46" Y="65"/> - <TopLine Value="59"/> - <EditorIndex Value="2"/> + <CursorPos X="1" Y="474"/> + <TopLine Value="463"/> + <EditorIndex Value="3"/> <UsageCount Value="27"/> <Loaded Value="True"/> </Unit20> <Unit21> <Filename Value="../../appkit/NSWindow_impl.inc"/> - <CursorPos X="106" Y="18"/> - <TopLine Value="11"/> - <EditorIndex Value="1"/> + <CursorPos X="65" Y="19"/> + <TopLine Value="14"/> <UsageCount Value="34"/> - <Loaded Value="True"/> </Unit21> <Unit22> <Filename Value="/System/Library/Frameworks/Foundation.framework/Headers/NSGeometry.h"/> @@ -191,8 +187,8 @@ </Unit22> <Unit23> <Filename Value="../../foundation/NSGeometry.inc"/> - <CursorPos X="13" Y="4"/> - <TopLine Value="2"/> + <CursorPos X="26" Y="142"/> + <TopLine Value="138"/> <UsageCount Value="25"/> </Unit23> <Unit24> @@ -204,8 +200,8 @@ </Unit24> <Unit25> <Filename Value="../../appkit/NSGraphics.inc"/> - <CursorPos X="33" Y="31"/> - <TopLine Value="26"/> + <CursorPos X="22" Y="7"/> + <TopLine Value="1"/> <UsageCount Value="22"/> </Unit25> <Unit26> @@ -247,15 +243,15 @@ </Unit31> <Unit32> <Filename Value="../../appkit/NSWindow_type.inc"/> - <CursorPos X="13" Y="25"/> - <TopLine Value="20"/> + <CursorPos X="41" Y="4"/> + <TopLine Value="1"/> <UsageCount Value="10"/> </Unit32> <Unit33> <Filename Value="../../appkit/NSApplication_type.inc"/> - <CursorPos X="12" Y="49"/> - <TopLine Value="46"/> - <UsageCount Value="9"/> + <CursorPos X="40" Y="252"/> + <TopLine Value="244"/> + <UsageCount Value="10"/> </Unit33> <Unit34> <Filename Value="../../../fpc/rtl/inc/objpash.inc"/> @@ -277,83 +273,39 @@ <UsageCount Value="10"/> </Unit36> </Units> - <JumpHistory Count="19" HistoryIndex="18"> + <JumpHistory Count="8" HistoryIndex="7"> <Position1> <Filename Value="simplewindow.pas"/> - <Caret Line="15" Column="6" TopLine="10"/> + <Caret Line="21" Column="45" TopLine="8"/> </Position1> <Position2> - <Filename Value="simplewindow.pas"/> - <Caret Line="25" Column="12" TopLine="13"/> + <Filename Value="../../appkit/appkit.pas"/> + <Caret Line="21" Column="14" TopLine="12"/> </Position2> <Position3> - <Filename Value="simplewindow.pas"/> - <Caret Line="59" Column="29" TopLine="50"/> + <Filename Value="../../appkit/NSWindow.inc"/> + <Caret Line="4" Column="24" TopLine="1"/> </Position3> <Position4> - <Filename Value="simplewindow.pas"/> - <Caret Line="60" Column="31" TopLine="50"/> + <Filename Value="../../appkit/appkit.pas"/> + <Caret Line="21" Column="15" TopLine="12"/> </Position4> <Position5> - <Filename Value="simplewindow.pas"/> - <Caret Line="66" Column="20" TopLine="55"/> + <Filename Value="../../appkit/AppKit.inc"/> + <Caret Line="17" Column="14" TopLine="3"/> </Position5> <Position6> - <Filename Value="simplewindow.pas"/> - <Caret Line="64" Column="53" TopLine="53"/> + <Filename Value="../../appkit/AppKit.inc"/> + <Caret Line="55" Column="19" TopLine="47"/> </Position6> <Position7> - <Filename Value="simplewindow.pas"/> - <Caret Line="70" Column="29" TopLine="56"/> + <Filename Value="../../appkit/AppKit.inc"/> + <Caret Line="69" Column="16" TopLine="60"/> </Position7> <Position8> - <Filename Value="simplewindow.pas"/> - <Caret Line="28" Column="77" TopLine="17"/> + <Filename Value="../../appkit/AppKit.inc"/> + <Caret Line="92" Column="15" TopLine="83"/> </Position8> - <Position9> - <Filename Value="simplewindow.pas"/> - <Caret Line="64" Column="24" TopLine="53"/> - </Position9> - <Position10> - <Filename Value="simplewindow.pas"/> - <Caret Line="65" Column="102" TopLine="59"/> - </Position10> - <Position11> - <Filename Value="simplewindow.pas"/> - <Caret Line="18" Column="14" TopLine="59"/> - </Position11> - <Position12> - <Filename Value="simplewindow.pas"/> - <Caret Line="66" Column="26" TopLine="55"/> - </Position12> - <Position13> - <Filename Value="simplewindow.pas"/> - <Caret Line="31" Column="38" TopLine="20"/> - </Position13> - <Position14> - <Filename Value="simplewindow.pas"/> - <Caret Line="29" Column="28" TopLine="18"/> - </Position14> - <Position15> - <Filename Value="simplewindow.pas"/> - <Caret Line="67" Column="52" TopLine="56"/> - </Position15> - <Position16> - <Filename Value="simplewindow.pas"/> - <Caret Line="72" Column="31" TopLine="58"/> - </Position16> - <Position17> - <Filename Value="simplewindow.pas"/> - <Caret Line="68" Column="30" TopLine="59"/> - </Position17> - <Position18> - <Filename Value="simplewindow.pas"/> - <Caret Line="63" Column="52" TopLine="52"/> - </Position18> - <Position19> - <Filename Value="simplewindow.pas"/> - <Caret Line="47" Column="1" TopLine="42"/> - </Position19> </JumpHistory> </ProjectOptions> <CompilerOptions> diff --git a/bindings/pascocoa/foundation/Foundation.inc b/bindings/pascocoa/foundation/Foundation.inc index be1eec6e6..1ccf850f9 100644 --- a/bindings/pascocoa/foundation/Foundation.inc +++ b/bindings/pascocoa/foundation/Foundation.inc @@ -9,8 +9,6 @@ #import <objc/objc.h> #import <objc/objc-auto.h>} -{$include NSObject.inc} - {#import <Foundation/NSObjCRuntime.h> #import <Foundation/NSAffineTransform.h> #import <Foundation/NSArchiver.h> @@ -61,7 +59,7 @@ #import <Foundation/NSNotificationQueue.h> #import <Foundation/NSNull.h> #import <Foundation/NSNumberFormatter.h> } -{.$include NSObject.inc} +{$include NSObject.inc} {#import <Foundation/NSPathUtilities.h> #import <Foundation/NSPort.h> #import <Foundation/NSPortCoder.h> diff --git a/bindings/pascocoa/foundation/Foundation_impl.inc b/bindings/pascocoa/foundation/Foundation_impl.inc deleted file mode 100644 index e8884c289..000000000 --- a/bindings/pascocoa/foundation/Foundation_impl.inc +++ /dev/null @@ -1,147 +0,0 @@ -{ Foundation.h - Copyright (c) 1994-2005, Apple, Inc. All rights reserved. -} - - -{#include <CoreFoundation/CoreFoundation.h> - -#import <AvailabilityMacros.h> -#import <objc/objc.h> -#import <objc/objc-auto.h>} - -{$include NSObject_impl.inc} - -{#import <Foundation/NSObjCRuntime.h> -#import <Foundation/NSAffineTransform.h> -#import <Foundation/NSArchiver.h> -#import <Foundation/NSArray.h> -#import <Foundation/NSAttributedString.h> } -{$include NSAutoreleasePool_impl.inc} -{#import <Foundation/NSBundle.h> -#import <Foundation/NSByteOrder.h> -#import <Foundation/NSCalendar.h> -#import <Foundation/NSCalendarDate.h> -#import <Foundation/NSCharacterSet.h> -#import <Foundation/NSClassDescription.h> -#import <Foundation/NSCoder.h> -#import <Foundation/NSConnection.h> -#import <Foundation/NSData.h> -#import <Foundation/NSDate.h> -#import <Foundation/NSDateFormatter.h> -#import <Foundation/NSDecimal.h> -#import <Foundation/NSDecimalNumber.h> -#import <Foundation/NSDictionary.h> -#import <Foundation/NSDistantObject.h> -#import <Foundation/NSDistributedLock.h> -#import <Foundation/NSDistributedNotificationCenter.h> -#import <Foundation/NSEnumerator.h> -#import <Foundation/NSError.h> -#import <Foundation/NSException.h> -#import <Foundation/NSFileHandle.h> -#import <Foundation/NSFileManager.h> -#import <Foundation/NSFormatter.h> -#import <Foundation/NSGeometry.h> -#import <Foundation/NSHashTable.h> -#import <Foundation/NSHFSFileTypes.h> -#import <Foundation/NSHost.h> -#import <Foundation/NSIndexPath.h> -#import <Foundation/NSIndexSet.h> -#import <Foundation/NSInvocation.h> -#import <Foundation/NSJavaSetup.h> -#import <Foundation/NSKeyValueCoding.h> -#import <Foundation/NSKeyValueObserving.h> -#import <Foundation/NSKeyedArchiver.h> -#import <Foundation/NSLocale.h> -#import <Foundation/NSLock.h> -#import <Foundation/NSMapTable.h> -#import <Foundation/NSMetadata.h> -#import <Foundation/NSMethodSignature.h> -#import <Foundation/NSNetServices.h> -#import <Foundation/NSNotification.h> -#import <Foundation/NSNotificationQueue.h> -#import <Foundation/NSNull.h> -#import <Foundation/NSNumberFormatter.h> } -{.$include NSObject_impl.inc} -{#import <Foundation/NSPathUtilities.h> -#import <Foundation/NSPort.h> -#import <Foundation/NSPortCoder.h> -#import <Foundation/NSPortMessage.h> -#import <Foundation/NSPortNameServer.h> -#import <Foundation/NSProcessInfo.h> -#import <Foundation/NSPropertyList.h> -#import <Foundation/NSProtocolChecker.h> -#import <Foundation/NSProxy.h> -#import <Foundation/NSRange.h> -#import <Foundation/NSRunLoop.h> -#import <Foundation/NSScanner.h> -#import <Foundation/NSSet.h> -#import <Foundation/NSSortDescriptor.h> -#import <Foundation/NSSpellServer.h> -#import <Foundation/NSStream.h> -#import <Foundation/NSString.h> -#import <Foundation/NSTask.h> -#import <Foundation/NSThread.h> -#import <Foundation/NSTimeZone.h> -#import <Foundation/NSTimer.h> -#import <Foundation/NSUndoManager.h> -#import <Foundation/NSURL.h> -#import <Foundation/NSURLHandle.h> -#import <Foundation/NSUserDefaults.h> -#import <Foundation/NSValue.h> -#import <Foundation/NSValueTransformer.h> -#import <Foundation/NSXMLDTD.h> -#import <Foundation/NSXMLDTDNode.h> -#import <Foundation/NSXMLDocument.h> -#import <Foundation/NSXMLElement.h> -#import <Foundation/NSXMLNode.h> -#import <Foundation/NSXMLNodeOptions.h> -#import <Foundation/NSXMLParser.h> -#import <Foundation/NSZone.h> - -#import <Foundation/NSExpression.h> -#import <Foundation/NSPredicate.h> -#import <Foundation/NSComparisonPredicate.h> -#import <Foundation/NSCompoundPredicate.h> - -#import <Foundation/NSAppleEventDescriptor.h> -#import <Foundation/NSAppleEventManager.h> -#import <Foundation/NSAppleScript.h> -#import <Foundation/NSObjectScripting.h> -#import <Foundation/NSScriptClassDescription.h> -#import <Foundation/NSScriptCoercionHandler.h> -#import <Foundation/NSScriptCommand.h> -#import <Foundation/NSScriptCommandDescription.h> -#import <Foundation/NSScriptExecutionContext.h> -#import <Foundation/NSScriptKeyValueCoding.h> -#import <Foundation/NSScriptObjectSpecifiers.h> -#import <Foundation/NSScriptStandardSuiteCommands.h> -#import <Foundation/NSScriptSuiteRegistry.h> -#import <Foundation/NSScriptWhoseTests.h> - -// Note: To use the APIs described in these headers, you must perform -// a runtime check for Foundation-462.1 or later. -#if defined(MAC_OS_X_VERSION_10_2) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2) -#import <Foundation/NSURLAuthenticationChallenge.h> -#import <Foundation/NSURLCredential.h> -#import <Foundation/NSURLCredentialStorage.h> -#import <Foundation/NSURLProtectionSpace.h> -#import <Foundation/NSURLCache.h> -#import <Foundation/NSURLConnection.h> -#import <Foundation/NSURLProtocol.h> -#import <Foundation/NSURLRequest.h> -#import <Foundation/NSURLResponse.h> -#import <Foundation/NSHTTPCookie.h> -#import <Foundation/NSHTTPCookieStorage.h> -#import <Foundation/NSURLDownload.h> -#import <Foundation/NSURLError.h> -#endif - -#import <Foundation/FoundationErrors.h> - -#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_2 - #import <Foundation/NSSerialization.h> -#else - @class NSSerializer, NSDeserializer; -#endif -} - diff --git a/bindings/pascocoa/foundation/NSAutoreleasePool.inc b/bindings/pascocoa/foundation/NSAutoreleasePool.inc index 740273b92..95a1e133b 100644 --- a/bindings/pascocoa/foundation/NSAutoreleasePool.inc +++ b/bindings/pascocoa/foundation/NSAutoreleasePool.inc @@ -2,12 +2,23 @@ Copyright (c) 1994-2005, Apple, Inc. All rights reserved. } -//#import <Foundation/NSObject.h> +{$ifdef HEADER} +{$ifndef NSAUTORELEASEPOOL_PAS_H} +{$define NSAUTORELEASEPOOL_PAS_H} + +{$include NSObject.inc} const Str_NSAutoreleasePool = 'NSAutoreleasePool'; -type +{$endif} +{$endif} +{$ifdef CLASSES} +{$ifndef NSAUTORELEASEPOOL_PAS_C} +{$define NSAUTORELEASEPOOL_PAS_C} + +{$include NSObject.inc} + NSAutoreleasePool = class(NSObject) public constructor Create; override; @@ -22,3 +33,17 @@ type end; +{$endif} +{$endif} +{$ifdef IMPLEMENTATION} + +constructor NSAutoreleasePool.Create; +begin + { NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; } + ClassId := objc_getClass(PChar(Str_NSAutoreleasePool)); + allocbuf := objc_msgSend(ClassId, sel_registerName(PChar(Str_alloc)), []); + Handle := objc_msgSend(allocbuf, sel_registerName(PChar(Str_init)), []); +end; + +{$endif} + diff --git a/bindings/pascocoa/foundation/NSAutoreleasePool_impl.inc b/bindings/pascocoa/foundation/NSAutoreleasePool_impl.inc deleted file mode 100644 index 181a4e287..000000000 --- a/bindings/pascocoa/foundation/NSAutoreleasePool_impl.inc +++ /dev/null @@ -1,9 +0,0 @@ - -constructor NSAutoreleasePool.Create; -begin - { NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; } - ClassId := objc_getClass(PChar(Str_NSAutoreleasePool)); - allocbuf := objc_msgSend(ClassId, sel_registerName(PChar(Str_alloc)), []); - Handle := objc_msgSend(allocbuf, sel_registerName(PChar(Str_init)), []); -end; - diff --git a/bindings/pascocoa/foundation/NSGeometry.inc b/bindings/pascocoa/foundation/NSGeometry.inc index 1ef471f09..a2205cde1 100644 --- a/bindings/pascocoa/foundation/NSGeometry.inc +++ b/bindings/pascocoa/foundation/NSGeometry.inc @@ -3,6 +3,10 @@ Copyright (c) 1994-2005, Apple, Inc. All rights reserved. } +{$ifdef HEADER} +{$ifndef NSGEOMETRY_PAS_H} +{$define NSGEOMETRY_PAS_H} + {#import <Foundation/NSValue.h> #import <Foundation/NSCoder.h>} @@ -147,3 +151,6 @@ FOUNDATION_EXPORT NSRect NSRectFromString(NSString *aString); @end} +{$endif} +{$endif} + diff --git a/bindings/pascocoa/foundation/NSObject.inc b/bindings/pascocoa/foundation/NSObject.inc index c6880af61..47be6a768 100644 --- a/bindings/pascocoa/foundation/NSObject.inc +++ b/bindings/pascocoa/foundation/NSObject.inc @@ -2,6 +2,10 @@ Copyright (c) 1994-2005, Apple, Inc. All rights reserved. } +{$ifdef HEADER} +{$ifndef NSOBJECT_PAS_H} +{$define NSOBJECT_PAS_H} + //#import <Foundation/NSObjCRuntime.h> //#import <Foundation/NSZone.h> @@ -67,7 +71,28 @@ const Str_init = 'init'; Str_release = 'release'; -type +{*********** Object Allocation / Deallocation *******} + +{FOUNDATION_EXPORT id <NSObject> NSAllocateObject(Class aClass, unsigned extraBytes, NSZone *zone); + +FOUNDATION_EXPORT void NSDeallocateObject(id <NSObject>object); + +FOUNDATION_EXPORT id <NSObject> NSCopyObject(id <NSObject>object, unsigned extraBytes, NSZone *zone); + +FOUNDATION_EXPORT BOOL NSShouldRetainWithZone(id <NSObject> anObject, NSZone *requestedZone); + +FOUNDATION_EXPORT void NSIncrementExtraRefCount(id object); + +FOUNDATION_EXPORT BOOL NSDecrementExtraRefCountWasZero(id object); + +FOUNDATION_EXPORT unsigned NSExtraRefCount(id object);} + +{$endif} +{$endif} +{$ifdef CLASSES} +{$ifndef NSOBJECT_PAS_C} +{$define NSOBJECT_PAS_C} + NSObject = class public { class id } @@ -125,20 +150,19 @@ type end; -{*********** Object Allocation / Deallocation *******} +{$endif} +{$endif} +{$ifdef IMPLEMENTATION} -{FOUNDATION_EXPORT id <NSObject> NSAllocateObject(Class aClass, unsigned extraBytes, NSZone *zone); +constructor NSObject.Create; +begin -FOUNDATION_EXPORT void NSDeallocateObject(id <NSObject>object); +end; -FOUNDATION_EXPORT id <NSObject> NSCopyObject(id <NSObject>object, unsigned extraBytes, NSZone *zone); - -FOUNDATION_EXPORT BOOL NSShouldRetainWithZone(id <NSObject> anObject, NSZone *requestedZone); - -FOUNDATION_EXPORT void NSIncrementExtraRefCount(id object); - -FOUNDATION_EXPORT BOOL NSDecrementExtraRefCountWasZero(id object); - -FOUNDATION_EXPORT unsigned NSExtraRefCount(id object);} +destructor NSObject.Destroy; +begin + objc_msgSend(Handle, sel_registerName(PChar(Str_release)), []); +end; +{$endif} diff --git a/bindings/pascocoa/foundation/NSObject_impl.inc b/bindings/pascocoa/foundation/NSObject_impl.inc deleted file mode 100644 index 1d38e576e..000000000 --- a/bindings/pascocoa/foundation/NSObject_impl.inc +++ /dev/null @@ -1,11 +0,0 @@ - -constructor NSObject.Create; -begin - -end; - -destructor NSObject.Destroy; -begin - objc_msgSend(Handle, sel_registerName(PChar(Str_release)), []); -end; - diff --git a/bindings/pascocoa/foundation/foundation.pas b/bindings/pascocoa/foundation/foundation.pas index a006f5cbc..161d9e519 100644 --- a/bindings/pascocoa/foundation/foundation.pas +++ b/bindings/pascocoa/foundation/foundation.pas @@ -9,11 +9,20 @@ interface uses ctypes, objc, FPCMacOSAll; +{$define HEADER} {$include Foundation.inc} +{$undef HEADER} + +type +{$define CLASSES} +{$include Foundation.inc} +{$undef CLASSES} implementation -{$include Foundation_impl.inc} +{$define IMPLEMENTATION} +{$include Foundation.inc} +{$undef IMPLEMENTATION} end.