2 * Copyright(c) 2021 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 using System.ComponentModel;
19 using Tizen.NUI.BaseComponents;
21 namespace Tizen.NUI.Components
24 /// PageAppearingEventArgs is a class to record page appearing event arguments which will be sent to user.
26 [EditorBrowsable(EditorBrowsableState.Never)]
27 public class PageAppearingEventArgs : EventArgs
32 /// PageDisappearingEventArgs is a class to record page disappearing event arguments which will be sent to user.
34 [EditorBrowsable(EditorBrowsableState.Never)]
35 public class PageDisappearingEventArgs : EventArgs
40 /// The Page class is a class which is an element of navigation.
42 [EditorBrowsable(EditorBrowsableState.Never)]
43 public class Page : Control
45 private AppBar appBar = null;
46 private View content = null;
49 /// Creates a new instance of a Page.
51 /// <param name="content">The content to set to Content of Page.</param>
52 [EditorBrowsable(EditorBrowsableState.Never)]
53 public Page(View content = null) : this(null, content)
58 /// Creates a new instance of a Page.
60 /// <param name="appBar">The content to set to AppBar of Page.</param>
61 /// <param name="content">The content to set to Content of Page.</param>
62 [EditorBrowsable(EditorBrowsableState.Never)]
63 public Page(AppBar appBar, View content = null) : base()
65 //AppBar and Content are located vertically.
66 var linearLayout = new LinearLayout();
67 linearLayout.LinearOrientation = LinearLayout.Orientation.Vertical;
68 Layout = linearLayout;
70 //Page fills to parent by default.
71 WidthResizePolicy = ResizePolicyType.FillToParent;
72 HeightResizePolicy = ResizePolicyType.FillToParent;
86 /// Dispose Page and all children on it.
88 /// <param name="type">Dispose type.</param>
89 [EditorBrowsable(EditorBrowsableState.Never)]
90 protected override void Dispose(DisposeTypes type)
97 if (type == DisposeTypes.Explicit)
101 Utility.Dispose(appBar);
106 Utility.Dispose(content);
114 /// AppBar of Page. AppBar is added to Children automatically.
116 [EditorBrowsable(EditorBrowsableState.Never)]
141 appBar.Weight = 0.0f;
148 /// Content of Page. Content is added to Children automatically.
150 [EditorBrowsable(EditorBrowsableState.Never)]
159 if (content == value)
175 content.Weight = 1.0f;
181 private void ResetContent()
183 //To keep the order of AppBar and Content, the existing contents are
184 //removed and added again.
185 if ((appBar != null) && Children.Contains(appBar))
190 if ((content != null) && Children.Contains(content))
207 /// An event for the page appearing signal which can be used to subscribe or unsubscribe the event handler provided by the user.
209 [EditorBrowsable(EditorBrowsableState.Never)]
210 public event EventHandler<PageAppearingEventArgs> Appearing;
213 /// An event for the page disappearing signal which can be used to subscribe or unsubscribe the event handler provided by the user.
215 [EditorBrowsable(EditorBrowsableState.Never)]
216 public event EventHandler<PageDisappearingEventArgs> Disappearing;
218 internal void InvokeAppearing()
220 Appearing?.Invoke(this, new PageAppearingEventArgs());
223 internal void InvokeDisappearing()
225 Disappearing?.Invoke(this, new PageDisappearingEventArgs());