[NUI] Fix not to propagate gesture from scrim
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI.Components / Controls / Navigation / DialogPage.cs
index 10da0c9..1df0542 100755 (executable)
@@ -26,17 +26,13 @@ namespace Tizen.NUI.Components
     /// DialogPage contains dialog and dimmed scrim behind the dialog.
     /// </summary>
     /// <since_tizen> 9 </since_tizen>
-    public class DialogPage : Page
+    public partial class DialogPage : Page
     {
         private View content = null;
         private View scrim = null;
         private bool enableScrim = true;
 
-        /// <summary>
-        /// Creates a new instance of a DialogPage.
-        /// </summary>
-        /// <since_tizen> 9 </since_tizen>
-        public DialogPage() : base()
+        private void Initialize()
         {
             Layout = new AbsoluteLayout();
 
@@ -52,6 +48,35 @@ namespace Tizen.NUI.Components
         }
 
         /// <summary>
+        /// Creates a new instance of a DialogPage.
+        /// </summary>
+        /// <since_tizen> 9 </since_tizen>
+        public DialogPage() : base()
+        {
+            Initialize();
+        }
+
+        /// <summary>
+        /// Creates a new instance of DialogPage with style.
+        /// </summary>
+        /// <param name="style">Creates DialogPage by special style defined in UX.</param>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public DialogPage(string style) : base(style)
+        {
+            Initialize();
+        }
+
+        /// <summary>
+        /// Creates a new instance of a DialogPage with style.
+        /// </summary>
+        /// <param name="style">A style applied to the newly created DialogPage.</param>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public DialogPage(ControlStyle style) : base(style)
+        {
+            Initialize();
+        }
+
+        /// <summary>
         /// Dispose DialogPage and all children on it.
         /// </summary>
         /// <param name="type">Dispose type.</param>
@@ -89,6 +114,18 @@ namespace Tizen.NUI.Components
         {
             get
             {
+                return GetValue(ContentProperty) as View;
+            }
+            set
+            {
+                SetValue(ContentProperty, value);
+                NotifyPropertyChanged();
+            }
+        }
+        private View InternalContent
+        {
+            get
+            {
                 return content;
             }
             set
@@ -188,6 +225,18 @@ namespace Tizen.NUI.Components
         {
             get
             {
+                return (bool)GetValue(EnableScrimProperty);
+            }
+            set
+            {
+                SetValue(EnableScrimProperty, value);
+                NotifyPropertyChanged();
+            }
+        }
+        private bool InternalEnableScrim
+        {
+            get
+            {
                 return enableScrim;
             }
             set
@@ -217,7 +266,19 @@ namespace Tizen.NUI.Components
         /// Indicates to dismiss dialog by touching on scrim.
         /// </summary>
         /// <since_tizen> 9 </since_tizen>
-        public bool EnableDismissOnScrim { get; set; } = true;
+        public bool EnableDismissOnScrim
+        {
+            get
+            {
+                return (bool)GetValue(EnableDismissOnScrimProperty);
+            }
+            set
+            {
+                SetValue(EnableDismissOnScrimProperty, value);
+                NotifyPropertyChanged();
+            }
+        }
+        private bool InternalEnableDismissOnScrim { get; set; } = true;
 
         /// <summary>
         /// The color of scrim.
@@ -227,6 +288,18 @@ namespace Tizen.NUI.Components
         {
             get
             {
+                return GetValue(ScrimColorProperty) as Color;
+            }
+            set
+            {
+                SetValue(ScrimColorProperty, value);
+                NotifyPropertyChanged();
+            }
+        }
+        private Color InternalScrimColor
+        {
+            get
+            {
                 return Scrim?.BackgroundColor;
             }
             set
@@ -240,9 +313,8 @@ namespace Tizen.NUI.Components
 
         private View CreateDefaultScrim()
         {
-            //FIXME: Needs to separate GUI implementation codes to style cs file.
-            var scrim = new VisualView();
-            scrim.BackgroundColor = new Color(0.0f, 0.0f, 0.0f, 0.5f);
+            var scrimStyle = ThemeManager.GetStyle("Tizen.NUI.Components.DialogPage.Scrim");
+            var scrim = new VisualView(scrimStyle);
             //FIXME: Needs to set proper size to Scrim.
             scrim.Size = NUIApplication.GetDefaultWindow().Size;
             scrim.TouchEvent += (object source, TouchEventArgs e) =>
@@ -253,6 +325,7 @@ namespace Tizen.NUI.Components
                 }
                 return true;
             };
+            scrim.DispatchParentGestureEvents = false;
 
             return scrim;
         }