From e41482071072293d5a5371099360ed4c2b15a454 Mon Sep 17 00:00:00 2001 From: Woochan Lee Date: Mon, 6 Jan 2025 19:03:47 +0900 Subject: [PATCH] [NUI] Remove unnecessary PInvoke calls --- .../src/public/Common/NUIConstants.cs | 159 +++--------------- 1 file changed, 24 insertions(+), 135 deletions(-) diff --git a/src/Tizen.NUI/src/public/Common/NUIConstants.cs b/src/Tizen.NUI/src/public/Common/NUIConstants.cs index c32a9c5dbeb..58cb76e2eb1 100755 --- a/src/Tizen.NUI/src/public/Common/NUIConstants.cs +++ b/src/Tizen.NUI/src/public/Common/NUIConstants.cs @@ -1323,210 +1323,99 @@ public struct SelectionPopupStyleProperty /// 3 public struct ParentOrigin { + private static readonly Position topLeft = new Position(Top, Left, Middle); + private static readonly Position topCenter = new Position(Top, Middle, Middle); + private static readonly Position topRight = new Position(Top, Right, Middle); + private static readonly Position centerLeft = new Position(Middle, Left, Middle); + private static readonly Position center = new Position(Middle, Middle, Middle); + private static readonly Position centerRight = new Position(Middle, Right, Middle); + private static readonly Position bottomLeft = new Position(Bottom, Left, Middle); + private static readonly Position bottomCenter = new Position(Bottom, Middle, Middle); + private static readonly Position bottomRight = new Position(Bottom, Right, Middle); + /// /// Top /// /// 3 - public static float Top - { - get - { - float ret = Interop.NDalicParentOrigin.ParentOriginTopGet(); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); - return ret; - } - } + public static float Top => 0.0f; /// /// Bottom /// /// 3 - public static float Bottom - { - get - { - float ret = Interop.NDalicParentOrigin.ParentOriginBottomGet(); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); - return ret; - } - } + public static float Bottom => 1.0f; /// /// Left /// /// 3 - public static float Left - { - get - { - float ret = Interop.NDalicParentOrigin.ParentOriginLeftGet(); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); - return ret; - } - } + public static float Left => 0.0f; /// /// Right /// /// 3 - public static float Right - { - get - { - float ret = Interop.NDalicParentOrigin.ParentOriginRightGet(); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); - return ret; - } - } + public static float Right => 1.0f; /// /// Middle /// /// 3 - public static float Middle - { - get - { - float ret = Interop.NDalicParentOrigin.ParentOriginMiddleGet(); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); - return ret; - } - } + public static float Middle => 0.5f; /// /// TopLeft /// /// 3 - public static Position TopLeft - { - get - { - global::System.IntPtr cPtr = Interop.NDalicParentOrigin.ParentOriginTopLeftGet(); - Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); - return ret; - } - } + public static Position TopLeft => topLeft; /// /// TopCenter /// /// 3 - public static Position TopCenter - { - get - { - global::System.IntPtr cPtr = Interop.NDalicParentOrigin.ParentOriginTopCenterGet(); - Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); - return ret; - } - } + public static Position TopCenter => topCenter; /// /// TopRight /// /// 3 - public static Position TopRight - { - get - { - global::System.IntPtr cPtr = Interop.NDalicParentOrigin.ParentOriginTopRightGet(); - Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); - return ret; - } - } + public static Position TopRight => topRight; /// /// CenterLeft /// /// 3 - public static Position CenterLeft - { - get - { - global::System.IntPtr cPtr = Interop.NDalicParentOrigin.ParentOriginCenterLeftGet(); - Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); - return ret; - } - } + public static Position CenterLeft => centerLeft; /// /// Center /// /// 3 - public static Position Center - { - get - { - global::System.IntPtr cPtr = Interop.NDalicParentOrigin.ParentOriginCenterGet(); - Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); - return ret; - } - } + public static Position Center => center; /// /// CenterRight /// /// 3 - public static Position CenterRight - { - get - { - global::System.IntPtr cPtr = Interop.NDalicParentOrigin.ParentOriginCenterRightGet(); - Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); - return ret; - } - } + public static Position CenterRight => centerRight; /// /// BottomLeft /// /// 3 - public static Position BottomLeft - { - get - { - global::System.IntPtr cPtr = Interop.NDalicParentOrigin.ParentOriginBottomLeftGet(); - Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); - return ret; - } - } + public static Position BottomLeft => bottomLeft; /// /// BottomCenter /// /// 3 - public static Position BottomCenter - { - get - { - global::System.IntPtr cPtr = Interop.NDalicParentOrigin.ParentOriginBottomCenterGet(); - Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); - return ret; - } - } + public static Position BottomCenter => bottomCenter; /// /// BottomRight /// /// 3 - public static Position BottomRight - { - get - { - global::System.IntPtr cPtr = Interop.NDalicParentOrigin.ParentOriginBottomRightGet(); - Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); - return ret; - } - } + public static Position BottomRight => bottomRight; } ///