summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsung-su.kim <sung-su.kim@samsung.com>2017-05-19 10:55:13 +0900
committersung-su.kim <sung-su.kim@samsung.com>2017-05-19 10:55:45 +0900
commit0d6aa6145f81d918e6f64627aedbe2c4639463ad (patch)
tree0a5959d12dc48fd3984f96b8cf842dededbad821
parente1ba94758ddca850d8d26c79b011fda6483f599a (diff)
downloadelm-sharp-0d6aa6145f81d918e6f64627aedbe2c4639463ad.tar.gz
elm-sharp-0d6aa6145f81d918e6f64627aedbe2c4639463ad.tar.bz2
elm-sharp-0d6aa6145f81d918e6f64627aedbe2c4639463ad.zip
Enhance ProgressBar widget
Change-Id: I7bcc55907f337e63581ad878d8169ba01d130e66
-rw-r--r--ElmSharp.Test/TC/ProgressBarTest1.cs94
-rwxr-xr-xElmSharp/ElmSharp/ProgressBar.cs22
-rw-r--r--ElmSharp/Interop/Interop.Elementary.ProgressBar.cs3
3 files changed, 102 insertions, 17 deletions
diff --git a/ElmSharp.Test/TC/ProgressBarTest1.cs b/ElmSharp.Test/TC/ProgressBarTest1.cs
index 3e28ead..04a04cf 100644
--- a/ElmSharp.Test/TC/ProgressBarTest1.cs
+++ b/ElmSharp.Test/TC/ProgressBarTest1.cs
@@ -54,9 +54,17 @@ namespace ElmSharp.Test
WeightY = 1
};
+ Label lb2 = new Label(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = 0,
+ WeightX = 1,
+ WeightY = 1
+ };
+
Button bt1 = new Button(window)
{
- Text = "Increase",
+ Text = "Increase Value",
AlignmentX = -1,
AlignmentY = 0,
WeightX = 1,
@@ -65,38 +73,92 @@ namespace ElmSharp.Test
Button bt2 = new Button(window)
{
- Text = "Decrease",
+ Text = "Decrease Value",
AlignmentX = -1,
AlignmentY = 0,
WeightX = 1,
WeightY = 1
};
- table.Pack(pb1, 1, 1, 2, 1);
- table.Pack(lb1, 1, 2, 2, 1);
- table.Pack(bt1, 1, 3, 1, 1);
- table.Pack(bt2, 2, 3, 1, 1);
+ Button bt3 = new Button(window)
+ {
+ Text = "Increase PartValue",
+ AlignmentX = -1,
+ AlignmentY = 0,
+ WeightX = 1,
+ WeightY = 1
+ };
- pb1.Show();
- lb1.Show();
- bt1.Show();
- bt2.Show();
+ Button bt4 = new Button(window)
+ {
+ Text = "Decrease PartValue",
+ AlignmentX = -1,
+ AlignmentY = 0,
+ WeightX = 1,
+ WeightY = 1
+ };
+
+ string part = "elm.cur.progressbar";
+ double unit = 0.1;
+ double max = 1.0;
+ double min = 0;
+
+ pb1.ValueChanged += (s, e) =>
+ {
+ lb1.Text = string.Format("Value Changed: {0}", pb1.Value);
+ lb1.EdjeObject["elm.text"].TextStyle = "DEFAULT='color=#ffffff'";
+
+ lb2.Text = string.Format("PartValue Changed: {0}", pb1.GetPartValue(part));
+ lb2.EdjeObject["elm.text"].TextStyle = "DEFAULT='color=#ffffff'";
+ };
bt1.Clicked += (s, e) =>
{
- pb1.Value += 0.1;
+ var val = pb1.Value + unit;
+ if (val <= max)
+ pb1.Value = val;
};
bt2.Clicked += (s, e) =>
{
- pb1.Value -= 0.1;
+ var val = pb1.Value - unit;
+ if (val >= min)
+ {
+ pb1.Value = val;
+ }
};
- pb1.ValueChanged += (s, e) =>
+ bt3.Clicked += (s, e) =>
{
- lb1.Text = string.Format("Value Changed: {0}", pb1.Value);
- lb1.EdjeObject["elm.text"].TextStyle = "DEFAULT='color=#ffffff'";
+ var val = pb1.GetPartValue(part) + unit;
+ if (val <= max)
+ pb1.SetPartValue(part, val);
};
+
+ bt4.Clicked += (s, e) =>
+ {
+ var val = pb1.GetPartValue(part) - unit;
+ if (val >= min)
+ {
+ pb1.SetPartValue(part, val);
+ }
+ };
+
+ table.Pack(pb1, 1, 1, 2, 1);
+ table.Pack(lb1, 1, 2, 2, 1);
+ table.Pack(lb2, 1, 3, 2, 1);
+ table.Pack(bt1, 1, 4, 1, 1);
+ table.Pack(bt2, 1, 5, 1, 1);
+ table.Pack(bt3, 1, 6, 1, 1);
+ table.Pack(bt4, 1, 7, 1, 1);
+
+ pb1.Show();
+ lb1.Show();
+ lb2.Show();
+ bt1.Show();
+ bt2.Show();
+ bt3.Show();
+ bt4.Show();
}
}
-}
+} \ No newline at end of file
diff --git a/ElmSharp/ElmSharp/ProgressBar.cs b/ElmSharp/ElmSharp/ProgressBar.cs
index 5ef887b..d0121e6 100755
--- a/ElmSharp/ElmSharp/ProgressBar.cs
+++ b/ElmSharp/ElmSharp/ProgressBar.cs
@@ -175,6 +175,26 @@ namespace ElmSharp
Interop.Elementary.elm_progressbar_pulse(RealHandle, false);
}
+ /// <summary>
+ /// Gets the part value of the given part of the Progressbar.
+ /// </summary>
+ /// <param name="part">Part of the Progressbar.</param>
+ /// <returns>Returns value range is from 0.0 to 1.0.</returns>
+ public double GetPartValue(string part)
+ {
+ return Interop.Elementary.elm_progressbar_part_value_get(RealHandle, part);
+ }
+
+ /// <summary>
+ /// Sets the part value of the give part of the Progressbar.
+ /// </summary>
+ /// <param name="part">Part of the Progressbar.</param>
+ /// <param name="value">Value range is from 0.0 to 1.0.</param>
+ public void SetPartValue(string part, double value)
+ {
+ Interop.Elementary.elm_progressbar_part_value_set(RealHandle, part, value);
+ }
+
protected override IntPtr CreateHandle(EvasObject parent)
{
IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle);
@@ -186,4 +206,4 @@ namespace ElmSharp
return handle;
}
}
-}
+} \ No newline at end of file
diff --git a/ElmSharp/Interop/Interop.Elementary.ProgressBar.cs b/ElmSharp/Interop/Interop.Elementary.ProgressBar.cs
index e171fdc..259b53f 100644
--- a/ElmSharp/Interop/Interop.Elementary.ProgressBar.cs
+++ b/ElmSharp/Interop/Interop.Elementary.ProgressBar.cs
@@ -61,6 +61,9 @@ internal static partial class Interop
internal static extern void elm_progressbar_part_value_set(IntPtr obj, string part, double val);
[DllImport(Libraries.Elementary)]
+ internal static extern double elm_progressbar_part_value_get(IntPtr obj, string part);
+
+ [DllImport(Libraries.Elementary)]
internal static extern void elm_progressbar_unit_format_set(IntPtr obj, string format);
[DllImport(Libraries.Elementary)]