You've already forked lazarus-ccr
Added objective-c and Cocoa bindings to Pascal
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@352 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
113
bindings/objc/List.inc
Normal file
113
bindings/objc/List.inc
Normal file
@ -0,0 +1,113 @@
|
||||
{
|
||||
* Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
}
|
||||
{
|
||||
List.h
|
||||
Copyright 1988-1996 NeXT Software, Inc.
|
||||
|
||||
DEFINED AS: A common class
|
||||
HEADER FILES: objc/List.h
|
||||
|
||||
}
|
||||
|
||||
//#warning The API in this header is obsoleted by NSArray.
|
||||
|
||||
//#import <objc/Object.h>
|
||||
|
||||
{@interface List : Object
|
||||
(
|
||||
@public
|
||||
id *dataPtr; /* data of the List object */
|
||||
unsigned numElements; /* Actual number of elements */
|
||||
unsigned maxElements; /* Total allocated elements */
|
||||
)
|
||||
|
||||
/* Creating, freeing */
|
||||
|
||||
- free;
|
||||
- freeObjects;
|
||||
- copyFromZone:(void *)z;
|
||||
|
||||
/* Initializing */
|
||||
|
||||
- init;
|
||||
- initCount:(unsigned)numSlots;
|
||||
|
||||
/* Comparing two lists */
|
||||
|
||||
- (BOOL)isEqual: anObject;
|
||||
|
||||
/* Managing the storage capacity */
|
||||
|
||||
- (unsigned)capacity;
|
||||
- setAvailableCapacity:(unsigned)numSlots;
|
||||
|
||||
/* Manipulating objects by index */
|
||||
|
||||
- (unsigned)count;
|
||||
- objectAt:(unsigned)index;
|
||||
- lastObject;
|
||||
- addObject:anObject;
|
||||
- insertObject:anObject at:(unsigned)index;
|
||||
- removeObjectAt:(unsigned)index;
|
||||
- removeLastObject;
|
||||
- replaceObjectAt:(unsigned)index with:newObject;
|
||||
- appendList: (List *)otherList;
|
||||
|
||||
/* Manipulating objects by id */
|
||||
|
||||
- (unsigned)indexOf:anObject;
|
||||
- addObjectIfAbsent:anObject;
|
||||
- removeObject:anObject;
|
||||
- replaceObject:anObject with:newObject;
|
||||
|
||||
/* Emptying the list */
|
||||
|
||||
- empty;
|
||||
|
||||
/* Sending messages to elements of the list */
|
||||
|
||||
- makeObjectsPerform:(SEL)aSelector;
|
||||
- makeObjectsPerform:(SEL)aSelector with:anObject;
|
||||
|
||||
/*
|
||||
* The following new... methods are now obsolete. They remain in this
|
||||
* interface file for backward compatibility only. Use Object's alloc method
|
||||
* and the init... methods defined in this class instead.
|
||||
*/
|
||||
|
||||
+ new;
|
||||
+ newCount:(unsigned)numSlots;
|
||||
|
||||
@end
|
||||
|
||||
typedef struct (
|
||||
@defs(List)
|
||||
) NXListId;
|
||||
|
||||
#define NX_ADDRESS(x) (((NXListId *)(x))->dataPtr)
|
||||
}
|
||||
|
||||
const
|
||||
NX_NOT_IN_LIST = $ffffffff;
|
164
bindings/objc/Object.inc
Normal file
164
bindings/objc/Object.inc
Normal file
@ -0,0 +1,164 @@
|
||||
{
|
||||
* Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
}
|
||||
{
|
||||
Object.h
|
||||
Copyright 1988-1996 NeXT Software, Inc.
|
||||
|
||||
DEFINED AS: A common class
|
||||
HEADER FILES: <objc/Object.h>
|
||||
|
||||
}
|
||||
|
||||
//#include <objc/objc-runtime.h>
|
||||
|
||||
{@class Protocol;
|
||||
|
||||
@interface Object
|
||||
(
|
||||
Class isa; /* A pointer to the instance's class structure */
|
||||
)
|
||||
|
||||
/* Initializing classes and instances */
|
||||
|
||||
+ initialize;
|
||||
- init;
|
||||
|
||||
/* Creating, copying, and freeing instances */
|
||||
|
||||
+ new;
|
||||
+ free;
|
||||
- free;
|
||||
+ alloc;
|
||||
- copy;
|
||||
+ allocFromZone:(void *)zone;
|
||||
- copyFromZone:(void *)zone;
|
||||
- (void *)zone;
|
||||
|
||||
/* Identifying classes */
|
||||
|
||||
+ class;
|
||||
+ superclass;
|
||||
+ (const char *) name;
|
||||
- class;
|
||||
- superclass;
|
||||
- (const char *) name;
|
||||
|
||||
/* Identifying and comparing instances */
|
||||
|
||||
- self;
|
||||
- (unsigned int) hash;
|
||||
- (BOOL) isEqual:anObject;
|
||||
|
||||
/* Testing inheritance relationships */
|
||||
|
||||
- (BOOL) isKindOf: aClassObject;
|
||||
- (BOOL) isMemberOf: aClassObject;
|
||||
- (BOOL) isKindOfClassNamed: (const char *)aClassName;
|
||||
- (BOOL) isMemberOfClassNamed: (const char *)aClassName;
|
||||
|
||||
/* Testing class functionality */
|
||||
|
||||
+ (BOOL) instancesRespondTo:(SEL)aSelector;
|
||||
- (BOOL) respondsTo:(SEL)aSelector;
|
||||
|
||||
/* Testing protocol conformance */
|
||||
|
||||
- (BOOL) conformsTo: (Protocol *)aProtocolObject;
|
||||
+ (BOOL) conformsTo: (Protocol *)aProtocolObject;
|
||||
|
||||
/* Obtaining method descriptors from protocols */
|
||||
|
||||
- (struct objc_method_description *) descriptionForMethod:(SEL)aSel;
|
||||
+ (struct objc_method_description *) descriptionForInstanceMethod:(SEL)aSel;
|
||||
|
||||
/* Obtaining method handles */
|
||||
|
||||
- (IMP) methodFor:(SEL)aSelector;
|
||||
+ (IMP) instanceMethodFor:(SEL)aSelector;
|
||||
|
||||
/* Sending messages determined at run time */
|
||||
|
||||
- perform:(SEL)aSelector;
|
||||
- perform:(SEL)aSelector with:anObject;
|
||||
- perform:(SEL)aSelector with:object1 with:object2;
|
||||
|
||||
/* Posing */
|
||||
|
||||
+ poseAs: aClassObject;
|
||||
|
||||
/* Enforcing intentions */
|
||||
|
||||
- subclassResponsibility:(SEL)aSelector;
|
||||
- notImplemented:(SEL)aSelector;
|
||||
|
||||
/* Error handling */
|
||||
|
||||
- doesNotRecognize:(SEL)aSelector;
|
||||
- error:(const char *)aString, ...;
|
||||
|
||||
/* Debugging */
|
||||
|
||||
- (void) printForDebugger:(void *)stream;
|
||||
|
||||
/* Archiving */
|
||||
|
||||
- awake;
|
||||
- write:(void *)stream;
|
||||
- read:(void *)stream;
|
||||
+ (int) version;
|
||||
+ setVersion: (int) aVersion;
|
||||
|
||||
/* Forwarding */
|
||||
|
||||
- forward: (SEL)sel : (marg_list)args;
|
||||
- performv: (SEL)sel : (marg_list)args;
|
||||
|
||||
@end
|
||||
|
||||
/* Abstract Protocol for Archiving */
|
||||
|
||||
@interface Object (Archiving)
|
||||
|
||||
- startArchiving: (void *)stream;
|
||||
- finishUnarchiving;
|
||||
|
||||
@end
|
||||
|
||||
/* Abstract Protocol for Dynamic Loading */
|
||||
|
||||
@interface Object (DynamicLoading)
|
||||
|
||||
//+ finishLoading:(headerType *)header;
|
||||
+ finishLoading:(struct mach_header *)header;
|
||||
+ startUnloading;
|
||||
|
||||
@end
|
||||
|
||||
OBJC_EXPORT id object_dispose(Object *anObject);
|
||||
OBJC_EXPORT id object_copy(Object *anObject, unsigned nBytes);
|
||||
OBJC_EXPORT id object_copyFromZone(Object *anObject, unsigned nBytes, void *z);
|
||||
OBJC_EXPORT id object_realloc(Object *anObject, unsigned nBytes);
|
||||
OBJC_EXPORT id object_reallocFromZone(Object *anObject, unsigned nBytes, void *z);
|
||||
}
|
67
bindings/objc/Protocol.inc
Normal file
67
bindings/objc/Protocol.inc
Normal file
@ -0,0 +1,67 @@
|
||||
{
|
||||
* Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
}
|
||||
{
|
||||
Protocol.h
|
||||
Copyright 1991-1996 NeXT Software, Inc.
|
||||
}
|
||||
|
||||
//#import <objc/Object.h>
|
||||
|
||||
type
|
||||
objc_method_description = record
|
||||
name: SEL;
|
||||
types: PChar;
|
||||
end;
|
||||
|
||||
objc_method_description_list = record
|
||||
count: cint;
|
||||
list: array[0..0] of objc_method_description;
|
||||
end;
|
||||
|
||||
{
|
||||
@interface Protocol : Object
|
||||
(
|
||||
@private
|
||||
char *protocol_name;
|
||||
struct objc_protocol_list *protocol_list;
|
||||
struct objc_method_description_list *instance_methods, *class_methods;
|
||||
)
|
||||
|
||||
/* Obtaining attributes intrinsic to the protocol */
|
||||
|
||||
- (const char *)name;
|
||||
|
||||
/* Testing protocol conformance */
|
||||
|
||||
- (BOOL) conformsTo: (Protocol *)aProtocolObject;
|
||||
|
||||
/* Looking up information specific to a protocol */
|
||||
|
||||
- (struct objc_method_description *) descriptionForInstanceMethod:(SEL)aSel;
|
||||
- (struct objc_method_description *) descriptionForClassMethod:(SEL)aSel;
|
||||
|
||||
@end
|
||||
}
|
||||
|
137
bindings/objc/error.inc
Normal file
137
bindings/objc/error.inc
Normal file
@ -0,0 +1,137 @@
|
||||
{
|
||||
* Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
}
|
||||
|
||||
{
|
||||
error.h
|
||||
|
||||
This file defines the interface to the exception raising scheme.
|
||||
|
||||
Copyright (c) 1988-1996 NeXT Software, Inc. as an unpublished work.
|
||||
All rights reserved.
|
||||
}
|
||||
|
||||
//#warning The API in this header is obsoleted by NSException et al.
|
||||
|
||||
//#include <setjmp.h>
|
||||
//#import <objc/objc-api.h>
|
||||
|
||||
|
||||
type
|
||||
PNXHandler = ^NXHandler;
|
||||
|
||||
NXHandler = record { a node in the handler chain }
|
||||
jumpState: jmp_buf; { place to longjmp to }
|
||||
next: PNXHandler; { ptr to next handler }
|
||||
code: cint; { error code of exception }
|
||||
data1, data2: Pointer; { blind data for describing error }
|
||||
end;
|
||||
|
||||
|
||||
{ Handles RAISE's with nowhere to longjmp to }
|
||||
type
|
||||
NXUncaughtExceptionHandler = procedure(code: cint; const data1, data2: Pointer); cdecl;
|
||||
{OBJC_EXPORT NXUncaughtExceptionHandler *_NXUncaughtExceptionHandler;
|
||||
#define NXGetUncaughtExceptionHandler() _NXUncaughtExceptionHandler
|
||||
#define NXSetUncaughtExceptionHandler(proc) \
|
||||
(_NXUncaughtExceptionHandler = (proc))}
|
||||
|
||||
{ NX_DURING, NX_HANDLER and NX_ENDHANDLER are always used like:
|
||||
|
||||
NX_DURING
|
||||
some code which might raise an error
|
||||
NX_HANDLER
|
||||
code that will be jumped to if an error occurs
|
||||
NX_ENDHANDLER
|
||||
|
||||
If any error is raised within the first block of code, the second block
|
||||
of code will be jumped to. Typically, this code will clean up any
|
||||
resources allocated in the routine, possibly case on the error code
|
||||
and perform special processing, and default to RERAISE the error to
|
||||
the next handler. Within the scope of the handler, a local variable
|
||||
called NXLocalHandler of type NXHandler holds information about the
|
||||
error raised.
|
||||
|
||||
It is illegal to exit the first block of code by any other means than
|
||||
NX_VALRETURN, NX_VOIDRETURN, or just falling out the bottom.
|
||||
}
|
||||
|
||||
{ private support routines. Do not call directly. }
|
||||
procedure _NXAddHandler(handler: PNXHandler); cdecl; external;
|
||||
procedure _NXRemoveHandler(handler: PNXHandler); cdecl; external;
|
||||
|
||||
{#define NX_DURING ( NXHandler NXLocalHandler; \
|
||||
_NXAddHandler(&NXLocalHandler); \
|
||||
if( !_setjmp(NXLocalHandler.jumpState) ) [
|
||||
|
||||
#define NX_HANDLER _NXRemoveHandler(&NXLocalHandler); ] else [
|
||||
|
||||
#define NX_ENDHANDLER ]]
|
||||
|
||||
#define NX_VALRETURN(val) do [ typeof(val) temp = (val); \
|
||||
_NXRemoveHandler(&NXLocalHandler); \
|
||||
return(temp); ] while (0)
|
||||
|
||||
#define NX_VOIDRETURN do [ _NXRemoveHandler(&NXLocalHandler); \
|
||||
return; ] while (0)
|
||||
}
|
||||
|
||||
{ RAISE and RERAISE are called to indicate an error condition. They
|
||||
initiate the process of jumping up the chain of handlers.
|
||||
}
|
||||
|
||||
{#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
|
||||
volatile /* never returns */
|
||||
#endif}
|
||||
|
||||
procedure _NXRaiseError(code: cint; const data1, data2: Pointer); cdecl; external;
|
||||
|
||||
{#if defined(__GNUC__)
|
||||
__attribute__ ((noreturn))
|
||||
#endif}
|
||||
|
||||
|
||||
procedure NX_RAISE(code: cint; const data1, data2: Pointer);
|
||||
|
||||
procedure NX_RERAISE();
|
||||
|
||||
{ These routines set and return the procedure which is called when
|
||||
exceptions are raised. This procedure must NEVER return. It will
|
||||
usually either longjmp, or call the uncaught exception handler.
|
||||
The default exception raiser is also declared
|
||||
}
|
||||
type
|
||||
{volatile} NXExceptionRaiser = procedure (code: cint; const data1, data2: Pointer); cdecl;
|
||||
|
||||
procedure NXSetExceptionRaiser(proc: NXExceptionRaiser); cdecl; external;
|
||||
function NXGetExceptionRaiser(): NXExceptionRaiser; cdecl; external;
|
||||
function NXDefaultExceptionRaiser(): NXExceptionRaiser; cdecl; external;
|
||||
|
||||
|
||||
{ The error buffer is used to allocate data which is passed up to other
|
||||
handlers. Clients should clear the error buffer in their top level
|
||||
handler. The Application Kit does this.
|
||||
}
|
||||
procedure NXAllocErrorData(size: cint; data: PPointer); cdecl; external;
|
||||
procedure NXResetErrorData(); cdecl; external;
|
173
bindings/objc/examples/cocoamsgbox/cocoamsgbox.lpi
Normal file
173
bindings/objc/examples/cocoamsgbox/cocoamsgbox.lpi
Normal file
@ -0,0 +1,173 @@
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<PathDelim Value="/"/>
|
||||
<Version Value="6"/>
|
||||
<General>
|
||||
<MainUnit Value="0"/>
|
||||
<IconPath Value="./"/>
|
||||
<TargetFileExt Value=""/>
|
||||
<ActiveEditorIndexAtStart Value="0"/>
|
||||
</General>
|
||||
<VersionInfo>
|
||||
<ProjectVersion Value=""/>
|
||||
<Language Value=""/>
|
||||
<CharSet Value=""/>
|
||||
</VersionInfo>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<IgnoreBinaries Value="False"/>
|
||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<Units Count="17">
|
||||
<Unit0>
|
||||
<Filename Value="cocoamsgbox.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="cocoamsgbox"/>
|
||||
<CursorPos X="13" Y="6"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="0"/>
|
||||
<UsageCount Value="24"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="../objc-runtime.inc"/>
|
||||
<CursorPos X="68" Y="77"/>
|
||||
<TopLine Value="64"/>
|
||||
<UsageCount Value="11"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="../objc.inc"/>
|
||||
<CursorPos X="3" Y="50"/>
|
||||
<TopLine Value="37"/>
|
||||
<UsageCount Value="11"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="../appkit/appkit.pas"/>
|
||||
<UnitName Value="appkit"/>
|
||||
<CursorPos X="22" Y="22"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="11"/>
|
||||
</Unit3>
|
||||
<Unit4>
|
||||
<Filename Value="../appkit/appkit.inc"/>
|
||||
<CursorPos X="1" Y="14"/>
|
||||
<TopLine Value="6"/>
|
||||
<UsageCount Value="21"/>
|
||||
</Unit4>
|
||||
<Unit5>
|
||||
<Filename Value="/System/Library/Frameworks/AppKit.framework/Versions/C/Headers/AppKit.h"/>
|
||||
<CursorPos X="35" Y="120"/>
|
||||
<TopLine Value="117"/>
|
||||
<UsageCount Value="10"/>
|
||||
<SyntaxHighlighter Value="C++"/>
|
||||
</Unit5>
|
||||
<Unit6>
|
||||
<Filename Value="../appkit/NSApplication.inc"/>
|
||||
<CursorPos X="3" Y="49"/>
|
||||
<TopLine Value="45"/>
|
||||
<UsageCount Value="11"/>
|
||||
</Unit6>
|
||||
<Unit7>
|
||||
<Filename Value="../objc-api.inc"/>
|
||||
<CursorPos X="42" Y="21"/>
|
||||
<TopLine Value="13"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit7>
|
||||
<Unit8>
|
||||
<Filename Value="../objc-class.inc"/>
|
||||
<CursorPos X="41" Y="196"/>
|
||||
<TopLine Value="184"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit8>
|
||||
<Unit9>
|
||||
<Filename Value="../objc.pas"/>
|
||||
<UnitName Value="objc"/>
|
||||
<CursorPos X="10" Y="7"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="11"/>
|
||||
</Unit9>
|
||||
<Unit10>
|
||||
<Filename Value="../appkit/NSAlert.inc"/>
|
||||
<CursorPos X="34" Y="53"/>
|
||||
<TopLine Value="51"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit10>
|
||||
<Unit11>
|
||||
<Filename Value="../appkit/NSPanel.inc"/>
|
||||
<CursorPos X="20" Y="89"/>
|
||||
<TopLine Value="68"/>
|
||||
<UsageCount Value="11"/>
|
||||
</Unit11>
|
||||
<Unit12>
|
||||
<Filename Value="../../teste/carbondemos/carbontest.lpr"/>
|
||||
<UnitName Value="carbontest"/>
|
||||
<CursorPos X="1" Y="65"/>
|
||||
<TopLine Value="12"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit12>
|
||||
<Unit13>
|
||||
<Filename Value="../../../cocoa/appkit/appkit.pas"/>
|
||||
<UnitName Value="appkit"/>
|
||||
<CursorPos X="1" Y="1"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit13>
|
||||
<Unit14>
|
||||
<Filename Value="../../../cocoa/appkit/NSApplication.inc"/>
|
||||
<CursorPos X="1" Y="348"/>
|
||||
<TopLine Value="328"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit14>
|
||||
<Unit15>
|
||||
<Filename Value="../../../cocoa/appkit/NSPanel.inc"/>
|
||||
<CursorPos X="94" Y="15"/>
|
||||
<TopLine Value="5"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit15>
|
||||
<Unit16>
|
||||
<Filename Value="../../objc.pas"/>
|
||||
<UnitName Value="objc"/>
|
||||
<CursorPos X="24" Y="2"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit16>
|
||||
</Units>
|
||||
<JumpHistory Count="0" HistoryIndex="-1"/>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="5"/>
|
||||
<SearchPaths>
|
||||
<OtherUnitFiles Value="../../"/>
|
||||
<SrcPath Value="../../"/>
|
||||
</SearchPaths>
|
||||
<CodeGeneration>
|
||||
<Generate Value="Faster"/>
|
||||
</CodeGeneration>
|
||||
<Linking>
|
||||
<Options>
|
||||
<PassLinkerOptions Value="True"/>
|
||||
<LinkerOptions Value="-framework cocoa -lobjc"/>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
</CONFIG>
|
66
bindings/objc/examples/cocoamsgbox/cocoamsgbox.lpr
Normal file
66
bindings/objc/examples/cocoamsgbox/cocoamsgbox.lpr
Normal file
@ -0,0 +1,66 @@
|
||||
{
|
||||
cocoamsgbox.pas
|
||||
|
||||
This example shows how to use the objective-c runtime headers to call
|
||||
initialization and finalization code for an objective-c class (in this case
|
||||
NSAutoreleasePool), and also shows a message box using minimal AppKit
|
||||
bindings to demonstrate that this can be used to build Cocoa applications.
|
||||
|
||||
Compilation of this example requires the following options:
|
||||
-k-framework -kcocoa -k-lobjc
|
||||
|
||||
This example project is released under public domain
|
||||
|
||||
AUTHORS: Felipe Monteiro de Carvalho
|
||||
}
|
||||
program cocoamsgbox;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
objc, ctypes, FPCMacOSAll;
|
||||
|
||||
{ Very limited appkit bindings, just to run this example independently
|
||||
of the Cocoa bindings }
|
||||
|
||||
{ From AppKit/NSApplication.inc }
|
||||
function NSApplicationLoad(): CBOOL; cdecl; external;
|
||||
|
||||
{ from AppKit/NSPanel.inc }
|
||||
function NSRunAlertPanel(title, msg, defaultButton, alternateButton, otherButton: CFStringRef; others: array of const): cint; cdecl; external;
|
||||
|
||||
const
|
||||
Str_NSAutoreleasePool = 'NSAutoreleasePool';
|
||||
Str_alloc = 'alloc';
|
||||
Str_init = 'init';
|
||||
Str_release = 'release';
|
||||
Str_Panel_Title = 'This is the title';
|
||||
Str_Panel_Message = 'This is the message';
|
||||
var
|
||||
{ classes }
|
||||
NSAutoreleasePoolId: objc.id;
|
||||
{ objects }
|
||||
allocbuf, pool: objc.id;
|
||||
{ strings }
|
||||
CFTitle, CFMessage: CFStringRef;
|
||||
begin
|
||||
{ NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; }
|
||||
NSAutoreleasePoolId := objc_getClass(PChar(Str_NSAutoreleasePool));
|
||||
allocbuf := objc_msgSend(NSAutoreleasePoolId, sel_registerName(PChar(Str_alloc)), []);
|
||||
pool := objc_msgSend(allocbuf, sel_registerName(PChar(Str_init)), []);
|
||||
|
||||
NSApplicationLoad();
|
||||
|
||||
CFTitle := CFStringCreateWithCString(nil, PChar(Str_Panel_Title), kCFStringEncodingUTF8);
|
||||
CFMessage := CFStringCreateWithCString(nil, PChar(Str_Panel_Message), kCFStringEncodingUTF8);
|
||||
|
||||
{ uses a default "OK" button and no alternate buttons }
|
||||
NSRunAlertPanel(CFTitle, CFMessage, nil, nil, nil, []);
|
||||
|
||||
CFRelease(CFTitle);
|
||||
CFRelease(CFMessage);
|
||||
|
||||
{ [pool release]; }
|
||||
objc_msgSend(pool, sel_registerName(PChar(Str_release)), []);
|
||||
end.
|
||||
|
224
bindings/objc/hashtable.inc
Normal file
224
bindings/objc/hashtable.inc
Normal file
@ -0,0 +1,224 @@
|
||||
{
|
||||
* Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
}
|
||||
{
|
||||
hashtable2.h
|
||||
Scalable hash table.
|
||||
Copyright 1989-1996 NeXT Software, Inc.
|
||||
}
|
||||
|
||||
//#warning The API in this header is obsoleted by NSHashtable.h
|
||||
|
||||
//#import <objc/objc.h>
|
||||
|
||||
{*************************************************************************
|
||||
* Hash tables of arbitrary data
|
||||
*************************************************************************}
|
||||
|
||||
{ This module allows hashing of arbitrary data. Such data must be pointers or integers, and client is responsible for allocating/deallocating this data. A deallocation call-back is provided.
|
||||
The objective C class HashTable is preferred when dealing with (key, values) associations because it is easier to use in that situation.
|
||||
As well-behaved scalable data structures, hash tables double in size when they start becoming full, thus guaranteeing both average constant time access and linear size. }
|
||||
|
||||
type
|
||||
hash_t = function (const info, data: Pointer): uarith_t; cdecl;
|
||||
isEqual_t = function (const info, data1, data2: Pointer): cint; cdecl;
|
||||
free_t = procedure (const info, data: Pointer); cdecl;
|
||||
|
||||
PNXHashTablePrototype = ^NXHashTablePrototype;
|
||||
|
||||
NXHashTablePrototype = record
|
||||
hash: hash_t;
|
||||
isEqual: isEqual_t;
|
||||
free: free_t;
|
||||
style: cint; { reserved for future expansion; currently 0 }
|
||||
end;
|
||||
|
||||
{ the info argument allows a certain generality, such as freeing according to some owner information }
|
||||
{ invariants assumed by the implementation:
|
||||
1 - data1 = data2 => hash(data1) = hash(data2)
|
||||
when data varies over time, hash(data) must remain invariant
|
||||
e.g. if data hashes over a string key, the string must not be changed
|
||||
2- isEqual (data1, data2) => data1= data2
|
||||
}
|
||||
|
||||
type
|
||||
PNXHashTable = ^NXHashTable;
|
||||
|
||||
NXHashTable = record
|
||||
prototype: PNXHashTablePrototype;
|
||||
count: cunsigned;
|
||||
nbBuckets: cunsigned;
|
||||
buckets: Pointer;
|
||||
info: Pointer;
|
||||
end;
|
||||
{ private data structure; may change }
|
||||
|
||||
function NXCreateHashTableFromZone (prototype: NXHashTablePrototype; capacity: cunsigned; const info: Pointer; z: Pointer): PNXHashTable; cdecl; external;
|
||||
function NXCreateHashTable (prototype: NXHashTablePrototype; capacity: cunsigned; const info: Pointer): PNXHashTable; cdecl; external;
|
||||
{ if hash is 0, pointer hash is assumed }
|
||||
{ if isEqual is 0, pointer equality is assumed }
|
||||
{ if free is 0, elements are not freed }
|
||||
{ capacity is only a hint; 0 creates a small table }
|
||||
{ info allows call backs to be very general }
|
||||
|
||||
procedure NXFreeHashTable (table: PNXHashTable); cdecl; external;
|
||||
{ calls free for each data, and recovers table }
|
||||
|
||||
procedure NXEmptyHashTable (table: PNXHashTable); cdecl; external;
|
||||
{ does not deallocate table nor data; keeps current capacity }
|
||||
|
||||
procedure NXResetHashTable (table: PNXHashTable); cdecl; external;
|
||||
{ frees each entry; keeps current capacity }
|
||||
|
||||
function NXCompareHashTables (table1, table2: PNXHashTable): BOOL; cdecl; external;
|
||||
{ Returns YES if the two sets are equal (each member of table1 in table2, and table have same size) }
|
||||
|
||||
function NXCopyHashTable (table: PNXHashTable): PNXHashTable; cdecl; external;
|
||||
{ makes a fresh table, copying data pointers, not data itself. }
|
||||
|
||||
function NXCountHashTable (table: PNXHashTable): cunsigned; cdecl; external;
|
||||
{ current number of data in table }
|
||||
|
||||
function NXHashMember (table: PNXHashTable; const data: Pointer): cint; cdecl; external;
|
||||
{ returns non-0 iff data is present in table.
|
||||
Example of use when the hashed data is a struct containing the key,
|
||||
and when the callee only has a key:
|
||||
MyStruct pseudo;
|
||||
pseudo.key = myKey;
|
||||
return NXHashMember (myTable, &pseudo)
|
||||
}
|
||||
|
||||
function NXHashGet (table: PNXHashTable; const data: Pointer): Pointer; cdecl; external;
|
||||
{ return original table data or NULL.
|
||||
Example of use when the hashed data is a struct containing the key,
|
||||
and when the callee only has a key:
|
||||
MyStruct pseudo;
|
||||
MyStruct *original;
|
||||
pseudo.key = myKey;
|
||||
original = NXHashGet (myTable, &pseudo)
|
||||
}
|
||||
|
||||
function NXHashInsert (table: PNXHashTable; const data: Pointer): Pointer; cdecl; external;
|
||||
{ previous data or NULL is returned. }
|
||||
|
||||
function NXHashInsertIfAbsent (table: PNXHashTable; const data: Pointer): Pointer; cdecl; external;
|
||||
{ If data already in table, returns the one in table
|
||||
else adds argument to table and returns argument. }
|
||||
|
||||
function NXHashRemove (table: PNXHashTable; const data: Pointer): Pointer; cdecl; external;
|
||||
{ previous data or NULL is returned }
|
||||
|
||||
{ Iteration over all elements of a table consists in setting up an iteration state and then to progress until all entries have been visited. An example of use for counting elements in a table is:
|
||||
unsigned count = 0;
|
||||
MyData *data;
|
||||
NXHashState state = NXInitHashState(table);
|
||||
while (NXNextHashState(table, &state, &data)) )
|
||||
count++;
|
||||
(
|
||||
}
|
||||
|
||||
type
|
||||
NXHashState = record
|
||||
i, j: cint;
|
||||
end;
|
||||
|
||||
{ callers should not rely on actual contents of the struct }
|
||||
|
||||
function NXInitHashState(table: PNXHashTable): NXHashState; cdecl; external;
|
||||
|
||||
function NXNextHashState(table, state: PNXHashTable; data: PPointer): cint; cdecl; external;
|
||||
{ returns 0 when all elements have been visited }
|
||||
|
||||
{*************************************************************************
|
||||
* Conveniences for writing hash, isEqual and free functions
|
||||
* and common prototypes
|
||||
*************************************************************************}
|
||||
|
||||
function NXPtrHash(const info, data: Pointer): uarith_t; cdecl; external;
|
||||
{ scrambles the address bits; info unused }
|
||||
function NXStrHash(const info, data: Pointer): uarith_t; cdecl; external;
|
||||
{ string hashing; info unused }
|
||||
function NXPtrIsEqual(const info, data1, data2: Pointer): cint; cdecl; external;
|
||||
{ pointer comparison; info unused }
|
||||
function NXStrIsEqual(const info, data1, data2: Pointer): cint; cdecl; external;
|
||||
{ string comparison; NULL ok; info unused }
|
||||
procedure NXNoEffectFree(const info, data: Pointer); cdecl; external;
|
||||
{ no effect; info unused }
|
||||
procedure NXReallyFree(const info, data: Pointer); cdecl; external;
|
||||
{ frees it; info unused }
|
||||
|
||||
{ The two following prototypes are useful for manipulating set of pointers or set of strings; For them free is defined as NXNoEffectFree }
|
||||
//OBJC_EXPORT const NXHashTablePrototype NXPtrPrototype;
|
||||
{ prototype when data is a pointer (void *) }
|
||||
//OBJC_EXPORT const NXHashTablePrototype NXStrPrototype;
|
||||
{ prototype when data is a string (char *) }
|
||||
|
||||
{ following prototypes help describe mappings where the key is the first element of a struct and is either a pointer or a string.
|
||||
For example NXStrStructKeyPrototype can be used to hash pointers to Example, where Example is:
|
||||
typedef struct (
|
||||
char *key;
|
||||
int data1;
|
||||
...
|
||||
) Example
|
||||
|
||||
For the following prototypes, free is defined as NXReallyFree.
|
||||
}
|
||||
//OBJC_EXPORT const NXHashTablePrototype NXPtrStructKeyPrototype;
|
||||
//OBJC_EXPORT const NXHashTablePrototype NXStrStructKeyPrototype;
|
||||
|
||||
{*************************************************************************
|
||||
* Unique strings and buffers
|
||||
*************************************************************************}
|
||||
|
||||
{ Unique strings allows C users to enjoy the benefits of Lisp's atoms:
|
||||
A unique string is a string that is allocated once for all (never de-allocated) and that has only one representant (thus allowing comparison with == instead of strcmp). A unique string should never be modified (and in fact some memory protection is done to ensure that). In order to more explicitly insist on the fact that the string has been uniqued, a synonym of (const char *) has been added, NXAtom. }
|
||||
|
||||
type
|
||||
NXAtom = PChar;
|
||||
|
||||
function NXUniqueString(const buffer: PChar): NXAtom; cdecl; external;
|
||||
{ assumes that buffer is \0 terminated, and returns
|
||||
a previously created string or a new string that is a copy of buffer.
|
||||
If NULL is passed returns NULL.
|
||||
Returned string should never be modified. To ensure this invariant,
|
||||
allocations are made in a special read only zone. }
|
||||
|
||||
function NXUniqueStringWithLength(const buffer: PChar; length: cint): NXAtom; cdecl; external;
|
||||
{ assumes that buffer is a non NULL buffer of at least
|
||||
length characters. Returns a previously created string or
|
||||
a new string that is a copy of buffer.
|
||||
If buffer contains \0, string will be truncated.
|
||||
As for NXUniqueString, returned string should never be modified. }
|
||||
|
||||
function NXUniqueStringNoCopy(const buffer: PChar): NXAtom; cdecl; external;
|
||||
{ If there is already a unique string equal to string, returns the original.
|
||||
Otherwise, string is entered in the table, without making a copy. Argument should then never be modified. }
|
||||
|
||||
function NXCopyStringBuffer(const buffer: PChar): PChar; cdecl; external;
|
||||
{ given a buffer, allocates a new string copy of buffer.
|
||||
Buffer should be \0 terminated; returned string is \0 terminated. }
|
||||
|
||||
function NXCopyStringBufferFromZone(const buffer: PChar; z: Pointer): PChar; cdecl; external;
|
||||
{ given a buffer, allocates a new string copy of buffer.
|
||||
Buffer should be \0 terminated; returned string is \0 terminated. }
|
221
bindings/objc/hashtable2.inc
Normal file
221
bindings/objc/hashtable2.inc
Normal file
@ -0,0 +1,221 @@
|
||||
{
|
||||
* Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
}
|
||||
{
|
||||
hashtable2.h
|
||||
Scalable hash table.
|
||||
Copyright 1989-1996 NeXT Software, Inc.
|
||||
}
|
||||
|
||||
//#warning The API in this header is obsoleted by NSHashtable.h
|
||||
|
||||
//#import <objc/objc.h>
|
||||
|
||||
{*************************************************************************
|
||||
* Hash tables of arbitrary data
|
||||
*************************************************************************}
|
||||
|
||||
{ This module allows hashing of arbitrary data. Such data must be pointers or integers, and client is responsible for allocating/deallocating this data. A deallocation call-back is provided.
|
||||
The objective C class HashTable is preferred when dealing with (key, values) associations because it is easier to use in that situation.
|
||||
As well-behaved scalable data structures, hash tables double in size when they start becoming full, thus guaranteeing both average constant time access and linear size. }
|
||||
|
||||
type
|
||||
NXHashTablePrototype = record
|
||||
uarith_t (*hash)(const void *info, const void *data);
|
||||
int (*isEqual)(const void *info, const void *data1, const void *data2);
|
||||
void (*free)(const void *info, void *data);
|
||||
style: cint; { reserved for future expansion; currently 0 }
|
||||
end;
|
||||
|
||||
{ the info argument allows a certain generality, such as freeing according to some owner information }
|
||||
{ invariants assumed by the implementation:
|
||||
1 - data1 = data2 => hash(data1) = hash(data2)
|
||||
when data varies over time, hash(data) must remain invariant
|
||||
e.g. if data hashes over a string key, the string must not be changed
|
||||
2- isEqual (data1, data2) => data1= data2
|
||||
}
|
||||
|
||||
NXHashTable = record
|
||||
prototype: PNXHashTablePrototype;
|
||||
unsigned count;
|
||||
unsigned nbBuckets;
|
||||
buckets: Pointer;
|
||||
info: Pointer;
|
||||
end;
|
||||
|
||||
PNXHashTable = ^NXHashTable;
|
||||
|
||||
{ private data structure; may change }
|
||||
|
||||
function NXCreateHashTableFromZone (prototype: NXHashTablePrototype;
|
||||
unsigned capacity; const info, z: Pointer): PNXHashTable; cdecl; external;
|
||||
function NXCreateHashTable (prototype: NXHashTablePrototype;
|
||||
unsigned capacity; const info: Pointer): PNXHashTable; cdecl; external;
|
||||
{ if hash is 0, pointer hash is assumed }
|
||||
{ if isEqual is 0, pointer equality is assumed }
|
||||
{ if free is 0, elements are not freed }
|
||||
{ capacity is only a hint; 0 creates a small table }
|
||||
{ info allows call backs to be very general }
|
||||
|
||||
procedure NXFreeHashTable (table: PNXHashTable); cdecl; external;
|
||||
{ calls free for each data, and recovers table }
|
||||
|
||||
procedure NXEmptyHashTable (table: PNXHashTable); cdecl; external;
|
||||
{ does not deallocate table nor data; keeps current capacity }
|
||||
|
||||
procedure NXResetHashTable (table: PNXHashTable); cdecl; external;
|
||||
{ frees each entry; keeps current capacity }
|
||||
|
||||
function NXCompareHashTables (NXHashTable *table1, NXHashTable *table2): BOOL; cdecl; external;
|
||||
{ Returns YES if the two sets are equal (each member of table1 in table2, and table have same size) }
|
||||
|
||||
function NXCopyHashTable (table: PNXHashTable): PNXHashTable; cdecl; external;
|
||||
{ makes a fresh table, copying data pointers, not data itself. }
|
||||
|
||||
OBJC_EXPORT unsigned NXCountHashTable (table: PNXHashTable); cdecl; external;
|
||||
{ current number of data in table }
|
||||
|
||||
function NXHashMember (table: PNXHashTable; const data: Pointer): cint; cdecl; external;
|
||||
{ returns non-0 iff data is present in table.
|
||||
Example of use when the hashed data is a struct containing the key,
|
||||
and when the callee only has a key:
|
||||
MyStruct pseudo;
|
||||
pseudo.key = myKey;
|
||||
return NXHashMember (myTable, &pseudo)
|
||||
}
|
||||
|
||||
function NXHashGet (table: PNXHashTable; const data: Pointer): Pointer; cdecl; external;
|
||||
{ return original table data or NULL.
|
||||
Example of use when the hashed data is a struct containing the key,
|
||||
and when the callee only has a key:
|
||||
MyStruct pseudo;
|
||||
MyStruct *original;
|
||||
pseudo.key = myKey;
|
||||
original = NXHashGet (myTable, &pseudo)
|
||||
}
|
||||
|
||||
function NXHashInsert (table: PNXHashTable; const data: Pointer): Pointer; cdecl; external;
|
||||
{ previous data or NULL is returned. }
|
||||
|
||||
function NXHashInsertIfAbsent (table: PNXHashTable; const data: Pointer): Pointer; cdecl; external;
|
||||
{ If data already in table, returns the one in table
|
||||
else adds argument to table and returns argument. }
|
||||
|
||||
function NXHashRemove (table: PNXHashTable; const data: Pointer): Pointer; cdecl; external;
|
||||
{ previous data or NULL is returned }
|
||||
|
||||
{ Iteration over all elements of a table consists in setting up an iteration state and then to progress until all entries have been visited. An example of use for counting elements in a table is:
|
||||
unsigned count = 0;
|
||||
MyData *data;
|
||||
NXHashState state = NXInitHashState(table);
|
||||
while (NXNextHashState(table, &state, &data)) (
|
||||
count++;
|
||||
)
|
||||
}
|
||||
|
||||
type
|
||||
NXHashState = record
|
||||
i, j: cint;
|
||||
end;
|
||||
{ callers should not rely on actual contents of the struct }
|
||||
|
||||
function NXInitHashState(table: PNXHashTable): NXHashState; cdecl; external;
|
||||
|
||||
OBJC_EXPORT int NXNextHashState(NXHashTable *table, NXHashState *state, void **data);
|
||||
{ returns 0 when all elements have been visited }
|
||||
|
||||
{*************************************************************************
|
||||
* Conveniences for writing hash, isEqual and free functions
|
||||
* and common prototypes
|
||||
*************************************************************************}
|
||||
|
||||
function NXPtrHash(const info: Pointer; data: Pointer): uarith_t; cdecl; external;
|
||||
{ scrambles the address bits; info unused }
|
||||
function NXStrHash(const info: Pointer; data: Pointer): uarith_t; cdecl; external;
|
||||
{ string hashing; info unused }
|
||||
function NXPtrIsEqual(const info: Pointer; data1, data2: Pointer): cint; cdecl; external;
|
||||
{ pointer comparison; info unused }
|
||||
function NXStrIsEqual(const info: Pointer; data1, data2: Pointer): cint; cdecl; external;
|
||||
{ string comparison; NULL ok; info unused }
|
||||
procedure NXNoEffectFree(const info: Pointer; data: Pointer); cdecl; external;
|
||||
{ no effect; info unused }
|
||||
procedure NXReallyFree(const info: Pointer; data: Pointer); cdecl; external;
|
||||
{ frees it; info unused }
|
||||
|
||||
{ The two following prototypes are useful for manipulating set of pointers or set of strings; For them free is defined as NXNoEffectFree }
|
||||
OBJC_EXPORT const NXHashTablePrototype NXPtrPrototype;
|
||||
{ prototype when data is a pointer (void *) }
|
||||
OBJC_EXPORT const NXHashTablePrototype NXStrPrototype;
|
||||
{ prototype when data is a string (char *) }
|
||||
|
||||
{ following prototypes help describe mappings where the key is the first element of a struct and is either a pointer or a string.
|
||||
For example NXStrStructKeyPrototype can be used to hash pointers to Example, where Example is:
|
||||
typedef struct {
|
||||
char *key;
|
||||
int data1;
|
||||
...
|
||||
} Example
|
||||
|
||||
For the following prototypes, free is defined as NXReallyFree.
|
||||
}
|
||||
OBJC_EXPORT const NXHashTablePrototype NXPtrStructKeyPrototype;
|
||||
OBJC_EXPORT const NXHashTablePrototype NXStrStructKeyPrototype;
|
||||
|
||||
{*************************************************************************
|
||||
* Unique strings and buffers
|
||||
*************************************************************************}
|
||||
|
||||
{ Unique strings allows C users to enjoy the benefits of Lisp's atoms:
|
||||
A unique string is a string that is allocated once for all (never de-allocated) and that has only one representant (thus allowing comparison with == instead of strcmp). A unique string should never be modified (and in fact some memory protection is done to ensure that). In order to more explicitly insist on the fact that the string has been uniqued, a synonym of (const char *) has been added, NXAtom. }
|
||||
|
||||
type
|
||||
NXAtom: PChar;
|
||||
|
||||
function NXUniqueString(const buffer: PChar): NXAtom; cdecl; external;
|
||||
{ assumes that buffer is \0 terminated, and returns
|
||||
a previously created string or a new string that is a copy of buffer.
|
||||
If NULL is passed returns NULL.
|
||||
Returned string should never be modified. To ensure this invariant,
|
||||
allocations are made in a special read only zone. }
|
||||
|
||||
function NXUniqueStringWithLength(const buffer: PChar; length: cint): NXAtom; cdecl; external;
|
||||
{ assumes that buffer is a non NULL buffer of at least
|
||||
length characters. Returns a previously created string or
|
||||
a new string that is a copy of buffer.
|
||||
If buffer contains \0, string will be truncated.
|
||||
As for NXUniqueString, returned string should never be modified. }
|
||||
|
||||
function NXUniqueStringNoCopy(const _string: PChar): NXAtom; cdecl; external;
|
||||
{ If there is already a unique string equal to string, returns the original.
|
||||
Otherwise, string is entered in the table, without making a copy. Argument should then never be modified. */
|
||||
|
||||
function NXCopyStringBuffer(const buffer: PChar): PChar; cdecl; external;
|
||||
{ given a buffer, allocates a new string copy of buffer.
|
||||
Buffer should be \0 terminated; returned string is \0 terminated. }
|
||||
|
||||
function NXCopyStringBufferFromZone(const buffer: PChar; z: Pointer): PChar; cdecl; external;
|
||||
{ given a buffer, allocates a new string copy of buffer.
|
||||
Buffer should be \0 terminated; returned string is \0 terminated. }
|
||||
|
||||
|
25
bindings/objc/malloc.inc
Normal file
25
bindings/objc/malloc.inc
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
* Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
}
|
||||
|
||||
//#warning "Use <malloc/malloc.h> instead of <objc/malloc.h>"
|
||||
//#include <malloc/malloc.h>
|
39
bindings/objc/objc-api.inc
Normal file
39
bindings/objc/objc-api.inc
Normal file
@ -0,0 +1,39 @@
|
||||
{
|
||||
* Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
}
|
||||
// Copyright 1988-1996 NeXT Software, Inc.
|
||||
|
||||
{
|
||||
#if !defined(OBJC_EXPORT)
|
||||
#if defined(__cplusplus)
|
||||
# define OBJC_EXPORT extern "C"
|
||||
#else
|
||||
# define OBJC_EXPORT extern
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(OBJC_IMPORT)
|
||||
# define OBJC_IMPORT extern
|
||||
#endif
|
||||
}
|
53
bindings/objc/objc-auto.inc
Normal file
53
bindings/objc/objc-auto.inc
Normal file
@ -0,0 +1,53 @@
|
||||
{
|
||||
* Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Copyright (c) 2004 Apple Computer, Inc. All Rights Reserved.
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
}
|
||||
{
|
||||
* objc-auto.h
|
||||
* Copyright 2004 Apple Computer, Inc.
|
||||
}
|
||||
|
||||
//#import <objc/objc.h>
|
||||
//#include <sys/types.h>
|
||||
|
||||
{ Collection utilities }
|
||||
|
||||
const
|
||||
OBJC_GENERATIONAL = (1 shl 0);
|
||||
|
||||
procedure objc_collect_if_needed(options: culong); cdecl; external;
|
||||
function objc_numberAllocated(): cuint; cdecl; external;
|
||||
function objc_collecting_enabled(): BOOL; cdecl; external;
|
||||
|
||||
{ Memory management }
|
||||
function objc_allocate_object(cls: _Class; extra: cint): id; cdecl; external;
|
||||
|
||||
{ Write barriers }
|
||||
function objc_assign_strongCast(val: id; dest: Pid): id; cdecl; external;
|
||||
function objc_assign_global(val: id; dest: Pid): id; cdecl; external;
|
||||
function objc_assign_ivar(value, dest: id; offset: cuint): id; cdecl; external;
|
||||
function objc_memmove_collectable(dst: Pointer; const src: Pointer; size: size_t): Pointer; cdecl; external;
|
||||
|
||||
{ Testing tools }
|
||||
function objc_is_finalized(ptr: Pointer): BOOL; cdecl; external;
|
||||
|
283
bindings/objc/objc-class.inc
Normal file
283
bindings/objc/objc-class.inc
Normal file
@ -0,0 +1,283 @@
|
||||
{
|
||||
* Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
}
|
||||
{
|
||||
* objc-class.h
|
||||
* Copyright 1988-1996, NeXT Software, Inc.
|
||||
}
|
||||
|
||||
//#import <objc/objc.h>
|
||||
|
||||
{
|
||||
* Class Template
|
||||
}
|
||||
type
|
||||
Pobjc_class = ^objc_class;
|
||||
|
||||
Pobjc_ivar_list = ^objc_ivar_list;
|
||||
|
||||
Pobjc_method_list = ^objc_method_list;
|
||||
PPobjc_method_list = ^Pobjc_method_list;
|
||||
|
||||
Pobjc_cache = ^objc_cache;
|
||||
|
||||
Pobjc_protocol_list = ^objc_protocol_list;
|
||||
|
||||
objc_class = record
|
||||
isa: Pobjc_class;
|
||||
super_class: Pobjc_class;
|
||||
name: PChar;
|
||||
version: culong;
|
||||
info: culong;
|
||||
instance_size: culong;
|
||||
ivars: Pobjc_ivar_list;
|
||||
|
||||
methodLists: PPobjc_method_list;
|
||||
|
||||
cache: Pobjc_cache;
|
||||
protocols: Pobjc_protocol_list;
|
||||
end;
|
||||
|
||||
//#define CLS_GETINFO(cls,infomask) ((cls)->info & (infomask))
|
||||
//#define CLS_SETINFO(cls,infomask) ((cls)->info |= (infomask))
|
||||
|
||||
{ Constants here were moved to the end }
|
||||
|
||||
{
|
||||
* Category Template
|
||||
}
|
||||
Pobjc_category = ^objc_category;
|
||||
|
||||
Category = Pobjc_category;
|
||||
|
||||
objc_category = record
|
||||
category_name: PChar;
|
||||
class_name: PChar;
|
||||
instance_methods: Pobjc_method_list;
|
||||
class_methods: Pobjc_method_list;
|
||||
protocols: Pobjc_protocol_list;
|
||||
end;
|
||||
|
||||
{
|
||||
* Instance Variable Template
|
||||
}
|
||||
Pobjc_ivar = ^objc_ivar;
|
||||
|
||||
Ivar = Pobjc_ivar;
|
||||
|
||||
objc_ivar = record
|
||||
ivar_name: PChar;
|
||||
ivar_type: PChar;
|
||||
ivar_offset: cint;
|
||||
{$ifdef __alpha__}
|
||||
space: cint;
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
objc_ivar_list = record
|
||||
ivar_count: cint;
|
||||
{$ifdef __alpha__}
|
||||
space: cint;
|
||||
{$endif}
|
||||
ivar_list: array[0..0] of objc_ivar; { variable length structure }
|
||||
end;
|
||||
|
||||
{ functions here were moved down }
|
||||
|
||||
{
|
||||
* Method Template
|
||||
}
|
||||
Pobjc_method = ^objc_method;
|
||||
Method = Pobjc_method;
|
||||
|
||||
objc_method = record
|
||||
// method_name: SEL;
|
||||
method_types: PChar;
|
||||
// method_imp: IMP;
|
||||
end;
|
||||
|
||||
objc_method_list = record
|
||||
obsolete: Pobjc_method_list;
|
||||
|
||||
method_count: cint;
|
||||
{$ifdef __alpha__}
|
||||
space: cint;
|
||||
{$endif}
|
||||
method_list: array[0..0] of objc_method; { variable length structure }
|
||||
end;
|
||||
|
||||
{ Protocol support }
|
||||
|
||||
Protocol = objc_object;
|
||||
|
||||
objc_protocol_list = record
|
||||
next: Pobjc_protocol_list;
|
||||
count: cint;
|
||||
list: array[0..0] of Protocol;
|
||||
end;
|
||||
|
||||
{ Constants here moved down }
|
||||
|
||||
{ Structure for method cache - allocated/sized at runtime }
|
||||
|
||||
Cache = Pobjc_cache;
|
||||
|
||||
objc_cache = record
|
||||
mask: cuint; { total = mask + 1 }
|
||||
occupied: cuint;
|
||||
buckets: array[0..0] of Method;
|
||||
end;
|
||||
|
||||
{#define CACHE_BUCKET_NAME(B) ((B)->method_name)
|
||||
#define CACHE_BUCKET_IMP(B) ((B)->method_imp)
|
||||
#define CACHE_BUCKET_VALID(B) (B)
|
||||
#define CACHE_HASH(sel, mask) (((uarith_t)(sel)>>2) & (mask))}
|
||||
|
||||
{ operations }
|
||||
function class_createInstance(param1: _Class; idxIvars: cunsigned): id; cdecl; external;
|
||||
function class_createInstanceFromZone(param1: _Class; idxIvars: cunsigned; z: Pointer): id; cdecl; external;
|
||||
|
||||
procedure class_setVersion(param1: _Class; param2: cint); cdecl; external;
|
||||
function class_getVersion(param1: _Class): cint; cdecl; external;
|
||||
|
||||
function class_getInstanceVariable(param1: _Class; const param2: PChar): Ivar; cdecl; external;
|
||||
function class_getInstanceMethod(param1: _Class; param2: SEL): Method; cdecl; external;
|
||||
function class_getClassMethod(param1: _Class; param2: SEL): Method; cdecl; external;
|
||||
|
||||
procedure class_addMethods(param1: _Class; param2: objc_method_list); cdecl; external;
|
||||
procedure class_removeMethods(param1: _Class; param2: objc_method_list); cdecl; external;
|
||||
|
||||
function class_poseAs(imposter, original: _Class): _Class; cdecl; external;
|
||||
|
||||
function method_getNumberOfArguments(param1: Method): cunsigned; cdecl; external;
|
||||
function method_getSizeOfArguments(param1: Method): cunsigned; cdecl; external;
|
||||
function method_getArgumentInfo(m: Method; arg: cint; _type: PPChar; offset: Pcint): cunsigned; cdecl; external;
|
||||
|
||||
// usage for nextMethodList
|
||||
//
|
||||
// void *iterator = 0;
|
||||
// struct objc_method_list *mlist;
|
||||
// while ( mlist = class_nextMethodList( cls, &iterator ) )
|
||||
// ;
|
||||
const OBJC_NEXT_METHOD_LIST = 1;
|
||||
function class_nextMethodList(param1: _Class; param2: PPPointer): Pobjc_method_list; cdecl; external;
|
||||
|
||||
type
|
||||
marg_list = Pointer;
|
||||
|
||||
{$if defined(PowerPC) or defined(__ppc__) or defined(ppc)}
|
||||
const marg_prearg_size = 128;
|
||||
{$else}
|
||||
const marg_prearg_size = 0;
|
||||
{$endif}
|
||||
|
||||
{#define marg_malloc(margs, method) \
|
||||
do ( \
|
||||
margs = (marg_list *)malloc (marg_prearg_size + ((7 + method_getSizeOfArguments(method)) & ~7)); \
|
||||
) while (0)
|
||||
|
||||
|
||||
#define marg_free(margs) \
|
||||
do ( \
|
||||
free(margs); \
|
||||
) while (0)
|
||||
|
||||
#define marg_adjustedOffset(method, offset) \
|
||||
(marg_prearg_size + offset)
|
||||
|
||||
|
||||
|
||||
|
||||
#define marg_getRef(margs, offset, type) \
|
||||
( (type *)((char *)margs + marg_adjustedOffset(method,offset) ) )
|
||||
|
||||
#define marg_getValue(margs, offset, type) \
|
||||
( *marg_getRef(margs, offset, type) )
|
||||
|
||||
#define marg_setValue(margs, offset, type, value) \
|
||||
( marg_getValue(margs, offset, type) = (value) ) }
|
||||
|
||||
{ Load categories and non-referenced classes from libraries. }
|
||||
|
||||
{ Constants moved to the end }
|
||||
|
||||
const
|
||||
CLS_CLASS = $1;//L
|
||||
CLS_META = $2;//L
|
||||
CLS_INITIALIZED = $4;//L
|
||||
CLS_POSING = $8;//L
|
||||
CLS_MAPPED = $10;//L
|
||||
CLS_FLUSH_CACHE = $20;//L
|
||||
CLS_GROW_CACHE = $40;//L
|
||||
CLS_NEED_BIND = $80;//L
|
||||
CLS_METHOD_ARRAY = $100;//L
|
||||
// the JavaBridge constructs classes with these markers
|
||||
CLS_JAVA_HYBRID = $200;//L
|
||||
CLS_JAVA_CLASS = $400;//L
|
||||
// thread-safe +initialize
|
||||
CLS_INITIALIZING = $800;
|
||||
// bundle unloading
|
||||
CLS_FROM_BUNDLE = $1000;//L
|
||||
// C++ ivar support
|
||||
CLS_HAS_CXX_STRUCTORS = $2000;//L
|
||||
// Lazy method list arrays
|
||||
CLS_NO_METHOD_ARRAY = $4000;//L
|
||||
// +load implementation
|
||||
// #define CLS_HAS_LOAD_METHOD 0x8000L
|
||||
|
||||
{ Functions moved to the end }
|
||||
|
||||
function object_setInstanceVariable(param1: id; const name: PChar; param3: Pointer): Ivar; cdecl; external;
|
||||
function object_getInstanceVariable(param1: id; const name: PChar; param3: PPointer): Ivar; cdecl; external;
|
||||
|
||||
{ Constants moved down }
|
||||
|
||||
{ Definitions of filer types }
|
||||
|
||||
const
|
||||
_C_ID = '@';
|
||||
_C_CLASS = '#';
|
||||
_C_SEL = ':';
|
||||
_C_CHR = 'c';
|
||||
_C_UCHR = 'C';
|
||||
_C_SHT = 's';
|
||||
_C_USHT = 'S';
|
||||
_C_INT = 'i';
|
||||
_C_UINT = 'I';
|
||||
_C_LNG = 'l';
|
||||
_C_ULNG = 'L';
|
||||
_C_FLT = 'f';
|
||||
_C_DBL = 'd';
|
||||
_C_BFLD = 'b';
|
||||
_C_VOID = 'v';
|
||||
_C_UNDEF = '?';
|
||||
_C_PTR = '^';
|
||||
_C_CHARPTR = '*';
|
||||
_C_ARY_B = '[';
|
||||
_C_ARY_E = ']';
|
||||
_C_UNION_B = '(';
|
||||
_C_UNION_E = ')';
|
||||
_C_STRUCT_B = '{';
|
||||
_C_STRUCT_E = '}';
|
||||
|
67
bindings/objc/objc-exception.inc
Normal file
67
bindings/objc/objc-exception.inc
Normal file
@ -0,0 +1,67 @@
|
||||
{
|
||||
* Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
}
|
||||
|
||||
// objc_exception.h
|
||||
// Support for Objective-C language Exceptions
|
||||
//
|
||||
// Created by Blaine Garst on Fri Nov 01 2002.
|
||||
// Copyright (c) 2002-3 Apple Computer, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
//#import "objc/objc-class.h"
|
||||
|
||||
// compiler reserves a setjmp buffer + 4 words as localExceptionData
|
||||
|
||||
procedure objc_exception_throw(exception: id); cdecl; external;
|
||||
procedure objc_exception_try_enter(localExceptionData: Pointer); cdecl; external;
|
||||
procedure objc_exception_try_exit(localExceptionData: Pointer); cdecl; external;
|
||||
function objc_exception_extract(localExceptionData: Pointer): id; cdecl; external;
|
||||
function objc_exception_match(exceptionClass: _Class; exception: id): cint; cdecl; external;
|
||||
|
||||
|
||||
type
|
||||
throw_exc_t = procedure (param1: id); cdecl;
|
||||
try_enter_t = procedure (param1: Pointer); cdecl;
|
||||
try_exit_t = procedure (param1: Pointer); cdecl;
|
||||
extract_t = function (param1: Pointer): id; cdecl;
|
||||
match_t = function (param1: _Class; param2: id): cint; cdecl;
|
||||
|
||||
Pobjc_exception_functions_t = ^objc_exception_functions_t;
|
||||
|
||||
objc_exception_functions_t = record
|
||||
version: cint;
|
||||
throw_exc: throw_exc_t; // version 0
|
||||
try_enter: try_enter_t; // version 0
|
||||
try_exit: try_exit_t; // version 0
|
||||
extract: extract_t; // version 0
|
||||
match: match_t; // version 0
|
||||
end;
|
||||
|
||||
// get table; version tells how many
|
||||
procedure objc_exception_get_functions(table: Pobjc_exception_functions_t); cdecl; external;
|
||||
|
||||
// set table
|
||||
procedure objc_exception_set_functions(table: Pobjc_exception_functions_t); cdecl; external;
|
||||
|
65
bindings/objc/objc-load.inc
Normal file
65
bindings/objc/objc-load.inc
Normal file
@ -0,0 +1,65 @@
|
||||
{
|
||||
* Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
}
|
||||
{
|
||||
* objc-load.h
|
||||
* Copyright 1988-1996, NeXT Software, Inc.
|
||||
}
|
||||
|
||||
//#import <objc/objc-class.h>
|
||||
|
||||
//#import <mach-o/loader.h>
|
||||
|
||||
type
|
||||
class_callback_t = procedure (param1: _Class; param2: Category); cdecl;
|
||||
unloadCallback_t = procedure (param1: _Class; param2: Category); cdecl;
|
||||
|
||||
{ dynamically loading Mach-O object files that contain Objective-C code }
|
||||
|
||||
function objc_loadModules (
|
||||
modlist: array of PChar;
|
||||
errStream: Pointer;
|
||||
class_callback: class_callback_t;
|
||||
{headerType} hdr_addr: PPointer; //PPmach_header;
|
||||
debug_file: PChar
|
||||
): clong; cdecl; external;
|
||||
|
||||
function objc_loadModule (
|
||||
moduleName: PChar;
|
||||
class_callback: class_callback_t;
|
||||
errorCode: Pcint): cint; cdecl; external;
|
||||
|
||||
function objc_unloadModules(
|
||||
errorStream: Pointer; { input (optional) }
|
||||
unloadCallback: unloadCallback_t { input (optional) }
|
||||
): clong; cdecl; external;
|
||||
|
||||
procedure objc_register_header_name(
|
||||
name: PChar { input }
|
||||
); cdecl; external;
|
||||
|
||||
procedure objc_register_header(
|
||||
name: PChar { input }
|
||||
); cdecl; external;
|
||||
|
202
bindings/objc/objc-runtime.inc
Normal file
202
bindings/objc/objc-runtime.inc
Normal file
@ -0,0 +1,202 @@
|
||||
{
|
||||
* Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
}
|
||||
{
|
||||
* objc-runtime.h
|
||||
* Copyright 1988-1996, NeXT Software, Inc.
|
||||
}
|
||||
|
||||
//#import <stdarg.h>
|
||||
//#import <AvailabilityMacros.h>
|
||||
//#import <objc/objc.h>
|
||||
//#import <objc/objc-class.h>
|
||||
|
||||
{$ifndef AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER}
|
||||
{ For 10.2 compatibility }
|
||||
{$define AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER}
|
||||
{$endif}
|
||||
|
||||
type
|
||||
Pobjc_symtab = ^objc_symtab;
|
||||
|
||||
Symtab = Pobjc_symtab;
|
||||
|
||||
objc_symtab = record
|
||||
sel_ref_cnt: culong;
|
||||
refs: PSEL;
|
||||
cls_def_cnt: cushort;
|
||||
cat_def_cnt: cushort;
|
||||
defs: array [0..0] of Pointer; { variable size }
|
||||
end;
|
||||
|
||||
Pobjc_module = ^objc_module;
|
||||
|
||||
Module = Pobjc_module;
|
||||
|
||||
objc_module = record
|
||||
version: culong;
|
||||
size: culong;
|
||||
name: PChar;
|
||||
_symtab: Symtab;
|
||||
end;
|
||||
|
||||
Pobjc_super = ^objc_super;
|
||||
|
||||
objc_super = record
|
||||
receiver: id;
|
||||
super_class: _Class;
|
||||
end;
|
||||
|
||||
{
|
||||
* Messaging Primitives (prototypes)
|
||||
}
|
||||
|
||||
function objc_getClass(const name: PChar): id; cdecl; external;
|
||||
function objc_getMetaClass(const name: PChar): id; cdecl; external;
|
||||
function objc_msgSend(self: id; op: SEL; param3: array of const): id; cdecl; external;
|
||||
function objc_msgSendSuper(super: Pobjc_super; op: SEL; param3: array of const): id; cdecl; external;
|
||||
|
||||
|
||||
{* Floating-point-returning Messaging Primitives (prototypes)
|
||||
*
|
||||
* On some platforms, the ABI for functions returning a floating-point
|
||||
* value is incompatible with that for functions returning an integral type.
|
||||
* objc_msgSend_fpret must be used for these.
|
||||
*
|
||||
* ppc: objc_msgSend_fpret not used
|
||||
* ppc64: objc_msgSend_fpret not used
|
||||
* i386: objc_msgSend_fpret REQUIRED
|
||||
*
|
||||
* For `float` or `long double` return types, cast the function
|
||||
* to an appropriate function pointer type first.
|
||||
*}
|
||||
|
||||
{$if defined(CPUI386) or defined(__i386__)}
|
||||
function objc_msgSend_fpret(self: id; op: SEL; param3: array of const): cdouble; cdecl; external;
|
||||
{$endif}
|
||||
|
||||
|
||||
{* Struct-returning Messaging Primitives (prototypes)
|
||||
*
|
||||
* For historical reasons, the prototypes for the struct-returning
|
||||
* messengers are unusual. The portable, correct way to call these functions
|
||||
* is to cast them to your desired return type first.
|
||||
*
|
||||
* For example, `NSRect result = [myNSView frame]` could be written as:
|
||||
* NSRect (*msgSend_stret_fn)(id, SEL, ...) = (NSRect(*)(id, SEL, ...))objc_msgSend_stret;
|
||||
* NSRect result = (*msgSend_stret_fn)(myNSView, @selector(frame));
|
||||
* or, without the function pointer:
|
||||
* NSRect result = (*(NSRect(*)(id, SEL, ...))objc_msgSend_stret)(myNSView, @selector(frame));
|
||||
*
|
||||
* BE WARNED that these prototypes have changed in the past and will change
|
||||
* in the future. Code that uses a cast like the example above will be
|
||||
* unaffected.
|
||||
*}
|
||||
|
||||
{$ifdef __cplusplus}
|
||||
OBJC_EXPORT id objc_msgSend_stret(id self, SEL op, ...); cdecl; external;
|
||||
OBJC_EXPORT id objc_msgSendSuper_stret(struct objc_super *super, SEL op, ...); cdecl; external;
|
||||
{$else}
|
||||
procedure objc_msgSend_stret(stretAddr: Pointer; self: id; op: SEL; others: array of const); cdecl; external;
|
||||
procedure objc_msgSendSuper_stret(stretAddr: Pointer; super: Pobjc_super; op: SEL; others: array of const); cdecl; external;
|
||||
{$endif}
|
||||
|
||||
|
||||
{ Forwarding }
|
||||
|
||||
{ Note that objc_msgSendv_stret() does not return a structure type,
|
||||
* and should not be cast to do so. This is unlike objc_msgSend_stret()
|
||||
* and objc_msgSendSuper_stret().
|
||||
}
|
||||
|
||||
function objc_msgSendv(self: id; op: SEL; arg_size: cunsigned; arg_frame: marg_list): id; cdecl; external;
|
||||
procedure objc_msgSendv_stret(stretAddr: Pointer; self: id; op: SEL; arg_size: cunsigned; arg_frame: marg_list); cdecl; external;
|
||||
{$if defined(CPUI386) or defined(__i386__)}
|
||||
function objc_msgSendv_fpret(self: id; op: SEL; arg_size: cunsigned; arg_frame: marg_list): cdouble; cdecl; external;
|
||||
{$endif}
|
||||
|
||||
|
||||
{
|
||||
getting all the classes in the application...
|
||||
|
||||
int objc_getClassList(buffer, bufferLen)
|
||||
classes is an array of Class values (which are pointers)
|
||||
which will be filled by the function; if this
|
||||
argument is NULL, no copying is done, only the
|
||||
return value is returned
|
||||
bufferLen is the number of Class values the given buffer
|
||||
can hold; if the buffer is not large enough to
|
||||
hold all the classes, the buffer is filled to
|
||||
the indicated capacity with some arbitrary subset
|
||||
of the known classes, which could be different
|
||||
from call to call
|
||||
returns the number of classes, which is the number put
|
||||
in the buffer if the buffer was large enough,
|
||||
or the length the buffer should have been
|
||||
|
||||
int numClasses = 0, newNumClasses = objc_getClassList(NULL, 0);
|
||||
Class *classes = NULL;
|
||||
while (numClasses < newNumClasses) [
|
||||
numClasses = newNumClasses;
|
||||
classes = realloc(classes, sizeof(Class) * numClasses);
|
||||
newNumClasses = objc_getClassList(classes, numClasses);
|
||||
]
|
||||
// now, can use the classes list; if NULL, there are no classes
|
||||
free(classes);
|
||||
|
||||
}
|
||||
function objc_getClassList(buffer: PClass; bufferLen: cint): cint; cdecl; external;
|
||||
|
||||
{#define OBSOLETE_OBJC_GETCLASSES}
|
||||
{$ifdef OBSOLETE_OBJC_GETCLASSES}
|
||||
function objc_getClasses(): Pointer; cdecl; external;
|
||||
{$endif}
|
||||
|
||||
function objc_lookUpClass(const name: PChar): id; cdecl; external;
|
||||
function objc_getRequiredClass(const name: PChar): id; cdecl; external;
|
||||
procedure objc_addClass(myClass: _Class); cdecl; external;
|
||||
|
||||
{ customizing the error handling for objc_getClass/objc_getMetaClass }
|
||||
|
||||
type
|
||||
setClassHandler_callback = function (const param1: PChar): cint; cdecl;
|
||||
|
||||
procedure objc_setClassHandler(param1: setClassHandler_callback); cdecl; external;
|
||||
|
||||
{ Making the Objective-C runtime thread safe. }
|
||||
procedure objc_setMultithreaded (flag: BOOL); cdecl; external;
|
||||
|
||||
{ overriding the default object allocation and error handling routines }
|
||||
|
||||
{OBJC_EXPORT id (_alloc)(Class, unsigned int);
|
||||
OBJC_EXPORT id (_copy)(id, unsigned int);
|
||||
OBJC_EXPORT id (_realloc)(id, unsigned int);
|
||||
OBJC_EXPORT id (_dealloc)(id);
|
||||
OBJC_EXPORT id (_zoneAlloc)(Class, unsigned int, void *);
|
||||
OBJC_EXPORT id (_zoneRealloc)(id, unsigned int, void *);
|
||||
OBJC_EXPORT id (_zoneCopy)(id, unsigned int, void *);
|
||||
|
||||
OBJC_EXPORT void (_error)(id, const char *, va_list);
|
||||
}
|
||||
|
59
bindings/objc/objc-sync.inc
Normal file
59
bindings/objc/objc-sync.inc
Normal file
@ -0,0 +1,59 @@
|
||||
{
|
||||
* Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
}
|
||||
//
|
||||
// objc_sync.h
|
||||
//
|
||||
// Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
//#include <objc/objc.h>
|
||||
|
||||
// Begin synchronizing on 'obj'.
|
||||
// Allocates recursive pthread_mutex associated with 'obj' if needed.
|
||||
// Returns OBJC_SYNC_SUCCESS once lock is acquired.
|
||||
function objc_sync_enter(obj: id): cint; cdecl; external;
|
||||
|
||||
// End synchronizing on 'obj'.
|
||||
// Returns OBJC_SYNC_SUCCESS or OBJC_SYNC_NOT_OWNING_THREAD_ERROR
|
||||
function objc_sync_exit(obj: id): cint; cdecl; external;
|
||||
|
||||
// Temporarily release lock on 'obj' and wait for another thread to notify on 'obj'
|
||||
// Return OBJC_SYNC_SUCCESS, OBJC_SYNC_NOT_OWNING_THREAD_ERROR, OBJC_SYNC_TIMED_OUT
|
||||
function objc_sync_wait(obj: id; milliSecondsMaxWait: clonglong): cint; cdecl; external;
|
||||
|
||||
// Wake up another thread waiting on 'obj'
|
||||
// Return OBJC_SYNC_SUCCESS, OBJC_SYNC_NOT_OWNING_THREAD_ERROR
|
||||
function objc_sync_notify(obj: id): cint; cdecl; external;
|
||||
|
||||
// Wake up all threads waiting on 'obj'
|
||||
// Return OBJC_SYNC_SUCCESS, OBJC_SYNC_NOT_OWNING_THREAD_ERROR
|
||||
function objc_sync_notifyAll(obj: id): cint; cdecl; external;
|
||||
|
||||
const
|
||||
OBJC_SYNC_SUCCESS = 0;
|
||||
OBJC_SYNC_NOT_OWNING_THREAD_ERROR = -1;
|
||||
OBJC_SYNC_TIMED_OUT = -2;
|
||||
OBJC_SYNC_NOT_INITIALIZED = -3;
|
||||
|
106
bindings/objc/objc.inc
Normal file
106
bindings/objc/objc.inc
Normal file
@ -0,0 +1,106 @@
|
||||
{
|
||||
* Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
}
|
||||
{
|
||||
* objc.h
|
||||
* Copyright 1988-1996, NeXT Software, Inc.
|
||||
}
|
||||
|
||||
//#import <objc/objc-api.h> // for OBJC_EXPORT
|
||||
|
||||
type
|
||||
P_Class = ^_Class;
|
||||
|
||||
_Class = Pointer; // Is actually Pobjc_class, declared on objc-class.inc
|
||||
// But, because this type is declared on another file,
|
||||
// which depends on this one, it would not be possible
|
||||
// to declare it as Pobjc_class without changing the
|
||||
// headers a lot.
|
||||
//
|
||||
// Cast variables of this type to Pobjc_class when necessary
|
||||
|
||||
Pobjc_object = ^objc_object;
|
||||
|
||||
objc_object = record
|
||||
isa: _Class;
|
||||
end;
|
||||
|
||||
Pid = ^id;
|
||||
id = Pobjc_object;
|
||||
|
||||
Pobjc_selector = Pointer;
|
||||
|
||||
PSEL = ^SEL;
|
||||
|
||||
SEL = Pobjc_selector;
|
||||
|
||||
IMP = function (param1: id; param2: SEL; param3: array of const): id; cdecl;
|
||||
|
||||
BOOL = ShortInt;
|
||||
|
||||
// BOOL is explicitly signed so @encode(BOOL) == "c" rather than "C"
|
||||
// even if -funsigned-char is used.
|
||||
|
||||
|
||||
const
|
||||
YES = BOOL(1);
|
||||
NO = BOOL(0);
|
||||
|
||||
{#ifndef __OBJC_GC__
|
||||
# define __strong
|
||||
#endif}
|
||||
|
||||
{$ifndef STRICT_OPENSTEP}
|
||||
|
||||
type
|
||||
STR = PChar; // Possibly change to TSTR
|
||||
|
||||
function sel_isMapped(_sel: SEL): BOOL; cdecl; external;
|
||||
function sel_getName(_sel: SEL): PChar; cdecl; external;
|
||||
function sel_getUid(const str: PChar): SEL; cdecl; external;
|
||||
function sel_registerName(const str: PChar): SEL; cdecl; external;
|
||||
function object_getClassName(obj: id): PChar; cdecl; external;
|
||||
function object_getIndexedIvars(obj: id): Pointer; cdecl; external;
|
||||
|
||||
{#define ISSELECTOR(sel) sel_isMapped(sel)
|
||||
#define SELNAME(sel) sel_getName(sel)
|
||||
#define SELUID(str) sel_getUid(str)
|
||||
#define NAMEOF(obj) object_getClassName(obj)
|
||||
#define IV(obj) object_getIndexedIvars(obj)}
|
||||
|
||||
{$if defined(__osf__) and defined(__alpha__)}
|
||||
type
|
||||
arith_t = clong;
|
||||
uarith_t = culong;
|
||||
const ARITH_SHIFT = 32;
|
||||
{$else}
|
||||
type
|
||||
arith_t = cint;
|
||||
uarith_t = cunsigned;
|
||||
const ARITH_SHIFT = 16;
|
||||
{$endif}
|
||||
|
||||
{$endif} { !STRICT_OPENSTEP }
|
||||
|
||||
|
53
bindings/objc/objc.pas
Normal file
53
bindings/objc/objc.pas
Normal file
@ -0,0 +1,53 @@
|
||||
{
|
||||
objc.pas
|
||||
|
||||
Copyright (C) 2007 Felipe Monteiro de Carvalho
|
||||
|
||||
This unit is a pascal binding for the Objective-C Run-time Library
|
||||
headers included with XCode 2.4.1
|
||||
The original copyright note of is kept on each include file
|
||||
}
|
||||
unit objc;
|
||||
|
||||
{$ifdef fpc}
|
||||
{$mode objfpc}
|
||||
{$endif}
|
||||
|
||||
{$Packrecords c}
|
||||
|
||||
interface
|
||||
|
||||
uses ctypes, unix;
|
||||
|
||||
{$LinkLib objc}
|
||||
|
||||
{$include objc-api.inc}
|
||||
{$include objc.inc}
|
||||
{$include objc-class.inc}
|
||||
|
||||
{$include objc-auto.inc}
|
||||
{$include objc-exception.inc}
|
||||
{.$include objc-load.inc} // This module is obsolete
|
||||
{$include objc-runtime.inc}
|
||||
{$include objc-sync.inc}
|
||||
|
||||
{$include error.inc}
|
||||
{.$include hashtable.inc}
|
||||
{.$include hashtable2.inc}
|
||||
{$include malloc.inc}
|
||||
{.$include zone.inc}
|
||||
|
||||
implementation
|
||||
|
||||
{ Macros from error.h }
|
||||
procedure NX_RAISE(code: cint; const data1, data2: Pointer);
|
||||
begin
|
||||
_NXRaiseError(code, data1, data2);
|
||||
end;
|
||||
|
||||
procedure NX_RERAISE();
|
||||
begin
|
||||
// _NXRaiseError(NXLocalHandler.code, NXLocalHandler.data1, NXLocalHandler.data2);
|
||||
end;
|
||||
|
||||
end.
|
62
bindings/objc/zone.inc
Normal file
62
bindings/objc/zone.inc
Normal file
@ -0,0 +1,62 @@
|
||||
{
|
||||
* Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
}
|
||||
|
||||
//#import <malloc/malloc.h>
|
||||
|
||||
type
|
||||
NXZone = malloc_zone_t;
|
||||
PNXZone = ^NXZone;
|
||||
|
||||
const
|
||||
NX_NOZONE = nil;
|
||||
|
||||
{******** Interface to zone based malloc ***********}
|
||||
|
||||
//#include <sys/cdefs.h>
|
||||
|
||||
//__BEGIN_DECLS
|
||||
extern NXZone *NXDefaultMallocZone(void);
|
||||
// Returns the default zone used by the malloc(3) calls
|
||||
|
||||
extern NXZone *NXCreateZone(size_t startSize, size_t granularity, int canFree);
|
||||
// Create a new zone with its own memory pool.
|
||||
// canfree: if 0 the allocator will never free memory and mallocing will be fast
|
||||
|
||||
extern void NXNameZone(NXZone *z, const char *name);
|
||||
// name a zone; The string will be copied
|
||||
|
||||
extern void *NXZoneMalloc(malloc_zone_t *zone, size_t size);
|
||||
|
||||
extern void *NXZoneRealloc(malloc_zone_t *zone, void *ptr, size_t size);
|
||||
|
||||
extern void *NXZoneCalloc(NXZone *zonep, size_t numElems, size_t byteSize);
|
||||
// Allocates and then clears
|
||||
|
||||
extern void NXZoneFree(malloc_zone_t *zone, void *ptr);
|
||||
|
||||
extern void NXDestroyZone(malloc_zone_t *zone);
|
||||
|
||||
extern NXZone *NXZoneFromPtr(void *ptr);
|
||||
// Returns the zone for a pointer, or NX_NOZONE if not in any zone.
|
||||
// The ptr must have been returned from a malloc or realloc call.
|
||||
//__END_DECLS
|
174
bindings/pascocoa/appkit/AppKit.inc
Normal file
174
bindings/pascocoa/appkit/AppKit.inc
Normal file
@ -0,0 +1,174 @@
|
||||
{
|
||||
AppKit.h
|
||||
Application Kit
|
||||
Copyright (c) 1994-2005, Apple Computer, Inc.
|
||||
All rights reserved.
|
||||
|
||||
This file is included by all AppKit application source files for easy building. Using this file is preferred over importing individual files because it will use a precompiled version.
|
||||
}
|
||||
|
||||
{#import <AppKit/AppKitDefines.h>
|
||||
#import <AppKit/AppKitErrors.h>
|
||||
#import <AppKit/NSGraphicsContext.h>
|
||||
#import <AppKit/NSAccessibility.h>
|
||||
#import <AppKit/NSActionCell.h> }
|
||||
{.$include NSAlert.inc}
|
||||
//#import <AppKit/NSAppleScriptExtensions.h>
|
||||
{$include NSApplication.inc}
|
||||
{#import <AppKit/NSBox.h>
|
||||
#import <AppKit/NSButton.h>
|
||||
#import <AppKit/NSButtonCell.h>
|
||||
#import <AppKit/NSCell.h>
|
||||
#import <AppKit/NSClipView.h>
|
||||
#import <AppKit/NSControl.h>
|
||||
#import <AppKit/NSFont.h>
|
||||
#import <AppKit/NSFontDescriptor.h>
|
||||
#import <AppKit/NSFontManager.h>
|
||||
#import <AppKit/NSFontPanel.h>
|
||||
#import <AppKit/NSForm.h>
|
||||
#import <AppKit/NSFormCell.h>
|
||||
#import <AppKit/NSMatrix.h>
|
||||
#import <AppKit/NSMenu.h>
|
||||
#import <AppKit/NSMenuItem.h>
|
||||
#import <AppKit/NSColor.h>
|
||||
#import <AppKit/NSColorSpace.h>
|
||||
#import <AppKit/NSBitmapImageRep.h>
|
||||
#import <AppKit/NSBrowser.h>
|
||||
#import <AppKit/NSBrowserCell.h>
|
||||
#import <AppKit/NSCachedImageRep.h>
|
||||
#import <AppKit/NSCIImageRep.h>
|
||||
#import <AppKit/NSColorList.h>
|
||||
#import <AppKit/NSColorPanel.h>
|
||||
#import <AppKit/NSColorPicking.h>
|
||||
#import <AppKit/NSColorPicker.h>
|
||||
#import <AppKit/NSColorWell.h>
|
||||
#import <AppKit/NSCursor.h>
|
||||
#import <AppKit/NSCustomImageRep.h>
|
||||
#import <AppKit/NSDocument.h>
|
||||
#import <AppKit/NSDocumentController.h>
|
||||
#import <AppKit/NSDragging.h>
|
||||
#import <AppKit/NSEPSImageRep.h>
|
||||
#import <AppKit/NSErrors.h>
|
||||
#import <AppKit/NSEvent.h>
|
||||
#import <AppKit/NSFileWrapper.h>
|
||||
#import <AppKit/NSHelpManager.h>}
|
||||
{$include NSGraphics.inc}
|
||||
{#import <AppKit/NSImage.h>
|
||||
#import <AppKit/NSImageCell.h>
|
||||
#import <AppKit/NSImageRep.h>
|
||||
#import <AppKit/NSImageView.h>
|
||||
#import <AppKit/NSNib.h>
|
||||
#import <AppKit/NSNibLoading.h>
|
||||
#import <AppKit/NSPrinter.h>
|
||||
#import <AppKit/NSSpeechRecognizer.h>
|
||||
#import <AppKit/NSSpeechSynthesizer.h>
|
||||
#import <AppKit/NSSpellChecker.h>
|
||||
#import <AppKit/NSSplitView.h>
|
||||
#import <AppKit/NSOpenPanel.h>
|
||||
#import <AppKit/NSPageLayout.h> }
|
||||
{$include NSPanel.inc}
|
||||
{#import <AppKit/NSPasteboard.h>
|
||||
#import <AppKit/NSPopUpButton.h>
|
||||
#import <AppKit/NSPrintInfo.h>
|
||||
#import <AppKit/NSPrintOperation.h>
|
||||
#import <AppKit/NSPrintPanel.h>
|
||||
#import <AppKit/NSResponder.h>
|
||||
#import <AppKit/NSSavePanel.h>
|
||||
#import <AppKit/NSScreen.h>
|
||||
#import <AppKit/NSScrollView.h>
|
||||
#import <AppKit/NSScroller.h>
|
||||
#import <AppKit/NSSegmentedControl.h>
|
||||
#import <AppKit/NSSegmentedCell.h>
|
||||
#import <AppKit/NSSlider.h>
|
||||
#import <AppKit/NSSliderCell.h>
|
||||
#import <AppKit/NSSpellProtocol.h>
|
||||
#import <AppKit/NSText.h>
|
||||
#import <AppKit/NSTextField.h>
|
||||
#import <AppKit/NSTextFieldCell.h>
|
||||
#import <AppKit/NSText.h>
|
||||
#import <AppKit/NSTokenField.h>
|
||||
#import <AppKit/NSTokenFieldCell.h>
|
||||
#import <AppKit/NSView.h> }
|
||||
{$include NSWindow.inc}
|
||||
{#import <AppKit/NSWindowController.h>
|
||||
#import <AppKit/NSWorkspace.h>
|
||||
#import <AppKit/NSComboBox.h>
|
||||
#import <AppKit/NSComboBoxCell.h>
|
||||
#import <AppKit/NSTableColumn.h>
|
||||
#import <AppKit/NSTableHeaderCell.h>
|
||||
#import <AppKit/NSTableHeaderView.h>
|
||||
#import <AppKit/NSTableView.h>
|
||||
#import <AppKit/NSOutlineView.h>
|
||||
#import <AppKit/NSAttributedString.h>
|
||||
#import <AppKit/NSLayoutManager.h>
|
||||
#import <AppKit/NSParagraphStyle.h>
|
||||
#import <AppKit/NSTextStorage.h>
|
||||
#import <AppKit/NSTextView.h>
|
||||
#import <AppKit/NSTextContainer.h>
|
||||
#import <AppKit/NSTextAttachment.h>
|
||||
#import <AppKit/NSInputManager.h>
|
||||
#import <AppKit/NSInputServer.h>
|
||||
#import <AppKit/NSStringDrawing.h>
|
||||
#import <AppKit/NSRulerMarker.h>
|
||||
#import <AppKit/NSRulerView.h>
|
||||
#import <AppKit/NSSecureTextField.h>
|
||||
#import <AppKit/NSInterfaceStyle.h>
|
||||
#import <AppKit/NSNibDeclarations.h>
|
||||
#import <AppKit/NSProgressIndicator.h>
|
||||
#import <AppKit/NSTabView.h>
|
||||
#import <AppKit/NSTabViewItem.h>
|
||||
#import <AppKit/NSMenuView.h>
|
||||
#import <AppKit/NSMenuItemCell.h>
|
||||
#import <AppKit/NSPopUpButtonCell.h>
|
||||
#import <AppKit/NSGraphicsContext.h>
|
||||
#import <AppKit/NSAffineTransform.h>
|
||||
#import <AppKit/NSBezierPath.h>
|
||||
#import <AppKit/NSPICTImageRep.h>
|
||||
#import <AppKit/NSStatusBar.h>
|
||||
#import <AppKit/NSStatusItem.h>
|
||||
#import <AppKit/NSSound.h>
|
||||
#import <AppKit/NSMovie.h>
|
||||
#import <AppKit/NSMovieView.h>
|
||||
#import <AppKit/NSPDFImageRep.h>
|
||||
#import <AppKit/NSQuickDrawView.h>
|
||||
#import <AppKit/NSDrawer.h>
|
||||
#import <AppKit/NSOpenGL.h>
|
||||
#import <AppKit/NSOpenGLView.h>
|
||||
#import <AppKit/NSApplicationScripting.h>
|
||||
#import <AppKit/NSDocumentScripting.h>
|
||||
#import <AppKit/NSTextStorageScripting.h>
|
||||
#import <AppKit/NSToolbar.h>
|
||||
#import <AppKit/NSToolbarItem.h>
|
||||
#import <AppKit/NSWindowScripting.h>
|
||||
#import <AppKit/NSStepper.h>
|
||||
#import <AppKit/NSStepperCell.h>
|
||||
#import <AppKit/NSGlyphInfo.h>
|
||||
#import <AppKit/NSShadow.h>
|
||||
#import <AppKit/NSATSTypesetter.h>
|
||||
#import <AppKit/NSGlyphGenerator.h>
|
||||
#import <AppKit/NSSearchField.h>
|
||||
#import <AppKit/NSSearchFieldCell.h>
|
||||
#import <AppKit/NSController.h>
|
||||
#import <AppKit/NSObjectController.h>
|
||||
#import <AppKit/NSArrayController.h>
|
||||
#import <AppKit/NSTreeController.h>
|
||||
#import <AppKit/NSUserDefaultsController.h>
|
||||
#import <AppKit/NSKeyValueBinding.h>
|
||||
#import <AppKit/NSTextList.h>
|
||||
#import <AppKit/NSTextTable.h>
|
||||
#import <AppKit/NSDatePickerCell.h>
|
||||
#import <AppKit/NSDatePicker.h>
|
||||
#import <AppKit/NSLevelIndicatorCell.h>
|
||||
#import <AppKit/NSLevelIndicator.h>
|
||||
#import <AppKit/NSAnimation.h>
|
||||
#import <AppKit/NSPersistentDocument.h>
|
||||
}
|
||||
|
||||
type
|
||||
{$include NSApplication_type.inc}
|
||||
{$include NSWindow_type.inc}
|
||||
|
||||
var
|
||||
NSApp: NSApplication;
|
||||
|
||||
|
158
bindings/pascocoa/appkit/AppKit_impl.inc
Normal file
158
bindings/pascocoa/appkit/AppKit_impl.inc
Normal file
@ -0,0 +1,158 @@
|
||||
|
||||
{#import <AppKit/AppKitDefines.h>
|
||||
#import <AppKit/AppKitErrors.h>
|
||||
#import <AppKit/NSGraphicsContext.h>
|
||||
#import <AppKit/NSAccessibility.h>
|
||||
#import <AppKit/NSActionCell.h> }
|
||||
{.$include NSAlert.inc}
|
||||
//#import <AppKit/NSAppleScriptExtensions.h>
|
||||
{$include NSApplication_impl.inc}
|
||||
{#import <AppKit/NSBox.h>
|
||||
#import <AppKit/NSButton.h>
|
||||
#import <AppKit/NSButtonCell.h>
|
||||
#import <AppKit/NSCell.h>
|
||||
#import <AppKit/NSClipView.h>
|
||||
#import <AppKit/NSControl.h>
|
||||
#import <AppKit/NSFont.h>
|
||||
#import <AppKit/NSFontDescriptor.h>
|
||||
#import <AppKit/NSFontManager.h>
|
||||
#import <AppKit/NSFontPanel.h>
|
||||
#import <AppKit/NSForm.h>
|
||||
#import <AppKit/NSFormCell.h>
|
||||
#import <AppKit/NSMatrix.h>
|
||||
#import <AppKit/NSMenu.h>
|
||||
#import <AppKit/NSMenuItem.h>
|
||||
#import <AppKit/NSColor.h>
|
||||
#import <AppKit/NSColorSpace.h>
|
||||
#import <AppKit/NSBitmapImageRep.h>
|
||||
#import <AppKit/NSBrowser.h>
|
||||
#import <AppKit/NSBrowserCell.h>
|
||||
#import <AppKit/NSCachedImageRep.h>
|
||||
#import <AppKit/NSCIImageRep.h>
|
||||
#import <AppKit/NSColorList.h>
|
||||
#import <AppKit/NSColorPanel.h>
|
||||
#import <AppKit/NSColorPicking.h>
|
||||
#import <AppKit/NSColorPicker.h>
|
||||
#import <AppKit/NSColorWell.h>
|
||||
#import <AppKit/NSCursor.h>
|
||||
#import <AppKit/NSCustomImageRep.h>
|
||||
#import <AppKit/NSDocument.h>
|
||||
#import <AppKit/NSDocumentController.h>
|
||||
#import <AppKit/NSDragging.h>
|
||||
#import <AppKit/NSEPSImageRep.h>
|
||||
#import <AppKit/NSErrors.h>
|
||||
#import <AppKit/NSEvent.h>
|
||||
#import <AppKit/NSFileWrapper.h>
|
||||
#import <AppKit/NSHelpManager.h>
|
||||
#import <AppKit/NSGraphics.h>
|
||||
#import <AppKit/NSImage.h>
|
||||
#import <AppKit/NSImageCell.h>
|
||||
#import <AppKit/NSImageRep.h>
|
||||
#import <AppKit/NSImageView.h>
|
||||
#import <AppKit/NSNib.h>
|
||||
#import <AppKit/NSNibLoading.h>
|
||||
#import <AppKit/NSPrinter.h>
|
||||
#import <AppKit/NSSpeechRecognizer.h>
|
||||
#import <AppKit/NSSpeechSynthesizer.h>
|
||||
#import <AppKit/NSSpellChecker.h>
|
||||
#import <AppKit/NSSplitView.h>
|
||||
#import <AppKit/NSOpenPanel.h>
|
||||
#import <AppKit/NSPageLayout.h> }
|
||||
{.$include NSPanel.inc}
|
||||
{#import <AppKit/NSPasteboard.h>
|
||||
#import <AppKit/NSPopUpButton.h>
|
||||
#import <AppKit/NSPrintInfo.h>
|
||||
#import <AppKit/NSPrintOperation.h>
|
||||
#import <AppKit/NSPrintPanel.h>
|
||||
#import <AppKit/NSResponder.h>
|
||||
#import <AppKit/NSSavePanel.h>
|
||||
#import <AppKit/NSScreen.h>
|
||||
#import <AppKit/NSScrollView.h>
|
||||
#import <AppKit/NSScroller.h>
|
||||
#import <AppKit/NSSegmentedControl.h>
|
||||
#import <AppKit/NSSegmentedCell.h>
|
||||
#import <AppKit/NSSlider.h>
|
||||
#import <AppKit/NSSliderCell.h>
|
||||
#import <AppKit/NSSpellProtocol.h>
|
||||
#import <AppKit/NSText.h>
|
||||
#import <AppKit/NSTextField.h>
|
||||
#import <AppKit/NSTextFieldCell.h>
|
||||
#import <AppKit/NSText.h>
|
||||
#import <AppKit/NSTokenField.h>
|
||||
#import <AppKit/NSTokenFieldCell.h>
|
||||
#import <AppKit/NSView.h> }
|
||||
{$include NSWindow_impl.inc}
|
||||
{#import <AppKit/NSWindowController.h>
|
||||
#import <AppKit/NSWorkspace.h>
|
||||
#import <AppKit/NSComboBox.h>
|
||||
#import <AppKit/NSComboBoxCell.h>
|
||||
#import <AppKit/NSTableColumn.h>
|
||||
#import <AppKit/NSTableHeaderCell.h>
|
||||
#import <AppKit/NSTableHeaderView.h>
|
||||
#import <AppKit/NSTableView.h>
|
||||
#import <AppKit/NSOutlineView.h>
|
||||
#import <AppKit/NSAttributedString.h>
|
||||
#import <AppKit/NSLayoutManager.h>
|
||||
#import <AppKit/NSParagraphStyle.h>
|
||||
#import <AppKit/NSTextStorage.h>
|
||||
#import <AppKit/NSTextView.h>
|
||||
#import <AppKit/NSTextContainer.h>
|
||||
#import <AppKit/NSTextAttachment.h>
|
||||
#import <AppKit/NSInputManager.h>
|
||||
#import <AppKit/NSInputServer.h>
|
||||
#import <AppKit/NSStringDrawing.h>
|
||||
#import <AppKit/NSRulerMarker.h>
|
||||
#import <AppKit/NSRulerView.h>
|
||||
#import <AppKit/NSSecureTextField.h>
|
||||
#import <AppKit/NSInterfaceStyle.h>
|
||||
#import <AppKit/NSNibDeclarations.h>
|
||||
#import <AppKit/NSProgressIndicator.h>
|
||||
#import <AppKit/NSTabView.h>
|
||||
#import <AppKit/NSTabViewItem.h>
|
||||
#import <AppKit/NSMenuView.h>
|
||||
#import <AppKit/NSMenuItemCell.h>
|
||||
#import <AppKit/NSPopUpButtonCell.h>
|
||||
#import <AppKit/NSGraphicsContext.h>
|
||||
#import <AppKit/NSAffineTransform.h>
|
||||
#import <AppKit/NSBezierPath.h>
|
||||
#import <AppKit/NSPICTImageRep.h>
|
||||
#import <AppKit/NSStatusBar.h>
|
||||
#import <AppKit/NSStatusItem.h>
|
||||
#import <AppKit/NSSound.h>
|
||||
#import <AppKit/NSMovie.h>
|
||||
#import <AppKit/NSMovieView.h>
|
||||
#import <AppKit/NSPDFImageRep.h>
|
||||
#import <AppKit/NSQuickDrawView.h>
|
||||
#import <AppKit/NSDrawer.h>
|
||||
#import <AppKit/NSOpenGL.h>
|
||||
#import <AppKit/NSOpenGLView.h>
|
||||
#import <AppKit/NSApplicationScripting.h>
|
||||
#import <AppKit/NSDocumentScripting.h>
|
||||
#import <AppKit/NSTextStorageScripting.h>
|
||||
#import <AppKit/NSToolbar.h>
|
||||
#import <AppKit/NSToolbarItem.h>
|
||||
#import <AppKit/NSWindowScripting.h>
|
||||
#import <AppKit/NSStepper.h>
|
||||
#import <AppKit/NSStepperCell.h>
|
||||
#import <AppKit/NSGlyphInfo.h>
|
||||
#import <AppKit/NSShadow.h>
|
||||
#import <AppKit/NSATSTypesetter.h>
|
||||
#import <AppKit/NSGlyphGenerator.h>
|
||||
#import <AppKit/NSSearchField.h>
|
||||
#import <AppKit/NSSearchFieldCell.h>
|
||||
#import <AppKit/NSController.h>
|
||||
#import <AppKit/NSObjectController.h>
|
||||
#import <AppKit/NSArrayController.h>
|
||||
#import <AppKit/NSTreeController.h>
|
||||
#import <AppKit/NSUserDefaultsController.h>
|
||||
#import <AppKit/NSKeyValueBinding.h>
|
||||
#import <AppKit/NSTextList.h>
|
||||
#import <AppKit/NSTextTable.h>
|
||||
#import <AppKit/NSDatePickerCell.h>
|
||||
#import <AppKit/NSDatePicker.h>
|
||||
#import <AppKit/NSLevelIndicatorCell.h>
|
||||
#import <AppKit/NSLevelIndicator.h>
|
||||
#import <AppKit/NSAnimation.h>
|
||||
#import <AppKit/NSPersistentDocument.h>
|
||||
}
|
||||
|
134
bindings/pascocoa/appkit/NSAlert.inc
Normal file
134
bindings/pascocoa/appkit/NSAlert.inc
Normal file
@ -0,0 +1,134 @@
|
||||
{
|
||||
NSAlert.h
|
||||
Application Kit
|
||||
Copyright (c) 1994-2005, Apple Computer, Inc.
|
||||
All rights reserved.
|
||||
}
|
||||
|
||||
//#import <Foundation/NSObject.h>
|
||||
//#import <AppKit/NSGraphics.h>
|
||||
//@class NSTextField, NSPanel, NSArray, NSWindow, NSImage, NSButton, NSError;
|
||||
|
||||
//#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
|
||||
|
||||
// The default alert style is NSAlertWarningStyle. NSAlertCriticalStyle should be reserved for critical alerts and will cause the icon to be badged with a caution icon.
|
||||
//typedef enum NSAlertStyle {
|
||||
// NSWarningAlertStyle = 0,
|
||||
// NSInformationalAlertStyle = 1,
|
||||
// NSCriticalAlertStyle = 2
|
||||
//} NSAlertStyle;
|
||||
|
||||
//@interface NSAlert : NSObject
|
||||
{
|
||||
@private
|
||||
/*All instance variables are private*/
|
||||
NSTextField *_informationField;
|
||||
id _first;
|
||||
id _second;
|
||||
id _third;
|
||||
NSArray *_buttons;
|
||||
NSPanel *_panel;
|
||||
id _messageField;
|
||||
id _imageView;
|
||||
NSSize _minButtonSize;
|
||||
float _buttonSpacing;
|
||||
float _buttonPadding;
|
||||
float _messagePadding;
|
||||
float _buttonSpacingMaxX;
|
||||
float _buttonSpacingY;
|
||||
id _modalDelegate;
|
||||
NSWindow *_docWindow;
|
||||
SEL _didEndSelector;
|
||||
SEL _didDismissSelector;
|
||||
NSImage *_unbadgedImage;
|
||||
NSSize _defaultPanelSize;
|
||||
id _helpButton;
|
||||
id _delegate;
|
||||
NSAlertStyle _alertStyle;
|
||||
id _helpAnchor;
|
||||
BOOL _useNSLayout;
|
||||
BOOL _showsHelp;
|
||||
BOOL reserved[2];
|
||||
id reserved1;
|
||||
id reserved2;
|
||||
}
|
||||
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
|
||||
|
||||
/* Given an NSError, create an NSAlert that can be used to present the error to the user. The error's localized description, recovery suggestion, and recovery options will be used to set the alert's message text, informative text, and button titles, respectively.
|
||||
*/
|
||||
+ (NSAlert *)alertWithError:(NSError *)error;
|
||||
|
||||
#endif
|
||||
|
||||
// the following class method is for use by apps migrating from the C-based API. Note that this returns an NSAlert that is equivalent to the one created in NSRunAlertPanel, so the layout, button return values, and key equivalents are the same as for the C-based API.
|
||||
+ (NSAlert *)alertWithMessageText:(NSString *)message defaultButton:(NSString *)defaultButton alternateButton:(NSString *)alternateButton otherButton:(NSString *)otherButton informativeTextWithFormat:(NSString *)format, ...;
|
||||
|
||||
- (void)setMessageText:(NSString *)messageText;
|
||||
- (void)setInformativeText:(NSString *)informativeText;
|
||||
|
||||
- (NSString *)messageText;
|
||||
- (NSString *)informativeText;
|
||||
|
||||
// customize the icon. By default uses the image named NSApplicationIcon
|
||||
- (void)setIcon:(NSImage *)icon;
|
||||
- (NSImage *)icon;
|
||||
|
||||
// customize the buttons in the alert panel
|
||||
// buttons are added from right to left (for left to right languages)
|
||||
- (NSButton *)addButtonWithTitle:(NSString *)title;
|
||||
// get the buttons, where the rightmost button is at index 0
|
||||
- (NSArray *)buttons;
|
||||
|
||||
// by default, NSAlert return values are position dependent, with this mapping:
|
||||
// first (rightmost) button = NSAlertFirstButtonReturn
|
||||
// second button = NSAlertSecondButtonReturn
|
||||
// third button = NSAlertThirdButtonReturn
|
||||
// buttonPosition 3+x = NSAlertThirdButtonReturn + x
|
||||
|
||||
enum {
|
||||
NSAlertFirstButtonReturn = 1000,
|
||||
NSAlertSecondButtonReturn = 1001,
|
||||
NSAlertThirdButtonReturn = 1002
|
||||
};
|
||||
|
||||
// The following method can be used to customize return values for buttons
|
||||
// setTag:(int)tag; setting a tag on a button will cause that tag to be the button's return value
|
||||
// Note that we reserve the use of the tag for this purpose. We also reserve the use of the target and the action
|
||||
// by default, the first button has a key equivalent of return which implies a pulsing default button, the button named "Cancel", if any, has a key equivalent of escape, and the button named "Don't Save", if any, has a key equivalent of cmd-d. The following methods can be used to customize key equivalents.
|
||||
// setKeyEquivalent:(NSString *)charCode:
|
||||
// setKeyEquivalentModifierMask:(unsigned int)mask;
|
||||
|
||||
|
||||
// -setShowsHelp:YES adds a help button to the alert panel. When the help button is pressed, the delegate is first consulted. If the delegate does not implement alertShowHelp: or returns NO, then -[NSHelpManager openHelpAnchor:inBook:] is called with a nil book and the anchor specified by -setHelpAnchor:, if any. An exception will be raised if the delegate returns NO and there is no help anchor set.
|
||||
- (void)setShowsHelp:(BOOL)showsHelp;
|
||||
- (BOOL)showsHelp;
|
||||
|
||||
- (void)setHelpAnchor:(NSString *)anchor;
|
||||
- (NSString *)helpAnchor;
|
||||
|
||||
- (void)setAlertStyle:(NSAlertStyle)style;
|
||||
- (NSAlertStyle)alertStyle;
|
||||
|
||||
- (void)setDelegate:(id)delegate;
|
||||
- (id)delegate;
|
||||
|
||||
// Run the alert as an application-modal panel and return the result
|
||||
- (int)runModal;
|
||||
|
||||
// Run the alert as a sheet. didEndSelector will be invoked after the return value is known but before the sheet is dismissed. Callers that want to dismiss the sheet themselves before carrying out an action in response to the return value should do so by calling orderOut: on [alert window]. The didEndSelector should have the following signature:
|
||||
//- (void)alertDidEnd:(NSAlert *)alert returnCode:(int)returnCode contextInfo:(void *)contextInfo;
|
||||
|
||||
- (void)beginSheetModalForWindow:(NSWindow *)window modalDelegate:(id)delegate didEndSelector:(SEL)didEndSelector contextInfo:(void *)contextInfo;
|
||||
|
||||
// return the application-modal panel or the document-modal sheet corresponding to this alert
|
||||
- (id)window;
|
||||
|
||||
@end
|
||||
|
||||
@interface NSObject(NSAlertDelegate)
|
||||
// the delegate should implement this if custom help behavior is required.
|
||||
- (BOOL)alertShowHelp:(NSAlert *)alert;
|
||||
@end }
|
||||
|
||||
#endif
|
94
bindings/pascocoa/appkit/NSApplication.inc
Normal file
94
bindings/pascocoa/appkit/NSApplication.inc
Normal file
@ -0,0 +1,94 @@
|
||||
{
|
||||
NSApplication.h
|
||||
Application Kit
|
||||
Copyright (c) 1994-2005, Apple Computer, Inc.
|
||||
All rights reserved.
|
||||
}
|
||||
|
||||
//#import <AppKit/NSResponder.h>
|
||||
//#import <AppKit/AppKitDefines.h>
|
||||
|
||||
//@class NSDate, NSDictionary, NSError, NSException, NSNotification;
|
||||
//@class NSGraphicsContext, NSImage, NSPasteboard, NSWindow;
|
||||
|
||||
{ The version of the AppKit framework }
|
||||
//APPKIT_EXTERN const double NSAppKitVersionNumber;
|
||||
|
||||
const
|
||||
NSAppKitVersionNumber10_0 = 577;
|
||||
NSAppKitVersionNumber10_1 = 620;
|
||||
NSAppKitVersionNumber10_2 = 663;
|
||||
NSAppKitVersionNumber10_2_3 = 663.6;
|
||||
NSAppKitVersionNumber10_3 = 743;
|
||||
NSAppKitVersionNumber10_3_2 = 743.14;
|
||||
NSAppKitVersionNumber10_3_3 = 743.2;
|
||||
NSAppKitVersionNumber10_3_5 = 743.24;
|
||||
|
||||
{ Modes passed to NSRunLoop }
|
||||
//APPKIT_EXTERN NSString *NSModalPanelRunLoopMode;
|
||||
//APPKIT_EXTERN NSString *NSEventTrackingRunLoopMode;
|
||||
|
||||
{ Pre-defined return values for runModalFor: and runModalSession:. The system also reserves all values below these. }
|
||||
const
|
||||
NSRunStoppedResponse = (-1000);
|
||||
NSRunAbortedResponse = (-1001);
|
||||
NSRunContinuesResponse = (-1002);
|
||||
|
||||
{ used with NSRunLoop's performSelector:target:argument:order:modes: }
|
||||
const
|
||||
NSUpdateWindowsRunLoopOrdering = 500000;
|
||||
|
||||
{ Information used by the system during modal sessions }
|
||||
//typedef struct _NSModalSession *NSModalSession;
|
||||
// threading information
|
||||
//typedef struct NSThreadPrivate _NSThreadPrivate;
|
||||
|
||||
const
|
||||
Str_NSApplication = 'NSApplication';
|
||||
|
||||
Str_sharedApplication = 'sharedApplication';
|
||||
Str_run = 'run';
|
||||
Str_runModalForWindow = 'runModalForWindow:';
|
||||
|
||||
Str_orderFrontStandardAboutPanelWithOptions = 'orderFrontStandardAboutPanelWithOptions:';
|
||||
|
||||
{ An Application's startup function }
|
||||
|
||||
//APPKIT_EXTERN int NSApplicationMain(int argc, const char *argv[]);
|
||||
|
||||
//#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2
|
||||
{ The startup function to call for a Cocoa bundle }
|
||||
|
||||
function NSApplicationLoad(): CBOOL; cdecl; external;
|
||||
//#endif
|
||||
|
||||
{ NSShowsServicesMenuItem() always returns YES. }
|
||||
//APPKIT_EXTERN BOOL NSShowsServicesMenuItem(NSString * itemName);
|
||||
|
||||
{ NSSetShowsServicesMenuItem() has no effect, and always returns 0. }
|
||||
//APPKIT_EXTERN int NSSetShowsServicesMenuItem(NSString * itemName, BOOL enabled);
|
||||
|
||||
{ NSUpdateDynamicServices() causes the services information for the system to be updated. This will only be necessary if your program adds dynamic services to the system (i.e. services not found in macho segments of executables).
|
||||
}
|
||||
{APPKIT_EXTERN void NSUpdateDynamicServices(void);
|
||||
APPKIT_EXTERN BOOL NSPerformService(NSString *itemName, NSPasteboard *pboard);
|
||||
|
||||
APPKIT_EXTERN void NSRegisterServicesProvider(id provider, NSString *name); // apps should use -setServicesProvider
|
||||
APPKIT_EXTERN void NSUnregisterServicesProvider(NSString *name); }
|
||||
|
||||
{ Notifications }
|
||||
{APPKIT_EXTERN NSString *NSApplicationDidBecomeActiveNotification;
|
||||
APPKIT_EXTERN NSString *NSApplicationDidHideNotification;
|
||||
APPKIT_EXTERN NSString *NSApplicationDidFinishLaunchingNotification;
|
||||
APPKIT_EXTERN NSString *NSApplicationDidResignActiveNotification;
|
||||
APPKIT_EXTERN NSString *NSApplicationDidUnhideNotification;
|
||||
APPKIT_EXTERN NSString *NSApplicationDidUpdateNotification;
|
||||
APPKIT_EXTERN NSString *NSApplicationWillBecomeActiveNotification;
|
||||
APPKIT_EXTERN NSString *NSApplicationWillHideNotification;
|
||||
APPKIT_EXTERN NSString *NSApplicationWillFinishLaunchingNotification;
|
||||
APPKIT_EXTERN NSString *NSApplicationWillResignActiveNotification;
|
||||
APPKIT_EXTERN NSString *NSApplicationWillUnhideNotification;
|
||||
APPKIT_EXTERN NSString *NSApplicationWillUpdateNotification;
|
||||
APPKIT_EXTERN NSString *NSApplicationWillTerminateNotification;
|
||||
APPKIT_EXTERN NSString *NSApplicationDidChangeScreenParametersNotification; }
|
||||
|
26
bindings/pascocoa/appkit/NSApplication_impl.inc
Normal file
26
bindings/pascocoa/appkit/NSApplication_impl.inc
Normal file
@ -0,0 +1,26 @@
|
||||
|
||||
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}
|
||||
|
262
bindings/pascocoa/appkit/NSApplication_type.inc
Normal file
262
bindings/pascocoa/appkit/NSApplication_type.inc
Normal file
@ -0,0 +1,262 @@
|
||||
{
|
||||
NSApplication.h
|
||||
Application Kit
|
||||
Copyright (c) 1994-2005, Apple Computer, Inc.
|
||||
All rights reserved.
|
||||
}
|
||||
|
||||
//#import <AppKit/NSResponder.h>
|
||||
//#import <AppKit/AppKitDefines.h>
|
||||
|
||||
//@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;
|
||||
|
186
bindings/pascocoa/appkit/NSGraphics.inc
Normal file
186
bindings/pascocoa/appkit/NSGraphics.inc
Normal file
@ -0,0 +1,186 @@
|
||||
{
|
||||
NSGraphics.h
|
||||
Application Kit
|
||||
Copyright (c) 1994-2005, Apple Computer, Inc.
|
||||
All rights reserved.
|
||||
}
|
||||
|
||||
//#import <Foundation/NSGeometry.h>
|
||||
//#import <AppKit/AppKitDefines.h>
|
||||
|
||||
//@class NSColor, NSView;
|
||||
|
||||
{=== CONSTANTS ===}
|
||||
{ operation types for composite operators }
|
||||
{ Constants moved from dpsOpenStep.h }
|
||||
(*typedef enum _NSCompositingOperation {
|
||||
NSCompositeClear = 0,
|
||||
NSCompositeCopy = 1,
|
||||
NSCompositeSourceOver = 2,
|
||||
NSCompositeSourceIn = 3,
|
||||
NSCompositeSourceOut = 4,
|
||||
NSCompositeSourceAtop = 5,
|
||||
NSCompositeDestinationOver = 6,
|
||||
NSCompositeDestinationIn = 7,
|
||||
NSCompositeDestinationOut = 8,
|
||||
NSCompositeDestinationAtop = 9,
|
||||
NSCompositeXOR = 10,
|
||||
NSCompositePlusDarker = 11,
|
||||
NSCompositeHighlight = 12,
|
||||
NSCompositePlusLighter = 13
|
||||
} NSCompositingOperation;*)
|
||||
|
||||
{ types of window backing store }
|
||||
type
|
||||
NSBackingStoreType = (
|
||||
NSBackingStoreRetained = 0,
|
||||
NSBackingStoreNonretained = 1,
|
||||
NSBackingStoreBuffered = 2);
|
||||
|
||||
(*/* ways to order windows */
|
||||
typedef enum _NSWindowOrderingMode {
|
||||
NSWindowAbove = 1,
|
||||
NSWindowBelow = -1,
|
||||
NSWindowOut = 0
|
||||
} NSWindowOrderingMode;
|
||||
|
||||
/* order in which to draw focus ring - above or below graphic or just draw ring */
|
||||
typedef enum {
|
||||
NSFocusRingOnly = 0,
|
||||
NSFocusRingBelow = 1,
|
||||
NSFocusRingAbove = 2
|
||||
} NSFocusRingPlacement;
|
||||
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
|
||||
/* used by NSView and NSCell to configure if and how the control should draw its focus ring */
|
||||
typedef enum _NSFocusRingType {
|
||||
NSFocusRingTypeDefault = 0,
|
||||
NSFocusRingTypeNone = 1,
|
||||
NSFocusRingTypeExterior = 2
|
||||
} NSFocusRingType;
|
||||
#endif
|
||||
|
||||
/* Predefined colorspace names.
|
||||
*/
|
||||
APPKIT_EXTERN NSString *NSCalibratedWhiteColorSpace; /* 1.0 == white */
|
||||
APPKIT_EXTERN NSString *NSCalibratedBlackColorSpace; /* 1.0 == black */
|
||||
APPKIT_EXTERN NSString *NSCalibratedRGBColorSpace;
|
||||
APPKIT_EXTERN NSString *NSDeviceWhiteColorSpace; /* 1.0 == white */
|
||||
APPKIT_EXTERN NSString *NSDeviceBlackColorSpace; /* 1.0 == black */
|
||||
APPKIT_EXTERN NSString *NSDeviceRGBColorSpace;
|
||||
APPKIT_EXTERN NSString *NSDeviceCMYKColorSpace;
|
||||
APPKIT_EXTERN NSString *NSNamedColorSpace; /* Used for "catalog" colors */
|
||||
APPKIT_EXTERN NSString *NSPatternColorSpace;
|
||||
APPKIT_EXTERN NSString *NSCustomColorSpace; /* Used to indicate a custom gstate in images */
|
||||
|
||||
|
||||
/* NSWindowDepth defines the values used in setting window depth limits. "0" indicates default depth. Window depths should not be made persistent as they will not be the same across systems. Use the functions NSBPSFromDepth(), NSColorSpaceFromDepth(), NSBitsPerPixelFromDepth(), and NSPlanarFromDepth() to extract info from an NSWindowDepth. Use NSBestDepth() to compute window depths. NSBestDepth() will try to accomodate all the parameters (match or better); if there are multiple matches, it gives the closest, with matching colorSpace first, then bps, then planar, then bpp. bpp is "bits per pixel"; 0 indicates default (same as the number of bits per plane, either bps or bps * NSNumberOfColorComponents()); other values maybe used as hints to provide backing stores of different configuration; for instance, 8 bit color. exactMatch is optional and indicates whether all the parameters matched exactly.
|
||||
*/
|
||||
typedef int NSWindowDepth;
|
||||
APPKIT_EXTERN NSWindowDepth NSBestDepth (NSString *colorSpace, int bps, int bpp, BOOL planar, BOOL *exactMatch);
|
||||
APPKIT_EXTERN BOOL NSPlanarFromDepth (NSWindowDepth depth);
|
||||
APPKIT_EXTERN NSString *NSColorSpaceFromDepth (NSWindowDepth depth);
|
||||
APPKIT_EXTERN int NSBitsPerSampleFromDepth (NSWindowDepth depth);
|
||||
APPKIT_EXTERN int NSBitsPerPixelFromDepth (NSWindowDepth depth);
|
||||
APPKIT_EXTERN int NSNumberOfColorComponents (NSString *colorSpaceName);
|
||||
APPKIT_EXTERN const NSWindowDepth *NSAvailableWindowDepths (void); /* 0 terminated */
|
||||
|
||||
|
||||
/* Standard gray values for the 2-bit deep grayscale colorspace.
|
||||
*/
|
||||
APPKIT_EXTERN const float NSWhite;
|
||||
APPKIT_EXTERN const float NSLightGray;
|
||||
APPKIT_EXTERN const float NSDarkGray;
|
||||
APPKIT_EXTERN const float NSBlack;
|
||||
|
||||
|
||||
/* Keys for deviceDescription dictionaries.
|
||||
*/
|
||||
APPKIT_EXTERN NSString *NSDeviceResolution; /* NSValue containing NSSize, basically dpi */
|
||||
APPKIT_EXTERN NSString *NSDeviceColorSpaceName; /* NSString */
|
||||
APPKIT_EXTERN NSString *NSDeviceBitsPerSample; /* NSValue containing int */
|
||||
APPKIT_EXTERN NSString *NSDeviceIsScreen; /* "YES" or not there */
|
||||
APPKIT_EXTERN NSString *NSDeviceIsPrinter; /* "YES" or not there */
|
||||
APPKIT_EXTERN NSString *NSDeviceSize; /* NSValue containing NSSize */
|
||||
|
||||
|
||||
/* Graphics functions
|
||||
*/
|
||||
APPKIT_EXTERN void NSRectFill(NSRect aRect);
|
||||
APPKIT_EXTERN void NSRectFillList(const NSRect *rects, int count);
|
||||
APPKIT_EXTERN void NSRectFillListWithGrays(const NSRect *rects, const float *grays, int num);
|
||||
APPKIT_EXTERN void NSRectFillListWithColors(const NSRect *rects, NSColor **colors, int num);
|
||||
APPKIT_EXTERN void NSRectFillUsingOperation(NSRect aRect, NSCompositingOperation op);
|
||||
APPKIT_EXTERN void NSRectFillListUsingOperation(const NSRect *rects, int count, NSCompositingOperation op);
|
||||
APPKIT_EXTERN void NSRectFillListWithColorsUsingOperation(const NSRect *rects, NSColor **colors, int num, NSCompositingOperation op);
|
||||
APPKIT_EXTERN void NSFrameRect(NSRect aRect);
|
||||
APPKIT_EXTERN void NSFrameRectWithWidth(NSRect aRect, float frameWidth);
|
||||
APPKIT_EXTERN void NSFrameRectWithWidthUsingOperation(NSRect aRect, float frameWidth, NSCompositingOperation op);
|
||||
APPKIT_EXTERN void NSRectClip(NSRect aRect);
|
||||
APPKIT_EXTERN void NSRectClipList(const NSRect *rects, int count);
|
||||
APPKIT_EXTERN NSRect NSDrawTiledRects(NSRect boundsRect, NSRect clipRect, const NSRectEdge *sides, const float *grays, int count);
|
||||
APPKIT_EXTERN void NSDrawGrayBezel(NSRect aRect, NSRect clipRect);
|
||||
APPKIT_EXTERN void NSDrawGroove(NSRect aRect, NSRect clipRect);
|
||||
APPKIT_EXTERN void NSDrawWhiteBezel(NSRect aRect, NSRect clipRect);
|
||||
APPKIT_EXTERN void NSDrawButton(NSRect aRect, NSRect clipRect);
|
||||
APPKIT_EXTERN void NSEraseRect(NSRect aRect);
|
||||
APPKIT_EXTERN NSColor *NSReadPixel(NSPoint passedPoint);
|
||||
APPKIT_EXTERN void NSDrawBitmap(NSRect rect, int width, int height, int bps, int spp, int bpp, int bpr, BOOL isPlanar, BOOL hasAlpha, NSString *colorSpaceName, const unsigned char *const data[5]);
|
||||
APPKIT_EXTERN void NSCopyBits(int srcGState, NSRect srcRect, NSPoint destPoint);
|
||||
APPKIT_EXTERN void NSHighlightRect(NSRect aRect);
|
||||
APPKIT_EXTERN void NSBeep(void);
|
||||
APPKIT_EXTERN void NSCountWindows(int *count);
|
||||
APPKIT_EXTERN void NSWindowList(int size, int list[]);
|
||||
APPKIT_EXTERN void NSCountWindowsForContext(int context, int *count);
|
||||
APPKIT_EXTERN void NSWindowListForContext(int context, int size, int list[]);
|
||||
|
||||
/* gets performance stats about window server memory usage */
|
||||
APPKIT_EXTERN int NSGetWindowServerMemory(int context, int *virtualMemory, int *windowBackingMemory, NSString **windowDumpString);
|
||||
|
||||
APPKIT_EXTERN NSRect NSDrawColorTiledRects(NSRect boundsRect, NSRect clipRect, const NSRectEdge *sides, NSColor **colors, int count);
|
||||
APPKIT_EXTERN void NSDrawDarkBezel(NSRect aRect, NSRect clipRect);
|
||||
APPKIT_EXTERN void NSDrawLightBezel(NSRect aRect, NSRect clipRect);
|
||||
APPKIT_EXTERN void NSDottedFrameRect(NSRect aRect);
|
||||
|
||||
APPKIT_EXTERN void NSDrawWindowBackground(NSRect aRect);
|
||||
APPKIT_EXTERN void NSSetFocusRingStyle(NSFocusRingPlacement placement);
|
||||
|
||||
/* Disable and reenable screen updates.
|
||||
** NSDisableScreenUpdates prevents drawing for all windows belonging to the calling
|
||||
** process from being flushed to the screen. This function permits operations on
|
||||
** multiple windows to appear atomic to the user, and is particularly useful for parent
|
||||
** and child windows. Note that this function should be used with care for short
|
||||
** operations only as the system will only allow updates to be disabled for a short
|
||||
** time (currently one second) before automatically reenabling updates.
|
||||
** NSEnableScreenUpdates reenables drawing that was previously disabled by
|
||||
** NSDisableScreenUpdates. Multiple calls stack.
|
||||
*/
|
||||
APPKIT_EXTERN void NSDisableScreenUpdates(void) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
|
||||
APPKIT_EXTERN void NSEnableScreenUpdates(void) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
|
||||
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
|
||||
|
||||
/* Runs one of the standard system animation effects (display and sound).
|
||||
** 'centerLocation' represents the center, in screen coordinates, to show the effect.
|
||||
** 'size' specifies how big the effect should be. Use NSZeroSize to get the default size.
|
||||
** 'animationDelegate' is optionally, an object that wants to know when the effect has completed.
|
||||
** 'didEndSelector' will be invoked in the animationDelegate when the animation has completed.
|
||||
**
|
||||
** The didEndSelector should have the following signature:
|
||||
** - (void)animationEffectDidEnd:(void * )contextInfo;
|
||||
*/
|
||||
|
||||
typedef enum _NSAnimationEffect {
|
||||
// The default effect used to indicate removal of an item from a collection,
|
||||
// such as toolbar (indicates removal, without destroying the underlying data).
|
||||
NSAnimationEffectDisappearingItemDefault = 0,
|
||||
|
||||
// An effect showing a puff of smoke.
|
||||
NSAnimationEffectPoof = 10
|
||||
} NSAnimationEffect;
|
||||
|
||||
APPKIT_EXTERN void NSShowAnimationEffect(NSAnimationEffect animationEffect, NSPoint centerLocation, NSSize size, id animationDelegate, SEL didEndSelector, void *contextInfo) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
|
||||
|
||||
#endif *)
|
||||
|
||||
|
90
bindings/pascocoa/appkit/NSPanel.inc
Normal file
90
bindings/pascocoa/appkit/NSPanel.inc
Normal file
@ -0,0 +1,90 @@
|
||||
{
|
||||
NSPanel.h
|
||||
Application Kit
|
||||
Copyright (c) 1994-2005, Apple Computer, Inc.
|
||||
All rights reserved.
|
||||
}
|
||||
|
||||
//#import <AppKit/NSWindow.h>
|
||||
|
||||
{
|
||||
* In the following two functions, msg may be a printf-like message with
|
||||
* the arguments tacked onto the end. Thus, to get a '%' in your message,
|
||||
* you must use '%%'
|
||||
}
|
||||
function NSRunAlertPanel(title, msg, defaultButton, alternateButton, otherButton: CFStringRef; others: array of const): cint; cdecl; external;
|
||||
(*APPKIT_EXTERN int NSRunInformationalAlertPanel(NSString *title, NSString *msg, NSString *defaultButton, NSString *alternateButton, NSString *otherButton, ...);
|
||||
APPKIT_EXTERN int NSRunCriticalAlertPanel(NSString *title, NSString *msg, NSString *defaultButton, NSString *alternateButton, NSString *otherButton, ...);
|
||||
|
||||
/*
|
||||
** The NSRunAlertPanelRelativeToWindow variants are deprecated.
|
||||
** Please use the corresponding NSBeginAlertSheet() function instead.
|
||||
*/
|
||||
APPKIT_EXTERN int NSRunAlertPanelRelativeToWindow(NSString *title, NSString *msg, NSString *defaultButton, NSString *alternateButton, NSString *otherButton, NSWindow *docWindow, ...);
|
||||
APPKIT_EXTERN int NSRunInformationalAlertPanelRelativeToWindow(NSString *title, NSString *msg, NSString *defaultButton, NSString *alternateButton, NSString *otherButton, NSWindow *docWindow, ...);
|
||||
APPKIT_EXTERN int NSRunCriticalAlertPanelRelativeToWindow(NSString *title, NSString *msg, NSString *defaultButton, NSString *alternateButton, NSString *otherButton, NSWindow *docWindow, ...);
|
||||
|
||||
/*
|
||||
** Present a sheet alert on the given window. When the modal session is ended, but before the sheet is dismissed,
|
||||
** the didEndSelector will be invoked in the modalDelegate. After the sheet
|
||||
** is dismissed, the didDismissSelector will be invoked. Typically, you will want to implement the didEndSelector but you may
|
||||
** pass NULL for the didDismissSelector.
|
||||
** The methods should have the following signatures:
|
||||
** - (void)sheetDidEnd:(NSWindow * )sheet returnCode:(int)returnCode contextInfo:(void * )contextInfo;
|
||||
** - (void)sheetDidDismiss:(NSWindow * )sheet returnCode:(int)returnCode contextInfo:(void * )contextInfo;
|
||||
**
|
||||
*/
|
||||
APPKIT_EXTERN void NSBeginAlertSheet(NSString *title, NSString *defaultButton, NSString *alternateButton, NSString *otherButton, NSWindow *docWindow, id modalDelegate, SEL didEndSelector, SEL didDismissSelector, void *contextInfo, NSString *msg, ...);
|
||||
APPKIT_EXTERN void NSBeginInformationalAlertSheet(NSString *title, NSString *defaultButton, NSString *alternateButton, NSString *otherButton, NSWindow *docWindow, id modalDelegate, SEL didEndSelector, SEL didDismissSelector, void *contextInfo, NSString *msg, ...);
|
||||
APPKIT_EXTERN void NSBeginCriticalAlertSheet(NSString *title, NSString *defaultButton, NSString *alternateButton, NSString *otherButton, NSWindow *docWindow, id modalDelegate, SEL didEndSelector, SEL didDismissSelector, void *contextInfo, NSString *msg, ...);
|
||||
|
||||
APPKIT_EXTERN id NSGetAlertPanel(NSString *title, NSString *msg, NSString *defaultButton, NSString *alternateButton, NSString *otherButton, ...);
|
||||
APPKIT_EXTERN id NSGetInformationalAlertPanel(NSString *title, NSString *msg, NSString *defaultButton, NSString *alternateButton, NSString *otherButton, ...);
|
||||
APPKIT_EXTERN id NSGetCriticalAlertPanel(NSString *title, NSString *msg, NSString *defaultButton, NSString *alternateButton, NSString *otherButton, ...);
|
||||
|
||||
APPKIT_EXTERN void NSReleaseAlertPanel(id panel);
|
||||
|
||||
/*
|
||||
* NSRunAlertPanel() return values (also returned by runModalSession: when
|
||||
* the modal session is run with a panel returned by NSGetAlertPanel()).
|
||||
*/
|
||||
|
||||
enum {
|
||||
NSAlertDefaultReturn = 1,
|
||||
NSAlertAlternateReturn = 0,
|
||||
NSAlertOtherReturn = -1,
|
||||
NSAlertErrorReturn = -2
|
||||
};
|
||||
|
||||
enum {
|
||||
NSOKButton = 1,
|
||||
NSCancelButton = 0
|
||||
};
|
||||
|
||||
// Panel specific styleMask
|
||||
enum {
|
||||
NSUtilityWindowMask = 1 << 4,
|
||||
NSDocModalWindowMask = 1 << 6
|
||||
};
|
||||
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2
|
||||
enum {
|
||||
NSNonactivatingPanelMask = 1 << 7 // specify a panel that does not activate owning application
|
||||
};
|
||||
#endif
|
||||
|
||||
@interface NSPanel : NSWindow
|
||||
{
|
||||
/*All instance variables are private*/
|
||||
}
|
||||
|
||||
- (BOOL)isFloatingPanel;
|
||||
- (void)setFloatingPanel:(BOOL)flag;
|
||||
- (BOOL)becomesKeyOnlyIfNeeded;
|
||||
- (void)setBecomesKeyOnlyIfNeeded:(BOOL)flag;
|
||||
- (BOOL)worksWhenModal;
|
||||
- (void)setWorksWhenModal:(BOOL)flag;
|
||||
|
||||
@end
|
||||
*)
|
||||
|
85
bindings/pascocoa/appkit/NSWindow.inc
Normal file
85
bindings/pascocoa/appkit/NSWindow.inc
Normal file
@ -0,0 +1,85 @@
|
||||
{
|
||||
NSWindow.h
|
||||
Application Kit
|
||||
Copyright (c) 1994-2005, Apple Computer, Inc.
|
||||
All rights reserved.
|
||||
}
|
||||
|
||||
{#import <Foundation/NSGeometry.h>
|
||||
#import <AppKit/NSResponder.h>
|
||||
#import <AppKit/NSGraphics.h>
|
||||
#import <AppKit/AppKitDefines.h>
|
||||
#import <Foundation/NSDate.h>
|
||||
#import <ApplicationServices/ApplicationServices.h>
|
||||
|
||||
@class NSButton, NSButtonCell, NSColor, NSImage, NSPasteboard, NSScreen;
|
||||
@class NSNotification, NSText, NSView, NSMutableSet, NSSet, NSDate;
|
||||
@class NSToolbar, NSGraphicsContext;}
|
||||
|
||||
const
|
||||
NSAppKitVersionNumberWithCustomSheetPosition = 686.0;
|
||||
|
||||
NSBorderlessWindowMask = 0;
|
||||
NSTitledWindowMask = 1 shl 0;
|
||||
NSClosableWindowMask = 1 shl 1;
|
||||
NSMiniaturizableWindowMask = 1 shl 2;
|
||||
NSResizableWindowMask = 1 shl 3;
|
||||
|
||||
//#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2
|
||||
{ Specifies a window with textured background (eg. metal)
|
||||
}
|
||||
NSTexturedBackgroundWindowMask = 1 shl 8;
|
||||
//#endif
|
||||
|
||||
//#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
|
||||
{ Specifies a window that ignores the userSpaceScaleFactor of the NSScreen on which it is created. Currently restricted to borderless windows (NSBorderlessWindowMask)
|
||||
}
|
||||
NSUnscaledWindowMask = 1 shl 11;
|
||||
|
||||
{ Specifies a window whose titlebar and toolbar have a unified look - that is, a continuous background
|
||||
}
|
||||
NSUnifiedTitleAndToolbarWindowMask = 1 shl 12;
|
||||
|
||||
//#endif
|
||||
|
||||
{ used with NSRunLoop's performSelector:target:argument:order:modes: }
|
||||
NSDisplayWindowRunLoopOrdering = 600000;
|
||||
NSResetCursorRectsRunLoopOrdering = 700000;
|
||||
|
||||
{#define NSNormalWindowLevel kCGNormalWindowLevel
|
||||
#define NSFloatingWindowLevel kCGFloatingWindowLevel
|
||||
#define NSSubmenuWindowLevel kCGTornOffMenuWindowLevel
|
||||
#define NSTornOffMenuWindowLevel kCGTornOffMenuWindowLevel
|
||||
#define NSMainMenuWindowLevel kCGMainMenuWindowLevel
|
||||
#define NSStatusWindowLevel kCGStatusWindowLevel
|
||||
// NSDockWindowLevel is deprecated
|
||||
#define NSDockWindowLevel kCGDockWindowLevel
|
||||
#define NSModalPanelWindowLevel kCGModalPanelWindowLevel
|
||||
#define NSPopUpMenuWindowLevel kCGPopUpMenuWindowLevel
|
||||
#define NSScreenSaverWindowLevel kCGScreenSaverWindowLevel }
|
||||
|
||||
const
|
||||
Str_NSWindow = 'NSWindow';
|
||||
Str_initWithContentRect = 'initWithContentRect:styleMask:backing:defer:';
|
||||
Str_orderFrontRegardless = 'orderFrontRegardless';
|
||||
|
||||
{ Notifications }
|
||||
{APPKIT_EXTERN NSString *NSWindowDidBecomeKeyNotification;
|
||||
APPKIT_EXTERN NSString *NSWindowDidBecomeMainNotification;
|
||||
APPKIT_EXTERN NSString *NSWindowDidChangeScreenNotification;
|
||||
APPKIT_EXTERN NSString *NSWindowDidDeminiaturizeNotification;
|
||||
APPKIT_EXTERN NSString *NSWindowDidExposeNotification; // userInfo key: @"NSExposedRect"
|
||||
APPKIT_EXTERN NSString *NSWindowDidMiniaturizeNotification;
|
||||
APPKIT_EXTERN NSString *NSWindowDidMoveNotification;
|
||||
APPKIT_EXTERN NSString *NSWindowDidResignKeyNotification;
|
||||
APPKIT_EXTERN NSString *NSWindowDidResignMainNotification;
|
||||
APPKIT_EXTERN NSString *NSWindowDidResizeNotification;
|
||||
APPKIT_EXTERN NSString *NSWindowDidUpdateNotification;
|
||||
APPKIT_EXTERN NSString *NSWindowWillCloseNotification;
|
||||
APPKIT_EXTERN NSString *NSWindowWillMiniaturizeNotification;
|
||||
APPKIT_EXTERN NSString *NSWindowWillMoveNotification;
|
||||
APPKIT_EXTERN NSString *NSWindowWillBeginSheetNotification;
|
||||
APPKIT_EXTERN NSString *NSWindowDidEndSheetNotification;
|
||||
APPKIT_EXTERN NSString *NSWindowDidChangeScreenProfileNotification AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
|
||||
}
|
||||
|
32
bindings/pascocoa/appkit/NSWindow_impl.inc
Normal file
32
bindings/pascocoa/appkit/NSWindow_impl.inc
Normal file
@ -0,0 +1,32 @@
|
||||
{%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;
|
||||
|
393
bindings/pascocoa/appkit/NSWindow_type.inc
Normal file
393
bindings/pascocoa/appkit/NSWindow_type.inc
Normal file
@ -0,0 +1,393 @@
|
||||
{%MainUnit appkit.pas}
|
||||
{
|
||||
NSWindow.h
|
||||
Application Kit
|
||||
Copyright (c) 1994-2005, Apple Computer, Inc.
|
||||
All rights reserved.
|
||||
}
|
||||
|
||||
{#import <Foundation/NSGeometry.h>
|
||||
#import <AppKit/NSResponder.h>
|
||||
#import <AppKit/NSGraphics.h>
|
||||
#import <AppKit/AppKitDefines.h>
|
||||
#import <Foundation/NSDate.h>
|
||||
#import <ApplicationServices/ApplicationServices.h>
|
||||
|
||||
@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;
|
||||
|
27
bindings/pascocoa/appkit/appkit.pas
Normal file
27
bindings/pascocoa/appkit/appkit.pas
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
AppKit.h
|
||||
Application Kit
|
||||
Copyright (c) 1994-2005, Apple Computer, Inc.
|
||||
All rights reserved.
|
||||
|
||||
This file is included by all AppKit application source files for easy building. Using this file is preferred over importing individual files because it will use a precompiled version.
|
||||
}
|
||||
unit appkit;
|
||||
|
||||
{$ifdef fpc}
|
||||
{$mode delphi}
|
||||
{$packrecords c}
|
||||
{$endif}
|
||||
|
||||
interface
|
||||
|
||||
uses ctypes, FPCMacOSAll, objc, foundation;
|
||||
|
||||
{$include AppKit.inc}
|
||||
|
||||
implementation
|
||||
|
||||
{$include AppKit_impl.inc}
|
||||
|
||||
end.
|
||||
|
53
bindings/pascocoa/examples/simplewindow/createbundle.sh
Executable file
53
bindings/pascocoa/examples/simplewindow/createbundle.sh
Executable file
@ -0,0 +1,53 @@
|
||||
#!/bin/sh
|
||||
# Force Bourne shell in case tcsh is default.
|
||||
#
|
||||
appname=SimpleWindow
|
||||
appfolder=$appname.app
|
||||
macosfolder=$appfolder/Contents/MacOS
|
||||
plistfile=$appfolder/Contents/Info.plist
|
||||
appfile=simplewindow
|
||||
#
|
||||
if ! [ -e $appfile ]
|
||||
then
|
||||
echo "$appfile does not exist"
|
||||
elif [ -e $appfolder ]
|
||||
then
|
||||
echo "$appfolder already exists"
|
||||
else
|
||||
echo "Creating $appfolder..."
|
||||
mkdir $appfolder
|
||||
mkdir $appfolder/Contents
|
||||
mkdir $appfolder/Contents/MacOS
|
||||
mkdir $appfolder/Contents/Resources
|
||||
#
|
||||
# Instead of copying executable into .app folder after each compile,
|
||||
# simply create a symbolic link to executable.
|
||||
ln -s ../../../$appname $macosfolder/$appname
|
||||
#
|
||||
# Create PkgInfo file.
|
||||
echo "APPLMAG#" >$appfolder/Contents/PkgInfo
|
||||
#
|
||||
# Create information property list file (Info.plist).
|
||||
echo '<?xml version="1.0" encoding="UTF-8"?>' >$plistfile
|
||||
echo '<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">' >>$plistfile
|
||||
echo '<plist version="1.0">' >>$plistfile
|
||||
echo '<dict>' >>$plistfile
|
||||
echo ' <key>CFBundleDevelopmentRegion</key>' >>$plistfile
|
||||
echo ' <string>English</string>' >>$plistfile
|
||||
echo ' <key>CFBundleExecutable</key>' >>$plistfile
|
||||
echo ' <string>'$appname'</string>' >>$plistfile
|
||||
echo ' <key>CFBundleIconFile</key>' >>$plistfile
|
||||
echo ' <string></string>' >>$plistfile
|
||||
echo ' <key>CFBundleIdentifier</key>' >>$plistfile
|
||||
echo ' <string>org.magnifier.magnifier</string>' >>$plistfile
|
||||
echo ' <key>CFBundleInfoDictionaryVersion</key>' >>$plistfile
|
||||
echo ' <string>6.0</string>' >>$plistfile
|
||||
echo ' <key>CFBundlePackageType</key>' >>$plistfile
|
||||
echo ' <string>APPL</string>' >>$plistfile
|
||||
echo ' <key>CFBundleSignature</key>' >>$plistfile
|
||||
echo ' <string>MAG#</string>' >>$plistfile
|
||||
echo ' <key>CFBundleVersion</key>' >>$plistfile
|
||||
echo ' <string>1.0</string>' >>$plistfile
|
||||
echo '</dict>' >>$plistfile
|
||||
echo '</plist>' >>$plistfile
|
||||
fi
|
378
bindings/pascocoa/examples/simplewindow/simplewindow.lpi
Normal file
378
bindings/pascocoa/examples/simplewindow/simplewindow.lpi
Normal file
@ -0,0 +1,378 @@
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<PathDelim Value="/"/>
|
||||
<Version Value="6"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<AlwaysBuild Value="False"/>
|
||||
</Flags>
|
||||
<MainUnit Value="0"/>
|
||||
<IconPath Value="./"/>
|
||||
<TargetFileExt Value=""/>
|
||||
<Title Value="simplewindow"/>
|
||||
<ActiveEditorIndexAtStart Value="0"/>
|
||||
</General>
|
||||
<VersionInfo>
|
||||
<ProjectVersion Value=""/>
|
||||
</VersionInfo>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<IgnoreBinaries Value="False"/>
|
||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<Units Count="37">
|
||||
<Unit0>
|
||||
<Filename Value="simplewindow.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="simplewindow"/>
|
||||
<CursorPos X="3" Y="53"/>
|
||||
<TopLine Value="41"/>
|
||||
<EditorIndex Value="0"/>
|
||||
<UsageCount Value="47"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="../../appkit/appkit.pas"/>
|
||||
<UnitName Value="appkit"/>
|
||||
<CursorPos X="9" Y="10"/>
|
||||
<TopLine Value="5"/>
|
||||
<UsageCount Value="13"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="../../appkit/NSPanel.inc"/>
|
||||
<CursorPos X="44" Y="7"/>
|
||||
<TopLine Value="4"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="../../appkit/NSApplication_impl.inc"/>
|
||||
<CursorPos X="1" Y="4"/>
|
||||
<TopLine Value="4"/>
|
||||
<EditorIndex Value="4"/>
|
||||
<UsageCount Value="19"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit3>
|
||||
<Unit4>
|
||||
<Filename Value="../../appkit/AppKit.inc"/>
|
||||
<CursorPos X="11" Y="157"/>
|
||||
<TopLine Value="152"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit4>
|
||||
<Unit5>
|
||||
<Filename Value="../../../fpc/packages/extra/univint/FPCMacOSAll.pas"/>
|
||||
<UnitName Value="FPCMacOSAll"/>
|
||||
<CursorPos X="15" Y="397"/>
|
||||
<TopLine Value="391"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit5>
|
||||
<Unit6>
|
||||
<Filename Value="../../appkit/AppKit_impl.inc"/>
|
||||
<CursorPos X="33" Y="3"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="19"/>
|
||||
</Unit6>
|
||||
<Unit7>
|
||||
<Filename Value="/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h"/>
|
||||
<CursorPos X="10" Y="125"/>
|
||||
<TopLine Value="123"/>
|
||||
<UsageCount Value="9"/>
|
||||
<SyntaxHighlighter Value="C++"/>
|
||||
</Unit7>
|
||||
<Unit8>
|
||||
<Filename Value="/System/Library/Frameworks/Foundation.framework/Headers/NSAutoreleasePool.h"/>
|
||||
<CursorPos X="30" Y="5"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="9"/>
|
||||
<SyntaxHighlighter Value="C++"/>
|
||||
</Unit8>
|
||||
<Unit9>
|
||||
<Filename Value="../../Foundation/Foundation.inc"/>
|
||||
<CursorPos X="15" Y="6"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="20"/>
|
||||
</Unit9>
|
||||
<Unit10>
|
||||
<Filename Value="../../foundation/Foundation.inc"/>
|
||||
<CursorPos X="22" Y="31"/>
|
||||
<TopLine Value="27"/>
|
||||
<UsageCount Value="11"/>
|
||||
</Unit10>
|
||||
<Unit11>
|
||||
<Filename Value="../../foundation/Foundation_impl.inc"/>
|
||||
<CursorPos X="30" Y="4"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="20"/>
|
||||
</Unit11>
|
||||
<Unit12>
|
||||
<Filename Value="../../foundation/NSAutoreleasePool.inc"/>
|
||||
<CursorPos X="49" Y="12"/>
|
||||
<TopLine Value="2"/>
|
||||
<UsageCount Value="26"/>
|
||||
</Unit12>
|
||||
<Unit13>
|
||||
<Filename Value="../../foundation/NSAutoreleasePool_impl.inc"/>
|
||||
<CursorPos X="23" Y="3"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="20"/>
|
||||
</Unit13>
|
||||
<Unit14>
|
||||
<Filename Value="../../foundation/foundation.pas"/>
|
||||
<UnitName Value="foundation"/>
|
||||
<CursorPos X="12" Y="6"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="25"/>
|
||||
</Unit14>
|
||||
<Unit15>
|
||||
<Filename Value="/System/Library/Frameworks/Foundation.framework/Versions/C/Headers/NSObject.h"/>
|
||||
<CursorPos X="21" Y="116"/>
|
||||
<TopLine Value="111"/>
|
||||
<UsageCount Value="9"/>
|
||||
<SyntaxHighlighter Value="C++"/>
|
||||
</Unit15>
|
||||
<Unit16>
|
||||
<Filename Value="../../foundation/NSObject.inc"/>
|
||||
<CursorPos X="37" Y="59"/>
|
||||
<TopLine Value="56"/>
|
||||
<UsageCount Value="21"/>
|
||||
</Unit16>
|
||||
<Unit17>
|
||||
<Filename Value="../../foundation/NSObject_impl.inc"/>
|
||||
<CursorPos X="6" 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"/>
|
||||
<UsageCount Value="18"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit18>
|
||||
<Unit19>
|
||||
<Filename Value="/System/Library/Frameworks/AppKit.framework/Versions/C/Headers/NSWindow.h"/>
|
||||
<CursorPos X="21" Y="537"/>
|
||||
<TopLine Value="535"/>
|
||||
<UsageCount Value="9"/>
|
||||
<SyntaxHighlighter Value="C++"/>
|
||||
</Unit19>
|
||||
<Unit20>
|
||||
<Filename Value="../../appkit/NSWindow.inc"/>
|
||||
<CursorPos X="46" Y="65"/>
|
||||
<TopLine Value="59"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<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"/>
|
||||
<UsageCount Value="34"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit21>
|
||||
<Unit22>
|
||||
<Filename Value="/System/Library/Frameworks/Foundation.framework/Headers/NSGeometry.h"/>
|
||||
<CursorPos X="12" Y="131"/>
|
||||
<TopLine Value="125"/>
|
||||
<UsageCount Value="9"/>
|
||||
<SyntaxHighlighter Value="C++"/>
|
||||
</Unit22>
|
||||
<Unit23>
|
||||
<Filename Value="../../foundation/NSGeometry.inc"/>
|
||||
<CursorPos X="13" Y="4"/>
|
||||
<TopLine Value="2"/>
|
||||
<UsageCount Value="25"/>
|
||||
</Unit23>
|
||||
<Unit24>
|
||||
<Filename Value="/System/Library/Frameworks/AppKit.framework/Headers/NSGraphics.h"/>
|
||||
<CursorPos X="12" Y="167"/>
|
||||
<TopLine Value="163"/>
|
||||
<UsageCount Value="9"/>
|
||||
<SyntaxHighlighter Value="C++"/>
|
||||
</Unit24>
|
||||
<Unit25>
|
||||
<Filename Value="../../appkit/NSGraphics.inc"/>
|
||||
<CursorPos X="33" Y="31"/>
|
||||
<TopLine Value="26"/>
|
||||
<UsageCount Value="22"/>
|
||||
</Unit25>
|
||||
<Unit26>
|
||||
<Filename Value="../../../objc/objc.inc"/>
|
||||
<CursorPos X="104" Y="76"/>
|
||||
<TopLine Value="69"/>
|
||||
<UsageCount Value="16"/>
|
||||
</Unit26>
|
||||
<Unit27>
|
||||
<Filename Value="../../../fpc/rtl/unix/aliasctp.inc"/>
|
||||
<CursorPos X="49" Y="37"/>
|
||||
<TopLine Value="33"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit27>
|
||||
<Unit28>
|
||||
<Filename Value="../../../fpc/rtl/unix/unixtype.pp"/>
|
||||
<UnitName Value="unixtype"/>
|
||||
<CursorPos X="47" Y="8"/>
|
||||
<TopLine Value="3"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit28>
|
||||
<Unit29>
|
||||
<Filename Value="../../../fpc/rtl/darwin/ptypes.inc"/>
|
||||
<CursorPos X="34" Y="14"/>
|
||||
<TopLine Value="12"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit29>
|
||||
<Unit30>
|
||||
<Filename Value="../../../fpc/rtl/unix/ctypes.inc"/>
|
||||
<CursorPos X="34" Y="55"/>
|
||||
<TopLine Value="44"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit30>
|
||||
<Unit31>
|
||||
<Filename Value="../../../objc/objc-runtime.inc"/>
|
||||
<CursorPos X="62" Y="19"/>
|
||||
<TopLine Value="16"/>
|
||||
<UsageCount Value="16"/>
|
||||
</Unit31>
|
||||
<Unit32>
|
||||
<Filename Value="../../appkit/NSWindow_type.inc"/>
|
||||
<CursorPos X="13" Y="25"/>
|
||||
<TopLine Value="20"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit32>
|
||||
<Unit33>
|
||||
<Filename Value="../../appkit/NSApplication_type.inc"/>
|
||||
<CursorPos X="12" Y="49"/>
|
||||
<TopLine Value="46"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit33>
|
||||
<Unit34>
|
||||
<Filename Value="../../../fpc/rtl/inc/objpash.inc"/>
|
||||
<CursorPos X="11" Y="68"/>
|
||||
<TopLine Value="64"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit34>
|
||||
<Unit35>
|
||||
<Filename Value="../../../objc/objc.pas"/>
|
||||
<UnitName Value="objc"/>
|
||||
<CursorPos X="70" Y="14"/>
|
||||
<TopLine Value="9"/>
|
||||
<UsageCount Value="16"/>
|
||||
</Unit35>
|
||||
<Unit36>
|
||||
<Filename Value="../../../objc/objc-class.inc"/>
|
||||
<CursorPos X="5" Y="261"/>
|
||||
<TopLine Value="261"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit36>
|
||||
</Units>
|
||||
<JumpHistory Count="19" HistoryIndex="18">
|
||||
<Position1>
|
||||
<Filename Value="simplewindow.pas"/>
|
||||
<Caret Line="15" Column="6" TopLine="10"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="simplewindow.pas"/>
|
||||
<Caret Line="25" Column="12" TopLine="13"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="simplewindow.pas"/>
|
||||
<Caret Line="59" Column="29" TopLine="50"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="simplewindow.pas"/>
|
||||
<Caret Line="60" Column="31" TopLine="50"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="simplewindow.pas"/>
|
||||
<Caret Line="66" Column="20" TopLine="55"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="simplewindow.pas"/>
|
||||
<Caret Line="64" Column="53" TopLine="53"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="simplewindow.pas"/>
|
||||
<Caret Line="70" Column="29" TopLine="56"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="simplewindow.pas"/>
|
||||
<Caret Line="28" Column="77" TopLine="17"/>
|
||||
</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>
|
||||
<Version Value="5"/>
|
||||
<SearchPaths>
|
||||
<OtherUnitFiles Value="../../appkit/;../../../objc/;../../foundation/"/>
|
||||
<SrcPath Value="../../appkit/;../../../objc/;../../foundation/"/>
|
||||
</SearchPaths>
|
||||
<CodeGeneration>
|
||||
<Generate Value="Faster"/>
|
||||
</CodeGeneration>
|
||||
<Linking>
|
||||
<Options>
|
||||
<PassLinkerOptions Value="True"/>
|
||||
<LinkerOptions Value="-framework cocoa -lobjc"/>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
</CONFIG>
|
62
bindings/pascocoa/examples/simplewindow/simplewindow.pas
Normal file
62
bindings/pascocoa/examples/simplewindow/simplewindow.pas
Normal file
@ -0,0 +1,62 @@
|
||||
{
|
||||
simpleform.pas
|
||||
|
||||
This example shows how to use the objective-c runtime headers to call
|
||||
initialization and finalization code for an objective-c class (in this case
|
||||
NSAutoreleasePool), and also shows a message box using minimal AppKit
|
||||
bindings to demonstrate that this can be used to build Cocoa applications.
|
||||
|
||||
Compilation of this example requires the following options:
|
||||
-k-framework -kcocoa -k-lobjc
|
||||
|
||||
This example project is released under public domain
|
||||
|
||||
AUTHORS: Felipe Monteiro de Carvalho
|
||||
}
|
||||
program simplewindow;
|
||||
|
||||
{$mode delphi}
|
||||
|
||||
uses
|
||||
objc, ctypes, FPCMacOSAll, AppKit, Foundation;
|
||||
|
||||
const
|
||||
Str_Panel_Title = 'This is the title';
|
||||
Str_Panel_Message = 'This is the message';
|
||||
var
|
||||
{ classes }
|
||||
pool: NSAutoreleasePool;
|
||||
MainWindow: NSWindow;
|
||||
{ strings }
|
||||
CFTitle, CFMessage: CFStringRef;
|
||||
{ sizes }
|
||||
MainWindowRect: NSRect;
|
||||
begin
|
||||
{ NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; }
|
||||
pool := NSAutoreleasePool.Create;
|
||||
|
||||
// Creates the application NSApp object
|
||||
NSApp := NSApplication.sharedApplication;
|
||||
|
||||
// Creates a simple window
|
||||
MainWindowRect.origin.x := 300.0;
|
||||
MainWindowRect.origin.y := 300.0;
|
||||
MainWindowRect.size.width := 300.0;
|
||||
MainWindowRect.size.height := 500.0;
|
||||
|
||||
MainWindow := NSWindow.initWithContentRect(MainWindowRect,
|
||||
NSTitledWindowMask or NSClosableWindowMask or NSMiniaturizableWindowMask or NSResizableWindowMask,
|
||||
NSBackingStoreBuffered, NO);
|
||||
|
||||
MainWindow.orderFrontRegardless;
|
||||
|
||||
// CreateMenu();
|
||||
|
||||
{ Enters main message loop }
|
||||
|
||||
NSApp.run;
|
||||
|
||||
{ [pool release]; }
|
||||
pool.Free;
|
||||
end.
|
||||
|
147
bindings/pascocoa/foundation/Foundation.inc
Normal file
147
bindings/pascocoa/foundation/Foundation.inc
Normal file
@ -0,0 +1,147 @@
|
||||
{ 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.inc}
|
||||
|
||||
{#import <Foundation/NSObjCRuntime.h>
|
||||
#import <Foundation/NSAffineTransform.h>
|
||||
#import <Foundation/NSArchiver.h>
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSAttributedString.h> }
|
||||
{$include NSAutoreleasePool.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> }
|
||||
{$include NSGeometry.inc}
|
||||
{#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.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
|
||||
}
|
||||
|
147
bindings/pascocoa/foundation/Foundation_impl.inc
Normal file
147
bindings/pascocoa/foundation/Foundation_impl.inc
Normal file
@ -0,0 +1,147 @@
|
||||
{ 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
|
||||
}
|
||||
|
24
bindings/pascocoa/foundation/NSAutoreleasePool.inc
Normal file
24
bindings/pascocoa/foundation/NSAutoreleasePool.inc
Normal file
@ -0,0 +1,24 @@
|
||||
{ NSAutoreleasePool.h
|
||||
Copyright (c) 1994-2005, Apple, Inc. All rights reserved.
|
||||
}
|
||||
|
||||
//#import <Foundation/NSObject.h>
|
||||
|
||||
const
|
||||
Str_NSAutoreleasePool = 'NSAutoreleasePool';
|
||||
|
||||
type
|
||||
NSAutoreleasePool = class(NSObject)
|
||||
public
|
||||
constructor Create; override;
|
||||
|
||||
//+ (void)addObject:(id)anObject;
|
||||
|
||||
//- (void)addObject:(id)anObject;
|
||||
|
||||
//#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
|
||||
//- (void)drain;
|
||||
//#endif
|
||||
|
||||
end;
|
||||
|
9
bindings/pascocoa/foundation/NSAutoreleasePool_impl.inc
Normal file
9
bindings/pascocoa/foundation/NSAutoreleasePool_impl.inc
Normal file
@ -0,0 +1,9 @@
|
||||
|
||||
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;
|
||||
|
149
bindings/pascocoa/foundation/NSGeometry.inc
Normal file
149
bindings/pascocoa/foundation/NSGeometry.inc
Normal file
@ -0,0 +1,149 @@
|
||||
{%mainunit foundation.pas}
|
||||
{ NSGeometry.h
|
||||
Copyright (c) 1994-2005, Apple, Inc. All rights reserved.
|
||||
}
|
||||
|
||||
{#import <Foundation/NSValue.h>
|
||||
#import <Foundation/NSCoder.h>}
|
||||
|
||||
//@class NSString;
|
||||
|
||||
type
|
||||
NSPoint = record
|
||||
x: cfloat;
|
||||
y: cfloat;
|
||||
end;
|
||||
|
||||
//typedef NSPoint *NSPointPointer;
|
||||
//typedef NSPoint *NSPointArray;
|
||||
|
||||
NSSize = record
|
||||
width: cfloat; { should never be negative }
|
||||
height: cfloat; { should never be negative }
|
||||
end;
|
||||
|
||||
//typedef NSSize *NSSizePointer;
|
||||
//typedef NSSize *NSSizeArray;
|
||||
|
||||
NSRect = record
|
||||
origin: NSPoint;
|
||||
size: NSSize;
|
||||
end;
|
||||
|
||||
(*typedef NSRect *NSRectPointer;
|
||||
typedef NSRect *NSRectArray;
|
||||
|
||||
typedef enum _NSRectEdge {
|
||||
NSMinXEdge = 0,
|
||||
NSMinYEdge = 1,
|
||||
NSMaxXEdge = 2,
|
||||
NSMaxYEdge = 3
|
||||
} NSRectEdge;
|
||||
|
||||
FOUNDATION_EXPORT const NSPoint NSZeroPoint;
|
||||
FOUNDATION_EXPORT const NSSize NSZeroSize;
|
||||
FOUNDATION_EXPORT const NSRect NSZeroRect;
|
||||
|
||||
FOUNDATION_STATIC_INLINE NSPoint NSMakePoint(float x, float y) {
|
||||
NSPoint p;
|
||||
p.x = x;
|
||||
p.y = y;
|
||||
return p;
|
||||
}
|
||||
|
||||
FOUNDATION_STATIC_INLINE NSSize NSMakeSize(float w, float h) {
|
||||
NSSize s;
|
||||
s.width = w;
|
||||
s.height = h;
|
||||
return s;
|
||||
}
|
||||
|
||||
FOUNDATION_STATIC_INLINE NSRect NSMakeRect(float x, float y, float w, float h) {
|
||||
NSRect r;
|
||||
r.origin.x = x;
|
||||
r.origin.y = y;
|
||||
r.size.width = w;
|
||||
r.size.height = h;
|
||||
return r;
|
||||
}
|
||||
|
||||
FOUNDATION_STATIC_INLINE float NSMaxX(NSRect aRect) {
|
||||
return (aRect.origin.x + aRect.size.width);
|
||||
}
|
||||
|
||||
FOUNDATION_STATIC_INLINE float NSMaxY(NSRect aRect) {
|
||||
return (aRect.origin.y + aRect.size.height);
|
||||
}
|
||||
|
||||
FOUNDATION_STATIC_INLINE float NSMidX(NSRect aRect) {
|
||||
return (aRect.origin.x + aRect.size.width / 2.0);
|
||||
}
|
||||
|
||||
FOUNDATION_STATIC_INLINE float NSMidY(NSRect aRect) {
|
||||
return (aRect.origin.y + aRect.size.height / 2.0);
|
||||
}
|
||||
|
||||
FOUNDATION_STATIC_INLINE float NSMinX(NSRect aRect) {
|
||||
return (aRect.origin.x);
|
||||
}
|
||||
|
||||
FOUNDATION_STATIC_INLINE float NSMinY(NSRect aRect) {
|
||||
return (aRect.origin.y);
|
||||
}
|
||||
|
||||
FOUNDATION_STATIC_INLINE float NSWidth(NSRect aRect) {
|
||||
return (aRect.size.width);
|
||||
}
|
||||
|
||||
FOUNDATION_STATIC_INLINE float NSHeight(NSRect aRect) {
|
||||
return (aRect.size.height);
|
||||
}
|
||||
*)
|
||||
{FOUNDATION_EXPORT BOOL NSEqualPoints(NSPoint aPoint, NSPoint bPoint);
|
||||
FOUNDATION_EXPORT BOOL NSEqualSizes(NSSize aSize, NSSize bSize);
|
||||
FOUNDATION_EXPORT BOOL NSEqualRects(NSRect aRect, NSRect bRect);
|
||||
FOUNDATION_EXPORT BOOL NSIsEmptyRect(NSRect aRect);
|
||||
|
||||
FOUNDATION_EXPORT NSRect NSInsetRect(NSRect aRect, float dX, float dY);
|
||||
FOUNDATION_EXPORT NSRect NSIntegralRect(NSRect aRect);
|
||||
FOUNDATION_EXPORT NSRect NSUnionRect(NSRect aRect, NSRect bRect);
|
||||
FOUNDATION_EXPORT NSRect NSIntersectionRect(NSRect aRect, NSRect bRect);
|
||||
FOUNDATION_EXPORT NSRect NSOffsetRect(NSRect aRect, float dX, float dY);
|
||||
FOUNDATION_EXPORT void NSDivideRect(NSRect inRect, NSRect *slice, NSRect *rem, float amount, NSRectEdge edge);
|
||||
FOUNDATION_EXPORT BOOL NSPointInRect(NSPoint aPoint, NSRect aRect);
|
||||
FOUNDATION_EXPORT BOOL NSMouseInRect(NSPoint aPoint, NSRect aRect, BOOL flipped);
|
||||
FOUNDATION_EXPORT BOOL NSContainsRect(NSRect aRect, NSRect bRect);
|
||||
FOUNDATION_EXPORT BOOL NSIntersectsRect(NSRect aRect, NSRect bRect);
|
||||
|
||||
FOUNDATION_EXPORT NSString *NSStringFromPoint(NSPoint aPoint);
|
||||
FOUNDATION_EXPORT NSString *NSStringFromSize(NSSize aSize);
|
||||
FOUNDATION_EXPORT NSString *NSStringFromRect(NSRect aRect);
|
||||
FOUNDATION_EXPORT NSPoint NSPointFromString(NSString *aString);
|
||||
FOUNDATION_EXPORT NSSize NSSizeFromString(NSString *aString);
|
||||
FOUNDATION_EXPORT NSRect NSRectFromString(NSString *aString);
|
||||
|
||||
@interface NSValue (NSValueGeometryExtensions)
|
||||
|
||||
+ (NSValue *)valueWithPoint:(NSPoint)point;
|
||||
+ (NSValue *)valueWithSize:(NSSize)size;
|
||||
+ (NSValue *)valueWithRect:(NSRect)rect;
|
||||
|
||||
- (NSPoint)pointValue;
|
||||
- (NSSize)sizeValue;
|
||||
- (NSRect)rectValue;
|
||||
|
||||
@end
|
||||
|
||||
@interface NSCoder (NSGeometryCoding)
|
||||
|
||||
- (void)encodePoint:(NSPoint)point;
|
||||
- (NSPoint)decodePoint;
|
||||
|
||||
- (void)encodeSize:(NSSize)size;
|
||||
- (NSSize)decodeSize;
|
||||
|
||||
- (void)encodeRect:(NSRect)rect;
|
||||
- (NSRect)decodeRect;
|
||||
|
||||
@end}
|
||||
|
144
bindings/pascocoa/foundation/NSObject.inc
Normal file
144
bindings/pascocoa/foundation/NSObject.inc
Normal file
@ -0,0 +1,144 @@
|
||||
{ NSObject.h
|
||||
Copyright (c) 1994-2005, Apple, Inc. All rights reserved.
|
||||
}
|
||||
|
||||
//#import <Foundation/NSObjCRuntime.h>
|
||||
//#import <Foundation/NSZone.h>
|
||||
|
||||
//@class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
|
||||
//@class Protocol;
|
||||
|
||||
{*************** Basic protocols ***************}
|
||||
|
||||
{@protocol NSObject
|
||||
|
||||
- (BOOL)isEqual:(id)object;
|
||||
- (unsigned)hash;
|
||||
|
||||
- (Class)superclass;
|
||||
- (Class)class;
|
||||
- (id)self;
|
||||
- (NSZone *)zone;
|
||||
|
||||
- (id)performSelector:(SEL)aSelector;
|
||||
- (id)performSelector:(SEL)aSelector withObject:(id)object;
|
||||
- (id)performSelector:(SEL)aSelector withObject:(id)object1 withObject:(id)object2;
|
||||
|
||||
- (BOOL)isProxy;
|
||||
|
||||
- (BOOL)isKindOfClass:(Class)aClass;
|
||||
- (BOOL)isMemberOfClass:(Class)aClass;
|
||||
- (BOOL)conformsToProtocol:(Protocol *)aProtocol;
|
||||
|
||||
- (BOOL)respondsToSelector:(SEL)aSelector;
|
||||
|
||||
- (id)retain;
|
||||
- (oneway void)release;
|
||||
- (id)autorelease;
|
||||
- (unsigned)retainCount;
|
||||
|
||||
- (NSString *)description;
|
||||
|
||||
@end
|
||||
|
||||
@protocol NSCopying
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone;
|
||||
|
||||
@end
|
||||
|
||||
@protocol NSMutableCopying
|
||||
|
||||
- (id)mutableCopyWithZone:(NSZone *)zone;
|
||||
|
||||
@end
|
||||
|
||||
@protocol NSCoding
|
||||
|
||||
- (void)encodeWithCoder:(NSCoder *)aCoder;
|
||||
- (id)initWithCoder:(NSCoder *)aDecoder;
|
||||
|
||||
@end }
|
||||
|
||||
{*********** Base class ***********}
|
||||
|
||||
const
|
||||
Str_alloc = 'alloc';
|
||||
Str_init = 'init';
|
||||
Str_release = 'release';
|
||||
|
||||
type
|
||||
NSObject = class
|
||||
public
|
||||
{ class id }
|
||||
ClassId: objc.id;
|
||||
{ object references }
|
||||
allocbuf, Handle: objc.id;
|
||||
{ Constructor / Destructor }
|
||||
constructor Create; virtual;
|
||||
destructor Destroy; override;
|
||||
|
||||
{+ (void)load;
|
||||
|
||||
+ (void)initialize;
|
||||
- (id)init;
|
||||
|
||||
+ (id)new;
|
||||
+ (id)allocWithZone:(NSZone *)zone;
|
||||
+ (id)alloc;
|
||||
- (void)dealloc;
|
||||
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
|
||||
- (void)finalize;
|
||||
#endif
|
||||
|
||||
- (id)copy;
|
||||
- (id)mutableCopy;
|
||||
|
||||
+ (id)copyWithZone:(NSZone *)zone;
|
||||
+ (id)mutableCopyWithZone:(NSZone *)zone;
|
||||
|
||||
+ (Class)superclass;
|
||||
+ (Class)class;
|
||||
+ (void)poseAsClass:(Class)aClass;
|
||||
+ (BOOL)instancesRespondToSelector:(SEL)aSelector;
|
||||
+ (BOOL)conformsToProtocol:(Protocol *)protocol;
|
||||
- (IMP)methodForSelector:(SEL)aSelector;
|
||||
+ (IMP)instanceMethodForSelector:(SEL)aSelector;
|
||||
+ (int)version;
|
||||
+ (void)setVersion:(int)aVersion;
|
||||
- (void)doesNotRecognizeSelector:(SEL)aSelector;
|
||||
- (void)forwardInvocation:(NSInvocation *)anInvocation;
|
||||
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector;
|
||||
|
||||
+ (NSMethodSignature *)instanceMethodSignatureForSelector:(SEL)aSelector;
|
||||
|
||||
#if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED
|
||||
+ (BOOL)isSubclassOfClass:(Class)aClass;
|
||||
#endif
|
||||
|
||||
+ (NSString *)description;
|
||||
|
||||
- (Class)classForCoder;
|
||||
- (id)replacementObjectForCoder:(NSCoder *)aCoder;
|
||||
- (id)awakeAfterUsingCoder:(NSCoder *)aDecoder;}
|
||||
|
||||
end;
|
||||
|
||||
{*********** 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);}
|
||||
|
||||
|
11
bindings/pascocoa/foundation/NSObject_impl.inc
Normal file
11
bindings/pascocoa/foundation/NSObject_impl.inc
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
constructor NSObject.Create;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
destructor NSObject.Destroy;
|
||||
begin
|
||||
objc_msgSend(Handle, sel_registerName(PChar(Str_release)), []);
|
||||
end;
|
||||
|
19
bindings/pascocoa/foundation/foundation.pas
Normal file
19
bindings/pascocoa/foundation/foundation.pas
Normal file
@ -0,0 +1,19 @@
|
||||
unit foundation;
|
||||
|
||||
{$ifdef fpc}
|
||||
{$mode delphi}
|
||||
{$packrecords c}
|
||||
{$endif}
|
||||
|
||||
interface
|
||||
|
||||
uses ctypes, objc, FPCMacOSAll;
|
||||
|
||||
{$include Foundation.inc}
|
||||
|
||||
implementation
|
||||
|
||||
{$include Foundation_impl.inc}
|
||||
|
||||
end.
|
||||
|
Reference in New Issue
Block a user