[NUI] Add default components styles and etc (#1396) (#1400)
authorJiyun Yang <ji.yang@samsung.com>
Thu, 13 Feb 2020 01:48:36 +0000 (10:48 +0900)
committerGitHub <noreply@github.com>
Thu, 13 Feb 2020 01:48:36 +0000 (10:48 +0900)
* Add default styles for : Progress, Slider, Toast, Popup, DropDown
* Fix : PopupStyle.Buttons.Size.Height works now
* Add : Popup Dismiss() method
* Fix : Popup should be posted on the top layer
* Fix : DropDown button did not form well before first click
* Fix : DropDown selectedItemIndex did not update when select an item by touching it
* Fix : DropDownItemStyle did not applied to DropDownItemView so it was not able to detect control state change
* Fix : Progress need to show buffering bar and progress bar together in Determinate stage
* Fix : View.BackgroundImage property would reset its content when it gets null or empty string

Signed-off-by: Jiyun Yang <ji.yang@samsung.com>
21 files changed:
packaging/PlatformFileList.txt
src/Tizen.NUI.Components/Controls/ButtonGroup.cs
src/Tizen.NUI.Components/Controls/DropDown.cs
src/Tizen.NUI.Components/Controls/Popup.cs
src/Tizen.NUI.Components/Controls/Progress.cs
src/Tizen.NUI.Components/Controls/Slider.cs
src/Tizen.NUI.Components/PreloadStyle/DefaultDropDownStyle.cs [new file with mode: 0644]
src/Tizen.NUI.Components/PreloadStyle/DefaultPopupStyle.cs [new file with mode: 0644]
src/Tizen.NUI.Components/PreloadStyle/DefaultProgressStyle.cs [new file with mode: 0644]
src/Tizen.NUI.Components/PreloadStyle/DefaultSliderStyle.cs [new file with mode: 0644]
src/Tizen.NUI.Components/PreloadStyle/DefaultToastStyle.cs [new file with mode: 0644]
src/Tizen.NUI.Components/Style/ToastStyle.cs
src/Tizen.NUI.Components/Utils/StyleManager.cs
src/Tizen.NUI.Components/res/nui_component_default_dropdown_button_icon.png [new file with mode: 0755]
src/Tizen.NUI.Components/res/nui_component_default_dropdown_list_bg.png [new file with mode: 0755]
src/Tizen.NUI.Components/res/nui_component_default_popup_shadow.png [new file with mode: 0755]
src/Tizen.NUI.Components/res/nui_component_default_slider_thumb_bg_p.png [new file with mode: 0755]
src/Tizen.NUI.Components/res/nui_component_default_slider_thumb_n.png [new file with mode: 0755]
src/Tizen.NUI/src/public/BaseComponents/ViewBindableProperty.cs
src/Tizen.NUI/src/public/Extents.cs
src/Tizen.NUI/src/public/Rectangle.cs

index 144d30b..5d45d4e 100755 (executable)
@@ -16,6 +16,11 @@ res/nui_component_default_switch_track_s.png       #common #mobile #mobile-emul
 res/nui_component_default_radiobutton_n.png        #common #mobile #mobile-emul #tv #wearable
 res/nui_component_default_radiobutton_p.png        #common #mobile #mobile-emul #tv #wearable
 res/nui_component_default_radiobutton_s.png        #common #mobile #mobile-emul #tv #wearable
+res/nui_component_default_popup_shadow.png         #common #mobile #mobile-emul #tv #wearable
+res/nui_component_default_slider_thumb_bg_p.png    #common #mobile #mobile-emul #tv #wearable
+res/nui_component_default_slider_thumb_n.png       #common #mobile #mobile-emul #tv #wearable
+res/nui_component_default_dropdown_button_icon.png #common #mobile #mobile-emul #tv #wearable
+res/nui_component_default_dropdown_list_bg.png     #common #mobile #mobile-emul #tv #wearable
 Tizen.Account.AccountManager.dll                   #mobile #mobile-emul #tv #wearable
 Tizen.Account.FidoClient.dll                       #mobile #mobile-emul #wearable
 Tizen.Account.OAuth2.dll                           #mobile #mobile-emul #wearable
index d006c00..2afccfc 100755 (executable)
@@ -352,7 +352,7 @@ namespace Tizen.NUI.Components
             if (Count == 0) return;
 
             int buttonWidth = (int)root.Size.Width / Count;
-            int buttonHeight = (int)itemheight;
+            int buttonHeight = btStyle.Size.Height > itemheight ? (int)btStyle.Size.Height : (int)itemheight;
             foreach (Button btnTemp in itemGroup)
             {
                 btnTemp.Size = new Size(buttonWidth, buttonHeight);
index 745dccf..08e05fa 100755 (executable)
@@ -54,11 +54,11 @@ namespace Tizen.NUI.Components
             if (newValue != null)
             {
                 int selectedItemIndex = (int)newValue;
-                if (selectedItemIndex == instance.selectedItemIndex || instance.adapter == null || selectedItemIndex >= instance.adapter.GetItemCount())
+                if (selectedItemIndex == instance.selectedItemIndex || instance.adapter == null || selectedItemIndex < 0 || selectedItemIndex >= instance.adapter.GetItemCount())
                 {
                     return;
                 }
-                instance.UpdateSelectedItem(selectedItemIndex);
+                instance.SetListItemToSelected((uint)selectedItemIndex);
             }
         },
         defaultValueCreator: (bindable) =>
@@ -435,16 +435,17 @@ namespace Tizen.NUI.Components
         /// </summary>
         protected override void OnUpdate()
         {
-            float iconWidth = 0;
             float buttonTextWidth = 0;
             if (null != buttonText)
             {
                 buttonText.Text = Style.Button.Text.Text.All;
-                buttonText.PointSize = Style.Button.Text.PointSize?.All ?? 20;
+                buttonText.PointSize = Style.Button.Text.PointSize?.GetValue(ControlState) ?? DefaultStyle.PointSizeNormal;
                 buttonTextWidth = buttonText.NaturalSize.Width;
             }
-            iconWidth = Style.Button.Icon.Size?.Width ?? 48;
-            button.SizeWidth = iconWidth + Style.SpaceBetweenButtonTextAndIcon + buttonTextWidth;
+            float fitWidth = (Style.Button.Icon.Size?.Width ?? 48) + Style.SpaceBetweenButtonTextAndIcon + buttonTextWidth;
+            fitWidth += (button.IconPadding.Start + button.IconPadding.End);
+            button.Size.Width = Math.Max(button.Size.Width, fitWidth);
+            RelayoutRequest();
 
             int numberOfItemsToAdd = adapter.GetItemCount();
 
@@ -457,7 +458,10 @@ namespace Tizen.NUI.Components
                 }
             }
             // Set selection icon on View
