summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsung-su.kim <sung-su.kim@samsung.com>2017-05-18 20:30:03 +0900
committersung-su.kim <sung-su.kim@samsung.com>2017-06-01 11:30:10 +0900
commit2c5cdfe03beba3702530aa2e0eaf07f5f268205c (patch)
tree88b0c3dccd44c319d5e0a56fd93a9a4324cf5909
parent18604b62a7509bcb4b1bd312fd8f19b03188b663 (diff)
downloadelm-sharp-2c5cdfe03beba3702530aa2e0eaf07f5f268205c.tar.gz
elm-sharp-2c5cdfe03beba3702530aa2e0eaf07f5f268205c.tar.bz2
elm-sharp-2c5cdfe03beba3702530aa2e0eaf07f5f268205c.zip
Enhance Slider widget
Change-Id: If5947663d82e9d2a1b974ed736d33182959727cc
-rwxr-xr-xElmSharp.Test/ElmSharp.Test.csproj3
-rwxr-xr-xElmSharp.Test/TC/SliderTest2.cs125
-rw-r--r--ElmSharp/ElmSharp/Slider.cs32
-rw-r--r--ElmSharp/Interop/Interop.Elementary.Slider.cs6
4 files changed, 162 insertions, 4 deletions
diff --git a/ElmSharp.Test/ElmSharp.Test.csproj b/ElmSharp.Test/ElmSharp.Test.csproj
index 8457572..184b753 100755
--- a/ElmSharp.Test/ElmSharp.Test.csproj
+++ b/ElmSharp.Test/ElmSharp.Test.csproj
@@ -107,6 +107,7 @@
<Compile Include="TC\ScrollerTest1.cs" />
<Compile Include="TC\ScrollerTest2.cs" />
<Compile Include="TC\SliderTest1.cs" />
+ <Compile Include="TC\SliderTest2.cs" />
<Compile Include="TC\SpinnerTest1.cs" />
<Compile Include="TC\ToolbarTest1.cs" />
<Compile Include="TC\ToolbarTest2.cs" />
@@ -208,4 +209,4 @@
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
-</Project> \ No newline at end of file
+</Project>
diff --git a/ElmSharp.Test/TC/SliderTest2.cs b/ElmSharp.Test/TC/SliderTest2.cs
new file mode 100755
index 0000000..7fe3ec6
--- /dev/null
+++ b/ElmSharp.Test/TC/SliderTest2.cs
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ElmSharp.Test
+{
+ class SliderTest2 : TestCaseBase
+ {
+ public override string TestName => "SliderTest2";
+ public override string TestDescription => "To test basic operation of Slider";
+
+ public override void Run(Window window)
+ {
+ Conformant conformant = new Conformant(window);
+ conformant.Show();
+ Table table = new Table(window);
+ conformant.SetContent(table);
+ table.Show();
+
+ Slider sld = new Slider(window)
+ {
+ Text = "Slider Test",
+ UnitFormat = "%1.2f meters",
+ IndicatorFormat = "%1.2f meters",
+ Minimum = 0.0,
+ Maximum = 100.0,
+ Value = 0.1,
+ AlignmentX = -1,
+ AlignmentY = 0.5,
+ WeightX = 1,
+ WeightY = 1,
+ IsIndicatorFocusable = true
+ };
+
+ Label lb1 = new Label(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = 0,
+ WeightX = 1,
+ WeightY = 1,
+ Text = string.Format("IndicatorVisibleMode={0}", sld.IndicatorVisibleMode.ToString()),
+ };
+ lb1.EdjeObject["elm.text"].TextStyle = "DEFAULT='color=#ffffff'";
+
+ Label lb2 = new Label(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = 0,
+ WeightX = 1,
+ WeightY = 1,
+ Text = string.Format("IndicatorVisibleMode={0}", sld.IndicatorVisibleMode.ToString()),
+ };
+ lb2.EdjeObject["elm.text"].TextStyle = "DEFAULT='color=#ffffff'";
+
+ Button btn1 = new Button(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = 0,
+ WeightX = 1,
+ WeightY = 1,
+ Text = "Change IndicatorVisibleMode"
+ };
+ btn1.Clicked += (s, e) =>
+ {
+ sld.IndicatorVisibleMode = (SliderIndicatorVisibleMode)(((int)sld.IndicatorVisibleMode + 1) % 4);
+ lb1.Text = string.Format("IndicatorVisibleMode={0}", sld.IndicatorVisibleMode.ToString());
+ lb1.EdjeObject["elm.text"].TextStyle = "DEFAULT='color=#ffffff'";
+ };
+
+ Button btn2 = new Button(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = 0,
+ WeightX = 1,
+ WeightY = 1,
+ Text = "Change IsIndicatorVisible"
+ };
+ btn2.Clicked += (s, e) =>
+ {
+ sld.IsIndicatorVisible = !sld.IsIndicatorVisible;
+ lb2.Text = string.Format("IsIndicatorVisible={0}", sld.IsIndicatorVisible.ToString());
+ lb2.EdjeObject["elm.text"].TextStyle = "DEFAULT='color=#ffffff'";
+ };
+
+ table.Pack(sld, 1, 1, 2, 1);
+ table.Pack(lb1, 1, 2, 2, 1);
+ table.Pack(lb2, 1, 3, 2, 1);
+ table.Pack(btn1, 1, 4, 2, 1);
+ table.Pack(btn2, 1, 5, 2, 1);
+
+ sld.Show();
+ lb1.Show();
+ lb2.Show();
+ btn1.Show();
+ btn2.Show();
+
+ sld.ValueChanged += (s, e) =>
+ {
+ lb1.Text = string.Format("IndicatorVisibleMode={0}", sld.IndicatorVisibleMode.ToString());
+ lb1.EdjeObject["elm.text"].TextStyle = "DEFAULT='color=#ffffff'";
+
+ lb2.Text = string.Format("IsIndicatorVisible={0}", sld.IsIndicatorVisible.ToString());
+ lb2.EdjeObject["elm.text"].TextStyle = "DEFAULT='color=#ffffff'";
+ };
+ }
+ }
+} \ No newline at end of file
diff --git a/ElmSharp/ElmSharp/Slider.cs b/ElmSharp/ElmSharp/Slider.cs
index cf05a71..17f1479 100644
--- a/ElmSharp/ElmSharp/Slider.cs
+++ b/ElmSharp/ElmSharp/Slider.cs
@@ -42,6 +42,32 @@ namespace ElmSharp
}
/// <summary>
+ /// Enumeration for the Slider's indicator visiblity mode.
+ /// </summary>
+ public enum SliderIndicatorVisibleMode
+ {
+ /// <summary>
+ /// Show indicator on mouse down or change in slider value.
+ /// </summary>
+ Default,
+
+ /// <summary>
+ /// Always show the indicator.
+ /// </summary>
+ Always,
+
+ /// <summary>
+ /// Show the indicator on focus.
+ /// </summary>
+ OnFocus,
+
+ /// <summary>
+ /// Never show the indicator.
+ /// </summary>
+ None,
+ }
+
+ /// <summary>
/// The Slider is a widget that adds a draggable slider widget for selecting the value of something within a range.
/// </summary>
public class Slider : Layout
@@ -306,7 +332,7 @@ namespace ElmSharp
}
/// <summary>
- /// Sets or gets the visible mode of indicator.
+ /// Sets or gets the visible mode of slider indicator.
/// </summary>
public SliderIndicatorVisibleMode IndicatorVisibleMode
{
@@ -316,7 +342,7 @@ namespace ElmSharp
}
set
{
- Interop.Elementary.elm_slider_indicator_visible_mode_set(RealHandle, (Interop.Elementary.Elm_Slider_Indicator_Visible_Mode)value);
+ Interop.Elementary.elm_slider_indicator_visible_mode_set(RealHandle, (int)value);
}
}
@@ -346,4 +372,4 @@ namespace ElmSharp
return handle;
}
}
-} \ No newline at end of file
+}
diff --git a/ElmSharp/Interop/Interop.Elementary.Slider.cs b/ElmSharp/Interop/Interop.Elementary.Slider.cs
index 92e4a3a..9e351c6 100644
--- a/ElmSharp/Interop/Interop.Elementary.Slider.cs
+++ b/ElmSharp/Interop/Interop.Elementary.Slider.cs
@@ -115,5 +115,11 @@ internal static partial class Interop
[DllImport(Libraries.Elementary)]
internal static extern double elm_slider_step_get(IntPtr obj);
+
+ [DllImport(Libraries.Elementary)]
+ internal static extern int elm_slider_indicator_visible_mode_get(IntPtr obj);
+
+ [DllImport(Libraries.Elementary)]
+ internal static extern void elm_slider_indicator_visible_mode_set(IntPtr obj, int mode);
}
} \ No newline at end of file