diff --git a/bindings/pascocoa/appkit/AppKitDefines.inc b/bindings/pascocoa/appkit/AppKitDefines.inc new file mode 100755 index 000000000..8d1c8b69c --- /dev/null +++ b/bindings/pascocoa/appkit/AppKitDefines.inc @@ -0,0 +1 @@ + diff --git a/bindings/pascocoa/appkit/NSButton.inc b/bindings/pascocoa/appkit/NSButton.inc index 9ce224bd0..af784f8b7 100644 --- a/bindings/pascocoa/appkit/NSButton.inc +++ b/bindings/pascocoa/appkit/NSButton.inc @@ -1,3 +1,4 @@ +{%mainunit appkit.pas} (* NSButton.h Application Kit @@ -11,8 +12,6 @@ {$include NSControl.inc} {$include NSButtonCell.inc} -{$include NSImage.inc} - {$endif} {$endif} @@ -21,7 +20,6 @@ {$define NSBUTTON_PAS__FORWARD} NSButton = class; - {$endif} {$endif} @@ -31,7 +29,6 @@ {$include NSControl.inc} {$include NSButtonCell.inc} -{$include NSImage.inc} { NSButton } @@ -42,10 +39,10 @@ procedure setTitle(_aString: CFStringRef); function alternateTitle: CFStringRef; procedure setAlternateTitle(_aString: CFStringRef); - function image: NSImage; - procedure setImage(_image: NSImage); - function alternateImage: NSImage; - procedure setAlternateImage(_image: NSImage); + function image: objc.id;{NSImage} + procedure setImage(_image: objc.id {NSImage}); + function alternateImage: objc.id;{NSImage} + procedure setAlternateImage(_image: objc.id {NSImage}); function imagePosition: NSCellImagePosition; procedure setImagePosition(_aPosition: NSCellImagePosition); procedure setButtonType(_aType: NSButtonType); @@ -62,7 +59,7 @@ function keyEquivalentModifierMask: LongWord; procedure setKeyEquivalentModifierMask(_mask: LongWord); procedure highlight(_flag: LongBool); -// function performKeyEquivalent(_key: NSEvent): LongBool; + function performKeyEquivalent(_key: objc.id {NSEvent}): LongBool; procedure setTitleWithMnemonic(_stringWithAmpersand: CFStringRef); function attributedTitle: objc.id;{NSAttributedString} procedure setAttributedTitle(_aString: objc.id {NSAttributedString}); @@ -168,14 +165,14 @@ begin vmethod(Handle, sel_registerName(PChar(StrNSButton_setAlternateTitle)), _aString); end; -function NSButton.image: NSImage; +function NSButton.image: objc.id; begin - Result := NSImage(objc_msgSend(Handle, sel_registerName(PChar(StrNSButton_image)), [])); + Result := objc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSButton_image)), [])); end; -procedure NSButton.setImage(_image: NSImage); +procedure NSButton.setImage(_image: objc.id {NSImage}); type - TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_image: NSImage); cdecl; + TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_image: objc.id {NSImage}); cdecl; var vmethod: TmsgSendWrapper; begin @@ -183,14 +180,14 @@ begin vmethod(Handle, sel_registerName(PChar(StrNSButton_setImage)), _image); end; -function NSButton.alternateImage: NSImage; +function NSButton.alternateImage: objc.id; begin - Result := NSImage(objc_msgSend(Handle, sel_registerName(PChar(StrNSButton_alternateImage)), [])); + Result := objc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSButton_alternateImage)), [])); end; -procedure NSButton.setAlternateImage(_image: NSImage); +procedure NSButton.setAlternateImage(_image: objc.id {NSImage}); type - TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_image: NSImage); cdecl; + TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_image: objc.id {NSImage}); cdecl; var vmethod: TmsgSendWrapper; begin @@ -328,15 +325,15 @@ begin vmethod(Handle, sel_registerName(PChar(StrNSButton_highlight)), _flag); end; -{function NSButton.performKeyEquivalent(_key: NSEvent): LongBool; +function NSButton.performKeyEquivalent(_key: objc.id {NSEvent}): LongBool; type - TmsgSendWrapper = function (param1: objc.id; param2: SEL;_key: NSEvent): LongBool; cdecl; + TmsgSendWrapper = function (param1: objc.id; param2: SEL;_key: objc.id {NSEvent}): LongBool; cdecl; var vmethod: TmsgSendWrapper; begin vmethod := TmsgSendWrapper(@objc_msgSend); Result := LongBool(vmethod(Handle, sel_registerName(PChar(StrNSButton_performKeyEquivalent)), _key)); -end;} +end; procedure NSButton.setTitleWithMnemonic(_stringWithAmpersand: CFStringRef); type diff --git a/bindings/pascocoa/appkit/NSGraphics.inc b/bindings/pascocoa/appkit/NSGraphics.inc index e51afb800..2e4b946c4 100644 --- a/bindings/pascocoa/appkit/NSGraphics.inc +++ b/bindings/pascocoa/appkit/NSGraphics.inc @@ -1,3 +1,4 @@ +{%mainunit appkit.pas} (* NSGraphics.h Application Kit @@ -9,8 +10,7 @@ {$ifndef NSGRAPHICS_PAS_H} {$define NSGRAPHICS_PAS_H} -{.$include NSGeometry.inc} -{.$include AppKitDefines.inc} +{$include AppKitDefines.inc} {.$ifdef MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3} {.$endif} {.$ifdef MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3} @@ -151,8 +151,7 @@ type {$ifndef NSGRAPHICS_PAS_C} {$define NSGRAPHICS_PAS_C} -{.$include NSGeometry.inc} -{.$include AppKitDefines.inc} +{$include AppKitDefines.inc} {.$ifdef MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3} {.$endif} {.$ifdef MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3} diff --git a/bindings/pascocoa/appkit/NSWindow.inc b/bindings/pascocoa/appkit/NSWindow.inc index 4b503152d..f9086c721 100644 --- a/bindings/pascocoa/appkit/NSWindow.inc +++ b/bindings/pascocoa/appkit/NSWindow.inc @@ -1,3 +1,4 @@ +{%mainunit appkit.pas} (* NSWindow.h Application Kit @@ -9,11 +10,9 @@ {$ifndef NSWINDOW_PAS_H} {$define NSWINDOW_PAS_H} -{.$include NSGeometry.inc} -{.$include NSResponder.inc} +{$include NSResponder.inc} {$include NSGraphics.inc} -{.$include AppKitDefines.inc} -{.$include NSDate.inc} +{$include AppKitDefines.inc} {.$ifdef MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2} {.$endif} {.$ifdef MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4} @@ -118,11 +117,9 @@ type {$ifndef NSWINDOW_PAS_C} {$define NSWINDOW_PAS_C} -{.$include NSGeometry.inc} -{.$include NSResponder.inc} +{$include NSResponder.inc} {$include NSGraphics.inc} -{.$include AppKitDefines.inc} -{.$include NSDate.inc} +{$include AppKitDefines.inc} {.$ifdef MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2} {.$endif} {.$ifdef MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4} @@ -172,7 +169,7 @@ type // subclasses can override animationResizeTime: to control the total time for the frame // change. // newFrame is the rect passed into setFrame:display:animate: -// function animationResizeTime(_newFrame: NSRect): NSTimeInterval; + function animationResizeTime(_newFrame: NSRect): NSTimeInterval; // 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: @@ -207,8 +204,8 @@ type procedure setPreservesContentDuringLiveResize(_flag: LongBool); {.$endif} procedure update; - function makeFirstResponder(_aResponder: NSResponder): LongBool; - function firstResponder: NSResponder; + function makeFirstResponder(_aResponder: objc.id {NSResponder}): LongBool; + function firstResponder: objc.id;{NSResponder} function resizeFlags: Integer; procedure keyDown(_theEvent: objc.id {NSEvent}); procedure close; @@ -344,21 +341,21 @@ type function deviceDescription: CFDictionaryRef; procedure sendEvent(_theEvent: objc.id {NSEvent}); function mouseLocationOutsideOfEventStream: NSPoint; -// class procedure menuChanged(_menu: NSMenu); + class procedure menuChanged(_menu: objc.id {NSMenu}); function windowController: objc.id; procedure setWindowController(_windowController: objc.id {NSWindowController}); function isSheet: LongBool; - function attachedSheet: NSWindow; + function attachedSheet: objc.id;{NSWindow} {.$ifdef MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2} class function standardWindowButton_forStyleMask(_b: NSWindowButton; _styleMask: LongWord): objc.id;{NSButton} function standardWindowButton(_b: NSWindowButton): objc.id;{NSButton} {.$endif} {.$ifdef MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2} - procedure addChildWindow_ordered(_childWin: NSWindow; _place: NSWindowOrderingMode); - procedure removeChildWindow(_childWin: NSWindow); + procedure addChildWindow_ordered(_childWin: objc.id {NSWindow}; _place: NSWindowOrderingMode); + procedure removeChildWindow(_childWin: objc.id {NSWindow}); function childWindows: CFArrayRef; - function parentWindow: NSWindow; - procedure setParentWindow(_window: NSWindow); + function parentWindow: objc.id;{NSWindow} + procedure setParentWindow(_window: objc.id {NSWindow}); {.$endif} {.$ifdef 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 @@ -900,7 +897,7 @@ begin objc_msgSend_stret(@Result, Handle, sel_registerName(PChar(StrNSWindow_frame)), []); end; -{function NSWindow.animationResizeTime(_newFrame: NSRect): NSTimeInterval; +function NSWindow.animationResizeTime(_newFrame: NSRect): NSTimeInterval; type TmsgSendWrapper = function (param1: objc.id; param2: SEL;_newFrame: NSRect): NSTimeInterval; cdecl; var @@ -908,7 +905,7 @@ var begin vmethod := TmsgSendWrapper(@objc_msgSend_stret); Result := vmethod(Handle, sel_registerName(PChar(StrNSWindow_animationResizeTime)), _newFrame); -end;} +end; procedure NSWindow.setFrame_display_animate(_frameRect: NSRect; _displayFlag: LongBool; _animateFlag: LongBool); type @@ -1094,9 +1091,9 @@ begin objc_msgSend(Handle, sel_registerName(PChar(StrNSWindow_update)), []); end; -function NSWindow.makeFirstResponder(_aResponder: NSResponder): LongBool; +function NSWindow.makeFirstResponder(_aResponder: objc.id {NSResponder}): LongBool; type - TmsgSendWrapper = function (param1: objc.id; param2: SEL;_aResponder: NSResponder): LongBool; cdecl; + TmsgSendWrapper = function (param1: objc.id; param2: SEL;_aResponder: objc.id {NSResponder}): LongBool; cdecl; var vmethod: TmsgSendWrapper; begin @@ -1104,9 +1101,9 @@ begin Result := LongBool(vmethod(Handle, sel_registerName(PChar(StrNSWindow_makeFirstResponder)), _aResponder)); end; -function NSWindow.firstResponder: NSResponder; +function NSWindow.firstResponder: objc.id; begin - Result := NSResponder(objc_msgSend(Handle, sel_registerName(PChar(StrNSWindow_firstResponder)), [])); + Result := objc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSWindow_firstResponder)), [])); end; function NSWindow.resizeFlags: Integer; @@ -1981,15 +1978,15 @@ begin objc_msgSend_stret(@Result, Handle, sel_registerName(PChar(StrNSWindow_mouseLocationOutsideOfEventStream)), []); end; -{class procedure NSWindow.menuChanged(_menu: NSMenu); +class procedure NSWindow.menuChanged(_menu: objc.id {NSMenu}); type - TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_menu: NSMenu); cdecl; + TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_menu: objc.id {NSMenu}); cdecl; var vmethod: TmsgSendWrapper; begin vmethod := TmsgSendWrapper(@objc_msgSend); vmethod(getClass, sel_registerName(PChar(StrNSWindow_menuChanged)), _menu); -end;} +end; function NSWindow.windowController: objc.id; begin @@ -2011,9 +2008,9 @@ begin Result := LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSWindow_isSheet)), [])); end; -function NSWindow.attachedSheet: NSWindow; +function NSWindow.attachedSheet: objc.id; begin - Result := NSWindow(objc_msgSend(Handle, sel_registerName(PChar(StrNSWindow_attachedSheet)), [])); + Result := objc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSWindow_attachedSheet)), [])); end; {.$ifdef MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2} @@ -2039,9 +2036,9 @@ end; {.$endif} {.$ifdef MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2} -procedure NSWindow.addChildWindow_ordered(_childWin: NSWindow; _place: NSWindowOrderingMode); +procedure NSWindow.addChildWindow_ordered(_childWin: objc.id {NSWindow}; _place: NSWindowOrderingMode); type - TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_childWin: NSWindow; _place: NSWindowOrderingMode); cdecl; + TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_childWin: objc.id {NSWindow}; _place: NSWindowOrderingMode); cdecl; var vmethod: TmsgSendWrapper; begin @@ -2049,9 +2046,9 @@ begin vmethod(Handle, sel_registerName(PChar(StrNSWindow_addChildWindow_ordered)), _childWin, _place); end; -procedure NSWindow.removeChildWindow(_childWin: NSWindow); +procedure NSWindow.removeChildWindow(_childWin: objc.id {NSWindow}); type - TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_childWin: NSWindow); cdecl; + TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_childWin: objc.id {NSWindow}); cdecl; var vmethod: TmsgSendWrapper; begin @@ -2064,14 +2061,14 @@ begin Result := CFArrayRef(objc_msgSend(Handle, sel_registerName(PChar(StrNSWindow_childWindows)), [])); end; -function NSWindow.parentWindow: NSWindow; +function NSWindow.parentWindow: objc.id; begin - Result := NSWindow(objc_msgSend(Handle, sel_registerName(PChar(StrNSWindow_parentWindow)), [])); + Result := objc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSWindow_parentWindow)), [])); end; -procedure NSWindow.setParentWindow(_window: NSWindow); +procedure NSWindow.setParentWindow(_window: objc.id {NSWindow}); type - TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_window: NSWindow); cdecl; + TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_window: objc.id {NSWindow}); cdecl; var vmethod: TmsgSendWrapper; begin diff --git a/bindings/pascocoa/build/appkit.ini b/bindings/pascocoa/build/appkit.ini index f3c9ac5d1..06a42eeaf 100755 --- a/bindings/pascocoa/build/appkit.ini +++ b/bindings/pascocoa/build/appkit.ini @@ -1,7 +1,6 @@ [Common] mainunit=appkit.pas -ignoreincludes="CoreFoundation/ CoreData/ QuartzCore/ Foundation/ IOKit/" -ignoreincludes2="Foundation/ IOKit/" +ignoreincludes="Foundation/ CoreData/ QuartzCore/ CoreFoundation/ IOKit/" [TypeDefs] NSObject=objcclass diff --git a/bindings/pascocoa/build/buildappkit.sh b/bindings/pascocoa/build/buildappkit.sh index 4b7934946..2a48d9f20 100755 --- a/bindings/pascocoa/build/buildappkit.sh +++ b/bindings/pascocoa/build/buildappkit.sh @@ -1,7 +1,8 @@ cd .. cd parser -DEFAULT_INI="../parser/default.ini" +DEFAULT_INI="default.ini" +APPKIT_INI="../build/appkit.ini" FRAMEWORK="/System/Library/Frameworks/AppKit.framework/Headers" -./objcparser -ini=$DEFAULT_INI -ini=appkit.ini $FRAMEWORK/NSButton.h > ../appkit/NSButton.inc -./objcparser -ini=$DEFAULT_INI -ini=appkit.ini $FRAMEWORK/NSWindow.h > ../appkit/NSWindow.inc -./objcparser -ini=$DEFAULT_INI -ini=appkit.ini $FRAMEWORK/NSGraphics.h > ../appkit/NSGraphics.inc +./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSButton.h > ../appkit/NSButton.inc +./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSWindow.h > ../appkit/NSWindow.inc +./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSGraphics.h > ../appkit/NSGraphics.inc diff --git a/bindings/pascocoa/build/buildfoundation.sh b/bindings/pascocoa/build/buildfoundation.sh new file mode 100755 index 000000000..5b072a8d8 --- /dev/null +++ b/bindings/pascocoa/build/buildfoundation.sh @@ -0,0 +1,7 @@ +cd .. +cd parser +DEFAULT_INI="default.ini" +LOCAL_INI="../build/foundation.ini" +FRAMEWORK="/System/Library/Frameworks/Foundation.framework/Headers" +./objcparser -ini=$DEFAULT_INI -ini=$LOCAL_INI $FRAMEWORK/NSObjCRuntime.h > ../foundation/NSObjCRuntime.inc +./objcparser -ini=$DEFAULT_INI -ini=$LOCAL_INI $FRAMEWORK/NSDate.h > ../foundation/NSDate.inc diff --git a/bindings/pascocoa/build/foundation.ini b/bindings/pascocoa/build/foundation.ini new file mode 100755 index 000000000..d0303a3b8 --- /dev/null +++ b/bindings/pascocoa/build/foundation.ini @@ -0,0 +1,176 @@ +[Common] +mainunit=foundation.pas +ignoreincludes=AvailabiltyMacros.h +ignoreincludes2=objc/ +ignoreincludes3=CoreFoundation/ + +[TypeDefs] +NSAffineTransform=objcclass +NSAppleEventDescriptor=objcclass +NSAppleEventManager=objcclass +NSAppleScript=objcclass +NSArchiver=objcclass +NSUnarchiver=objcclass +NSObject=objcclass +NSArray=objcclass +NSMutableArray=objcclass +NSAttributedString=objcclass +NSMutableAttributedString=objcclass +NSAutoreleasePool=objcclass +NSBundle=objcclass +NSCalendar=objcclass +NSDateComponents=objcclass +NSCalendarDate=objcclass +NSDate=objcclass +NSCharacterSet=objcclass +NSMutableCharacterSet=objcclass +NSClassDescription=objcclass +NSCoder=objcclass +NSComparisonPredicate=objcclass +NSCompoundPredicate=objcclass +NSConnection=objcclass +NSDistantObjectRequest=objcclass +NSData=objcclass +NSMutableData=objcclass +NSTimeInterval=float +NSDateFormatter=objcclass +NSDecimalNumber=objcclass +NSDecimalNumberHandler=objcclass +NSNumber=objcclass +NSScanner=objcclass +NSDictionary=objcclass +NSMutableDictionary=objcclass +NSDistantObject=objcclass +NSDistributedLock=objcclass +NSDistributedNotificationCenter=objcclass +NSEnumerator=objcclass +NSError=objcclass +NSException=objcclass +NSAssertionHandler=objcclass +NSExpression=objcclass +NSFileHandle=objcclass +NSPipe=objcclass +NSFileManager=objcclass +NSDirectoryEnumerator=objcclass +NSFormatter=objcclass +NSGarbageCollector=objcclass +NSValue=objcclass +NSHashTable=objcclass +NSHost=objcclass +NSHTTPCookie=objcclass +NSHTTPCookieStorage=objcclass +NSIndexPath=objcclass +NSIndexSet=objcclass +NSMutableIndexSet=objcclass +NSInvocation=objcclass +NSKeyedArchiver=objcclass +NSKeyedUnarchiver=objcclass +NSSet=objcclass +NSLocale=objcclass +NSLock=objcclass +NSConditionLock=objcclass +NSRecursiveLock=objcclass +NSCondition=objcclass +NSMapTable=objcclass +NSMetadataQuery=objcclass +NSMetadataItem=objcclass +NSMetadataQueryAttributeValueTuple=objcclass +NSMetadataQueryResultGroup=objcclass +NSMethodSignature=objcclass +NSNetService=objcclass +NSNetServiceBrowser=objcclass +NSNotification=objcclass +NSNotificationCenter=objcclass +NSNotificationQueue=objcclass +NSNull=objcclass +NSNumberFormatter=objcclass +NSOperation=objcclass +NSInvocationOperation=objcclass +NSOperationQueue=objcclass +NSString=objcclass +NSPointerArray=objcclass +NSPointerFunctions=objcclass +NSPort=objcclass +NSMachPort=objcclass +NSMessagePort=objcclass +NSSocketPort=objcclass +NSPortCoder=objcclass +NSPortMessage=objcclass +NSPortNameServer=objcclass +NSMachBootstrapServer=objcclass +NSMessagePortNameServer=objcclass +NSSocketPortNameServer=objcclass +NSPredicate=objcclass +NSMutableSet=objcclass +NSProcessInfo=objcclass +NSPropertyListSerialization=objcclass +NSProtocolChecker=objcclass +NSProxy=objcclass +NSRunLoop=objcclass +NSScriptClassDescription=objcclass +NSScriptCoercionHandler=objcclass +NSScriptCommand=objcclass +NSScriptCommandDescription=objcclass +NSScriptExecutionContext=objcclass +NSScriptObjectSpecifier=objcclass +NSIndexSpecifier=objcclass +NSMiddleSpecifier=objcclass +NSNameSpecifier=objcclass +NSPositionalSpecifier=objcclass +NSPropertySpecifier=objcclass +NSRandomSpecifier=objcclass +NSRangeSpecifier=objcclass +NSRelativeSpecifier=objcclass +NSUniqueIDSpecifier=objcclass +NSWhoseSpecifier=objcclass +NSCloneCommand=objcclass +NSCloseCommand=objcclass +NSCountCommand=objcclass +NSCreateCommand=objcclass +NSDeleteCommand=objcclass +NSExistsCommand=objcclass +NSGetCommand=objcclass +NSMoveCommand=objcclass +NSQuitCommand=objcclass +NSSetCommand=objcclass +NSScriptSuiteRegistry=objcclass +NSScriptWhoseTest=objcclass +NSLogicalTest=objcclass +NSSpecifierTest=objcclass +NSCountedSet=objcclass +NSSortDescriptor=objcclass +NSSpellServer=objcclass +NSStream=objcclass +NSInputStream=objcclass +NSOutputStream=objcclass +NSMutableString=objcclass +NSSimpleCString=objcclass +NSConstantString=objcclass +NSTask=objcclass +NSThread=objcclass +NSTimer=objcclass +NSTimeZone=objcclass +NSUndoManager=objcclass +NSURL=objcclass +NSURLAuthenticationChallenge=objcclass +NSCachedURLResponse=objcclass +NSURLCache=objcclass +NSURLConnection=objcclass +NSURLCredential=objcclass +NSURLCredentialStorage=objcclass +NSURLDownload=objcclass +NSURLHandle=objcclass +NSURLProtectionSpace=objcclass +NSURLProtocol=objcclass +NSURLRequest=objcclass +NSMutableURLRequest=objcclass +NSURLResponse=objcclass +NSHTTPURLResponse=objcclass +NSUserDefaults=objcclass +NSValueTransformer=objcclass +NSXMLDocument=objcclass +NSXMLDTD=objcclass +NSXMLDTDNode=objcclass +NSXMLElement=objcclass +NSXMLNode=objcclass +NSXMLParser=objcclass diff --git a/bindings/pascocoa/examples/statusitem/statusitem.lpi b/bindings/pascocoa/examples/statusitem/statusitem.lpi index eef68eec1..21463f798 100644 --- a/bindings/pascocoa/examples/statusitem/statusitem.lpi +++ b/bindings/pascocoa/examples/statusitem/statusitem.lpi @@ -7,7 +7,7 @@ - + @@ -26,7 +26,7 @@ - + @@ -34,7 +34,7 @@ - + @@ -48,7 +48,7 @@ - + @@ -56,7 +56,7 @@ - + @@ -168,8 +168,8 @@ - - + + @@ -228,7 +228,7 @@ - + @@ -257,7 +257,7 @@ - + @@ -390,18 +390,50 @@ - - + + + + + + + + + + + + + + + + + + + + + + - + - + + + + + + + + + + + + + diff --git a/bindings/pascocoa/foundation/Foundation.inc b/bindings/pascocoa/foundation/Foundation.inc index 1ccf850f9..255441e93 100644 --- a/bindings/pascocoa/foundation/Foundation.inc +++ b/bindings/pascocoa/foundation/Foundation.inc @@ -9,8 +9,8 @@ #import #import } -{#import -#import +{$include NSObjCRuntime.inc} +{#import #import #import #import } @@ -23,9 +23,9 @@ #import #import #import -#import -#import -#import +#import } +{$include NSDate.inc} +{#import #import #import #import diff --git a/bindings/pascocoa/foundation/NSDate.inc b/bindings/pascocoa/foundation/NSDate.inc new file mode 100644 index 000000000..ce054d9e7 --- /dev/null +++ b/bindings/pascocoa/foundation/NSDate.inc @@ -0,0 +1,296 @@ +{%mainunit foundation.pas} +(* NSDate.h + Copyright (c) 1994-2005, Apple, Inc. All rights reserved. +*) + +{$ifdef HEADER} +{$ifndef NSDATE_PAS_H} +{$define NSDATE_PAS_H} + +{$include NSObject.inc} +const + NSTimeIntervalSince1970 = 978307200.0; +type + NSTimeInterval = double; + +{$endif} +{$endif} + +{$ifdef FORWARD} +{$ifndef NSDATE_PAS__FORWARD} +{$define NSDATE_PAS__FORWARD} + + NSDate = class; +{$endif} +{$endif} + +{$ifdef CLASSES} +{$ifndef NSDATE_PAS_C} +{$define NSDATE_PAS_C} + +{$include NSObject.inc} + + { NSDate } + + NSDate = class(NSObject) + public + class function getClass: objc.id; override; + function timeIntervalSinceReferenceDate: NSTimeInterval; + function timeIntervalSinceDate(_anotherDate: CFDateRef): NSTimeInterval; + function timeIntervalSinceNow: NSTimeInterval; + function timeIntervalSince1970: NSTimeInterval; + function addTimeInterval(_seconds: NSTimeInterval): objc.id; + function earlierDate(_anotherDate: CFDateRef): CFDateRef; + function laterDate(_anotherDate: CFDateRef): CFDateRef; + function compare(_other: CFDateRef): NSComparisonResult; + function description: CFStringRef; + function isEqualToDate(_otherDate: CFDateRef): LongBool; + class function timeIntervalSinceReferenceDate_: NSTimeInterval; + constructor date; + constructor dateWithTimeIntervalSinceNow(_secs: NSTimeInterval); + constructor dateWithTimeIntervalSinceReferenceDate(_secs: NSTimeInterval); + constructor dateWithTimeIntervalSince1970(_secs: NSTimeInterval); + constructor distantFuture; + constructor distantPast; + constructor init; + constructor initWithTimeIntervalSinceReferenceDate(_secsToBeAdded: NSTimeInterval); + constructor initWithTimeInterval_sinceDate(_secsToBeAdded: NSTimeInterval; _anotherDate: CFDateRef); + constructor initWithTimeIntervalSinceNow(_secsToBeAddedToNow: NSTimeInterval); + end; + +{$endif} +{$endif} + +{$ifdef IMPLEMENTATION} +const + StrNSDate_NSDate = 'NSDate'; + StrNSDate_timeIntervalSinceReferenceDate = 'timeIntervalSinceReferenceDate'; + + StrNSDate_timeIntervalSinceDate = 'timeIntervalSinceDate:'; + StrNSDate_timeIntervalSinceNow = 'timeIntervalSinceNow'; + StrNSDate_timeIntervalSince1970 = 'timeIntervalSince1970'; + StrNSDate_addTimeInterval = 'addTimeInterval:'; + StrNSDate_earlierDate = 'earlierDate:'; + StrNSDate_laterDate = 'laterDate:'; + StrNSDate_compare = 'compare:'; + StrNSDate_description = 'description'; + StrNSDate_isEqualToDate = 'isEqualToDate:'; + + StrNSDate_date = 'date'; + StrNSDate_dateWithTimeIntervalSinceNow = 'dateWithTimeIntervalSinceNow:'; + StrNSDate_dateWithTimeIntervalSinceReferenceDate = 'dateWithTimeIntervalSinceReferenceDate:'; + StrNSDate_dateWithTimeIntervalSince1970 = 'dateWithTimeIntervalSince1970:'; + StrNSDate_distantFuture = 'distantFuture'; + StrNSDate_distantPast = 'distantPast'; + StrNSDate_init = 'init'; + StrNSDate_initWithTimeIntervalSinceReferenceDate = 'initWithTimeIntervalSinceReferenceDate:'; + StrNSDate_initWithTimeInterval_sinceDate = 'initWithTimeInterval:sinceDate:'; + StrNSDate_initWithTimeIntervalSinceNow = 'initWithTimeIntervalSinceNow:'; + +{ NSDate } + +class function NSDate.getClass: objc.id; +begin + Result := objc_getClass(StrNSDate_NSDate); +end; + +function NSDate.timeIntervalSinceReferenceDate: NSTimeInterval; +begin + Result := objc_msgSend_fpret(Handle, sel_registerName(PChar(StrNSDate_timeIntervalSinceReferenceDate)), []); +end; + +function NSDate.timeIntervalSinceDate(_anotherDate: CFDateRef): NSTimeInterval; +type + TmsgSendWrapper = function (param1: objc.id; param2: SEL;_anotherDate: CFDateRef): NSTimeInterval; cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend_stret); + Result := vmethod(Handle, sel_registerName(PChar(StrNSDate_timeIntervalSinceDate)), _anotherDate); +end; + +function NSDate.timeIntervalSinceNow: NSTimeInterval; +begin + Result := objc_msgSend_fpret(Handle, sel_registerName(PChar(StrNSDate_timeIntervalSinceNow)), []); +end; + +function NSDate.timeIntervalSince1970: NSTimeInterval; +begin + Result := objc_msgSend_fpret(Handle, sel_registerName(PChar(StrNSDate_timeIntervalSince1970)), []); +end; + +function NSDate.addTimeInterval(_seconds: NSTimeInterval): objc.id; +type + TmsgSendWrapper = function (param1: objc.id; param2: SEL;_seconds: NSTimeInterval): objc.id; cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + Result := objc.id(vmethod(Handle, sel_registerName(PChar(StrNSDate_addTimeInterval)), _seconds)); +end; + +function NSDate.earlierDate(_anotherDate: CFDateRef): CFDateRef; +type + TmsgSendWrapper = function (param1: objc.id; param2: SEL;_anotherDate: CFDateRef): CFDateRef; cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + Result := CFDateRef(vmethod(Handle, sel_registerName(PChar(StrNSDate_earlierDate)), _anotherDate)); +end; + +function NSDate.laterDate(_anotherDate: CFDateRef): CFDateRef; +type + TmsgSendWrapper = function (param1: objc.id; param2: SEL;_anotherDate: CFDateRef): CFDateRef; cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + Result := CFDateRef(vmethod(Handle, sel_registerName(PChar(StrNSDate_laterDate)), _anotherDate)); +end; + +function NSDate.compare(_other: CFDateRef): NSComparisonResult; +type + TmsgSendWrapper = function (param1: objc.id; param2: SEL;_other: CFDateRef): NSComparisonResult; cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + Result := NSComparisonResult(vmethod(Handle, sel_registerName(PChar(StrNSDate_compare)), _other)); +end; + +function NSDate.description: CFStringRef; +begin + Result := CFStringRef(objc_msgSend(Handle, sel_registerName(PChar(StrNSDate_description)), [])); +end; + +function NSDate.isEqualToDate(_otherDate: CFDateRef): LongBool; +type + TmsgSendWrapper = function (param1: objc.id; param2: SEL;_otherDate: CFDateRef): LongBool; cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + Result := LongBool(vmethod(Handle, sel_registerName(PChar(StrNSDate_isEqualToDate)), _otherDate)); +end; + +class function NSDate.timeIntervalSinceReferenceDate_: NSTimeInterval; +begin + Result := objc_msgSend_fpret(getClass, sel_registerName(PChar(StrNSDate_timeIntervalSinceReferenceDate)), []); +end; + +constructor NSDate.date; +type + TmsgSendWrapper = function (param1: objc.id; param2: SEL): objc.id; cdecl; +var + vmethod: TmsgSendWrapper; +begin + ClassID := getClass(); + vmethod := TmsgSendWrapper(@objc_msgSend); + Handle := vmethod(ClassID, sel_registerName(PChar(StrNSDate_date))); +end; + +constructor NSDate.dateWithTimeIntervalSinceNow(_secs: NSTimeInterval); +type + TmsgSendWrapper = function (param1: objc.id; param2: SEL;_secs: NSTimeInterval): objc.id; cdecl; +var + vmethod: TmsgSendWrapper; +begin + ClassID := getClass(); + vmethod := TmsgSendWrapper(@objc_msgSend); + Handle := vmethod(ClassID, sel_registerName(PChar(StrNSDate_dateWithTimeIntervalSinceNow)), _secs); +end; + +constructor NSDate.dateWithTimeIntervalSinceReferenceDate(_secs: NSTimeInterval); +type + TmsgSendWrapper = function (param1: objc.id; param2: SEL;_secs: NSTimeInterval): objc.id; cdecl; +var + vmethod: TmsgSendWrapper; +begin + ClassID := getClass(); + vmethod := TmsgSendWrapper(@objc_msgSend); + Handle := vmethod(ClassID, sel_registerName(PChar(StrNSDate_dateWithTimeIntervalSinceReferenceDate)), _secs); +end; + +constructor NSDate.dateWithTimeIntervalSince1970(_secs: NSTimeInterval); +type + TmsgSendWrapper = function (param1: objc.id; param2: SEL;_secs: NSTimeInterval): objc.id; cdecl; +var + vmethod: TmsgSendWrapper; +begin + ClassID := getClass(); + vmethod := TmsgSendWrapper(@objc_msgSend); + Handle := vmethod(ClassID, sel_registerName(PChar(StrNSDate_dateWithTimeIntervalSince1970)), _secs); +end; + +constructor NSDate.distantFuture; +type + TmsgSendWrapper = function (param1: objc.id; param2: SEL): objc.id; cdecl; +var + vmethod: TmsgSendWrapper; +begin + ClassID := getClass(); + vmethod := TmsgSendWrapper(@objc_msgSend); + Handle := vmethod(ClassID, sel_registerName(PChar(StrNSDate_distantFuture))); +end; + +constructor NSDate.distantPast; +type + TmsgSendWrapper = function (param1: objc.id; param2: SEL): objc.id; cdecl; +var + vmethod: TmsgSendWrapper; +begin + ClassID := getClass(); + vmethod := TmsgSendWrapper(@objc_msgSend); + Handle := vmethod(ClassID, sel_registerName(PChar(StrNSDate_distantPast))); +end; + +constructor NSDate.init; +type + TmsgSendWrapper = function (param1: objc.id; param2: SEL): objc.id; cdecl; +var + vmethod: TmsgSendWrapper; +begin + ClassID := getClass(); + allocbuf := objc_msgSend(ClassID, sel_registerName(PChar(Str_alloc)), []); + vmethod := TmsgSendWrapper(@objc_msgSend); + Handle := vmethod(allocbuf, sel_registerName(PChar(StrNSDate_init))); +end; + +constructor NSDate.initWithTimeIntervalSinceReferenceDate(_secsToBeAdded: NSTimeInterval); +type + TmsgSendWrapper = function (param1: objc.id; param2: SEL;_secsToBeAdded: NSTimeInterval): objc.id; cdecl; +var + vmethod: TmsgSendWrapper; +begin + ClassID := getClass(); + allocbuf := objc_msgSend(ClassID, sel_registerName(PChar(Str_alloc)), []); + vmethod := TmsgSendWrapper(@objc_msgSend); + Handle := vmethod(allocbuf, sel_registerName(PChar(StrNSDate_initWithTimeIntervalSinceReferenceDate)), _secsToBeAdded); +end; + +constructor NSDate.initWithTimeInterval_sinceDate(_secsToBeAdded: NSTimeInterval; _anotherDate: CFDateRef); +type + TmsgSendWrapper = function (param1: objc.id; param2: SEL;_secsToBeAdded: NSTimeInterval; _anotherDate: CFDateRef): objc.id; cdecl; +var + vmethod: TmsgSendWrapper; +begin + ClassID := getClass(); + allocbuf := objc_msgSend(ClassID, sel_registerName(PChar(Str_alloc)), []); + vmethod := TmsgSendWrapper(@objc_msgSend); + Handle := vmethod(allocbuf, sel_registerName(PChar(StrNSDate_initWithTimeInterval_sinceDate)), _secsToBeAdded, _anotherDate); +end; + +constructor NSDate.initWithTimeIntervalSinceNow(_secsToBeAddedToNow: NSTimeInterval); +type + TmsgSendWrapper = function (param1: objc.id; param2: SEL;_secsToBeAddedToNow: NSTimeInterval): objc.id; cdecl; +var + vmethod: TmsgSendWrapper; +begin + ClassID := getClass(); + allocbuf := objc_msgSend(ClassID, sel_registerName(PChar(Str_alloc)), []); + vmethod := TmsgSendWrapper(@objc_msgSend); + Handle := vmethod(allocbuf, sel_registerName(PChar(StrNSDate_initWithTimeIntervalSinceNow)), _secsToBeAddedToNow); +end; + +{$endif} diff --git a/bindings/pascocoa/foundation/NSObjCRuntime.inc b/bindings/pascocoa/foundation/NSObjCRuntime.inc new file mode 100755 index 000000000..d36040a3e --- /dev/null +++ b/bindings/pascocoa/foundation/NSObjCRuntime.inc @@ -0,0 +1,26 @@ +{%mainunit foundation.pas} +(* NSObjCRuntime.h + Copyright (c) 1994-2007, Apple Inc. All rights reserved. +*) + +{$ifdef HEADER} +{$ifndef NSOBJCRUNTIME_PAS_H} +{$define NSOBJCRUNTIME_PAS_H} + +type + NSInteger = Integer; + NSUInteger = LongWord; + +const + NSOrderedAscending = 1; + NSOrderedSame = 2; + NSOrderedDescending = 3; + +type + NSComparisonResult = Integer; + +const + NSNotFound = MaxInt; + +{$endif} +{$endif}