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.
19 using System.ComponentModel;
20 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 TransitionItemBase(TransitionItemBase handle) : this(Interop.TransitionItemBase.NewTransitionItemBase(TransitionItemBase.getCPtr(handle)), true)
123 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
126 internal TransitionItemBase Assign(TransitionItemBase rhs)
128 TransitionItemBase ret = new TransitionItemBase(Interop.TransitionItemBase.Assign(SwigCPtr, TransitionItemBase.getCPtr(rhs)), false);
129 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
134 /// To make TransitionItemBase instance be disposed.
136 protected override void Dispose(DisposeTypes type)
145 /// This will not be public opened.
146 [EditorBrowsable(EditorBrowsableState.Never)]
147 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
149 if (swigCPtr.Handle == IntPtr.Zero || this.HasBody() == false)
151 Tizen.Log.Fatal("NUI", $"[ERROR] TransitionItemBase ReleaseSwigCPtr()! IntPtr=0x{swigCPtr.Handle:X} HasBody={this.HasBody()}");
154 Interop.TransitionItemBase.Delete(swigCPtr);
157 private float MilliSecondsToSeconds(int millisec)
159 return (float)millisec / 1000.0f;
162 private int SecondsToMilliSeconds(float sec)
164 return (int)(sec * 1000);