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 isAppearing, TimePeriod timePeriod, AlphaFunction alphaFunction) : this(Interop.TransitionItemBase.New(), true)
31 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
33 AppearingTransition = isAppearing;
34 TimePeriod = timePeriod;
35 AlphaFunction = alphaFunction;
38 internal TransitionItemBase(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
43 /// Gets or sets the TimePeriod
45 public TimePeriod TimePeriod
49 Interop.TransitionItemBase.SetTimePeriod(SwigCPtr, value.SwigCPtr);
50 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
54 TimePeriod ret = new TimePeriod(Interop.TransitionItemBase.GetTimePeriod(SwigCPtr), true);
55 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
61 /// Gets or sets the AlphaFunction
63 public AlphaFunction AlphaFunction
67 Interop.TransitionItemBase.SetAlphaFunction(SwigCPtr, value.SwigCPtr);
68 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
72 AlphaFunction ret = new AlphaFunction(Interop.TransitionItemBase.GetAlphaFunction(SwigCPtr), true);
73 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
79 /// Gets or sets whether the View moves with child or not.
81 public bool TransitionWithChild
85 Interop.TransitionItemBase.TransitionWithChild(SwigCPtr, value);
86 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
91 /// Gets or sets whether this transition is appearing transition or not.
93 public bool AppearingTransition
97 Interop.TransitionItemBase.SetAppearingTransition(SwigCPtr, value);
98 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
103 /// Downcasts a handle to TransitionItemBase handle.<br />
104 /// If handle points to an TransitionItemBase object, the downcast produces a valid handle.<br />
105 /// If not, the returned handle is left uninitialized.<br />
107 /// <param name="handle">Handle to an object.</param>
108 /// <returns>Handle to an TransitionItemBase object or an uninitialized handle.</returns>
109 /// <exception cref="ArgumentNullException"> Thrown when handle is null. </exception>
110 public static TransitionItemBase DownCast(BaseHandle handle)
114 throw new ArgumentNullException(nameof(handle));
116 TransitionItemBase ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as TransitionItemBase;
117 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
121 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TransitionItemBase obj)
123 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
126 internal TransitionItemBase(TransitionItemBase handle) : this(Interop.TransitionItemBase.NewTransitionItemBase(TransitionItemBase.getCPtr(handle)), true)
128 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
131 internal TransitionItemBase Assign(TransitionItemBase rhs)
133 TransitionItemBase ret = new TransitionItemBase(Interop.TransitionItemBase.Assign(SwigCPtr, TransitionItemBase.getCPtr(rhs)), false);
134 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
139 /// To make TransitionItemBase instance be disposed.
141 protected override void Dispose(DisposeTypes type)
150 /// This will not be public opened.
151 [EditorBrowsable(EditorBrowsableState.Never)]
152 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
154 if (swigCPtr.Handle == IntPtr.Zero || this.HasBody() == false)
156 Tizen.Log.Fatal("NUI", $"[ERROR] TransitionItemBase ReleaseSwigCPtr()! IntPtr=0x{swigCPtr.Handle:X} HasBody={this.HasBody()}");
159 Interop.TransitionItemBase.Delete(swigCPtr);
162 private float MilliSecondsToSeconds(int millisec)
164 return (float)millisec / 1000.0f;
167 private int SecondsToMilliSeconds(float sec)
169 return (int)(sec * 1000);