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