The statusitem example now works. Adds NSImage.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@373 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
sekelsenmat
2008-03-10 11:01:03 +00:00
parent b839964d8e
commit 6308ce38ab
7 changed files with 395 additions and 128 deletions

View File

@ -9,68 +9,18 @@
//#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 ***********}
{ Class and method name strings }
const
{*********** Base class ***********}
Str_NSObject = 'NSObject';
Str_alloc = 'alloc';
Str_init = 'init';
{*************** Basic protocols ***************}
Str_retain = 'retain';
Str_release = 'release';
{*********** Object Allocation / Deallocation *******}
@ -95,6 +45,8 @@ FOUNDATION_EXPORT unsigned NSExtraRefCount(id object);}
{$ifndef NSOBJECT_PAS_C}
{$define NSOBJECT_PAS_C}
{*********** Base class ***********}
NSObject = class
public
{ class id }
@ -153,12 +105,69 @@ FOUNDATION_EXPORT unsigned NSExtraRefCount(id object);}
- (id)replacementObjectForCoder:(NSCoder *)aCoder;
- (id)awakeAfterUsingCoder:(NSCoder *)aDecoder;}
//@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;}
function retain: objc.id;
procedure 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 }
end;
{$endif}
{$endif}
{$ifdef IMPLEMENTATION}
{*********** Base class ***********}
constructor NSObject.Create;
begin
ClassId := getClass();
@ -168,14 +177,13 @@ end;
constructor NSObject.CreateWithHandle(aHandle: objc.id);
begin
ClassId := getClass();
Handle := aHandle;
inherited Create;
end;
destructor NSObject.Destroy;
begin
objc_msgSend(Handle, sel_registerName(PChar(Str_release)), []);
release;
end;
function NSObject.getClass: objc.id;
@ -183,5 +191,17 @@ begin
Result := objc_getClass(Str_NSObject);
end;
{*************** Basic protocols ***************}
function NSObject.retain: objc.id;
begin
Result := objc_msgSend(Handle, sel_registerName(PChar(Str_retain)), []);
end;
procedure NSObject.release;
begin
objc_msgSend(Handle, sel_registerName(PChar(Str_release)), []);
end;
{$endif}