[NUI] Do not register when we try to copy same handle
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Animation / TransitionData.cs
1 /*
2  * Copyright(c) 2021 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17 using System.ComponentModel;
18
19 namespace Tizen.NUI
20 {
21     /// <summary>
22     /// This object translates data from a property array of maps into an array of animators.
23     /// This is normally used when animating visuals.
24     /// </summary>
25     /// <since_tizen> 3 </since_tizen>
26     public class TransitionData : BaseHandle
27     {
28         /// <summary>
29         /// Create an instance of TransitionData.
30         /// </summary>
31         /// <param name="transition">The transition data to store (a single animator).</param>
32         /// <since_tizen> 3 </since_tizen>
33         public TransitionData(PropertyMap transition) : this(Interop.TransitionData.NewByMap(PropertyMap.getCPtr(transition)), true)
34         {
35             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
36         }
37
38         /// <summary>
39         /// Create an instance of TransitionData.
40         /// </summary>
41         /// <param name="transition">The transition data to store (an array of maps of animators).</param>
42         /// <since_tizen> 3 </since_tizen>
43         public TransitionData(PropertyArray transition) : this(Interop.TransitionData.NewByArray(PropertyArray.getCPtr(transition)), true)
44         {
45             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
46
47         }
48
49         /// <summary>
50         /// Create an instance of TransitionData by copy constructor.
51         /// </summary>
52         /// <param name="handle">Handle to an object.</param>
53         /// <since_tizen> 3 </since_tizen>
54         public TransitionData(TransitionData handle) : this(Interop.TransitionData.NewTransitionData(TransitionData.getCPtr(handle)), true, false)
55         {
56             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
57         }
58
59         internal TransitionData(global::System.IntPtr cPtr, bool cMemoryOwn) : this(cPtr, cMemoryOwn, cMemoryOwn)
60         {
61         }
62
63         internal TransitionData(global::System.IntPtr cPtr, bool cMemoryOwn, bool cRegister) : base(cPtr, cMemoryOwn, cRegister)
64         {
65         }
66
67         /// <summary>
68         /// returns the count of the individual property transitions stored within this handle.
69         /// </summary>
70         /// <returns>A handle to the image at the specified position.</returns>
71         /// <since_tizen> 3 </since_tizen>
72         public uint Count()
73         {
74             uint ret = Interop.TransitionData.Count(SwigCPtr);
75             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
76             return ret;
77         }
78
79         /// <summary>
80         /// returns the count of the individual property transitions stored within this handle.
81         /// </summary>
82         /// <param name="index">The index of the animator.</param>
83         /// <returns>A property map representing the animator.</returns>
84         /// <since_tizen> 3 </since_tizen>
85         public PropertyMap GetAnimatorAt(uint index)
86         {
87             PropertyMap ret = new PropertyMap(Interop.TransitionData.GetAnimatorAt(SwigCPtr, index), true);
88             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
89             return ret;
90         }
91
92         /// This will not be public opened.
93         [EditorBrowsable(EditorBrowsableState.Never)]
94         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
95         {
96             Interop.TransitionData.DeleteTransitionData(swigCPtr);
97         }
98     }
99 }