[Mono-osx] [ANN] cocoa3-sharp 0.1

Jesse Jones jesjones at mindspring.com
Mon Jun 23 22:21:55 EDT 2008


cocoa3-sharp is a mono library which wraps the appkit and foundation  
frameworks. It relies on the objc3-sharp library. You can download  
cocoa3-sharp from <http://code.google.com/p/cocoa3-sharp/>. The  
library is still missing a lot of methods and classes, but it's  
trivial to add these and there's a non-trivial document oriented  
example included in the source (a gui wrapper around make).

Usage looks like this:

[ExportClass("DocController", "NSDocumentController")]
internal sealed class DocController : NSDocumentController
{
     private DocController(IntPtr instance) : base(instance)
     {
     }

     [OverrideMethod("runModalOpenPanel:forTypes:")]
     public int RunModalOpenPanelForTypes(NSOpenPanel openPanel,  
NSObject extensions)
     {
         openPanel.Delegate = this;

         return (int) SuperCall("runModalOpenPanel:forTypes:",  
openPanel, extensions);
     }

     [NewMethod("panel:shouldShowFilename:")]
     public bool PanelShouldShowFilename(NSObject sender, NSString  
fileName)
     {
         string name = fileName.ToString();
         if (Directory.Exists(name))
             return true;

         name = Path.GetFileName(name);
         return name == "Makefile";
     }
}

   -- Jesse


More information about the Mono-osx mailing list