[NUI] Remove duplicate getCPtr from BaseHandle subclasses (#3545)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / Transition / ScaleTransitionItem.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
18 namespace Tizen.NUI
19 {
20     using System;
21     using System.ComponentModel;
22
23     using Tizen.NUI.BaseComponents;
24
25     /// <summary>
26     /// ScaleTransitionItem is an object to set scale transition of a View that will appear or disappear.
27     /// ScaleTransitionItem object is required to be added to the TransitionSet to play.
28     /// </summary>
29     internal class ScaleTransitionItem : TransitionItemBase
30     {
31         /// <summary>
32         /// Creates an initialized ScaleTransition.<br />
33         /// </summary>
34         /// <remarks>Delay and duration of timePeriod must be greater than zero.</remarks>
35         public ScaleTransitionItem(View view, float scale, bool isAppearing, TimePeriod timePeriod, AlphaFunction alphaFunction) : this(Interop.ScaleTransitionItem.New(view.SwigCPtr, scale, timePeriod.SwigCPtr), true)
36         {
37             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
38             AppearingTransition = isAppearing;
39             AlphaFunction = alphaFunction;
40         }
41
42         /// <summary>
43         /// Creates an initialized ScaleTransition.<br />
44         /// </summary>
45         /// <remarks>Delay and duration of timePeriod must be greater than zero.</remarks>
46         public ScaleTransitionItem(View view, Vector2 scale, bool isAppearing, TimePeriod timePeriod, AlphaFunction alphaFunction) : this(Interop.ScaleTransitionItem.New(view.SwigCPtr, scale.SwigCPtr, timePeriod.SwigCPtr), true)
47         {
48             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
49             AppearingTransition = isAppearing;
50             AlphaFunction = alphaFunction;
51         }
52
53         internal ScaleTransitionItem(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
54         {
55         }
56
57         internal ScaleTransitionItem(ScaleTransitionItem handle) : this(Interop.ScaleTransitionItem.NewScaleTransitionItem(ScaleTransitionItem.getCPtr(handle)), true)
58         {
59             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
60         }
61
62         internal ScaleTransitionItem Assign(ScaleTransitionItem rhs)
63         {
64             ScaleTransitionItem ret = new ScaleTransitionItem(Interop.ScaleTransitionItem.Assign(SwigCPtr, ScaleTransitionItem.getCPtr(rhs)), false);
65             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
66             return ret;
67         }
68
69         /// <summary>
70         /// To make ScaleTransition instance be disposed.
71         /// </summary>
72         protected override void Dispose(DisposeTypes type)
73         {
74             if (disposed)
75             {
76                 return;
77             }
78             base.Dispose(type);
79         }
80
81         /// This will not be public opened.
82         [EditorBrowsable(EditorBrowsableState.Never)]
83         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
84         {
85             if (swigCPtr.Handle == IntPtr.Zero || this.HasBody() == false)
86             {
87                 Tizen.Log.Fatal("NUI", $"[ERROR] ScaleTransitionItem ReleaseSwigCPtr()! IntPtr=0x{swigCPtr.Handle:X} HasBody={this.HasBody()}");
88                 return;
89             }
90             Interop.ScaleTransitionItem.Delete(swigCPtr);
91         }
92     }
93 }