[NUI] Add Page's Appeared and Disappeared events
[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         /// <summary>
63         /// Creates a new instance of a Page.
64         /// </summary>
65         /// <since_tizen> 9 </since_tizen>
66         public Page() : base()
67         {
68         }
69
70         /// <summary>
71         /// Navigator which has pushed the Page into its stack.
72         /// If this Page has not been pushed into any Navigator, then Navigator is null.
73         /// </summary>
74         /// <since_tizen> 9 </since_tizen>
75         public Navigator Navigator
76         {
77             get
78             {
79                 return navigator;
80             }
81             internal set
82             {
83                 if (navigator == value)
84                 {
85                     return;
86                 }
87
88                 navigator = value;
89             }
90         }
91
92         /// <summary>
93         /// An event for the page appearing signal which can be used to subscribe or unsubscribe the event handler provided by the user.
94         /// </summary>
95         [EditorBrowsable(EditorBrowsableState.Never)]
96         public event EventHandler<PageAppearingEventArgs> Appearing;
97
98         /// <summary>
99         /// An event for the page disappearing signal which can be used to subscribe or unsubscribe the event handler provided by the user.
100         /// </summary>
101         [EditorBrowsable(EditorBrowsableState.Never)]
102         public event EventHandler<PageDisappearingEventArgs> Disappearing;
103
104         /// <summary>
105         /// An event for the page appeared signal which can be used to subscribe or unsubscribe the event handler provided by the user.
106         /// </summary>
107         [EditorBrowsable(EditorBrowsableState.Never)]
108         public event EventHandler<PageAppearedEventArgs> Appeared;
109
110         /// <summary>
111         /// An event for the page disappeared signal which can be used to subscribe or unsubscribe the event handler provided by the user.
112         /// </summary>
113         [EditorBrowsable(EditorBrowsableState.Never)]
114         public event EventHandler<PageDisappearedEventArgs> Disappeared;
115
116         internal void InvokeAppearing()
117         {
118             Appearing?.Invoke(this, new PageAppearingEventArgs());
119         }
120
121         internal void InvokeDisappearing()
122         {
123             Disappearing?.Invoke(this, new PageDisappearingEventArgs());
124         }
125
126         internal void InvokeAppeared()
127         {
128             Appeared?.Invoke(this, new PageAppearedEventArgs());
129         }
130
131         internal void InvokeDisappeared()
132         {
133             Disappeared?.Invoke(this, new PageDisappearedEventArgs());
134         }
135     }
136 }