-
-
Notifications
You must be signed in to change notification settings - Fork 63
Expand file tree
/
Copy pathok_objc.pas
More file actions
50 lines (41 loc) · 1.38 KB
/
ok_objc.pas
File metadata and controls
50 lines (41 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{ Objective-C/Objective-Pascal FPC syntax tests.
See
https://github.com/pasdoc/pasdoc/issues/220
https://wiki.freepascal.org/FPC_PasCocoa
}
{$mode objfpc}
{$modeswitch objectivec2}
unit ok_objc;
interface
type
TSomeCocoaClassObject = objcclass(NSObject)
procedure SomeFunction(someparameter: SomeType); message 'SomeFunction:';
end;
NSSomeObject = objcclass(NSObject)
procedure method(params: Integer); message 'method:';
class procedure classmethod(para: char); override; // "message 'classmethod:'" not required, compiler will get this from the parent class
end;
NSView = objcclass external (NSResponder)
private
_subview : id; // private field
public
function initWithFrame(rect : NSRect): id; message 'initWithFrame:';
procedure addSubview(aview: NSView); message 'addSubview:';
procedure setAutoresizingMask(mask: NSUInteger); message 'setAutoresizingMask:';
procedure setAutoresizesSubviews(flag: LongBool); message 'setAutoresizesSubviews:';
procedure drawRect(dirtyRect: NSRect); message 'drawRect:';
end;
MyView = objcclass(MSView)
public
data : Integer;
procedure customMessage(dirtyRect: NSRect); message 'customMessage';
procedure drawRect(dirtyRect: NSRect); override;
end;
implementation
procedure MyView.customMessage(dirtyRect: NSRect);
begin
end;
procedure MyView.drawRect(dirtyRect: NSRect);
begin
end;
end.