Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Extensions.cs « Xamarin.PropertyEditing.Mac - github.com/xamarin/Xamarin.PropertyEditing.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: de9fdceee357d9d61155cb969c996ed2fa822c38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using System;
using System.Runtime.InteropServices;
using AppKit;
using Foundation;

namespace Xamarin.PropertyEditing.Mac
{
	internal static class Extensions
	{
		internal const string LIBOBJC_DYLIB = "/usr/lib/libobjc.dylib";

		[DllImport (LIBOBJC_DYLIB, EntryPoint = "objc_msgSend")]
		public extern static void void_objc_msgSend_intptr (IntPtr receiver, IntPtr selector, IntPtr arg1);

		const string selSetFormatter = "setFormatter:";
		static readonly IntPtr selSetFormatter_Handle = ObjCRuntime.Selector.GetHandle (selSetFormatter);

		internal static void SetFormatter (this NumericSpinEditor control, NSFormatter formatter)
		{
			IntPtr pointer = formatter != null ? formatter.Handle : IntPtr.Zero;
			void_objc_msgSend_intptr (control.NumericEditor.Handle, selSetFormatter_Handle, pointer);
		}
	}
}