[Mono-osx] [MonoMac] Adding WebKit DOM interfaces

Alexander Shulgin alexander.shulgin at yessoftware.com
Thu Nov 11 06:21:27 EST 2010


On 10.11.2010 18:39, Miguel de Icaza wrote:
>
>     The problem is that these [Model] interfaces aren't converted to any
>     real code during compilation, so `make' complains like
>     `DomEventTarget' does not exist in namespace `MonoMac.WebKit'.
>
>
> They are missing the [BaseType] declaration, that is why they do not work.
> As to what [Model] does. it is described in 'Binding Protocols':
>
> http://monotouch.net/Documentation/Binding_New_Objective-C_Types

Thanks, the link helped a lot.

Attached is what I currently got for DomEvents.  Typical usage:

class ClickHandler : DomEventListener
{
   public override void HandleEvent(DomEvent evt)
   {
     // handle the event
   }
}

this.webView.MainFrameDocument.AddEventListener("click", new 
ClickHandler(), true);

Otherwise, client can still use Export attribute to expose handleEvent:, 
though listening to multiple event types/targets might become difficult.

class MainWindowController : NSWindowController
{
   [Export("handleEvent:")]
   public void HandleEvent(DomEvent evt)
   {
   }
}

Note: added WebKit/DomNode.cs to put the DomEventTarget protocol 
implementation there.

Please push if this looks good.

--
Alex
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0001-Added-DomEvent-DomEventListener-protocol-and-DomNode.patch
Url: http://lists.ximian.com/pipermail/mono-osx/attachments/20101111/9099e68a/attachment.pl 


More information about the Mono-osx mailing list