[Mono-osx] [MonoMac] Adding WebView delegate classes

Alexander Shulgin alexander.shulgin at yessoftware.com
Thu Nov 11 06:39:51 EST 2010


Hello,

attached is my attempt at adding strongly-typed WebView delegates. 
Please take a look.

I'm not really sure about "webView:setStatusText:" vs. 
"webViewStatusText:" naming:

		[Export ("webView:setStatusText:")]
		void SetStatusText (WebView sender, string text);

		[Export ("webViewStatusText:")]
		string WebViewStatusText (WebView sender);

As a rule of thumb, I just dropped "WebView" prefix from method name if 
it comes as "webView:" in selector.  Feel free to correct if you 
understand it better.

Usage:

class UIDelegate : WebUIDelegate
{
   public override void MouseDidMoveOverElement(WebView sender, 
NSDictionary elementInformation, uint modifierFlags)
   {
   }

   ...
}

this.webView.UIDelegate = new UIDelegate();

or

class MainWindowController : NSWindowController
{
   [Export("webView:mouseDidMoveOverElement:modifierFlags:")]
   public override void MouseDidMoveOverElement(WebView sender, 
NSDictionary elementInformation, uint modifierFlags)
   {
   }

   ...

   {
     this.webView.WeakUIDelegate = this;
   }
}

--
Alex
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0001-Adding-WebView-delegate-protocols.patch
Url: http://lists.ximian.com/pipermail/mono-osx/attachments/20101111/02efbeb5/attachment.pl 


More information about the Mono-osx mailing list