[NUI] Add constructors with string style to apply string style
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI.Components / Controls / Navigation / Page.cs
index f26a3a4..136e595 100755 (executable)
@@ -134,6 +134,15 @@ namespace Tizen.NUI.Components
         }
 
         /// <summary>
+        /// Creates a new instance of Page with style.
+        /// </summary>
+        /// <param name="style">Creates Page by special style defined in UX.</param>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public Page(string style) : base(style)
+        {
+        }
+
+        /// <summary>
         /// Creates a new instance of a Page with style.
         /// </summary>
         /// <param name="style">A style applied to the newly created Page.</param>
@@ -245,7 +254,9 @@ namespace Tizen.NUI.Components
         public event EventHandler<PageDisappearedEventArgs> Disappeared;
 
         /// <summary>
-        /// Gets or sets if this page is popped when back button or back key is pressed and released.
+        /// Gets or sets if this page proceeds back navigation when back button or back key is pressed and released.
+        /// Back navigation pops the peek page if Navigator has more than one page.
+        /// If Navigator has only one page, then the current program is exited.
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
         public bool EnableBackNavigation
@@ -365,5 +376,39 @@ namespace Tizen.NUI.Components
             }
         }
 
+        /// <summary>
+        /// Called when the back navigation is started.
+        /// Back navigation pops the peek page if Navigator has more than one page.
+        /// If Navigator has only one page, then the current program is exited.
+        /// </summary>
+        /// <param name="eventArgs">The back navigation information.</param>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected virtual void OnBackNavigation(PageBackNavigationEventArgs eventArgs)
+        {
+            if (Navigator.PageCount > 1)
+            {
+                Navigator.Pop();
+            }
+            else
+            {
+                NUIApplication.Current?.Exit();
+            }
+        }
+
+        /// <summary>
+        /// Called when the back navigation is required outside Navigator.
+        /// </summary>
+        internal void NavigateBack()
+        {
+            OnBackNavigation(new PageBackNavigationEventArgs());
+        }
+    }
+
+    /// <summary>
+    /// PageBackNavigationEventArgs is a class to record back navigation event arguments which will sent to user.
+    /// </summary>
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public class PageBackNavigationEventArgs : EventArgs
+    {
     }
 }