2 * Copyright(c) 2021 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
21 using System.ComponentModel;
22 using Tizen.NUI.BaseComponents;
24 internal class TransitionItemBase : BaseHandle
27 /// Creates an initialized TransitionItemBase.<br />
29 public TransitionItemBase(View target, bool isEntering, TimePeriod timePeriod, AlphaFunction alphaFunction) : this(Interop.TransitionItemBase.New(/*target.SwigCPtr, isEntering, timePeriod.SwigCPtr*/), true)
31 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
32 AlphaFunction = alphaFunction;
35 internal TransitionItemBase(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
40 /// Gets or sets the TimePeriod
42 public TimePeriod TimePeriod
46 Interop.TransitionItemBase.SetTimePeriod(SwigCPtr, value.SwigCPtr);
47 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
51 TimePeriod ret = new TimePeriod(Interop.TransitionItemBase.GetTimePeriod(SwigCPtr), true);
52 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
58 /// Gets or sets the AlphaFunction
60 public AlphaFunction AlphaFunction
64 Interop.TransitionItemBase.SetAlphaFunction(SwigCPtr, value.SwigCPtr);
65 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
69 AlphaFunction ret = new AlphaFunction(Interop.TransitionItemBase.GetAlphaFunction(SwigCPtr), true);
70 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
76 /// Gets or sets whether the View moves with child or not.
78 public bool TransitionWithChild
82 Interop.TransitionItemBase.TransitionWithChild(SwigCPtr, value);
83 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
88 /// Downcasts a handle to TransitionItemBase handle.<br />
89 /// If handle points to an TransitionItemBase object, the downcast produces a valid handle.<br />
90 /// If not, the returned handle is left uninitialized.<br />
92 /// <param name="handle">Handle to an object.</param>
93 /// <returns>Handle to an TransitionItemBase object or an uninitialized handle.</returns>
94 /// <exception cref="ArgumentNullException"> Thrown when handle is null. </exception>
95 public static TransitionItemBase DownCast(BaseHandle handle)
99 throw new ArgumentNullException(nameof(handle));
101 TransitionItemBase ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as TransitionItemBase;
102 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
106 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TransitionItemBase obj)
108 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
111 internal TransitionItemBase(TransitionItemBase handle) : this(Interop.TransitionItemBase.NewTransitionItemBase(TransitionItemBase.getCPtr(handle)), true)
113 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
116 internal TransitionItemBase Assign(TransitionItemBase rhs)
118 TransitionItemBase ret = new TransitionItemBase(Interop.TransitionItemBase.Assign(SwigCPtr, TransitionItemBase.getCPtr(rhs)), false);
119 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
124 /// To make TransitionItemBase instance be disposed.
126 protected override void Dispose(DisposeTypes type)
135 /// This will not be public opened.
136 [EditorBrowsable(EditorBrowsableState.Never)]
137 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
139 if (swigCPtr.Handle == IntPtr.Zero || this.HasBody() == false)
141 Tizen.Log.Fatal("NUI", $"[ERROR] TransitionItemBase ReleaseSwigCPtr()! IntPtr=0x{swigCPtr.Handle:X} HasBody={this.HasBody()}");
144 Interop.TransitionItemBase.Delete(swigCPtr);
147 private float MilliSecondsToSeconds(int millisec)
149 return (float)millisec / 1000.0f;
152 private int SecondsToMilliSeconds(float sec)
154 return (int)(sec * 1000);