Add C# tooltip example to the control dashboard 04/111904/3
authorRichard Huang <r.huang@samsung.com>
Tue, 24 Jan 2017 17:01:36 +0000 (17:01 +0000)
committerRichard Huang <r.huang@samsung.com>
Tue, 24 Jan 2017 17:08:54 +0000 (17:08 +0000)
Change-Id: I1c96eb3b3ab73a257179d42901cce8b258283b54

plugins/dali-swig/examples/control-dashboard.cs

index 8fe3c70..756f651 100755 (executable)
@@ -48,7 +48,7 @@ namespace MyCSharpExample
             new Item("PushButton", true),  new Item("DropDown", false),    new Item("Toggle", false),
             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", false),     new Item("Popup", true),       new Item("Toast", true),
+            new Item("Tooltip", true),     new Item("Popup", true),       new Item("Toast", true),
             new Item("ItemView", false),    new Item("CheckBox", true)
         };
 
@@ -203,7 +203,49 @@ namespace MyCSharpExample
                 }
                 if (item.name.CompareTo("Tooltip") == 0)
                 {
+                    TableView tableView = new TableView(2, 1);
+                    tableView.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.WIDTH);
+                    tableView.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.HEIGHT);
+
+                    // Create two push buttons and add them to a table view
+                    PushButton buttonWithSimpleTooltip = new PushButton();
+                    buttonWithSimpleTooltip.LabelText = "Tooltip with text only";
+                    buttonWithSimpleTooltip.UnselectedColor = new Vector4(0.5f,0.5f,0.7f,1.0f);
+                    buttonWithSimpleTooltip.SelectedColor = new Vector4(0.7f,0.5f,0.7f,1.0f);
+                    buttonWithSimpleTooltip.WidthResizePolicy = "FILL_TO_PARENT";
+                    tableView.AddChild(buttonWithSimpleTooltip, new TableView.CellPosition(0, 0));
+
+                    PushButton buttonWithIconTooltip = new PushButton();
+                    buttonWithIconTooltip.LabelText = "Tooltip with Text and Icon";
+                    buttonWithIconTooltip.WidthResizePolicy = "FILL_TO_PARENT";
+                    buttonWithIconTooltip.UnselectedColor = new Vector4(0.5f,0.5f,0.7f,1.0f);
+                    buttonWithIconTooltip.SelectedColor = new Vector4(0.7f,0.5f,0.7f,1.0f);
+                    tableView.AddChild(buttonWithIconTooltip, new TableView.CellPosition(1, 0));
+
+                    // Add a simple text only tooltip to the first push button
+                    buttonWithSimpleTooltip.TooltipText = "Simple Tooltip";
 
+                    // Create a property map for a tooltip with one icon and one text
+                    Property.Array iconTooltipContent = new Property.Array();
+
+                    Property.Map iconVisual = new Property.Map();
+                    iconVisual.Add( Dali.Constants.Visual.Property.Type, new Property.Value((int)Dali.Constants.Visual.Type.Image) )
+                              .Add( Dali.Constants.ImageVisualProperty.URL, new Property.Value("./images/star-highlight.png") );
+                    iconTooltipContent.Add(new Property.Value(iconVisual));
+
+                    Property.Map textVisual = new Property.Map();
+                    textVisual.Add( Dali.Constants.Visual.Property.Type, new Property.Value((int)Dali.Constants.Visual.Type.Text) )
+                              .Add( Dali.Constants.TextVisualProperty.Text, new Property.Value("Tooltip with Icon") );
+                    iconTooltipContent.Add(new Property.Value(textVisual));
+
+                    Property.Map iconTooltip = new Property.Map();
+                    iconTooltip.Add( Dali.Constants.Tooltip.Property.Content, new Property.Value(iconTooltipContent) )
+                               .Add( Dali.Constants.Tooltip.Property.Tail, new Property.Value(true) );
+
+                    // Add the tooltip with icon and text to the second push button
+                    buttonWithIconTooltip.Tooltip = iconTooltip;
+
+                    _contentContainer.AddChild(tableView, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5));
                 }
                 if (item.name.CompareTo("Popup") == 0)
                 {