Difference between revisions of "PasCocoa"

From Lazarus wiki
Jump to navigationJump to search
(New page: '''PasCocoa''' is the project to build object oriented bindings to use Cocoa in Pascal. ==Objective-C to Pascal Bindings== ==Example== <delphi> program simplewindow; {$mode delphi} u...)
 
Line 1: Line 1:
 
 
'''PasCocoa''' is the project to build object oriented bindings to use Cocoa in Pascal.
 
'''PasCocoa''' is the project to build object oriented bindings to use Cocoa in Pascal.
  
Line 57: Line 56:
 
==Subversion==
 
==Subversion==
  
svn co https://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr/bindings bindings
+
<pre>
 +
svn co https://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr/bindings/objc objc
 +
svn co https://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr/bindings/pascocoa pascocoa
 +
</pre>

Revision as of 15:39, 17 February 2008

PasCocoa is the project to build object oriented bindings to use Cocoa in Pascal.

Objective-C to Pascal Bindings

Example

<delphi> program simplewindow;

{$mode delphi}

uses

 objc, ctypes, FPCMacOSAll, AppKit, Foundation;

const

 Str_Panel_Title = 'This is the title';
 Str_Panel_Message = 'This is the message';

var

 { classes }
 pool: NSAutoreleasePool;
 MainWindow: NSWindow;
 { strings }
 CFTitle, CFMessage: CFStringRef;
 { sizes }
 MainWindowRect: NSRect;

begin

 {  NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; }
 pool := NSAutoreleasePool.Create;
 // Creates the application NSApp object
 NSApp := NSApplication.sharedApplication;
 // Creates a simple window
 MainWindowRect.origin.x := 300.0;
 MainWindowRect.origin.y := 300.0;
 MainWindowRect.size.width := 300.0;
 MainWindowRect.size.height := 500.0;
 MainWindow := NSWindow.initWithContentRect(MainWindowRect,
   NSTitledWindowMask or NSClosableWindowMask or NSMiniaturizableWindowMask or NSResizableWindowMask,
   NSBackingStoreBuffered, NO);
   
 MainWindow.orderFrontRegardless;

// CreateMenu();

 { Enters main message loop }
 NSApp.run;
 {  [pool release]; }
 pool.Free;

end. </delphi>

Subversion

svn co https://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr/bindings/objc objc
svn co https://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr/bindings/pascocoa pascocoa