04aaf6036c0531665348a2893fd2ddea7019c3c3
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Transition / TransitionBase.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     using Tizen.NUI.BaseComponents;
23
24     /// <summary>
25     /// TransitionBase class is a base class for each Transitions.
26     /// Each Transition child classes inherits this base class.
27     /// </summary>
28     [EditorBrowsable(EditorBrowsableState.Never)]
29     public class TransitionBase : Disposable
30     {
31         private static readonly float DefaultDuration = 0.5f;
32         protected internal AlphaFunction alphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.Default);
33         protected internal TimePeriod timePeriod = new TimePeriod(DefaultDuration);
34
35         [EditorBrowsable(EditorBrowsableState.Never)]
36         public TransitionBase()
37         {
38         }
39
40         [EditorBrowsable(EditorBrowsableState.Never)]
41         public AlphaFunction AlphaFunction
42         {
43             set
44             {
45                 alphaFunction = value;
46             }
47             get
48             {
49                 return alphaFunction;
50             }
51         }
52
53         [EditorBrowsable(EditorBrowsableState.Never)]
54         public TimePeriod TimePeriod
55         {
56             set
57             {
58                 timePeriod = value;
59             }
60             get
61             {
62                 return timePeriod;
63             }
64         }
65
66         internal TransitionItemBase CreateTransition(View target, bool isEntering)
67         {
68             return new TransitionItemBase(target, isEntering, timePeriod, alphaFunction);
69         }
70
71         protected override void Dispose(DisposeTypes type)
72         {
73             alphaFunction.Dispose();
74             timePeriod.Dispose();
75             base.Dispose(type);
76         }
77     }
78 }