mirror of
https://gitee.com/csharpui/CPF.git
synced 2025-04-05 17:37:51 +08:00
167 lines
4.5 KiB
C#
167 lines
4.5 KiB
C#
using CPF.Mac.Foundation;
|
|
using CPF.Mac.ObjCRuntime;
|
|
using System;
|
|
using System.ComponentModel;
|
|
|
|
namespace CPF.Mac.CoreData
|
|
{
|
|
[Register("NSPropertyMapping", true)]
|
|
public class NSPropertyMapping : NSObject
|
|
{
|
|
private static readonly IntPtr selNameHandle = Selector.GetHandle("name");
|
|
|
|
private static readonly IntPtr selSetName_Handle = Selector.GetHandle("setName:");
|
|
|
|
private static readonly IntPtr selValueExpressionHandle = Selector.GetHandle("valueExpression");
|
|
|
|
private static readonly IntPtr selSetValueExpression_Handle = Selector.GetHandle("setValueExpression:");
|
|
|
|
private static readonly IntPtr selUserInfoHandle = Selector.GetHandle("userInfo");
|
|
|
|
private static readonly IntPtr selSetUserInfo_Handle = Selector.GetHandle("setUserInfo:");
|
|
|
|
private static readonly IntPtr class_ptr = Class.GetHandle("NSPropertyMapping");
|
|
|
|
private object __mt_ValueExpression_var;
|
|
|
|
private object __mt_UserInfo_var;
|
|
|
|
public override IntPtr ClassHandle => class_ptr;
|
|
|
|
public virtual string Name
|
|
{
|
|
[Export("name")]
|
|
get
|
|
{
|
|
if (IsDirectBinding)
|
|
{
|
|
return NSString.FromHandle(Messaging.IntPtr_objc_msgSend(base.Handle, selNameHandle));
|
|
}
|
|
return NSString.FromHandle(Messaging.IntPtr_objc_msgSendSuper(base.SuperHandle, selNameHandle));
|
|
}
|
|
[Export("setName:")]
|
|
set
|
|
{
|
|
if (value == null)
|
|
{
|
|
throw new ArgumentNullException("value");
|
|
}
|
|
IntPtr intPtr = NSString.CreateNative(value);
|
|
if (IsDirectBinding)
|
|
{
|
|
Messaging.void_objc_msgSend_IntPtr(base.Handle, selSetName_Handle, intPtr);
|
|
}
|
|
else
|
|
{
|
|
Messaging.void_objc_msgSendSuper_IntPtr(base.SuperHandle, selSetName_Handle, intPtr);
|
|
}
|
|
NSString.ReleaseNative(intPtr);
|
|
}
|
|
}
|
|
|
|
public virtual NSExpression ValueExpression
|
|
{
|
|
[Export("valueExpression")]
|
|
get
|
|
{
|
|
return (NSExpression)(__mt_ValueExpression_var = ((!IsDirectBinding) ? ((NSExpression)Runtime.GetNSObject(Messaging.IntPtr_objc_msgSendSuper(base.SuperHandle, selValueExpressionHandle))) : ((NSExpression)Runtime.GetNSObject(Messaging.IntPtr_objc_msgSend(base.Handle, selValueExpressionHandle)))));
|
|
}
|
|
[Export("setValueExpression:")]
|
|
set
|
|
{
|
|
if (value == null)
|
|
{
|
|
throw new ArgumentNullException("value");
|
|
}
|
|
if (IsDirectBinding)
|
|
{
|
|
Messaging.void_objc_msgSend_IntPtr(base.Handle, selSetValueExpression_Handle, value.Handle);
|
|
}
|
|
else
|
|
{
|
|
Messaging.void_objc_msgSendSuper_IntPtr(base.SuperHandle, selSetValueExpression_Handle, value.Handle);
|
|
}
|
|
__mt_ValueExpression_var = value;
|
|
}
|
|
}
|
|
|
|
public virtual NSDictionary UserInfo
|
|
{
|
|
[Export("userInfo")]
|
|
get
|
|
{
|
|
return (NSDictionary)(__mt_UserInfo_var = ((!IsDirectBinding) ? ((NSDictionary)Runtime.GetNSObject(Messaging.IntPtr_objc_msgSendSuper(base.SuperHandle, selUserInfoHandle))) : ((NSDictionary)Runtime.GetNSObject(Messaging.IntPtr_objc_msgSend(base.Handle, selUserInfoHandle)))));
|
|
}
|
|
[Export("setUserInfo:")]
|
|
set
|
|
{
|
|
if (value == null)
|
|
{
|
|
throw new ArgumentNullException("value");
|
|
}
|
|
if (IsDirectBinding)
|
|
{
|
|
Messaging.void_objc_msgSend_IntPtr(base.Handle, selSetUserInfo_Handle, value.Handle);
|
|
}
|
|
else
|
|
{
|
|
Messaging.void_objc_msgSendSuper_IntPtr(base.SuperHandle, selSetUserInfo_Handle, value.Handle);
|
|
}
|
|
__mt_UserInfo_var = value;
|
|
}
|
|
}
|
|
|
|
[EditorBrowsable(EditorBrowsableState.Advanced)]
|
|
[Export("init")]
|
|
public NSPropertyMapping()
|
|
: base(NSObjectFlag.Empty)
|
|
{
|
|
if (IsDirectBinding)
|
|
{
|
|
base.Handle = Messaging.IntPtr_objc_msgSend(base.Handle, Selector.Init);
|
|
}
|
|
else
|
|
{
|
|
base.Handle = Messaging.IntPtr_objc_msgSendSuper(base.SuperHandle, Selector.Init);
|
|
}
|
|
}
|
|
|
|
[EditorBrowsable(EditorBrowsableState.Advanced)]
|
|
[Export("initWithCoder:")]
|
|
public NSPropertyMapping(NSCoder coder)
|
|
: base(NSObjectFlag.Empty)
|
|
{
|
|
if (IsDirectBinding)
|
|
{
|
|
base.Handle = Messaging.IntPtr_objc_msgSend_IntPtr(base.Handle, Selector.InitWithCoder, coder.Handle);
|
|
}
|
|
else
|
|
{
|
|
base.Handle = Messaging.IntPtr_objc_msgSendSuper_IntPtr(base.SuperHandle, Selector.InitWithCoder, coder.Handle);
|
|
}
|
|
}
|
|
|
|
[EditorBrowsable(EditorBrowsableState.Advanced)]
|
|
public NSPropertyMapping(NSObjectFlag t)
|
|
: base(t)
|
|
{
|
|
}
|
|
|
|
[EditorBrowsable(EditorBrowsableState.Advanced)]
|
|
public NSPropertyMapping(IntPtr handle)
|
|
: base(handle)
|
|
{
|
|
}
|
|
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
base.Dispose(disposing);
|
|
if (base.Handle == IntPtr.Zero)
|
|
{
|
|
__mt_ValueExpression_var = null;
|
|
__mt_UserInfo_var = null;
|
|
}
|
|
}
|
|
}
|
|
}
|