[Mono-osx] Lion support

MonoMac Reality Check monomac at reality-check-inc.com
Mon Mar 19 15:20:25 UTC 2012


The question was "how would you easily add Print to NSView without having the source for MonoMac?"

Should I be able to add the following to my application and have it work?

namespace MonoMac.AppKit {
	public partial class NSView : NSResponder {
		static IntPtr selPrint_ = Selector.GetHandle ("print:");

		[Export ("print:")]
		public virtual void Print (NSObject sender)
		{
			Console.WriteLine("NSWindow.Print");
			if (sender == null)
				throw new ArgumentNullException ("sender");
			if (IsDirectBinding) {
				MonoMac.ObjCRuntime.Messaging.void_objc_msgSend_IntPtr (this.Handle, selPrint_, sender.Handle);
			} else {
				MonoMac.ObjCRuntime.Messaging.void_objc_msgSendSuper_IntPtr (this.SuperHandle, selPrint_, sender.Handle);
			}
		}
	}
}

On Mar 19, 2012, at 8:09 AM, Jon Lipsky wrote:

> Here's how you do it:
> 
> // This is what you'd add to an Objective-C class
> - (void)print:(id)sender
> {
> 
> }
> 
> //  Here's what you'd add to a MonoMac class
> [Export("print:")]
> public void Print(NSObject sender)
> {
> 
> }
> 
> 
> On Mar 19, 2012, at 5:54 AM, MonoMac Reality Check wrote:
> 
>> Is there an easy way to add bindings without having the source?
>> 
>> For example, how would you easily add Print to NSView?
>> 
>> On Mar 10, 2012, at 7:20 AM, Jon Lipsky wrote:
>> 
>>> Hi David,
>>> 
>>> It's relatively simple to add additional (missing) binding into MonoMac, and I've never run into any issues using a version built from source.  (As a side note, I'm doing it right now in my current project.)
>>> 
>>> If you run into any problems adding that binding, let me know and I'll help you do it.
>>> 
>>> Jon...
>>> 
>>> On Mar 10, 2012, at 7:56 AM, David Black wrote:
>>> 
>>>> 
>>>> 
>>>> Hi all
>>>> 
>>>> I was wondering if there is any information on when the Lion support for MonoMac will be released? I noticed the other day that Miguel's blog said they were using it quite heavily internally at Xamarin. Is the Lion support tied to a specific Monodevelop release or is it independent? I really need to get at the NSTableView viewForTableColumn method which is available in the lion module.
>>>> 
>>>> I guess I could always build from source and use the GitHub version, does anyone do this? is it relatively safe?
>>>> 
>>>> D
>>>> _______________________________________________
>>>> Mono-osx mailing list
>>>> Mono-osx at lists.ximian.com
>>>> http://lists.ximian.com/mailman/listinfo/mono-osx
>>> 
>>> _______________________________________________
>>> Mono-osx mailing list
>>> Mono-osx at lists.ximian.com
>>> http://lists.ximian.com/mailman/listinfo/mono-osx
>> 
>> _______________________________________________
>> Mono-osx mailing list
>> Mono-osx at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-osx
> 



More information about the Mono-osx mailing list