Improves the PasCocoa bindings. Adds a script to parse appkit. NSWindow and NSButton are already taken from the parser.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@447 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
sekelsenmat
2008-05-09 19:51:36 +00:00
parent 81763fac6a
commit bc7c85f132
21 changed files with 3184 additions and 887 deletions

View File

@ -22,11 +22,12 @@ type
public
{ Extra binding functions }
constructor Create; override;
function getClass: objc.id; override;
class function getClass: objc.id; override;
procedure AddMethods; override;
{ Objective-c Methods }
class procedure doShowStatusitem(_self: objc.id; _cmd: SEL; sender: objc.id); cdecl; static;
class procedure doHideStatusitem(_self: objc.id; _cmd: SEL; sender: objc.id); cdecl; static;
class procedure doClose(_self: objc.id; _cmd: SEL; sender: objc.id); cdecl; static;
class function applicationShouldTerminateAfterLastWindowClosed(_self: objc.id;
_cmd: SEL; theApplication: objc.id): cbool; cdecl; static;
{ Other helper functions }
@ -45,11 +46,20 @@ const
Str_doShowStatusitem = 'doShowStatusitem:';
Str_doHideStatusitem = 'doHideStatusitem:';
Str_doClose = 'doClose:';
Str_applicationShouldTerminateAfterLastWindowClosed = 'applicationShouldTerminateAfterLastWindowClosed:';
var
myController: TMyController;
{ classes }
pool: NSAutoreleasePool;
MainWindow: NSWindow;
MainWindowView: NSView;
{ strings and sizes}
CFTitle: CFStringRef;
MainWindowRect: NSRect;
implementation
{ TMyController }
@ -67,6 +77,7 @@ procedure TMyController.AddMethods;
begin
AddMethod(Str_doShowStatusItem, 'v@:@', Pointer(doShowStatusitem));
AddMethod(Str_doHideStatusitem, 'v@:@', Pointer(doHideStatusitem));
AddMethod(Str_doClose, 'v@:@', Pointer(doClose));
AddMethod(Str_applicationShouldTerminateAfterLastWindowClosed, 'b@:@',
Pointer(applicationShouldTerminateAfterLastWindowClosed));
end;
@ -88,7 +99,7 @@ begin
image := NSImage.initWithContentsOfFile(fileName);
end;
function TMyController.getClass: objc.id;
class function TMyController.getClass: objc.id;
begin
Result := objc_getClass(Str_TMyController);
end;
@ -112,6 +123,11 @@ begin
myController.item := nil;
end;
class procedure TMyController.doClose(_self: objc.id; _cmd: SEL; sender: objc.id); cdecl;
begin
MainWindow.close;
end;
class function TMyController.applicationShouldTerminateAfterLastWindowClosed(_self: objc.id;
_cmd: SEL; theApplication: objc.id): cbool; cdecl;
begin