summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.MacOS/Controls
diff options
context:
space:
mode:
authorMarko B. Ludolph <MarkoBL@users.noreply.github.com>2017-08-14 21:16:36 +0200
committerRui Marinho <me@ruimarinho.net>2017-08-14 20:16:36 +0100
commit8723ed1b52c64788b4692a011769d7fc818c3b23 (patch)
tree60b140ff6cb3a8fdfdf7492bf5ff968428c498f7 /Xamarin.Forms.Platform.MacOS/Controls
parent9adeedceb96d918745fa9a19e72869f153c9e01b (diff)
downloadxamarin-forms-8723ed1b52c64788b4692a011769d7fc818c3b23.tar.gz
xamarin-forms-8723ed1b52c64788b4692a011769d7fc818c3b23.tar.bz2
xamarin-forms-8723ed1b52c64788b4692a011769d7fc818c3b23.zip
macOS: Fix for "Cannot register two managed types ('NSToolbarItemGroup')" (#1097)
Diffstat (limited to 'Xamarin.Forms.Platform.MacOS/Controls')
-rw-r--r--Xamarin.Forms.Platform.MacOS/Controls/NSToolbarItemGroup.cs102
1 files changed, 0 insertions, 102 deletions
diff --git a/Xamarin.Forms.Platform.MacOS/Controls/NSToolbarItemGroup.cs b/Xamarin.Forms.Platform.MacOS/Controls/NSToolbarItemGroup.cs
deleted file mode 100644
index ee02293c..00000000
--- a/Xamarin.Forms.Platform.MacOS/Controls/NSToolbarItemGroup.cs
+++ /dev/null
@@ -1,102 +0,0 @@
-using System;
-using System.Runtime.InteropServices;
-using AppKit;
-using Foundation;
-using ObjCRuntime;
-
-[Register("NSToolbarItemGroup", true)]
-// ReSharper disable once CheckNamespace
-// ReSharper disable once InconsistentNaming
-public class NSToolbarItemGroup : NSToolbarItem
-{
- const string SelSetSubitems = "setSubitems:";
- const string SelSubitems = "subitems";
- const string SelInitWithItemIdentifier = "initWithItemIdentifier:";
- static readonly IntPtr s_selSetSubitemsHandle = Selector.GetHandle(SelSetSubitems);
- static readonly IntPtr s_selSubitemsHandle = Selector.GetHandle(SelSubitems);
- static readonly IntPtr s_selInitWithItemIdentifierHandle = Selector.GetHandle(SelInitWithItemIdentifier);
- static readonly IntPtr s_classPtr = Class.GetHandle("NSToolbarItemGroup");
-
- [Export("init")]
- public NSToolbarItemGroup() : base(NSObjectFlag.Empty)
- {
- InitializeHandle(
- IsDirectBinding
- ? IntPtr_objc_msgSend(Handle, Selector.GetHandle("init"))
- : IntPtr_objc_msgSendSuper(SuperHandle, Selector.GetHandle("init")), "init");
- }
-
- [Export("initWithItemIdentifier:")]
- public NSToolbarItemGroup(string itemIdentifier)
- : base(NSObjectFlag.Empty)
- {
- NSApplication.EnsureUIThread();
- if (itemIdentifier == null)
- throw new ArgumentNullException(nameof(itemIdentifier));
- IntPtr nsitemIdentifier = NSString.CreateNative(itemIdentifier);
-
- InitializeHandle(
- IsDirectBinding
- ? IntPtr_objc_msgSend_IntPtr(Handle, s_selInitWithItemIdentifierHandle, nsitemIdentifier)
- : IntPtr_objc_msgSendSuper_IntPtr(SuperHandle, s_selInitWithItemIdentifierHandle, nsitemIdentifier),
- "initWithItemIdentifier:");
- NSString.ReleaseNative(nsitemIdentifier);
- }
-
- protected internal NSToolbarItemGroup(IntPtr handle) : base(handle)
- {
- }
-
- protected NSToolbarItemGroup(NSObjectFlag t) : base(t)
- {
- }
-
- public override IntPtr ClassHandle => s_classPtr;
-
- public virtual NSToolbarItem[] Subitems
- {
- [Export(SelSubitems, ArgumentSemantic.Copy)]
- get
- {
- NSApplication.EnsureUIThread();
- NSToolbarItem[] ret =
- NSArray.ArrayFromHandle<NSToolbarItem>(IsDirectBinding
- ? IntPtr_objc_msgSend(Handle, s_selSubitemsHandle)
- : IntPtr_objc_msgSendSuper(SuperHandle, s_selSubitemsHandle));
- return ret;
- }
-
- [Export(SelSetSubitems, ArgumentSemantic.Copy)]
- set
- {
- NSApplication.EnsureUIThread();
- if (value == null)
- throw new ArgumentNullException(nameof(value));
- // ReSharper disable once CoVariantArrayConversion
- NSArray nsaValue = NSArray.FromNSObjects(value);
-
- if (IsDirectBinding)
- void_objc_msgSend_IntPtr(Handle, s_selSetSubitemsHandle, nsaValue.Handle);
- else void_objc_msgSendSuper_IntPtr(SuperHandle, s_selSetSubitemsHandle, nsaValue.Handle);
- nsaValue.Dispose();
- }
- }
-
- [DllImport("/usr/lib/libobjc.dylib", EntryPoint = "objc_msgSend")]
- public static extern IntPtr IntPtr_objc_msgSend(IntPtr receiver, IntPtr selector);
-
- [DllImport("/usr/lib/libobjc.dylib", EntryPoint = "objc_msgSend")]
- public static extern IntPtr IntPtr_objc_msgSend_IntPtr(IntPtr receiver, IntPtr selector, IntPtr arg1);
-
- [DllImport("/usr/lib/libobjc.dylib", EntryPoint = "objc_msgSendSuper")]
- public static extern IntPtr IntPtr_objc_msgSendSuper(IntPtr receiver, IntPtr selector);
-
- [DllImport("/usr/lib/libobjc.dylib", EntryPoint = "objc_msgSendSuper")]
- public static extern IntPtr IntPtr_objc_msgSendSuper_IntPtr(IntPtr receiver, IntPtr selector, IntPtr arg1);
-
- [DllImport("/usr/lib/libobjc.dylib", EntryPoint = "objc_msgSend")]
- public static extern void void_objc_msgSend_IntPtr(IntPtr receiver, IntPtr selector, IntPtr arg1);
-
- [DllImport("/usr/lib/libobjc.dylib", EntryPoint = "objc_msgSendSuper")]
- public static extern void void_objc_msgSendSuper_IntPtr(IntPtr receiver, IntPtr selector, IntPtr arg1);
-} \ No newline at end of file