[NUI] Refactoring Transition and FadeTransition
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI.Components / Controls / Navigation / Page.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;
18 using System.ComponentModel;
19
20 namespace Tizen.NUI.Components
21 {
22     /// <summary>
23     /// PageAppearingEventArgs is a class to record page appearing event arguments which will be sent to user.
24     /// </summary>
25     [EditorBrowsable(EditorBrowsableState.Never)]
26     public class PageAppearingEventArgs : EventArgs
27     {
28     }
29
30     /// <summary>
31     /// PageDisappearingEventArgs is a class to record page disappearing event arguments which will be sent to user.
32     /// </summary>
33     [EditorBrowsable(EditorBrowsableState.Never)]
34     public class PageDisappearingEventArgs : EventArgs
35     {
36     }
37
38     /// <summary>
39     /// PageAppearedEventArgs is a class to record page appeared event arguments which will be sent to user.
40     /// </summary>
41     [EditorBrowsable(EditorBrowsableState.Never)]
42     public class PageAppearedEventArgs : EventArgs
43     {
44     }
45
46     /// <summary>
47     /// PageDisappearedEventArgs is a class to record page disappeared event arguments which will be sent to user.
48     /// </summary>
49     [EditorBrowsable(EditorBrowsableState.Never)]
50     public class PageDisappearedEventArgs : EventArgs
51     {
52     }
53
54     /// <summary>
55     /// The Page class is a class which is an element of navigation.
56     /// </summary>
57     /// <since_tizen> 9 </since_tizen>
58     public abstract class Page : Control
59     {
60         private Navigator navigator = null;
61
62         // Default transition is Fade.
63         private TransitionBase appearingTransition = null;
64
65         private TransitionBase disappearingTransition = null;
66
67         /// <summary>
68         /// Creates a new instance of a Page.
69         /// </summary>
70         /// <since_tizen> 9 </since_tizen>
71         public Page() : base()
72         {
73         }
74
75         /// <summary>
76         /// Navigator which has pushed the Page into its stack.
77         /// If this Page has not been pushed into any Navigator, then Navigator is null.
78         /// </summary>
79         /// <since_tizen> 9 </since_tizen>
80         public Navigator Navigator
81         {
82             get
83             {
84                 return navigator;
85             }
86             internal set
87             {
88                 if (navigator == value)
89                 {
90                     return;
91                 }
92
93                 navigator = value;
94             }
95         }
96
97         /// <summary>
98         /// Transition properties for the transition of Views in this page during this page is pushed to Navigator.
99         /// </summary>
100         [EditorBrowsable(EditorBrowsableState.Never)]
101         public TransitionBase AppearingTransition
102         {
103             set
104             {
105                 appearingTransition = value;
106             }
107             get
108             {
109                 return appearingTransition;
110             }
111         }
112
113         /// <summary>
114         /// Transition properties for the transition of Views in this page during this page is popped from Navigator.
115         /// </summary>
116         [EditorBrowsable(EditorBrowsableState.Never)]
117         public TransitionBase DisappearingTransition
118         {
119             set
120             {
121                 disappearingTransition = value;
122             }
123             get
124             {
125                 return disappearingTransition;
126             }
127         }
128
129         /// <summary>
130         /// An event for the page appearing signal which can be used to subscribe or unsubscribe the event handler provided by the user.
131         /// </summary>
132         [EditorBrowsable(EditorBrowsableState.Never)]
133         public event EventHandler<PageAppearingEventArgs> Appearing;
134
135         /// <summary>
136         /// An event for the page disappearing signal which can be used to subscribe or unsubscribe the event handler provided by the user.
137         /// </summary>
138         [EditorBrowsable(EditorBrowsableState.Never)]
139         public event EventHandler<PageDisappearingEventArgs> Disappearing;
140
141         /// <summary>
142         /// An event for the page appeared signal which can be used to subscribe or unsubscribe the event handler provided by the user.
143         /// </summary>
144         [EditorBrowsable(EditorBrowsableState.Never)]
145         public event EventHandler<PageAppearedEventArgs> Appeared;
146
147         /// <summary>
148         /// An event for the page disappeared signal which can be used to subscribe or unsubscribe the event handler provided by the user.
149         /// </summary>
150         [EditorBrowsable(EditorBrowsableState.Never)]
151         public event EventHandler<PageDisappearedEventArgs> Disappeared;
152
153         internal void InvokeAppearing()
154         {
155             Appearing?.Invoke(this, new PageAppearingEventArgs());
156         }
157
158         internal void InvokeDisappearing()
159         {
160             Disappearing?.Invoke(this, new PageDisappearingEventArgs());
161         }
162
163         internal void InvokeAppeared()
164         {
165             Appeared?.Invoke(this, new PageAppearedEventArgs());
166         }
167
168         internal void InvokeDisappeared()
169         {
170             Disappeared?.Invoke(this, new PageDisappearedEventArgs());
171         }
172     }
173 }