Add Toggle button example for dashboard demo. 56/112056/4
authorxb.teng <xb.teng@samsung.com>
Wed, 25 Jan 2017 14:30:43 +0000 (22:30 +0800)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Thu, 2 Feb 2017 18:15:17 +0000 (10:15 -0800)
Change-Id: Ia6193084e2019e53814207811788d46ebaf5eb1b
Signed-off-by: xb.teng <xb.teng@samsung.com>
plugins/dali-swig/examples/control-dashboard.cs
plugins/dali-swig/examples/images/star-mod.png [new file with mode: 0644]

index 756f6516115316e85ac06e1aa49ecfd3547cb6ee..6c9fc64c9909af1362116dfceb6c44e721df9c14 100755 (executable)
@@ -45,7 +45,7 @@ namespace MyCSharpExample
 
         // List of items
         private Item[] mViewList = {
-            new Item("PushButton", true),  new Item("DropDown", false),    new Item("Toggle", false),
+            new Item("PushButton", true),  new Item("DropDown", false),    new Item("Toggle", true),
             new Item("InputField", false),  new Item("AnimateGif", false),  new Item("Loading", false),
             new Item("ProgressBar", false), new Item("CheckBox", false),    new Item("RadioButton", true),
             new Item("Tooltip", true),     new Item("Popup", true),       new Item("Toast", true),
@@ -154,7 +154,28 @@ namespace MyCSharpExample
                 }
                 if (item.name.CompareTo("Toggle") == 0)
                 {
+                    ToggleButton toggleButton = new ToggleButton();
+                    Dali.Property.Array array = new Dali.Property.Array();
+                    array.Add( new Dali.Property.Value("./images/star-highlight.png") );
+                    array.Add( new Dali.Property.Value("./images/star-mod.png") );
+                    array.Add( new Dali.Property.Value("./images/star-dim.png") );
+                    toggleButton.StateVisuals = array;
+
+                    Dali.Property.Array tooltips = new Dali.Property.Array();
+                    tooltips.Add( new Dali.Property.Value("State A") );
+                    tooltips.Add( new Dali.Property.Value("State B") );
+                    tooltips.Add( new Dali.Property.Value("State C") );
+                    toggleButton.Tooltips = tooltips;
+
+                    toggleButton.WidthResizePolicy  = "FILL_TO_PARENT";
+                    toggleButton.HeightResizePolicy = "FILL_TO_PARENT";
+                    toggleButton.Clicked += (obj, e) =>
+                    {
+                        Console.WriteLine("Toggle button state changed.");
+                        return true;
+                    };
 
+                    _contentContainer.AddChild(toggleButton, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5));
                 }
                 if (item.name.CompareTo("InputField") == 0)
                 {
diff --git a/plugins/dali-swig/examples/images/star-mod.png b/plugins/dali-swig/examples/images/star-mod.png
new file mode 100644 (file)
index 0000000..2e3212e
Binary files /dev/null and b/plugins/dali-swig/examples/images/star-mod.png differ