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
26 private bool appearingTransition = true;
29 /// Creates an initialized TransitionItemBase.<br />
31 public TransitionItemBase(View target, bool appearingTransition, TimePeriod timePeriod, AlphaFunction alphaFunction) : this(Interop.TransitionItemBase.New(), true)
33 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
35 AppearingTransition = appearingTransition;
36 TimePeriod = timePeriod;
37 AlphaFunction = alphaFunction;
40 internal TransitionItemBase(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
45 /// Gets or sets the TimePeriod
47 public TimePeriod TimePeriod
51 Interop.TransitionItemBase.SetTimePeriod(SwigCPtr, value.SwigCPtr);
52 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
56 TimePeriod ret = new TimePeriod(Interop.TransitionItemBase.GetTimePeriod(SwigCPtr), true);
57 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
63 /// Gets or sets the AlphaFunction
65 public AlphaFunction AlphaFunction
69 Interop.TransitionItemBase.SetAlphaFunction(SwigCPtr, value.SwigCPtr);
70 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
74 AlphaFunction ret = new AlphaFunction(Interop.TransitionItemBase.GetAlphaFunction(SwigCPtr), true);
75 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
81 /// Gets or sets whether the View moves with child or not.
83 public virtual bool TransitionWithChild
87 Interop.TransitionItemBase.TransitionWithChild(SwigCPtr, value);
88 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
93 /// Gets or sets whether this transition is appearing transition or not.
95 public bool AppearingTransition
99 appearingTransition = value;
100 Interop.TransitionItemBase.SetAppearingTransition(SwigCPtr, value);
101 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
105 return appearingTransition;
110 /// Downcasts a handle to TransitionItemBase handle.<br />
111 /// If handle points to an TransitionItemBase object, the downcast produces a valid handle.<br />
112 /// If not, the returned handle is left uninitialized.<br />
114 /// <param name="handle">Handle to an object.</param>
115 /// <returns>Handle to an TransitionItemBase object or an uninitialized handle.</returns>
116 /// <exception cref="ArgumentNullException"> Thrown when handle is null. </exception>
117 public static TransitionItemBase DownCast(BaseHandle handle)
121 throw new ArgumentNullException(nameof(handle));
123 TransitionItemBase ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as TransitionItemBase;
124 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
128 internal TransitionItemBase(TransitionItemBase handle) : this(Interop.TransitionItemBase.NewTransitionItemBase(TransitionItemBase.getCPtr(handle)), true)
130 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
133 internal TransitionItemBase Assign(TransitionItemBase rhs)
135 TransitionItemBase ret = new TransitionItemBase(Interop.TransitionItemBase.Assign(SwigCPtr, TransitionItemBase.getCPtr(rhs)), false);
136 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
141 /// To make TransitionItemBase instance be disposed.
143 protected override void Dispose(DisposeTypes type)
152 /// This will not be public opened.
153 [EditorBrowsable(EditorBrowsableState.Never)]
154 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
156 if (swigCPtr.Handle == IntPtr.Zero || Disposed)
158 Tizen.Log.Fatal("NUI", $"[ERROR] TransitionItemBase ReleaseSwigCPtr()! IntPtr=0x{swigCPtr.Handle:X} Disposed={Disposed}");
161 Interop.TransitionItemBase.Delete(swigCPtr);
164 private float MilliSecondsToSeconds(int millisec)
166 return (float)millisec / 1000.0f;
169 private int SecondsToMilliSeconds(float sec)
171 return (int)(sec * 1000);