You've already forked lazarus-ccr
Many improvements to the examples and Cocoa bindings.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@368 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -110,6 +110,9 @@ APPKIT_EXTERN NSString *NSApplicationDidChangeScreenParametersNotification; }
|
|||||||
//APPKIT_EXTERN const double NSAppKitVersionNumber;
|
//APPKIT_EXTERN const double NSAppKitVersionNumber;
|
||||||
|
|
||||||
NSApplication = class(NSResponder)
|
NSApplication = class(NSResponder)
|
||||||
|
public
|
||||||
|
{ Extra binding functions }
|
||||||
|
function getClass: objc.id; override;
|
||||||
public
|
public
|
||||||
constructor sharedApplication;
|
constructor sharedApplication;
|
||||||
|
|
||||||
@ -358,9 +361,14 @@ If not specified, obtain from CFBundleShortVersionString key in infoDictionary.
|
|||||||
{$endif}
|
{$endif}
|
||||||
{$ifdef IMPLEMENTATION}
|
{$ifdef IMPLEMENTATION}
|
||||||
|
|
||||||
|
function NSApplication.getClass: objc.id;
|
||||||
|
begin
|
||||||
|
Result := objc_getClass(Str_NSApplication);
|
||||||
|
end;
|
||||||
|
|
||||||
constructor NSApplication.sharedApplication;
|
constructor NSApplication.sharedApplication;
|
||||||
begin
|
begin
|
||||||
ClassId := objc_getClass(PChar(Str_NSApplication));
|
ClassId := getClass;
|
||||||
Handle := objc_msgSend(ClassId, sel_registerName(PChar(Str_sharedApplication)), []);
|
Handle := objc_msgSend(ClassId, sel_registerName(PChar(Str_sharedApplication)), []);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -6,6 +6,18 @@
|
|||||||
All rights reserved.
|
All rights reserved.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{$ifdef HEADER}
|
||||||
|
{$ifndef NSBUTTON_PAS_H}
|
||||||
|
{$define NSBUTTON_PAS_H}
|
||||||
|
|
||||||
|
const
|
||||||
|
Str_NSButton = 'NSButton';
|
||||||
|
|
||||||
|
Str_setTitle = 'setTitle:';
|
||||||
|
Str_setBezelStyle = 'setBezelStyle:';
|
||||||
|
|
||||||
|
{$endif}
|
||||||
|
{$endif}
|
||||||
{$ifdef CLASSES}
|
{$ifdef CLASSES}
|
||||||
{$ifndef NSBUTTON_PAS_C}
|
{$ifndef NSBUTTON_PAS_C}
|
||||||
{$define NSBUTTON_PAS_C}
|
{$define NSBUTTON_PAS_C}
|
||||||
@ -17,10 +29,12 @@
|
|||||||
|
|
||||||
NSButton = class(NSControl)
|
NSButton = class(NSControl)
|
||||||
public
|
public
|
||||||
|
{ Extra binding functions }
|
||||||
{- (NSString *)title;
|
function getClass: objc.id; override;
|
||||||
- (void)setTitle:(NSString *)aString;
|
public
|
||||||
- (NSString *)alternateTitle;
|
//- (NSString *)title;
|
||||||
|
procedure setTitle(aString: CFStringRef);
|
||||||
|
{- (NSString *)alternateTitle;
|
||||||
- (void)setAlternateTitle:(NSString *)aString;
|
- (void)setAlternateTitle:(NSString *)aString;
|
||||||
- (NSImage *)image;
|
- (NSImage *)image;
|
||||||
- (void)setImage:(NSImage *)image;
|
- (void)setImage:(NSImage *)image;
|
||||||
@ -55,14 +69,14 @@
|
|||||||
- (void)setAttributedTitle:(NSAttributedString *)aString;
|
- (void)setAttributedTitle:(NSAttributedString *)aString;
|
||||||
- (NSAttributedString *)attributedAlternateTitle;
|
- (NSAttributedString *)attributedAlternateTitle;
|
||||||
- (void)setAttributedAlternateTitle:(NSAttributedString *)obj;
|
- (void)setAttributedAlternateTitle:(NSAttributedString *)obj;
|
||||||
@end
|
@end}
|
||||||
|
|
||||||
@interface NSButton(NSButtonBezelStyles)
|
//@interface NSButton(NSButtonBezelStyles)
|
||||||
- (void) setBezelStyle:(NSBezelStyle)bezelStyle;
|
procedure setBezelStyle(bezelStyle: NSBezelStyle);
|
||||||
- (NSBezelStyle)bezelStyle;
|
//- (NSBezelStyle)bezelStyle;
|
||||||
@end
|
//@end
|
||||||
|
|
||||||
@interface NSButton(NSButtonMixedState)
|
{@interface NSButton(NSButtonMixedState)
|
||||||
- (void)setAllowsMixedState:(BOOL)flag;
|
- (void)setAllowsMixedState:(BOOL)flag;
|
||||||
- (BOOL)allowsMixedState;
|
- (BOOL)allowsMixedState;
|
||||||
- (void)setNextState;
|
- (void)setNextState;
|
||||||
@ -82,4 +96,34 @@
|
|||||||
|
|
||||||
{$endif}
|
{$endif}
|
||||||
{$endif}
|
{$endif}
|
||||||
|
{$ifdef IMPLEMENTATION}
|
||||||
|
|
||||||
|
function NSButton.getClass: objc.id;
|
||||||
|
begin
|
||||||
|
Result := objc_getClass(Str_NSButton);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure NSButton.setTitle(aString: CFStringRef);
|
||||||
|
type
|
||||||
|
setTitle_t = procedure (param1: objc.id; param2: SEL;
|
||||||
|
param3: CFStringRef); cdecl;
|
||||||
|
var
|
||||||
|
vmethod: setTitle_t;
|
||||||
|
begin
|
||||||
|
vmethod := setTitle_t(@objc_msgSend);
|
||||||
|
vmethod(Handle, sel_registerName(PChar(Str_setTitle)), aString);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure NSButton.setBezelStyle(bezelStyle: NSBezelStyle);
|
||||||
|
type
|
||||||
|
setBezelStyle_t = procedure (param1: objc.id; param2: SEL;
|
||||||
|
param3: NSBezelStyle); cdecl;
|
||||||
|
var
|
||||||
|
vmethod: setBezelStyle_t;
|
||||||
|
begin
|
||||||
|
vmethod := setBezelStyle_t(@objc_msgSend);
|
||||||
|
vmethod(Handle, sel_registerName(PChar(Str_setBezelStyle)), bezelStyle);
|
||||||
|
end;
|
||||||
|
|
||||||
|
{$endif}
|
||||||
|
|
||||||
|
@ -10,9 +10,7 @@
|
|||||||
{$ifndef NSCELL_PAS_H}
|
{$ifndef NSCELL_PAS_H}
|
||||||
{$define NSCELL_PAS_H}
|
{$define NSCELL_PAS_H}
|
||||||
|
|
||||||
{#import <Foundation/NSObject.h>
|
{#import <AppKit/NSText.h>
|
||||||
#import <Foundation/NSGeometry.h>
|
|
||||||
#import <AppKit/NSText.h>
|
|
||||||
#import <AppKit/NSParagraphStyle.h>
|
#import <AppKit/NSParagraphStyle.h>
|
||||||
|
|
||||||
@class NSAttributedString, NSEvent, NSFont, NSFormatter, NSImage, NSMenu, NSText, NSView;}
|
@class NSAttributedString, NSEvent, NSFont, NSFormatter, NSImage, NSMenu, NSText, NSView;}
|
||||||
|
@ -14,9 +14,11 @@
|
|||||||
const
|
const
|
||||||
Str_NSControl = 'NSControl';
|
Str_NSControl = 'NSControl';
|
||||||
|
|
||||||
Str_setStringValue = 'setStringValue:';
|
|
||||||
Str_initWithFrame = 'initWithFrame:';
|
Str_initWithFrame = 'initWithFrame:';
|
||||||
|
Str_setTarget = 'setTarget:';
|
||||||
|
Str_setAction = 'setAction:';
|
||||||
|
Str_setStringValue = 'setStringValue:';
|
||||||
|
|
||||||
{$endif}
|
{$endif}
|
||||||
{$endif}
|
{$endif}
|
||||||
{$ifdef CLASSES}
|
{$ifdef CLASSES}
|
||||||
@ -34,17 +36,17 @@ const
|
|||||||
{+ (void)setCellClass:(Class)factoryId;
|
{+ (void)setCellClass:(Class)factoryId;
|
||||||
+ (Class)cellClass;}
|
+ (Class)cellClass;}
|
||||||
|
|
||||||
constructor initWithFrame(frameRect: NSRect); virtual;
|
constructor initWithFrame(frameRect: NSRect);
|
||||||
{- (void)sizeToFit;
|
{- (void)sizeToFit;
|
||||||
- (void)calcSize;
|
- (void)calcSize;
|
||||||
- (id)cell;
|
- (id)cell;
|
||||||
- (void)setCell:(NSCell *)aCell;
|
- (void)setCell:(NSCell *)aCell;
|
||||||
- (id)selectedCell;
|
- (id)selectedCell;
|
||||||
- (id)target;
|
- (id)target;}
|
||||||
- (void)setTarget:(id)anObject;
|
procedure setTarget(anObject: objc.id);
|
||||||
- (SEL)action;
|
//- (SEL)action;
|
||||||
- (void)setAction:(SEL)aSelector;
|
procedure setAction(aSelector: SEL);
|
||||||
- (int)tag;
|
{- (int)tag;
|
||||||
- (void)setTag:(int)anInt;
|
- (void)setTag:(int)anInt;
|
||||||
- (int)selectedTag;
|
- (int)selectedTag;
|
||||||
- (void)setIgnoresMultiClick:(BOOL)flag;
|
- (void)setIgnoresMultiClick:(BOOL)flag;
|
||||||
@ -150,13 +152,34 @@ type
|
|||||||
var
|
var
|
||||||
vmethod: initWithFrame_t;
|
vmethod: initWithFrame_t;
|
||||||
begin
|
begin
|
||||||
// Allows descendents to set a new ClassId
|
ClassID := getClass();
|
||||||
if ClassID = nil then ClassId := objc_getClass(PChar(Str_NSControl));
|
|
||||||
allocbuf := objc_msgSend(ClassId, sel_registerName(PChar(Str_alloc)), []);
|
allocbuf := objc_msgSend(ClassId, sel_registerName(PChar(Str_alloc)), []);
|
||||||
vmethod := initWithFrame_t(@objc_msgSend);
|
vmethod := initWithFrame_t(@objc_msgSend);
|
||||||
Handle := vmethod(allocbuf, sel_registerName(PChar(Str_initWithFrame)), frameRect);
|
Handle := vmethod(allocbuf, sel_registerName(PChar(Str_initWithFrame)), frameRect);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure NSControl.setTarget(anObject: objc.id);
|
||||||
|
type
|
||||||
|
setTarget_t = procedure (param1: objc.id; param2: SEL;
|
||||||
|
param3: objc.id); cdecl;
|
||||||
|
var
|
||||||
|
vmethod: setTarget_t;
|
||||||
|
begin
|
||||||
|
vmethod := setTarget_t(@objc_msgSend);
|
||||||
|
vmethod(Handle, sel_registerName(PChar(Str_setTarget)), anObject);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure NSControl.setAction(aSelector: SEL);
|
||||||
|
type
|
||||||
|
setAction_t = procedure (param1: objc.id; param2: SEL;
|
||||||
|
param3: SEL); cdecl;
|
||||||
|
var
|
||||||
|
vmethod: setAction_t;
|
||||||
|
begin
|
||||||
|
vmethod := setAction_t(@objc_msgSend);
|
||||||
|
vmethod(Handle, sel_registerName(PChar(Str_setAction)), aSelector);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure NSControl.setStringValue(aString: CFStringRef);
|
procedure NSControl.setStringValue(aString: CFStringRef);
|
||||||
type
|
type
|
||||||
setStringValue_t = procedure (param1: objc.id; param2: SEL;
|
setStringValue_t = procedure (param1: objc.id; param2: SEL;
|
||||||
|
@ -19,6 +19,7 @@ const
|
|||||||
Str_NSStatusBar = 'NSStatusBar';
|
Str_NSStatusBar = 'NSStatusBar';
|
||||||
|
|
||||||
Str_systemStatusBar = 'systemStatusBar';
|
Str_systemStatusBar = 'systemStatusBar';
|
||||||
|
Str_statusItemWithLength = 'statusItemWithLength:';
|
||||||
|
|
||||||
{$endif}
|
{$endif}
|
||||||
{$endif}
|
{$endif}
|
||||||
@ -32,6 +33,9 @@ const
|
|||||||
{@class NSMutableArray;}
|
{@class NSMutableArray;}
|
||||||
|
|
||||||
NSStatusBar = class(NSObject)
|
NSStatusBar = class(NSObject)
|
||||||
|
public
|
||||||
|
{ Extra binding functions }
|
||||||
|
function getClass: objc.id; override;
|
||||||
public
|
public
|
||||||
constructor systemStatusBar();
|
constructor systemStatusBar();
|
||||||
|
|
||||||
@ -47,15 +51,28 @@ const
|
|||||||
{$endif}
|
{$endif}
|
||||||
{$ifdef IMPLEMENTATION}
|
{$ifdef IMPLEMENTATION}
|
||||||
|
|
||||||
|
function NSStatusBar.getClass: objc.id;
|
||||||
|
begin
|
||||||
|
Result := objc_getClass(Str_NSStatusBar);
|
||||||
|
end;
|
||||||
|
|
||||||
constructor NSStatusBar.systemStatusBar();
|
constructor NSStatusBar.systemStatusBar();
|
||||||
begin
|
begin
|
||||||
ClassId := objc_getClass(PChar(Str_NSStatusBar));
|
ClassId := getClass();
|
||||||
Handle := objc_msgSend(ClassId, sel_registerName(PChar(Str_systemStatusBar)), []);
|
Handle := objc_msgSend(ClassId, sel_registerName(PChar(Str_systemStatusBar)), []);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function NSStatusBar.statusItemWithLength(length: cfloat): NSStatusItem;
|
function NSStatusBar.statusItemWithLength(length: cfloat): NSStatusItem;
|
||||||
|
type
|
||||||
|
statusItemWithLength_t = function (param1: objc.id; param2: SEL;
|
||||||
|
param3: cfloat): objc.id; cdecl;
|
||||||
|
var
|
||||||
|
vmethod: statusItemWithLength_t;
|
||||||
|
itemHandle: objc.id;
|
||||||
begin
|
begin
|
||||||
|
vmethod := statusItemWithLength_t(@objc_msgSend);
|
||||||
|
itemHandle := vmethod(Handle, sel_registerName(PChar(Str_statusItemWithLength)), length);
|
||||||
|
Result := NSStatusItem.CreateWithHandle(itemHandle);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure NSStatusBar.removeStatusItem(item: NSStatusItem);
|
procedure NSStatusBar.removeStatusItem(item: NSStatusItem);
|
||||||
|
@ -28,7 +28,9 @@ const
|
|||||||
|
|
||||||
NSTextField = class(NSControl)
|
NSTextField = class(NSControl)
|
||||||
public
|
public
|
||||||
constructor initWithFrame(frameRect: NSRect); override;
|
{ Extra binding functions }
|
||||||
|
function getClass: objc.id; override;
|
||||||
|
public
|
||||||
|
|
||||||
{- (void)setBackgroundColor:(NSColor *)color;
|
{- (void)setBackgroundColor:(NSColor *)color;
|
||||||
- (NSColor *)backgroundColor;
|
- (NSColor *)backgroundColor;
|
||||||
@ -77,10 +79,9 @@ const
|
|||||||
{$endif}
|
{$endif}
|
||||||
{$ifdef IMPLEMENTATION}
|
{$ifdef IMPLEMENTATION}
|
||||||
|
|
||||||
constructor NSTextField.initWithFrame(frameRect: NSRect);
|
function NSTextField.getClass: objc.id;
|
||||||
begin
|
begin
|
||||||
ClassId := objc_getClass(PChar(Str_NSTextField));
|
Result := objc_getClass(Str_NSTextField);
|
||||||
inherited initWithFrame(frameRect);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$endif}
|
{$endif}
|
||||||
|
@ -101,7 +101,6 @@ const
|
|||||||
|
|
||||||
Str_initWithContentRect = 'initWithContentRect:styleMask:backing:defer:';
|
Str_initWithContentRect = 'initWithContentRect:styleMask:backing:defer:';
|
||||||
Str_orderFrontRegardless = 'orderFrontRegardless';
|
Str_orderFrontRegardless = 'orderFrontRegardless';
|
||||||
Str_setTitle = 'setTitle:';
|
|
||||||
Str_contentView = 'contentView';
|
Str_contentView = 'contentView';
|
||||||
|
|
||||||
{$endif}
|
{$endif}
|
||||||
@ -120,6 +119,9 @@ const
|
|||||||
|
|
||||||
NSWindow = class(NSResponder)
|
NSWindow = class(NSResponder)
|
||||||
public
|
public
|
||||||
|
{ Extra binding functions }
|
||||||
|
function getClass: objc.id; override;
|
||||||
|
public
|
||||||
|
|
||||||
|
|
||||||
{+ (NSRect)frameRectForContentRect:(NSRect)cRect styleMask:(unsigned int)aStyle;
|
{+ (NSRect)frameRectForContentRect:(NSRect)cRect styleMask:(unsigned int)aStyle;
|
||||||
@ -477,6 +479,11 @@ const
|
|||||||
{$endif}
|
{$endif}
|
||||||
{$ifdef IMPLEMENTATION}
|
{$ifdef IMPLEMENTATION}
|
||||||
|
|
||||||
|
function NSWindow.getClass: objc.id;
|
||||||
|
begin
|
||||||
|
Result := objc_getClass(Str_NSWindow);
|
||||||
|
end;
|
||||||
|
|
||||||
constructor NSWindow.initWithContentRect(
|
constructor NSWindow.initWithContentRect(
|
||||||
contentRect: NSRect;
|
contentRect: NSRect;
|
||||||
aStyle: cuint;
|
aStyle: cuint;
|
||||||
@ -494,7 +501,7 @@ begin
|
|||||||
styleMask: NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask
|
styleMask: NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask
|
||||||
backing: NSBackingStoreBuffered
|
backing: NSBackingStoreBuffered
|
||||||
defer: NO]; }
|
defer: NO]; }
|
||||||
ClassId := objc_getClass(PChar(Str_NSWindow));
|
ClassId := getClass();
|
||||||
allocbuf := objc_msgSend(ClassId, sel_registerName(PChar(Str_alloc)), []);
|
allocbuf := objc_msgSend(ClassId, sel_registerName(PChar(Str_alloc)), []);
|
||||||
vinit := initWithContentRect_t(@objc_msgSend);
|
vinit := initWithContentRect_t(@objc_msgSend);
|
||||||
Handle := vinit(allocbuf, sel_registerName(PChar(Str_initWithContentRect)),
|
Handle := vinit(allocbuf, sel_registerName(PChar(Str_initWithContentRect)),
|
||||||
|
@ -33,8 +33,8 @@
|
|||||||
<Filename Value="simplewindow.pas"/>
|
<Filename Value="simplewindow.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="simplewindow"/>
|
<UnitName Value="simplewindow"/>
|
||||||
<CursorPos X="31" Y="58"/>
|
<CursorPos X="105" Y="56"/>
|
||||||
<TopLine Value="55"/>
|
<TopLine Value="52"/>
|
||||||
<EditorIndex Value="0"/>
|
<EditorIndex Value="0"/>
|
||||||
<UsageCount Value="106"/>
|
<UsageCount Value="106"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
@ -383,44 +383,7 @@
|
|||||||
<UsageCount Value="10"/>
|
<UsageCount Value="10"/>
|
||||||
</Unit52>
|
</Unit52>
|
||||||
</Units>
|
</Units>
|
||||||
<JumpHistory Count="9" HistoryIndex="8">
|
<JumpHistory Count="0" HistoryIndex="-1"/>
|
||||||
<Position1>
|
|
||||||
<Filename Value="../../appkit/NSApplication.inc"/>
|
|
||||||
<Caret Line="102" Column="32" TopLine="98"/>
|
|
||||||
</Position1>
|
|
||||||
<Position2>
|
|
||||||
<Filename Value="../../appkit/NSApplication.inc"/>
|
|
||||||
<Caret Line="103" Column="16" TopLine="96"/>
|
|
||||||
</Position2>
|
|
||||||
<Position3>
|
|
||||||
<Filename Value="../../appkit/AppKit.inc"/>
|
|
||||||
<Caret Line="14" Column="18" TopLine="7"/>
|
|
||||||
</Position3>
|
|
||||||
<Position4>
|
|
||||||
<Filename Value="../../appkit/AppKit.inc"/>
|
|
||||||
<Caret Line="92" Column="15" TopLine="82"/>
|
|
||||||
</Position4>
|
|
||||||
<Position5>
|
|
||||||
<Filename Value="../../appkit/NSApplication.inc"/>
|
|
||||||
<Caret Line="103" Column="16" TopLine="96"/>
|
|
||||||
</Position5>
|
|
||||||
<Position6>
|
|
||||||
<Filename Value="../../appkit/NSApplication.inc"/>
|
|
||||||
<Caret Line="320" Column="14" TopLine="307"/>
|
|
||||||
</Position6>
|
|
||||||
<Position7>
|
|
||||||
<Filename Value="../../appkit/NSApplication.inc"/>
|
|
||||||
<Caret Line="107" Column="14" TopLine="98"/>
|
|
||||||
</Position7>
|
|
||||||
<Position8>
|
|
||||||
<Filename Value="../../appkit/AppKit.inc"/>
|
|
||||||
<Caret Line="92" Column="15" TopLine="82"/>
|
|
||||||
</Position8>
|
|
||||||
<Position9>
|
|
||||||
<Filename Value="../../appkit/NSView.inc"/>
|
|
||||||
<Caret Line="364" Column="41" TopLine="360"/>
|
|
||||||
</Position9>
|
|
||||||
</JumpHistory>
|
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
<Version Value="5"/>
|
<Version Value="5"/>
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
}
|
}
|
||||||
program simplewindow;
|
program simplewindow;
|
||||||
|
|
||||||
{$mode delphi}
|
{$ifdef fpc}{$mode delphi}{$endif}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
objc, ctypes, FPCMacOSAll, AppKit, Foundation;
|
objc, ctypes, FPCMacOSAll, AppKit, Foundation;
|
||||||
@ -56,12 +56,14 @@ begin
|
|||||||
MainWindow.setTitle(CFTitle);
|
MainWindow.setTitle(CFTitle);
|
||||||
|
|
||||||
{ Adds a NSTextField with a string }
|
{ Adds a NSTextField with a string }
|
||||||
|
|
||||||
|
CFMessage := CFStringCreateWithPascalString(nil, Str_Window_Message, kCFStringEncodingUTF8);
|
||||||
TextFieldRect.origin.x := 0.0;
|
TextFieldRect.origin.x := 0.0;
|
||||||
TextFieldRect.origin.y := 0.0;
|
TextFieldRect.origin.y := 200.0;
|
||||||
TextFieldRect.size.width := 300.0;
|
TextFieldRect.size.width := 300.0;
|
||||||
TextFieldRect.size.height := 500.0;
|
TextFieldRect.size.height := 100.0;
|
||||||
TextField := NSTextField.initWithFrame(TextFieldRect);
|
TextField := NSTextField.initWithFrame(TextFieldRect);
|
||||||
TextField.setStringValue(CFTitle);
|
TextField.setStringValue(CFMessage);
|
||||||
MainWindowView := NSView.CreateWithHandle(MainWindow.contentView);
|
MainWindowView := NSView.CreateWithHandle(MainWindow.contentView);
|
||||||
MainWindowView.addSubview(TextField);
|
MainWindowView.addSubview(TextField);
|
||||||
|
|
||||||
|
@ -22,6 +22,9 @@ const
|
|||||||
NSAutoreleasePool = class(NSObject)
|
NSAutoreleasePool = class(NSObject)
|
||||||
public
|
public
|
||||||
constructor Create; override;
|
constructor Create; override;
|
||||||
|
{ Extra binding functions }
|
||||||
|
function getClass: objc.id; override;
|
||||||
|
public
|
||||||
|
|
||||||
//+ (void)addObject:(id)anObject;
|
//+ (void)addObject:(id)anObject;
|
||||||
|
|
||||||
@ -37,10 +40,15 @@ const
|
|||||||
{$endif}
|
{$endif}
|
||||||
{$ifdef IMPLEMENTATION}
|
{$ifdef IMPLEMENTATION}
|
||||||
|
|
||||||
|
function NSAutoreleasePool.getClass: objc.id;
|
||||||
|
begin
|
||||||
|
Result := objc_getClass(Str_NSAutoreleasePool);
|
||||||
|
end;
|
||||||
|
|
||||||
constructor NSAutoreleasePool.Create;
|
constructor NSAutoreleasePool.Create;
|
||||||
begin
|
begin
|
||||||
{ NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; }
|
{ NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; }
|
||||||
ClassId := objc_getClass(PChar(Str_NSAutoreleasePool));
|
ClassId := getClass();
|
||||||
allocbuf := objc_msgSend(ClassId, sel_registerName(PChar(Str_alloc)), []);
|
allocbuf := objc_msgSend(ClassId, sel_registerName(PChar(Str_alloc)), []);
|
||||||
Handle := objc_msgSend(allocbuf, sel_registerName(PChar(Str_init)), []);
|
Handle := objc_msgSend(allocbuf, sel_registerName(PChar(Str_init)), []);
|
||||||
end;
|
end;
|
||||||
|
@ -67,6 +67,8 @@
|
|||||||
{*********** Base class ***********}
|
{*********** Base class ***********}
|
||||||
|
|
||||||
const
|
const
|
||||||
|
Str_NSObject = 'NSObject';
|
||||||
|
|
||||||
Str_alloc = 'alloc';
|
Str_alloc = 'alloc';
|
||||||
Str_init = 'init';
|
Str_init = 'init';
|
||||||
Str_release = 'release';
|
Str_release = 'release';
|
||||||
@ -103,7 +105,9 @@ FOUNDATION_EXPORT unsigned NSExtraRefCount(id object);}
|
|||||||
constructor Create; virtual;
|
constructor Create; virtual;
|
||||||
constructor CreateWithHandle(aHandle: objc.id);
|
constructor CreateWithHandle(aHandle: objc.id);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
{ Extra binding functions }
|
||||||
|
function getClass: objc.id; virtual;
|
||||||
|
public
|
||||||
{+ (void)load;
|
{+ (void)load;
|
||||||
|
|
||||||
+ (void)initialize;
|
+ (void)initialize;
|
||||||
@ -172,5 +176,10 @@ begin
|
|||||||
objc_msgSend(Handle, sel_registerName(PChar(Str_release)), []);
|
objc_msgSend(Handle, sel_registerName(PChar(Str_release)), []);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function NSObject.getClass: objc.id;
|
||||||
|
begin
|
||||||
|
Result := objc_getClass(Str_NSObject);
|
||||||
|
end;
|
||||||
|
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user