-            UpdateSelectedItem(selectedItemIndex);
+            if (selectedItemIndex > 0)
+            {
+                SetListItemToSelected((uint)selectedItemIndex, selectedItemView);
+            }
         }
 
         /// <summary>
@@ -512,6 +516,7 @@ namespace Tizen.NUI.Components
                 tapGestureDetector = new TapGestureDetector();
             }
             View view = viewHolder.ItemView;
+            view.ApplyStyle(itemData.itemDataStyle);
             view.TouchEvent += ListItemTouchEvent;
             dropDownMenuFullList.Add(view);
         }
@@ -621,22 +626,64 @@ namespace Tizen.NUI.Components
             }
         }
 
-        private void SetListItemToSelected(DropDownItemView targetItemView)
+        private void SetListItemToSelected(DropDownItemView view)
         {
-            // Set the DropDownItemView matching the targetItemView to selected.
-            if (selectedItemView!=targetItemView)
+            if (dropDownMenuFullList == null || view == null || view == selectedItemView)
+            {
+                return;
+            }
+
+            uint newSelectedIndex = 0;
+            for (; newSelectedIndex < dropDownMenuFullList.ChildCount; newSelectedIndex++)
             {
-                if (selectedItemView!=null)
+                var itemView = dropDownMenuFullList.GetChildAt(newSelectedIndex) as DropDownItemView;
+                if (itemView == view)
                 {
-                    // clear selection status of currently selected item view
-                    selectedItemView.IsSelected = false;
+                    SetListItemToSelected(newSelectedIndex, view);
+                    return;
                 }
-                // Set target item to selected
-                targetItemView.IsSelected = true;
-                selectedItemView = targetItemView;
             }
         }
 
