You've already forked lazarus-ccr
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:
@ -53,8 +53,8 @@
|
|||||||
#import <AppKit/NSFileWrapper.h>
|
#import <AppKit/NSFileWrapper.h>
|
||||||
#import <AppKit/NSHelpManager.h>}
|
#import <AppKit/NSHelpManager.h>}
|
||||||
{$include NSGraphics.inc}
|
{$include NSGraphics.inc}
|
||||||
{#import <AppKit/NSImage.h>
|
{$include NSImage.inc}
|
||||||
#import <AppKit/NSImageCell.h>
|
{#import <AppKit/NSImageCell.h>
|
||||||
#import <AppKit/NSImageRep.h>
|
#import <AppKit/NSImageRep.h>
|
||||||
#import <AppKit/NSImageView.h>
|
#import <AppKit/NSImageView.h>
|
||||||
#import <AppKit/NSNib.h>
|
#import <AppKit/NSNib.h>
|
||||||
|
189
bindings/pascocoa/appkit/NSImage.inc
Normal file
189
bindings/pascocoa/appkit/NSImage.inc
Normal file
@ -0,0 +1,189 @@
|
|||||||
|
{%mainunit appkit.pas}
|
||||||
|
{
|
||||||
|
NSImage.h
|
||||||
|
Application Kit
|
||||||
|
Copyright (c) 1994-2005, Apple Computer, Inc.
|
||||||
|
All rights reserved.
|
||||||
|
}
|
||||||
|
|
||||||
|
{$ifdef HEADER}
|
||||||
|
{$ifndef NSIMAGE_PAS_H}
|
||||||
|
{$define NSIMAGE_PAS_H}
|
||||||
|
|
||||||
|
{#import <AppKit/NSGraphics.h>
|
||||||
|
#import <AppKit/NSBitmapImageRep.h>}
|
||||||
|
|
||||||
|
//#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2
|
||||||
|
|
||||||
|
type
|
||||||
|
NSImageLoadStatus = (
|
||||||
|
NSImageLoadStatusCompleted,
|
||||||
|
NSImageLoadStatusCancelled,
|
||||||
|
NSImageLoadStatusInvalidData,
|
||||||
|
NSImageLoadStatusUnexpectedEOF,
|
||||||
|
NSImageLoadStatusReadError
|
||||||
|
);
|
||||||
|
|
||||||
|
NSImageCacheMode = (
|
||||||
|
NSImageCacheDefault, // unspecified. use image rep's default
|
||||||
|
NSImageCacheAlways, // always generate a cache when drawing
|
||||||
|
NSImageCacheBySize, // cache if cache size is smaller than original data
|
||||||
|
NSImageCacheNever // never cache, always draw direct
|
||||||
|
);
|
||||||
|
|
||||||
|
//#endif
|
||||||
|
|
||||||
|
{ Class and method name strings }
|
||||||
|
const
|
||||||
|
Str_NSImage = 'NSImage';
|
||||||
|
|
||||||
|
Str_initWithContentsOfFile = 'initWithContentsOfFile:';
|
||||||
|
|
||||||
|
{$endif}
|
||||||
|
{$endif}
|
||||||
|
{$ifdef CLASSES}
|
||||||
|
{$ifndef NSIMAGE_PAS_C}
|
||||||
|
{$define NSIMAGE_PAS_C}
|
||||||
|
|
||||||
|
{#import <AppKit/NSGraphics.h>
|
||||||
|
#import <AppKit/NSBitmapImageRep.h>}
|
||||||
|
|
||||||
|
//@class NSArray, NSColor, NSImageRep, NSPasteboard, NSURL;
|
||||||
|
|
||||||
|
NSImage = class(NSObject) // <NSCopying, NSCoding>
|
||||||
|
public
|
||||||
|
{ Extra binding functions }
|
||||||
|
function getClass: objc.id; override;
|
||||||
|
public
|
||||||
|
{
|
||||||
|
+ (id)imageNamed:(NSString *)name; /* If this finds & creates the image, only name is saved when archived */
|
||||||
|
|
||||||
|
- (id)initWithSize:(NSSize)aSize;
|
||||||
|
- (id)initWithData:(NSData *)data; /* When archived, saves contents */}
|
||||||
|
constructor initWithContentsOfFile(fileName: CFStringRef); { When archived, saves contents }
|
||||||
|
{- (id)initWithContentsOfURL:(NSURL *)url; /* When archived, saves contents */
|
||||||
|
- (id)initByReferencingFile:(NSString *)fileName; /* When archived, saves fileName */
|
||||||
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2
|
||||||
|
- (id)initByReferencingURL:(NSURL *)url; /* When archived, saves url, supports progressive loading */
|
||||||
|
#endif
|
||||||
|
- (id)initWithPasteboard:(NSPasteboard *)pasteboard;
|
||||||
|
|
||||||
|
- (void)setSize:(NSSize)aSize;
|
||||||
|
- (NSSize)size;
|
||||||
|
- (BOOL)setName:(NSString *)string;
|
||||||
|
- (NSString *)name;
|
||||||
|
- (void)setScalesWhenResized:(BOOL)flag;
|
||||||
|
- (BOOL)scalesWhenResized;
|
||||||
|
- (void)setDataRetained:(BOOL)flag;
|
||||||
|
- (BOOL)isDataRetained;
|
||||||
|
- (void)setCachedSeparately:(BOOL)flag;
|
||||||
|
- (BOOL)isCachedSeparately;
|
||||||
|
- (void)setCacheDepthMatchesImageDepth:(BOOL)flag;
|
||||||
|
- (BOOL)cacheDepthMatchesImageDepth;
|
||||||
|
- (void)setBackgroundColor:(NSColor *)aColor;
|
||||||
|
- (NSColor *)backgroundColor;
|
||||||
|
- (void)setUsesEPSOnResolutionMismatch:(BOOL)flag;
|
||||||
|
- (BOOL)usesEPSOnResolutionMismatch;
|
||||||
|
- (void)setPrefersColorMatch:(BOOL)flag;
|
||||||
|
- (BOOL)prefersColorMatch;
|
||||||
|
- (void)setMatchesOnMultipleResolution:(BOOL)flag;
|
||||||
|
- (BOOL)matchesOnMultipleResolution;
|
||||||
|
- (void)dissolveToPoint:(NSPoint)point fraction:(float)aFloat;
|
||||||
|
- (void)dissolveToPoint:(NSPoint)point fromRect:(NSRect)rect fraction:(float)aFloat;
|
||||||
|
- (void)compositeToPoint:(NSPoint)point operation:(NSCompositingOperation)op;
|
||||||
|
- (void)compositeToPoint:(NSPoint)point fromRect:(NSRect)rect operation:(NSCompositingOperation)op;
|
||||||
|
- (void)compositeToPoint:(NSPoint)point operation:(NSCompositingOperation)op fraction:(float)delta;
|
||||||
|
- (void)compositeToPoint:(NSPoint)point fromRect:(NSRect)rect operation:(NSCompositingOperation)op fraction:(float)delta;
|
||||||
|
- (void)drawAtPoint:(NSPoint)point fromRect:(NSRect)fromRect operation:(NSCompositingOperation)op fraction:(float)delta;
|
||||||
|
- (void)drawInRect:(NSRect)rect fromRect:(NSRect)fromRect operation:(NSCompositingOperation)op fraction:(float)delta;
|
||||||
|
- (BOOL)drawRepresentation:(NSImageRep *)imageRep inRect:(NSRect)rect;
|
||||||
|
- (void)recache;
|
||||||
|
- (NSData *)TIFFRepresentation;
|
||||||
|
- (NSData *)TIFFRepresentationUsingCompression:(NSTIFFCompression)comp factor:(float)aFloat;
|
||||||
|
|
||||||
|
- (NSArray *)representations;
|
||||||
|
- (void)addRepresentations:(NSArray *)imageReps;
|
||||||
|
- (void)addRepresentation:(NSImageRep *)imageRep;
|
||||||
|
- (void)removeRepresentation:(NSImageRep *)imageRep;
|
||||||
|
|
||||||
|
- (BOOL)isValid;
|
||||||
|
- (void)lockFocus;
|
||||||
|
- (void)lockFocusOnRepresentation:(NSImageRep *)imageRepresentation;
|
||||||
|
- (void)unlockFocus;
|
||||||
|
|
||||||
|
- (NSImageRep *)bestRepresentationForDevice:(NSDictionary *)deviceDescription;
|
||||||
|
|
||||||
|
- (void)setDelegate:(id)anObject;
|
||||||
|
- (id)delegate;
|
||||||
|
|
||||||
|
/* These return union of all the types registered with NSImageRep.
|
||||||
|
*/
|
||||||
|
+ (NSArray *)imageUnfilteredFileTypes;
|
||||||
|
+ (NSArray *)imageUnfilteredPasteboardTypes;
|
||||||
|
+ (NSArray *)imageFileTypes;
|
||||||
|
+ (NSArray *)imagePasteboardTypes;
|
||||||
|
|
||||||
|
+ (BOOL)canInitWithPasteboard:(NSPasteboard *)pasteboard;
|
||||||
|
|
||||||
|
- (void)setFlipped:(BOOL)flag;
|
||||||
|
- (BOOL)isFlipped;
|
||||||
|
|
||||||
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2
|
||||||
|
- (void)cancelIncrementalLoad;
|
||||||
|
|
||||||
|
-(void)setCacheMode:(NSImageCacheMode)mode;
|
||||||
|
-(NSImageCacheMode)cacheMode;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
|
||||||
|
@interface NSImage (NSWindowsExtensions)
|
||||||
|
- (id)initWithIconHandle:(void * /* HICON */)icon;
|
||||||
|
- (id)initWithBitmapHandle:(void * /* HBITMAP */)bitmap;
|
||||||
|
@end
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@interface NSObject(NSImageDelegate)
|
||||||
|
- (NSImage *)imageDidNotDraw:(id)sender inRect:(NSRect)aRect;
|
||||||
|
|
||||||
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2
|
||||||
|
- (void)image:(NSImage*)image willLoadRepresentation:(NSImageRep*)rep;
|
||||||
|
- (void)image:(NSImage*)image didLoadRepresentationHeader:(NSImageRep*)rep;
|
||||||
|
- (void)image:(NSImage*)image didLoadPartOfRepresentation:(NSImageRep*)rep withValidRows:(int)rows;
|
||||||
|
- (void)image:(NSImage*)image didLoadRepresentation:(NSImageRep*)rep withStatus:(NSImageLoadStatus)status;
|
||||||
|
#endif
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface NSBundle(NSBundleImageExtension)
|
||||||
|
- (NSString *)pathForImageResource:(NSString *)name; /* May return nil if no file found */
|
||||||
|
@end}
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
{$endif}
|
||||||
|
{$endif}
|
||||||
|
{$ifdef IMPLEMENTATION}
|
||||||
|
|
||||||
|
function NSImage.getClass: objc.id;
|
||||||
|
begin
|
||||||
|
Result := objc_getClass(Str_NSImage);
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor NSImage.initWithContentsOfFile(fileName: CFStringRef);
|
||||||
|
type
|
||||||
|
initWithContentsOfFile_t = function (param1: objc.id; param2: SEL;
|
||||||
|
param3: CFStringRef): objc.id; cdecl;
|
||||||
|
var
|
||||||
|
vinit: initWithContentsOfFile_t;
|
||||||
|
begin
|
||||||
|
ClassId := getClass();
|
||||||
|
allocbuf := objc_msgSend(ClassId, sel_registerName(PChar(Str_alloc)), []);
|
||||||
|
vinit := initWithContentsOfFile_t(@objc_msgSend);
|
||||||
|
Handle := vinit(allocbuf, sel_registerName(PChar(Str_initWithContentsOfFile)), fileName);
|
||||||
|
end;
|
||||||
|
|
||||||
|
{$endif}
|
||||||
|
|
@ -20,6 +20,12 @@
|
|||||||
unsigned int reserved:29;
|
unsigned int reserved:29;
|
||||||
} _SBIFlags; *)
|
} _SBIFlags; *)
|
||||||
|
|
||||||
|
{ Class and method name strings }
|
||||||
|
const
|
||||||
|
Str_NSStatusItem = 'NSStatusItem';
|
||||||
|
|
||||||
|
Str_setImage = 'setImage:';
|
||||||
|
|
||||||
{$endif}
|
{$endif}
|
||||||
{$endif}
|
{$endif}
|
||||||
{$ifdef CLASSES}
|
{$ifdef CLASSES}
|
||||||
@ -36,6 +42,9 @@
|
|||||||
|
|
||||||
NSStatusItem = class(NSObject)
|
NSStatusItem = class(NSObject)
|
||||||
public
|
public
|
||||||
|
{ Extra binding functions }
|
||||||
|
function getClass: objc.id; override;
|
||||||
|
public
|
||||||
|
|
||||||
{- (NSStatusBar*) statusBar;
|
{- (NSStatusBar*) statusBar;
|
||||||
|
|
||||||
@ -63,10 +72,10 @@
|
|||||||
- (NSAttributedString*) attributedTitle;
|
- (NSAttributedString*) attributedTitle;
|
||||||
- (void) setAttributedTitle:(NSAttributedString*)title;
|
- (void) setAttributedTitle:(NSAttributedString*)title;
|
||||||
|
|
||||||
- (NSImage*) image;
|
- (NSImage*) image;}
|
||||||
- (void) setImage:(NSImage*)image;
|
procedure setImage(image: NSImage);
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
|
{#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
|
||||||
- (NSImage *)alternateImage;
|
- (NSImage *)alternateImage;
|
||||||
- (void)setAlternateImage:(NSImage*)image;
|
- (void)setAlternateImage:(NSImage*)image;
|
||||||
#endif
|
#endif
|
||||||
@ -103,5 +112,21 @@
|
|||||||
{$endif}
|
{$endif}
|
||||||
{$ifdef IMPLEMENTATION}
|
{$ifdef IMPLEMENTATION}
|
||||||
|
|
||||||
|
function NSStatusItem.getClass: objc.id;
|
||||||
|
begin
|
||||||
|
Result := objc_getClass(Str_NSStatusItem);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure NSStatusItem.setImage(image: NSImage);
|
||||||
|
type
|
||||||
|
setImage_t = procedure (param1: objc.id; param2: SEL;
|
||||||
|
param3: objc.id); cdecl;
|
||||||
|
var
|
||||||
|
vmethod: setImage_t;
|
||||||
|
begin
|
||||||
|
vmethod := setImage_t(@objc_msgSend);
|
||||||
|
vmethod(Handle, sel_registerName(PChar(Str_setImage)), image.Handle);
|
||||||
|
end;
|
||||||
|
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ type
|
|||||||
{ Fields }
|
{ Fields }
|
||||||
bar: NSStatusBar;
|
bar: NSStatusBar;
|
||||||
item: NSStatusItem;
|
item: NSStatusItem;
|
||||||
|
image: NSImage;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Objective-c Methods }
|
{ Objective-c Methods }
|
||||||
@ -57,12 +58,18 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TMyActionList.Create;
|
constructor TMyActionList.Create;
|
||||||
|
var
|
||||||
|
fileName: CFStringRef;
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
|
|
||||||
AddMethods();
|
AddMethods();
|
||||||
|
|
||||||
bar := NSStatusBar.systemStatusBar();
|
bar := NSStatusBar.systemStatusBar();
|
||||||
|
|
||||||
|
fileName := CFStringCreateWithPascalString(nil,
|
||||||
|
ExtractFilePath(ParamStr(0)) + 'icon.ico', kCFStringEncodingUTF8);
|
||||||
|
image := NSImage.initWithContentsOfFile(fileName);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Objective-c Methods }
|
{ Objective-c Methods }
|
||||||
@ -70,6 +77,12 @@ end;
|
|||||||
procedure doShowStatusitem(param1: objc.id; param2: SEL; param3: objc.id); cdecl;
|
procedure doShowStatusitem(param1: objc.id; param2: SEL; param3: objc.id); cdecl;
|
||||||
begin
|
begin
|
||||||
actionList.item := actionList.bar.statusItemWithLength(NSSquareStatusItemLength);
|
actionList.item := actionList.bar.statusItemWithLength(NSSquareStatusItemLength);
|
||||||
|
|
||||||
|
if actionList.item = nil then WriteLn('The item is nil!');
|
||||||
|
if actionList.image = nil then WriteLn('The image is nil!');
|
||||||
|
|
||||||
|
actionList.item.retain();
|
||||||
|
actionList.item.setImage(actionList.image);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
BIN
bindings/pascocoa/examples/statusitem/icon.ico
Normal file
BIN
bindings/pascocoa/examples/statusitem/icon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 478 B |
@ -7,7 +7,7 @@
|
|||||||
<MainUnit Value="0"/>
|
<MainUnit Value="0"/>
|
||||||
<IconPath Value="./"/>
|
<IconPath Value="./"/>
|
||||||
<TargetFileExt Value=""/>
|
<TargetFileExt Value=""/>
|
||||||
<ActiveEditorIndexAtStart Value="1"/>
|
<ActiveEditorIndexAtStart Value="5"/>
|
||||||
</General>
|
</General>
|
||||||
<VersionInfo>
|
<VersionInfo>
|
||||||
<ProjectVersion Value=""/>
|
<ProjectVersion Value=""/>
|
||||||
@ -26,15 +26,15 @@
|
|||||||
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||||
</local>
|
</local>
|
||||||
</RunParams>
|
</RunParams>
|
||||||
<Units Count="34">
|
<Units Count="37">
|
||||||
<Unit0>
|
<Unit0>
|
||||||
<Filename Value="statusitem.pas"/>
|
<Filename Value="statusitem.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="statusitem"/>
|
<UnitName Value="statusitem"/>
|
||||||
<CursorPos X="19" Y="26"/>
|
<CursorPos X="104" Y="43"/>
|
||||||
<TopLine Value="54"/>
|
<TopLine Value="20"/>
|
||||||
<EditorIndex Value="0"/>
|
<EditorIndex Value="0"/>
|
||||||
<UsageCount Value="37"/>
|
<UsageCount Value="39"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit0>
|
</Unit0>
|
||||||
<Unit1>
|
<Unit1>
|
||||||
@ -60,20 +60,24 @@
|
|||||||
<Filename Value="../../appkit/NSAlert.inc"/>
|
<Filename Value="../../appkit/NSAlert.inc"/>
|
||||||
<CursorPos X="1" Y="12"/>
|
<CursorPos X="1" Y="12"/>
|
||||||
<TopLine Value="1"/>
|
<TopLine Value="1"/>
|
||||||
<UsageCount Value="20"/>
|
<UsageCount Value="21"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit4>
|
</Unit4>
|
||||||
<Unit5>
|
<Unit5>
|
||||||
<Filename Value="../../appkit/NSStatusItem.inc"/>
|
<Filename Value="../../appkit/NSStatusItem.inc"/>
|
||||||
<CursorPos X="47" Y="26"/>
|
<CursorPos X="12" Y="123"/>
|
||||||
<TopLine Value="21"/>
|
<TopLine Value="37"/>
|
||||||
<UsageCount Value="13"/>
|
<EditorIndex Value="2"/>
|
||||||
|
<UsageCount Value="14"/>
|
||||||
|
<Loaded Value="True"/>
|
||||||
</Unit5>
|
</Unit5>
|
||||||
<Unit6>
|
<Unit6>
|
||||||
<Filename Value="../../appkit/AppKit.inc"/>
|
<Filename Value="../../appkit/AppKit.inc"/>
|
||||||
<CursorPos X="51" Y="9"/>
|
<CursorPos X="23" Y="56"/>
|
||||||
<TopLine Value="6"/>
|
<TopLine Value="44"/>
|
||||||
<UsageCount Value="11"/>
|
<EditorIndex Value="8"/>
|
||||||
|
<UsageCount Value="12"/>
|
||||||
|
<Loaded Value="True"/>
|
||||||
</Unit6>
|
</Unit6>
|
||||||
<Unit7>
|
<Unit7>
|
||||||
<Filename Value="/System/Library/Frameworks/AppKit.framework/Versions/C/Headers/NSActionCell.h"/>
|
<Filename Value="/System/Library/Frameworks/AppKit.framework/Versions/C/Headers/NSActionCell.h"/>
|
||||||
@ -123,11 +127,9 @@
|
|||||||
</Unit13>
|
</Unit13>
|
||||||
<Unit14>
|
<Unit14>
|
||||||
<Filename Value="../../appkit/NSControl.inc"/>
|
<Filename Value="../../appkit/NSControl.inc"/>
|
||||||
<CursorPos X="26" Y="147"/>
|
<CursorPos X="45" Y="142"/>
|
||||||
<TopLine Value="145"/>
|
<TopLine Value="142"/>
|
||||||
<EditorIndex Value="4"/>
|
|
||||||
<UsageCount Value="24"/>
|
<UsageCount Value="24"/>
|
||||||
<Loaded Value="True"/>
|
|
||||||
</Unit14>
|
</Unit14>
|
||||||
<Unit15>
|
<Unit15>
|
||||||
<Filename Value="/System/Library/Frameworks/AppKit.framework/Versions/C/Headers/NSView.h"/>
|
<Filename Value="/System/Library/Frameworks/AppKit.framework/Versions/C/Headers/NSView.h"/>
|
||||||
@ -159,17 +161,17 @@
|
|||||||
<Filename Value="../../appkit/appkit.pas"/>
|
<Filename Value="../../appkit/appkit.pas"/>
|
||||||
<UnitName Value="appkit"/>
|
<UnitName Value="appkit"/>
|
||||||
<CursorPos X="13" Y="21"/>
|
<CursorPos X="13" Y="21"/>
|
||||||
<TopLine Value="10"/>
|
<TopLine Value="15"/>
|
||||||
<EditorIndex Value="5"/>
|
<EditorIndex Value="7"/>
|
||||||
<UsageCount Value="19"/>
|
<UsageCount Value="20"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit19>
|
</Unit19>
|
||||||
<Unit20>
|
<Unit20>
|
||||||
<Filename Value="../../appkit/NSWindow.inc"/>
|
<Filename Value="../../appkit/NSWindow.inc"/>
|
||||||
<CursorPos X="1" Y="522"/>
|
<CursorPos X="1" Y="97"/>
|
||||||
<TopLine Value="21"/>
|
<TopLine Value="92"/>
|
||||||
<EditorIndex Value="2"/>
|
<EditorIndex Value="4"/>
|
||||||
<UsageCount Value="15"/>
|
<UsageCount Value="16"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit20>
|
</Unit20>
|
||||||
<Unit21>
|
<Unit21>
|
||||||
@ -218,18 +220,18 @@
|
|||||||
</Unit27>
|
</Unit27>
|
||||||
<Unit28>
|
<Unit28>
|
||||||
<Filename Value="../../foundation/NSObject.inc"/>
|
<Filename Value="../../foundation/NSObject.inc"/>
|
||||||
<CursorPos X="16" Y="7"/>
|
<CursorPos X="1" Y="25"/>
|
||||||
<TopLine Value="1"/>
|
<TopLine Value="9"/>
|
||||||
<EditorIndex Value="3"/>
|
<EditorIndex Value="5"/>
|
||||||
<UsageCount Value="11"/>
|
<UsageCount Value="12"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit28>
|
</Unit28>
|
||||||
<Unit29>
|
<Unit29>
|
||||||
<Filename Value="../../appkit/NSStatusBar.inc"/>
|
<Filename Value="../../appkit/NSStatusBar.inc"/>
|
||||||
<CursorPos X="27" Y="15"/>
|
<CursorPos X="10" Y="61"/>
|
||||||
<TopLine Value="36"/>
|
<TopLine Value="36"/>
|
||||||
<EditorIndex Value="6"/>
|
<EditorIndex Value="9"/>
|
||||||
<UsageCount Value="15"/>
|
<UsageCount Value="16"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit29>
|
</Unit29>
|
||||||
<Unit30>
|
<Unit30>
|
||||||
@ -254,74 +256,92 @@
|
|||||||
<Filename Value="actions.pas"/>
|
<Filename Value="actions.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="actions"/>
|
<UnitName Value="actions"/>
|
||||||
<CursorPos X="3" Y="61"/>
|
<CursorPos X="16" Y="84"/>
|
||||||
<TopLine Value="58"/>
|
<TopLine Value="69"/>
|
||||||
<EditorIndex Value="1"/>
|
<EditorIndex Value="1"/>
|
||||||
<UsageCount Value="21"/>
|
<UsageCount Value="23"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit33>
|
</Unit33>
|
||||||
|
<Unit34>
|
||||||
|
<Filename Value="/System/Library/Frameworks/AppKit.framework/Versions/C/Headers/NSImage.h"/>
|
||||||
|
<CursorPos X="24" Y="152"/>
|
||||||
|
<TopLine Value="148"/>
|
||||||
|
<UsageCount Value="10"/>
|
||||||
|
<SyntaxHighlighter Value="C++"/>
|
||||||
|
</Unit34>
|
||||||
|
<Unit35>
|
||||||
|
<Filename Value="../../appkit/NSImage.inc"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<UnitName Value="Unit1"/>
|
||||||
|
<CursorPos X="16" Y="15"/>
|
||||||
|
<TopLine Value="59"/>
|
||||||
|
<EditorIndex Value="3"/>
|
||||||
|
<UsageCount Value="22"/>
|
||||||
|
<Loaded Value="True"/>
|
||||||
|
</Unit35>
|
||||||
|
<Unit36>
|
||||||
|
<Filename Value="/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h"/>
|
||||||
|
<CursorPos X="14" Y="35"/>
|
||||||
|
<TopLine Value="113"/>
|
||||||
|
<EditorIndex Value="6"/>
|
||||||
|
<UsageCount Value="10"/>
|
||||||
|
<Loaded Value="True"/>
|
||||||
|
<SyntaxHighlighter Value="C++"/>
|
||||||
|
</Unit36>
|
||||||
</Units>
|
</Units>
|
||||||
<JumpHistory Count="15" HistoryIndex="14">
|
<JumpHistory Count="13" HistoryIndex="12">
|
||||||
<Position1>
|
<Position1>
|
||||||
<Filename Value="statusitem.pas"/>
|
<Filename Value="../../appkit/appkit.pas"/>
|
||||||
<Caret Line="38" Column="25" TopLine="29"/>
|
<Caret Line="21" Column="13" TopLine="15"/>
|
||||||
</Position1>
|
</Position1>
|
||||||
<Position2>
|
<Position2>
|
||||||
<Filename Value="statusitem.pas"/>
|
<Filename Value="../../appkit/NSImage.inc"/>
|
||||||
<Caret Line="39" Column="22" TopLine="23"/>
|
<Caret Line="3" Column="1" TopLine="1"/>
|
||||||
</Position2>
|
</Position2>
|
||||||
<Position3>
|
<Position3>
|
||||||
<Filename Value="actions.pas"/>
|
<Filename Value="../../appkit/NSImage.inc"/>
|
||||||
<Caret Line="22" Column="1" TopLine="18"/>
|
<Caret Line="39" Column="3" TopLine="30"/>
|
||||||
</Position3>
|
</Position3>
|
||||||
<Position4>
|
<Position4>
|
||||||
<Filename Value="actions.pas"/>
|
<Filename Value="../../appkit/NSImage.inc"/>
|
||||||
<Caret Line="15" Column="41" TopLine="9"/>
|
<Caret Line="170" Column="16" TopLine="51"/>
|
||||||
</Position4>
|
</Position4>
|
||||||
<Position5>
|
<Position5>
|
||||||
<Filename Value="actions.pas"/>
|
<Filename Value="../../appkit/NSImage.inc"/>
|
||||||
<Caret Line="18" Column="33" TopLine="9"/>
|
<Caret Line="51" Column="17" TopLine="47"/>
|
||||||
</Position5>
|
</Position5>
|
||||||
<Position6>
|
<Position6>
|
||||||
<Filename Value="actions.pas"/>
|
<Filename Value="actions.pas"/>
|
||||||
<Caret Line="17" Column="31" TopLine="9"/>
|
<Caret Line="63" Column="25" TopLine="58"/>
|
||||||
</Position6>
|
</Position6>
|
||||||
<Position7>
|
<Position7>
|
||||||
<Filename Value="actions.pas"/>
|
<Filename Value="actions.pas"/>
|
||||||
<Caret Line="15" Column="59" TopLine="12"/>
|
<Caret Line="70" Column="17" TopLine="65"/>
|
||||||
</Position7>
|
</Position7>
|
||||||
<Position8>
|
<Position8>
|
||||||
<Filename Value="actions.pas"/>
|
<Filename Value="actions.pas"/>
|
||||||
<Caret Line="21" Column="3" TopLine="18"/>
|
<Caret Line="33" Column="28" TopLine="24"/>
|
||||||
</Position8>
|
</Position8>
|
||||||
<Position9>
|
<Position9>
|
||||||
<Filename Value="actions.pas"/>
|
<Filename Value="actions.pas"/>
|
||||||
<Caret Line="70" Column="1" TopLine="58"/>
|
<Caret Line="79" Column="49" TopLine="69"/>
|
||||||
</Position9>
|
</Position9>
|
||||||
<Position10>
|
<Position10>
|
||||||
<Filename Value="actions.pas"/>
|
<Filename Value="../../appkit/NSStatusBar.inc"/>
|
||||||
<Caret Line="59" Column="12" TopLine="57"/>
|
<Caret Line="75" Column="32" TopLine="58"/>
|
||||||
</Position10>
|
</Position10>
|
||||||
<Position11>
|
<Position11>
|
||||||
<Filename Value="actions.pas"/>
|
<Filename Value="actions.pas"/>
|
||||||
<Caret Line="36" Column="1" TopLine="19"/>
|
<Caret Line="79" Column="39" TopLine="70"/>
|
||||||
</Position11>
|
</Position11>
|
||||||
<Position12>
|
<Position12>
|
||||||
<Filename Value="actions.pas"/>
|
<Filename Value="/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h"/>
|
||||||
<Caret Line="41" Column="14" TopLine="32"/>
|
<Caret Line="1" Column="1" TopLine="1"/>
|
||||||
</Position12>
|
</Position12>
|
||||||
<Position13>
|
<Position13>
|
||||||
<Filename Value="actions.pas"/>
|
<Filename Value="../../foundation/NSObject.inc"/>
|
||||||
<Caret Line="27" Column="1" TopLine="14"/>
|
<Caret Line="9" Column="22" TopLine="1"/>
|
||||||
</Position13>
|
</Position13>
|
||||||
<Position14>
|
|
||||||
<Filename Value="actions.pas"/>
|
|
||||||
<Caret Line="58" Column="15" TopLine="43"/>
|
|
||||||
</Position14>
|
|
||||||
<Position15>
|
|
||||||
<Filename Value="actions.pas"/>
|
|
||||||
<Caret Line="57" Column="1" TopLine="44"/>
|
|
||||||
</Position15>
|
|
||||||
</JumpHistory>
|
</JumpHistory>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
|
@ -9,68 +9,18 @@
|
|||||||
//#import <Foundation/NSObjCRuntime.h>
|
//#import <Foundation/NSObjCRuntime.h>
|
||||||
//#import <Foundation/NSZone.h>
|
//#import <Foundation/NSZone.h>
|
||||||
|
|
||||||
//@class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
|
{ Class and method name strings }
|
||||||
//@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
|
const
|
||||||
|
{*********** Base class ***********}
|
||||||
|
|
||||||
Str_NSObject = 'NSObject';
|
Str_NSObject = 'NSObject';
|
||||||
|
|
||||||
Str_alloc = 'alloc';
|
Str_alloc = 'alloc';
|
||||||
Str_init = 'init';
|
Str_init = 'init';
|
||||||
|
|
||||||
|
{*************** Basic protocols ***************}
|
||||||
|
|
||||||
|
Str_retain = 'retain';
|
||||||
Str_release = 'release';
|
Str_release = 'release';
|
||||||
|
|
||||||
{*********** Object Allocation / Deallocation *******}
|
{*********** Object Allocation / Deallocation *******}
|
||||||
@ -95,6 +45,8 @@ FOUNDATION_EXPORT unsigned NSExtraRefCount(id object);}
|
|||||||
{$ifndef NSOBJECT_PAS_C}
|
{$ifndef NSOBJECT_PAS_C}
|
||||||
{$define NSOBJECT_PAS_C}
|
{$define NSOBJECT_PAS_C}
|
||||||
|
|
||||||
|
{*********** Base class ***********}
|
||||||
|
|
||||||
NSObject = class
|
NSObject = class
|
||||||
public
|
public
|
||||||
{ class id }
|
{ class id }
|
||||||
@ -153,12 +105,69 @@ FOUNDATION_EXPORT unsigned NSExtraRefCount(id object);}
|
|||||||
- (id)replacementObjectForCoder:(NSCoder *)aCoder;
|
- (id)replacementObjectForCoder:(NSCoder *)aCoder;
|
||||||
- (id)awakeAfterUsingCoder:(NSCoder *)aDecoder;}
|
- (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;
|
end;
|
||||||
|
|
||||||
{$endif}
|
{$endif}
|
||||||
{$endif}
|
{$endif}
|
||||||
{$ifdef IMPLEMENTATION}
|
{$ifdef IMPLEMENTATION}
|
||||||
|
|
||||||
|
{*********** Base class ***********}
|
||||||
|
|
||||||
constructor NSObject.Create;
|
constructor NSObject.Create;
|
||||||
begin
|
begin
|
||||||
ClassId := getClass();
|
ClassId := getClass();
|
||||||
@ -168,14 +177,13 @@ end;
|
|||||||
|
|
||||||
constructor NSObject.CreateWithHandle(aHandle: objc.id);
|
constructor NSObject.CreateWithHandle(aHandle: objc.id);
|
||||||
begin
|
begin
|
||||||
|
ClassId := getClass();
|
||||||
Handle := aHandle;
|
Handle := aHandle;
|
||||||
|
|
||||||
inherited Create;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor NSObject.Destroy;
|
destructor NSObject.Destroy;
|
||||||
begin
|
begin
|
||||||
objc_msgSend(Handle, sel_registerName(PChar(Str_release)), []);
|
release;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function NSObject.getClass: objc.id;
|
function NSObject.getClass: objc.id;
|
||||||
@ -183,5 +191,17 @@ begin
|
|||||||
Result := objc_getClass(Str_NSObject);
|
Result := objc_getClass(Str_NSObject);
|
||||||
end;
|
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}
|
{$endif}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user