|
| 1 | +// <auto-generated /> |
| 2 | + |
| 3 | +#nullable enable |
| 4 | + |
| 5 | +using AVFoundation; |
| 6 | +using CoreGraphics; |
| 7 | +using Foundation; |
| 8 | +using ObjCBindings; |
| 9 | +using ObjCRuntime; |
| 10 | +using System; |
| 11 | +using System.ComponentModel; |
| 12 | +using System.Diagnostics; |
| 13 | +using System.Diagnostics.CodeAnalysis; |
| 14 | +using System.Drawing; |
| 15 | +using System.Runtime.InteropServices; |
| 16 | +using System.Runtime.Versioning; |
| 17 | + |
| 18 | +namespace UIKit; |
| 19 | + |
| 20 | +[SupportedOSPlatform ("macos")] |
| 21 | +[SupportedOSPlatform ("ios")] |
| 22 | +[SupportedOSPlatform ("tvos")] |
| 23 | +[SupportedOSPlatform ("maccatalyst13.1")] |
| 24 | +[Register ("NSCodingSubclass", true)] |
| 25 | +public partial class NSCodingSubclass |
| 26 | +{ |
| 27 | + [BindingImpl (BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)] |
| 28 | + static readonly global::ObjCRuntime.NativeHandle class_ptr = global::ObjCRuntime.Class.GetHandle ("NSCodingSubclass"); |
| 29 | + |
| 30 | + /// <summary>The Objective-C class handle for this class.</summary> |
| 31 | + /// <value>The pointer to the Objective-C class.</value> |
| 32 | + /// <remarks> |
| 33 | + /// Each managed class mirrors an unmanaged Objective-C class. |
| 34 | + /// This value contains the pointer to the Objective-C class. |
| 35 | + /// It is similar to calling the managed <see cref=\"ObjCRuntime.Class.GetHandle(string)\" /> or the native <see href=\"https://developer.apple.com/documentation/objectivec/1418952-objc_getclass\">objc_getClass</see> method with the type name. |
| 36 | + /// </remarks> |
| 37 | + public override global::ObjCRuntime.NativeHandle ClassHandle => class_ptr; |
| 38 | + |
| 39 | + /// <summary>Creates a new <see cref="NSCodingSubclass" /> with default values.</summary> |
| 40 | + [BindingImpl (BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)] |
| 41 | + [DesignatedInitializer] |
| 42 | + [Export ("init")] |
| 43 | + public NSCodingSubclass () : base (global::Foundation.NSObjectFlag.Empty) |
| 44 | + { |
| 45 | + if (IsDirectBinding) |
| 46 | + InitializeHandle (global::ObjCRuntime.Messaging.IntPtr_objc_msgSend (this.Handle, global::ObjCRuntime.Selector.GetHandle ("init")), "init"); |
| 47 | + else |
| 48 | + InitializeHandle (global::ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper (this.SuperHandle, global::ObjCRuntime.Selector.GetHandle ("init")), "init"); |
| 49 | + } |
| 50 | + |
| 51 | + /// <summary>Constructor to call on derived classes to skip initialization and merely allocate the object.</summary> |
| 52 | + /// <param name="t">Unused sentinel value, pass NSObjectFlag.Empty.</param> |
| 53 | + /// <remarks> |
| 54 | + /// <para> |
| 55 | + /// This constructor should be called by derived classes when they completely construct the object in managed code and merely want the runtime to allocate and initialize the <see cref="Foundation.NSObject" />. |
| 56 | + /// This is required to implement the two-step initialization process that Objective-C uses, the first step is to perform the object allocation, the second step is to initialize the object. |
| 57 | + /// When developers invoke this constructor, they take advantage of a direct path that goes all the way up to <see cref="Foundation.NSObject" /> to merely allocate the object's memory and bind the Objective-C and C# objects together. |
| 58 | + /// The actual initialization of the object is up to the developer. |
| 59 | + /// </para> |
| 60 | + /// <para> |
| 61 | + /// This constructor is typically used by the binding generator to allocate the object, but prevent the actual initialization to take place. |
| 62 | + /// Once the allocation has taken place, the constructor has to initialize the object. |
| 63 | + /// With constructors generated by the binding generator this means that it manually invokes one of the "init" methods to initialize the object. |
| 64 | + /// </para> |
| 65 | + /// <para>It is the developer's responsibility to completely initialize the object if they chain up using this constructor chain.</para> |
| 66 | + /// <para> |
| 67 | + /// In general, if the developer's constructor invokes the corresponding base implementation, then it should also call an Objective-C init method. |
| 68 | + /// If this is not the case, developers should instead chain to the proper constructor in their class. |
| 69 | + /// </para> |
| 70 | + /// <para> |
| 71 | + /// The argument value is ignored and merely ensures that the only code that is executed is the construction phase is the basic <see cref="Foundation.NSObject" /> allocation and runtime type registration. |
| 72 | + /// Typically the chaining would look like this: |
| 73 | + /// </para> |
| 74 | + /// <example> |
| 75 | + /// <code lang="csharp lang-csharp"><![CDATA[ |
| 76 | + /// // |
| 77 | + /// // The NSObjectFlag constructor merely allocates the object and registers the C# class with the Objective-C runtime if necessary. |
| 78 | + /// // No actual initXxx method is invoked, that is done later in the constructor |
| 79 | + /// // |
| 80 | + /// // This is taken from the iOS SDK's source code for the UIView class: |
| 81 | + /// // |
| 82 | + /// [Export ("initWithFrame:")] |
| 83 | + /// public UIView (System.Drawing.RectangleF frame) : base (NSObjectFlag.Empty) |
| 84 | + /// { |
| 85 | + /// // Invoke the init method now. |
| 86 | + /// var initWithFrame = new Selector ("initWithFrame:").Handle; |
| 87 | + /// if (IsDirectBinding) { |
| 88 | + /// Handle = ObjCRuntime.Messaging.IntPtr_objc_msgSend_CGRect (this.Handle, initWithFrame, frame); |
| 89 | + /// } else { |
| 90 | + /// Handle = ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper_CGRect (this.SuperHandle, initWithFrame, frame); |
| 91 | + /// } |
| 92 | + /// } |
| 93 | + /// ]]></code> |
| 94 | + /// </example> |
| 95 | + /// </remarks> |
| 96 | + [BindingImpl (BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)] |
| 97 | + [EditorBrowsable (EditorBrowsableState.Advanced)] |
| 98 | + protected NSCodingSubclass (global::Foundation.NSObjectFlag t) : base (t) {} |
| 99 | + |
| 100 | + /// <summary>A constructor used when creating managed representations of unmanaged objects. Called by the runtime.</summary> |
| 101 | + /// <param name="handle">Pointer (handle) to the unmanaged object.</param> |
| 102 | + /// <remarks> |
| 103 | + /// <para> |
| 104 | + /// This constructor is invoked by the runtime infrastructure (<see cref="ObjCRuntime.Runtime.GetNSObject(System.IntPtr)" />) to create a new managed representation for a pointer to an unmanaged Objective-C object. |
| 105 | + /// Developers should not invoke this method directly, instead they should call <see cref="ObjCRuntime.Runtime.GetNSObject(System.IntPtr)" /> as it will prevent two instances of a managed object pointing to the same native object. |
| 106 | + /// </para> |
| 107 | + /// </remarks> |
| 108 | + [BindingImpl (BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)] |
| 109 | + [EditorBrowsable (EditorBrowsableState.Advanced)] |
| 110 | + protected internal NSCodingSubclass (global::ObjCRuntime.NativeHandle handle) : base (handle) {} |
| 111 | + |
| 112 | + /// <summary>A constructor that initializes the object from the data stored in the unarchiver object.</summary> |
| 113 | + /// <param name="coder">The unarchiver object.</param> |
| 114 | + /// <remarks> |
| 115 | + /// <para>This constructor is provided to allow the class to be initialized from an unarchiver (for example, during NIB deserialization). This is part of the <see cref="Foundation.NSCoding" /> protocol.</para> |
| 116 | + /// <para>If developers want to create a subclass of this object and continue to support deserialization from an archive, they should implement a constructor with an identical signature: taking a single parameter of type <see cref="Foundation.NSCoder" /> and decorate it with the <c>[Export("initWithCoder:"]</c> attribute.</para> |
| 117 | + /// <para>The state of this object can also be serialized by using the <see cref="Foundation.INSCoding.EncodeTo" /> companion method.</para> |
| 118 | + /// </remarks> |
| 119 | + [BindingImpl (BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)] |
| 120 | + [DesignatedInitializer] |
| 121 | + [EditorBrowsable (EditorBrowsableState.Advanced)] |
| 122 | + [Export ("initWithCoder:")] |
| 123 | + public NSCodingSubclass (NSCoder coder) : base (NSObjectFlag.Empty) |
| 124 | + { |
| 125 | + UIKit.UIApplication.EnsureUIThread (); |
| 126 | + |
| 127 | + if (IsDirectBinding) { |
| 128 | + InitializeHandle (global::ObjCRuntime.Messaging.IntPtr_objc_msgSend_IntPtr (this.Handle, Selector.GetHandle ("initWithCoder:"), coder.Handle), "initWithCoder:"); |
| 129 | + } else { |
| 130 | + InitializeHandle (global::ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper_IntPtr (this.SuperHandle, Selector.GetHandle ("initWithCoder::"), coder.Handle), "initWithCoder:"); |
| 131 | + } |
| 132 | + GC.KeepAlive (coder); |
| 133 | + } |
| 134 | +} |
0 commit comments