[NUI] modify and add button, checkbox, slider, progress example with IsEnabled.
authoreverLEEst(SangHyeon Lee) <dltkdgus1764@gmail.com>
Fri, 18 Mar 2022 09:08:49 +0000 (02:08 -0700)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Tue, 22 Mar 2022 08:34:14 +0000 (17:34 +0900)
test/Tizen.NUI.StyleGuide/Examples/ButtonExample.cs
test/Tizen.NUI.StyleGuide/Examples/CheckBoxExample.cs
test/Tizen.NUI.StyleGuide/Examples/ProgressExample.cs [new file with mode: 0644]
test/Tizen.NUI.StyleGuide/Examples/SliderExample.cs [new file with mode: 0644]

index 709541f..89f22c7 100644 (file)
@@ -80,7 +80,6 @@ namespace Tizen.NUI.StyleGuide
                 Text = "Disabled",
                 IsEnabled = false,
             };
-            disabledButton.EnableFocus();
             disabledButton.Clicked += (object obj, ClickedEventArgs ev) =>
             {
                 // This event should not be recieved. button is disabled.
@@ -99,8 +98,8 @@ namespace Tizen.NUI.StyleGuide
                 Log.Info(this.GetType().Name, "Selected Button Clicked\n");
                 if (obj is Button button)
                 {
-                   disabledButton.IsEnabled = button.IsSelected;
-                   if (button.IsSelected)
+                    disabledButton.IsEnabled = button.IsSelected;
+                    if (button.IsSelected)
                     {
                         button.Text = "Selected";
                     }
index 318acfb..4180a94 100644 (file)
@@ -26,7 +26,7 @@ namespace Tizen.NUI.StyleGuide
     internal class CheckBoxExample : ContentPage, IExample
     {
         private View rootContent;
-        private CheckBox checkBox1, checkBox2, checkBox3;
+        private CheckBox checkBox, disabledCheckBox, selectedCheckBox;
 
         public void Activate()
         {
@@ -64,23 +64,28 @@ namespace Tizen.NUI.StyleGuide
             };
 
             // CheckBox examples.
-            checkBox1 = new CheckBox()
+            checkBox = new CheckBox();
+            rootContent.Add(checkBox);
+
+            disabledCheckBox = new CheckBox()
             {
-                WidthSpecification = LayoutParamPolicies.MatchParent,
+                IsEnabled = false,
             };
-            rootContent.Add(checkBox1);
+            rootContent.Add(disabledCheckBox);
 
-            checkBox2 = new CheckBox()
+            selectedCheckBox = new CheckBox()
             {
-                WidthSpecification = LayoutParamPolicies.MatchParent,
+                IsSelected = true,
             };
-            rootContent.Add(checkBox2);
-
-            checkBox3 = new CheckBox()
+            selectedCheckBox.Clicked += (object obj, ClickedEventArgs ev) =>
             {
-                WidthSpecification = LayoutParamPolicies.MatchParent,
+                Log.Info(this.GetType().Name, "Selected CheckBox Clicked\n");
+                if (obj is CheckBox cb)
+                {
+                    disabledCheckBox.IsEnabled = !cb.IsSelected;
+                }
             };
-            rootContent.Add(checkBox3);
+            rootContent.Add(selectedCheckBox);
 
             Content = rootContent;
         }
diff --git a/test/Tizen.NUI.StyleGuide/Examples/ProgressExample.cs b/test/Tizen.NUI.StyleGuide/Examples/ProgressExample.cs
new file mode 100644 (file)
index 0000000..c8cc7f1
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+ * Copyright(c) 2022 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;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+
+namespace Tizen.NUI.StyleGuide
+{
+    // IExample inehrited class will be automatically added in the main examples list.
+    internal class ProgressExample : ContentPage, IExample
+    {
+        private View rootContent;
+        private Tizen.NUI.Components.Progress bufferingProgress, disabledProgress, determinatedProgress, indeterminatedProgress;
+
+        public void Activate()
+        {
+        }
+        public void Deactivate()
+        {
+        }
+
+        /// Modify this method for adding other examples.
+        public ProgressExample() : base()
+        {
+            WidthSpecification = LayoutParamPolicies.MatchParent;
+            HeightSpecification = LayoutParamPolicies.MatchParent;
+
+            // Navigator bar title is added here.
+            AppBar = new AppBar()
+            {
+                Title = "Slider Default Style",
+            };
+
+            // Example root content view.
+            // you can decorate, add children on this view.
+            rootContent = new View()
+            {
+                WidthSpecification = LayoutParamPolicies.MatchParent,
+                HeightSpecification = LayoutParamPolicies.MatchParent,
+
+                Layout = new LinearLayout()
+                {
+                    LinearOrientation = LinearLayout.Orientation.Vertical,
+                    HorizontalAlignment = HorizontalAlignment.Center,
+                    VerticalAlignment = VerticalAlignment.Center,
+                    CellPadding = new Size2D(10, 20),
+                },
+            };
+
+            // CheckBox examples.
+            bufferingProgress = new Progress()
+            {
+                MinValue = 0,
+                MaxValue = 100,
+                BufferValue = 10,
+                ProgressState = Progress.ProgressStatusType.Buffering,
+            };
+            rootContent.Add(bufferingProgress);
+
+            determinatedProgress = new Progress()
+            {
+                MinValue = 0,
+                MaxValue = 100,
+                CurrentValue = 80,
+                ProgressState = Progress.ProgressStatusType.Determinate,
+            };
+            rootContent.Add(determinatedProgress);
+
+            indeterminatedProgress = new Progress()
+            {
+                MinValue = 0,
+                MaxValue = 100,
+                ProgressState = Progress.ProgressStatusType.Indeterminate,
+            };
+            rootContent.Add(indeterminatedProgress);
+
+
+            disabledProgress = new Progress()
+            {
+                MinValue = 0,
+                MaxValue = 100,
+                IsEnabled = false,
+                ProgressState = Progress.ProgressStatusType.Indeterminate,
+            };
+            rootContent.Add(disabledProgress);
+            Content = rootContent;
+        }
+    }
+}
diff --git a/test/Tizen.NUI.StyleGuide/Examples/SliderExample.cs b/test/Tizen.NUI.StyleGuide/Examples/SliderExample.cs
new file mode 100644 (file)
index 0000000..2fc905d
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * Copyright(c) 2022 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;
+using System.ComponentModel;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+
+namespace Tizen.NUI.StyleGuide
+{
+    // IExample inehrited class will be automatically added in the main examples list.
+    internal class SliderExample : ContentPage, IExample
+    {
+        private View rootContent;
+        private Slider slider, disabledSlider, completedSlider;
+
+        public void Activate()
+        {
+        }
+        public void Deactivate()
+        {
+        }
+
+        /// Modify this method for adding other examples.
+        public SliderExample() : base()
+        {
+            WidthSpecification = LayoutParamPolicies.MatchParent;
+            HeightSpecification = LayoutParamPolicies.MatchParent;
+
+            // Navigator bar title is added here.
+            AppBar = new AppBar()
+            {
+                Title = "Slider Default Style",
+            };
+
+            // Example root content view.
+            // you can decorate, add children on this view.
+            rootContent = new View()
+            {
+                WidthSpecification = LayoutParamPolicies.MatchParent,
+                HeightSpecification = LayoutParamPolicies.MatchParent,
+
+                Layout = new LinearLayout()
+                {
+                    LinearOrientation = LinearLayout.Orientation.Vertical,
+                    HorizontalAlignment = HorizontalAlignment.Center,
+                    VerticalAlignment = VerticalAlignment.Center,
+                    CellPadding = new Size2D(10, 20),
+                },
+            };
+
+            // CheckBox examples.
+            slider = new Slider()
+            {
+                MinValue = 0,
+                MaxValue = 100,
+            };
+            rootContent.Add(slider);
+
+            disabledSlider = new Slider()
+            {
+                MinValue = 0,
+                MaxValue = 100,
+                IsEnabled = false,
+            };
+            rootContent.Add(disabledSlider);
+
+            completedSlider = new Slider()
+            {
+                MinValue = 0,
+                MaxValue = 100,
+                CurrentValue = 100,
+            };
+            rootContent.Add(completedSlider);
+
+            Content = rootContent;
+        }
+    }
+}