+        private void SetListItemToSelected(uint index)
+        {
+            if (dropDownMenuFullList == null || index == selectedItemIndex)
+            {
+                return;
+            }
+
+            SetListItemToSelected(index, GetViewFromIndex(index) as DropDownItemView);
+        }
+
+        private void SetListItemToSelected(uint index, DropDownItemView view)
+        {
+            if (adapter == null)
+            {
+                return;
+            }
+
+            if (selectedItemView != null)
+            {
+                selectedItemView.IsSelected = false;
+                selectedItemView.ControlState = ControlStates.Normal;
+                adapter.GetData(selectedItemIndex).IsSelected = false;
+            }
+
+            if (view == null || index >= dropDownMenuFullList.ChildCount)
+            {
+                selectedItemIndex = -1;
+                selectedItemView = null;
+                return;
+            }
+
+            selectedItemIndex = (int)index;
+            selectedItemView = view;
+            selectedItemView.ControlState = ControlStates.Selected;
+            selectedItemView.IsSelected = true;
+            adapter.GetData(selectedItemIndex).IsSelected = true;
+            dropDownMenuFullList.Layout?.RequestLayout();
+        }
+
         private bool ListItemTouchEvent(object sender, TouchEventArgs e)
         {
             PointStateType state = e.Touch.GetState(0);
@@ -644,24 +691,22 @@ namespace Tizen.NUI.Components
             switch (state)
             {
                 case PointStateType.Down:
-                    if (touchedView != null && touchedView.BackgroundColorSelector != null)
+                    if (touchedView != null)
                     {
-                        touchedView.BackgroundColor = touchedView.BackgroundColorSelector.GetValue(ControlStates.Pressed);
+                        touchedView.ControlState = ControlStates.Pressed;
                     }
                     itemPressed = true;  // if matched with a Up then a click event.
                     break;
                 case PointStateType.Motion:
-                    if (touchedView != null && touchedView.BackgroundColorSelector != null)
+                    if (touchedView != null)
                     {
-                        touchedView.BackgroundColor = touchedView.BackgroundColorSelector.GetValue(ControlStates.Normal);
+                        touchedView.ControlState = ControlStates.Normal;
                     }
                     itemPressed = false;
                     break;
                 case PointStateType.Up:
-                    if (touchedView != null && touchedView.BackgroundColorSelector != null)
+                    if (touchedView != null)
                     {
-                        touchedView.BackgroundColor = touchedView.BackgroundColorSelector.GetValue(ControlStates.Selected);
-
                         if (itemPressed)  // if Down was previously sent without motion (Scrolling) in-between then a clicked event occurred.
                         {
                             // List item clicked
@@ -679,40 +724,6 @@ namespace Tizen.NUI.Components
             return true;
         }
 
-        private void UpdateSelectedItem(int index)
-        {
-            if (null == adapter) return;
-            if (null == dropDownMenuFullList) return;
-            if (selectedItemIndex != -1)
-            {
-                DropDownDataItem data = adapter.GetData(selectedItemIndex);
-                if(null != data)
-                {
-                    data.IsSelected = false;
-                }
-                DropDownItemView listItemView = dropDownMenuFullList.GetChildAt((uint)selectedItemIndex) as DropDownItemView;
-
-                SetListItemToSelected(listItemView);
-            }
-
-            if (index != -1)
-            {
-                DropDownDataItem data = adapter.GetData(index);
-                if (null != data)
-                {
-                    data.IsSelected = true;
-                    DropDownItemView listItemView = dropDownMenuFullList?.GetChildAt((uint)index) as DropDownItemView;
-                    if(listItemView)
-                    {
-                        SetListItemToSelected(listItemView);
-                    }
-                }
-            }
-
-            selectedItemIndex = index;
-            dropDownMenuFullList?.Layout?.RequestLayout();
-        }
-
         private void ButtonClickEvent(object sender, Button.ClickEventArgs e)
         {
             button.Hide();
@@ -754,7 +765,7 @@ namespace Tizen.NUI.Components
         //[EditorBrowsable(EditorBrowsableState.Never)]
         public class DropDownDataItem
         {
-            private DropDownItemStyle itemDataStyle = new DropDownItemStyle();
+            internal DropDownItemStyle itemDataStyle = new DropDownItemStyle();
 
             /// <summary>
             /// Creates a new instance of a DropDownItemData.
@@ -764,6 +775,7 @@ namespace Tizen.NUI.Components
             [EditorBrowsable(EditorBrowsableState.Never)]
             public DropDownDataItem()
             {
+                itemDataStyle = (DropDownItemStyle)StyleManager.Instance.GetComponentStyle(this.GetType());
                 Initialize();
             }
 
index ae5fd3c..5070cb8 100755 (executable)
@@ -199,6 +199,7 @@ namespace Tizen.NUI.Components
         private TextLabel titleText;
         private ButtonGroup btGroup = null;
         private Window window = null;
+        private Layer container = new Layer();
         static Popup() { }
 
         /// <summary>
@@ -236,11 +237,31 @@ namespace Tizen.NUI.Components
 
         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public void Post(Window win)
+        public virtual void Post(Window targetWindow)
         {
-            if (null == win) return;
-            window = win;
-            window.Add(this);
+            if (targetWindow == null)
+            {
+                return;
+            }
+
+            window = targetWindow;
+            window.AddLayer(container);
+            container.RaiseToTop();
+        }
+
+        /// <summary>
+        /// Dismiss the dialog
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public virtual void Dismiss()
+        {
+            if (window == null)
+            {
+                return;
+            }
+
+            window.RemoveLayer(container);
+            window = null;
         }
 
         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
@@ -708,6 +729,7 @@ namespace Tizen.NUI.Components
 
         private void Initialize()
         {
+            container.Add(this);
             LeaveRequired = true;
             PropertyChanged += PopupAttributesPropertyChanged;
 
index 196c8a0..5a0a47b 100755 (executable)
@@ -122,7 +122,7 @@ namespace Tizen.NUI.Components
 
         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
         [EditorBrowsable(EditorBrowsableState.Never)]
-        protected ProgressStatusType state = ProgressStatusType.Indeterminate;
+        protected ProgressStatusType state = ProgressStatusType.Determinate;
 
         private const float round = 0.5f;
         private ImageView trackImage = null;
@@ -174,19 +174,19 @@ namespace Tizen.NUI.Components
         public enum ProgressStatusType
         {
             /// <summary>
-            /// Show TrackImage
+            /// Show BufferImage
             /// </summary>
             /// <since_tizen> 6 </since_tizen>
             Buffering,
 
             /// <summary>
-            /// Show ProgressImage
+            /// Show ProgressImage and BufferImage
             /// </summary>
             /// <since_tizen> 6 </since_tizen>
             Determinate,
 
             /// <summary>
-            /// Show LoadingImage
+            /// Show TrackImage
             /// </summary>
             /// <since_tizen> 6 </since_tizen>
             Indeterminate
@@ -507,7 +507,7 @@ namespace Tizen.NUI.Components
             }
             else if (state == ProgressStatusType.Determinate)
             {
-                bufferImage.Hide();
+                bufferImage.Show();
                 progressImage.Show();
                 UpdateValue();
             }
index 8cbb064..7f1bc9a 100755 (executable)
@@ -47,11 +47,11 @@ namespace Tizen.NUI.Components
         private IndicatorType indicatorType = IndicatorType.None;
         private const float round = 0.5f;
         // the minimum value
-        private float? minValue = null;
+        private float minValue = 0;
         // the maximum value
-        private float? maxValue = null;
+        private float maxValue = 100;
         // the current value
-        private float? curValue = null;
+        private float curValue = 0;
         // the size of the low indicator
         private Size lowIndicatorSize = null;
         // the size of the high indicator
@@ -339,7 +339,7 @@ namespace Tizen.NUI.Components
         {
             get
             {
-                return minValue ?? 0;
+                return minValue;
             }
             set
             {
@@ -356,7 +356,7 @@ namespace Tizen.NUI.Components
         {
             get
             {
-                return maxValue ?? 100;
+                return maxValue;
             }
             set
             {
@@ -373,7 +373,7 @@ namespace Tizen.NUI.Components
         {
             get
             {
-                return curValue ?? 0;
+                return curValue;
             }
             set
             {
@@ -1021,7 +1021,7 @@ namespace Tizen.NUI.Components
                 if (null != slidingFinishedHandler)
                 {
                     SlidingFinishedArgs args = new SlidingFinishedArgs();
-                    args.CurrentValue = curValue.Value;
+                    args.CurrentValue = curValue;
                     slidingFinishedHandler(this, args);
                 }
 
@@ -1279,7 +1279,7 @@ namespace Tizen.NUI.Components
 
         private void UpdateValue()
         {
-            if (slidedTrackImage == null || curValue == null || minValue == null || maxValue == null)
+            if (slidedTrackImage == null)
             {
                 return;
             }
@@ -1444,7 +1444,7 @@ namespace Tizen.NUI.Components
             if (valueChangedHandler != null)
             {
                 ValueChangedArgs args = new ValueChangedArgs();
-                args.CurrentValue = curValue.Value;
+                args.CurrentValue = curValue;
                 valueChangedHandler(this, args);
             }
         }
@@ -1460,7 +1460,7 @@ namespace Tizen.NUI.Components
                 if (null != slidingFinishedHandler)
                 {
                     SlidingFinishedArgs args = new SlidingFinishedArgs();
-                    args.CurrentValue = curValue.Value;
+                    args.CurrentValue = curValue;
                     slidingFinishedHandler(this, args);
                 }
             }
@@ -1498,7 +1498,7 @@ namespace Tizen.NUI.Components
                 if (null != valueChangedHandler)
                 {
                     ValueChangedArgs args = new ValueChangedArgs();
-                    args.CurrentValue = curValue.Value;
+                    args.CurrentValue = curValue;
                     valueChangedHandler(this, args);
                 }
             }
diff --git a/src/Tizen.NUI.Components/PreloadStyle/DefaultDropDownStyle.cs b/src/Tizen.NUI.Components/PreloadStyle/DefaultDropDownStyle.cs
new file mode 100644 (file)
index 0000000..b220354
--- /dev/null
@@ -0,0 +1,114 @@
+/*
+ * Copyright(c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System.ComponentModel;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI.Components
+{
+    /// <summary>
+    /// The default DropDown style
+    /// </summary>
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public class DefaultDropDownStyle : StyleBase
+    {
+        /// <summary>
+        /// Return default DropDown style
+        /// </summary>
+        internal protected override ViewStyle GetAttributes()
+        {
+            DropDownStyle style = new DropDownStyle
+            {
+                Position = new Position(50, 50),
+                // WidthResizePolicy = ResizePolicyType.FitToChildren,
+                // HeightResizePolicy = ResizePolicyType.FitToChildren,
+                // HeaderText = new TextLabelStyle
+                // {
+                //     Text = new Selector<string> { All = "TitleArea" },
+                //     PointSize = new Selector<float?> { All = 28 },
+                //     TextColor = new Selector<Color> { All = new Color(0, 0, 0, 1) },
+                //     FontFamily = "SamsungOneUI 500C",
+                // },
+                // BackgroundColor = new Selector<Color> { All = new Color(1, 1, 1, 1) },
+
+                Button = new ButtonStyle
+                {
+                    ParentOrigin = ParentOrigin.TopLeft,
+                    PivotPoint = PivotPoint.TopLeft,
+                    BackgroundImage = new Selector<string>
+                    {
+                        Normal = DefaultStyle.GetResourcePath("nui_component_default_checkbox_bg_n.png"),
+                        Pressed = DefaultStyle.GetResourcePath("nui_component_default_checkbox_bg_p.png")
+                    },
+                    BackgroundImageBorder = (Rectangle)6,
+                    Text = new TextLabelStyle
+                    {
+                        Text = "Select an item",
+                        PointSize = DefaultStyle.PointSizeNormal,
+                        TextColor = Color.Black,
+                    },
+                    Icon = new ImageViewStyle
+                    {
+                        Size = new Size(28, 28),
+                        ResourceUrl = DefaultStyle.GetResourcePath("nui_component_default_dropdown_button_icon.png"),
+                    },
+                    IconRelativeOrientation = Button.IconOrientation.Right,
+                    IconPadding = 6,
+                },
+                ListBackgroundImage = new ImageViewStyle
+                {
+                    ResourceUrl = DefaultStyle.GetResourcePath("nui_component_default_dropdown_list_bg.png"),
+                    Border = (Rectangle)6,
+                    Size = new Size(280, 360),
+                },
+                SpaceBetweenButtonTextAndIcon = 10,
+                ListPadding = 5,
+            };
+            return style;
+        }
+    }
+
+    /// <summary>
+    /// The default DropDownItem style
+    /// </summary>
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public class DefaultDropDownItemStyle : StyleBase
+    {
+        /// <summary>
+        /// Return default DropDownItem style
+        /// </summary>
+        internal protected override ViewStyle GetAttributes()
+        {
+            DropDownItemStyle style = new DropDownItemStyle
+            {
+                Size = new Size(360, 50),
+                BackgroundColor = new Selector<Color>
+                {
+                    Pressed = new Color(0.05f, 0.63f, 0.9f, 1),
+                    Selected = new Color(0.8f, 0.8f, 0.8f, 1),
+                    Normal = new Color(1, 1, 1, 1),
+                },
+                Text = new TextLabelStyle
+                {
+                    PointSize = DefaultStyle.PointSizeNormal,
+                    Position = new Position(28, 0),
+                    Text = "List item",
+                },
+            };
+            return style;
+        }
+    }
+}
diff --git a/src/Tizen.NUI.Components/PreloadStyle/DefaultPopupStyle.cs b/src/Tizen.NUI.Components/PreloadStyle/DefaultPopupStyle.cs
new file mode 100644 (file)
index 0000000..efa265f
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * Copyright(c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System.ComponentModel;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI.Components
+{
+    /// <summary>
+    /// The default Popup style
+    /// </summary>
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public class DefaultPopupStyle : StyleBase
+    {
+        /// <summary>
+        /// Return default Popup style
+        /// </summary>
+        internal protected override ViewStyle GetAttributes()
+        {
+            PopupStyle style = new PopupStyle
+            {
+                Size = new Size(500, 280),
+                BackgroundColor = new Color(0.9f, 0.9f, 0.9f, 1),
+                ImageShadow = new ImageShadow
+                {
+                    Url = DefaultStyle.GetResourcePath("nui_component_default_popup_shadow.png"),
+                    Border = new Rectangle(24, 24, 24, 24),
+                    Offset = new Vector2(-24, -24),
+                    Extents = new Vector2(48, 48),
+                },
+                Title = new TextLabelStyle
+                {
+                    PointSize = 16,
+                    TextColor = Color.Black,
+                    PositionUsesPivotPoint = true,
+                    ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+                    PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+                    HorizontalAlignment = HorizontalAlignment.Begin,
+                    VerticalAlignment = VerticalAlignment.Bottom,
+                    Padding = 20,
+                    Text = "Title",
+                },
+                Buttons = new ButtonStyle
+                {
+                    Size = new Size(0, 80),
+                    PositionUsesPivotPoint = true,
+                    ParentOrigin = Tizen.NUI.ParentOrigin.BottomLeft,
+                    PivotPoint = Tizen.NUI.PivotPoint.BottomLeft,
+                    BackgroundColor = new Selector<Color>
+                    {
+                        Normal = new Color(1, 1, 1, 1),
+                        Pressed = new Color(1, 1, 1, 0.5f),
+                    },
+                    Overlay = new ImageViewStyle
+                    {
+                        PositionUsesPivotPoint = true,
+                        ParentOrigin = Tizen.NUI.ParentOrigin.Center,
+                        PivotPoint = Tizen.NUI.PivotPoint.Center,
+                        WidthResizePolicy = ResizePolicyType.FillToParent,
+                        HeightResizePolicy = ResizePolicyType.FillToParent,
+                        BackgroundColor = new Selector<Color>
+                        {
+                            Normal = new Color(1.0f, 1.0f, 1.0f, 1.0f),
+                            Pressed = new Color(0.0f, 0.0f, 0.0f, 0.1f),
+                            Selected = new Color(1.0f, 1.0f, 1.0f, 1.0f),
+                        }
+                    },
+                    Text = new TextLabelStyle
+                    {
+                        PositionUsesPivotPoint = true,
+                        ParentOrigin = Tizen.NUI.ParentOrigin.Center,
+                        PivotPoint = Tizen.NUI.PivotPoint.Center,
+                        HorizontalAlignment = HorizontalAlignment.Center,
+                        VerticalAlignment = VerticalAlignment.Center,
+                        TextColor = new Color(0.05f, 0.63f, 0.9f, 1)
+                    },
+                },
+            };
+            return style;
+        }
+    }
+}
diff --git a/src/Tizen.NUI.Components/PreloadStyle/DefaultProgressStyle.cs b/src/Tizen.NUI.Components/PreloadStyle/DefaultProgressStyle.cs
new file mode 100644 (file)
index 0000000..f41ea26
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright(c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System.ComponentModel;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI.Components
+{
+    /// <summary>
+    /// The default Progress style
+    /// </summary>
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public class DefaultProgressStyle : StyleBase
+    {
+        /// <summary>
+        /// Return default Progress style
+        /// </summary>
+        internal protected override ViewStyle GetAttributes()
+        {
+            ProgressStyle style = new ProgressStyle
+            {
+                Size = new Size(200, 5),
+                Track = new ImageViewStyle
+                {
+                    BackgroundColor = new Color(0, 0, 0, 0.1f),
+                },
+                Buffer = new ImageViewStyle
+                {
+                    BackgroundColor = new Color(0.05f, 0.63f, 0.9f, 0.3f)
+                },
+                Progress = new ImageViewStyle
+                {
+                    BackgroundColor = new Color(0.05f, 0.63f, 0.9f, 1)
+                },
+
+            };
+            return style;
+        }
+    }
+}
diff --git a/src/Tizen.NUI.Components/PreloadStyle/DefaultSliderStyle.cs b/src/Tizen.NUI.Components/PreloadStyle/DefaultSliderStyle.cs
new file mode 100644 (file)
index 0000000..ef8041c
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * Copyright(c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System.ComponentModel;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI.Components
+{
+    /// <summary>
+    /// The default Slider style
+    /// </summary>
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public class DefaultSliderStyle : StyleBase
+    {
+        /// <summary>
+        /// Return default Slider style
+        /// </summary>
+        internal protected override ViewStyle GetAttributes()
+        {
+            SliderStyle style = new SliderStyle
+            {
+                Size = new Size(200, 50),
+                TrackThickness = 5,
+                Track = new ImageViewStyle
+                {
+                    BackgroundColor = new Color(0, 0, 0, 0.1f),
+                },
+
+                Progress = new ImageViewStyle
+                {
+                    BackgroundColor = new Color(0.05f, 0.63f, 0.9f, 1),
+                },
+
+                Thumb = new ImageViewStyle
+                {
+                    Size = new Size(50, 50),
+                    ResourceUrl = DefaultStyle.GetResourcePath("nui_component_default_slider_thumb_n.png"),
+                    BackgroundImage = new Selector<string>
+                    {
+                        Normal = "",
+                        Pressed = DefaultStyle.GetResourcePath("nui_component_default_slider_thumb_bg_p.png"),
+                    }
+                },
+
+            };
+            return style;
+        }
+    }
+}
diff --git a/src/Tizen.NUI.Components/PreloadStyle/DefaultToastStyle.cs b/src/Tizen.NUI.Components/PreloadStyle/DefaultToastStyle.cs
new file mode 100644 (file)
index 0000000..f348491
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright(c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System.ComponentModel;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI.Components
+{
+    /// <summary>
+    /// The default Toast style
+    /// </summary>
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public class DefaultToastStyle : StyleBase
+    {
+        /// <summary>
+        /// Return default Toast style
+        /// </summary>
+        internal protected override ViewStyle GetAttributes()
+        {
+            ToastStyle style = new ToastStyle
+            {
+                WidthResizePolicy = ResizePolicyType.FitToChildren,
+                HeightResizePolicy = ResizePolicyType.FitToChildren,
+                BackgroundColor = new Color(0, 0, 0, 0.8f),
+                Text = new TextLabelStyle()
+                {
+                    PositionUsesPivotPoint = true,
+                    ParentOrigin = Tizen.NUI.ParentOrigin.Center,
+                    PivotPoint = Tizen.NUI.PivotPoint.Center,
+                    WidthResizePolicy = ResizePolicyType.UseNaturalSize,
+                    HeightResizePolicy = ResizePolicyType.UseNaturalSize,
+                    HorizontalAlignment = HorizontalAlignment.Center,
+                    VerticalAlignment = VerticalAlignment.Center,
+                    TextColor = Color.White,
+                    Padding = new Extents(12, 12, 8, 8),
+                }
+            };
+            return style;
+        }
+    }
+}
index b74249b..00a3ae7 100755 (executable)
@@ -97,8 +97,8 @@ namespace Tizen.NUI.Components
                 PositionUsesPivotPoint = true,
                 ParentOrigin = Tizen.NUI.ParentOrigin.Center,
                 PivotPoint = Tizen.NUI.PivotPoint.Center,
-                WidthResizePolicy = ResizePolicyType.FillToParent,
-                HeightResizePolicy = ResizePolicyType.FillToParent,
+                WidthResizePolicy = ResizePolicyType.UseNaturalSize,
+                HeightResizePolicy = ResizePolicyType.UseNaturalSize,
                 HorizontalAlignment = HorizontalAlignment.Center,
                 VerticalAlignment = VerticalAlignment.Center,
                 TextColor = Color.White
index 3bc0e85..f3a4ff0 100755 (executable)
@@ -178,6 +178,12 @@ namespace Tizen.NUI.Components
                 throw new ArgumentException("The argument targetTheme must be specified");
             }
 
+            if (defaultThemeName.Equals(targetTheme))
+            {
+                // Ensure default component styles have loaded before override custom default style
+                LoadDefaultComponentStyle();
+            }
+
             if (!componentStyleByTheme.ContainsKey(targetTheme))
             {
                 componentStyleByTheme.Add(targetTheme, new Dictionary<Type, StyleBase>());
@@ -207,7 +213,7 @@ namespace Tizen.NUI.Components
                 currentTheme = defaultThemeName;
             }
 
-            if (defaultThemeName.Equals(currentTheme) && !componentStyleByTheme.ContainsKey(defaultThemeName))
+            if (defaultThemeName.Equals(currentTheme))
             {
                 LoadDefaultComponentStyle();
             }
@@ -237,13 +243,24 @@ namespace Tizen.NUI.Components
 
         private void LoadDefaultComponentStyle()
         {
+            if (componentStyleByTheme.ContainsKey(defaultThemeName))
+            {
+                return;
+            }
+
             componentStyleByTheme.Add(defaultThemeName, new Dictionary<Type, StyleBase>());
 
             var defaultComponentsStyle = componentStyleByTheme[defaultThemeName];
-            defaultComponentsStyle.Add(typeof(Button), new DefaultButtonStyle());
-            defaultComponentsStyle.Add(typeof(CheckBox), new DefaultCheckBoxStyle());
-            defaultComponentsStyle.Add(typeof(RadioButton), new DefaultRadioButtonStyle());
-            defaultComponentsStyle.Add(typeof(Switch), new DefaultSwitchStyle());
+            defaultComponentsStyle.Add(typeof(Tizen.NUI.Components.Button), new DefaultButtonStyle());
+            defaultComponentsStyle.Add(typeof(Tizen.NUI.Components.CheckBox), new DefaultCheckBoxStyle());
+            defaultComponentsStyle.Add(typeof(Tizen.NUI.Components.RadioButton), new DefaultRadioButtonStyle());
+            defaultComponentsStyle.Add(typeof(Tizen.NUI.Components.Switch), new DefaultSwitchStyle());
+            defaultComponentsStyle.Add(typeof(Tizen.NUI.Components.Progress), new DefaultProgressStyle());
+            defaultComponentsStyle.Add(typeof(Tizen.NUI.Components.Slider), new DefaultSliderStyle());
+            defaultComponentsStyle.Add(typeof(Tizen.NUI.Components.Toast), new DefaultToastStyle());
+            defaultComponentsStyle.Add(typeof(Tizen.NUI.Components.Popup), new DefaultPopupStyle());
+            defaultComponentsStyle.Add(typeof(Tizen.NUI.Components.DropDown), new DefaultDropDownStyle());
+            defaultComponentsStyle.Add(typeof(Tizen.NUI.Components.DropDown.DropDownDataItem), new DefaultDropDownItemStyle());
         }
     }
 }
diff --git a/src/Tizen.NUI.Components/res/nui_component_default_dropdown_button_icon.png b/src/Tizen.NUI.Components/res/nui_component_default_dropdown_button_icon.png
new file mode 100755 (executable)
index 0000000..e87c800
Binary files /dev/null and b/src/Tizen.NUI.Components/res/nui_component_default_dropdown_button_icon.png differ
diff --git a/src/Tizen.NUI.Components/res/nui_component_default_dropdown_list_bg.png b/src/Tizen.NUI.Components/res/nui_component_default_dropdown_list_bg.png
new file mode 100755 (executable)
index 0000000..3b2255b
Binary files /dev/null and b/src/Tizen.NUI.Components/res/nui_component_default_dropdown_list_bg.png differ
diff --git a/src/Tizen.NUI.Components/res/nui_component_default_popup_shadow.png b/src/Tizen.NUI.Components/res/nui_component_default_popup_shadow.png
new file mode 100755 (executable)
index 0000000..c302f68
Binary files /dev/null and b/src/Tizen.NUI.Components/res/nui_component_default_popup_shadow.png differ
diff --git a/src/Tizen.NUI.Components/res/nui_component_default_slider_thumb_bg_p.png b/src/Tizen.NUI.Components/res/nui_component_default_slider_thumb_bg_p.png
new file mode 100755 (executable)
index 0000000..80ffad5
Binary files /dev/null and b/src/Tizen.NUI.Components/res/nui_component_default_slider_thumb_bg_p.png differ
diff --git a/src/Tizen.NUI.Components/res/nui_component_default_slider_thumb_n.png b/src/Tizen.NUI.Components/res/nui_component_default_slider_thumb_n.png
new file mode 100755 (executable)
index 0000000..fed03cf
Binary files /dev/null and b/src/Tizen.NUI.Components/res/nui_component_default_slider_thumb_n.png differ
index 85eb288..2b9e4e5 100755 (executable)
@@ -85,7 +85,7 @@ namespace Tizen.NUI.BaseComponents
 
                 if (Rectangle.IsNullOrZero(view.backgroundImageBorder))
                 {
-                    Tizen.NUI.Object.SetProperty(view.swigCPtr, View.Property.BACKGROUND, new PropertyValue(url));
+                    Tizen.NUI.Object.SetProperty(view.swigCPtr, View.Property.BACKGROUND, string.IsNullOrEmpty(url) ? new PropertyValue() : new PropertyValue(url));
                 }
                 else
                 {
index 9985833..9ee8fd6 100755 (executable)
@@ -48,6 +48,17 @@ namespace Tizen.NUI
         }
 
         /// <summary>
+        /// The type cast operator, ushort to Extents.
+        /// </summary>
+        /// <param name="value">A value of ushort type.</param>
+        /// <returns>return a Extents instance</returns>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static implicit operator Extents(ushort value)
+        {
+            return new Extents(value, value, value, value);
+        }
+
+        /// <summary>
         /// Constructor.
         /// <param name="start">Start extent.</param>
         /// <param name="end">End extent.</param>
index 5d992a5..7bc4279 100755 (executable)
@@ -66,6 +66,17 @@ namespace Tizen.NUI
         {
         }
 
+        /// <summary>
+        /// The type cast operator, int to Rectangle.
+        /// </summary>
+        /// <param name="value">A value of int type.</param>
+        /// <returns>return a Extents instance</returns>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static implicit operator Rectangle(int value)
+        {
+            return new Rectangle(value, value, value, value);
+        }
+
         internal delegate void RectangleChangedCallback(int x, int y, int width, int height);
         private RectangleChangedCallback callback = null;