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