2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
22 /// The ProgressBar is a widget for visually representing the progress status of a given job/task.
24 public class ProgressBar : Layout
29 /// Creates and initializes a new instance of the ProgressBar class.
31 /// <param name="parent">The EvasObject to which the new ProgressBar will be attached as a child.</param>
32 public ProgressBar(EvasObject parent) : base(parent)
34 _changed = new SmartEvent(this, this.RealHandle, "changed");
35 _changed.On += (s, e) =>
37 ValueChanged?.Invoke(this, EventArgs.Empty);
42 /// ValueChanged will be triggered when value of ProgressBar change.
44 public event EventHandler ValueChanged;
47 /// Sets or gets the value wheather a given ProgressBar widget is at the "pulsing mode".
50 /// By default, progress bars display values from low to high value boundaries.
51 /// There are, though, contexts in which the progress of a given task is unknown.
52 /// For such cases, one can set a progress bar widget to a "pulsing state",
53 /// to give the user an idea that some computation is being held,
54 /// but without exact progress values. In the default theme,
55 /// it animates its bar with the contents filling in constantly and back to non-filled, in a loop.
57 public bool IsPulseMode
61 return Interop.Elementary.elm_progressbar_pulse_get(RealHandle);
65 Interop.Elementary.elm_progressbar_pulse_set(RealHandle, value);
70 /// Sets or gets the value of ProgressBar.
76 return Interop.Elementary.elm_progressbar_value_get(RealHandle);
80 Interop.Elementary.elm_progressbar_value_set(RealHandle, value);
85 /// Sets or gets the span value of ProgressBar.
91 return Interop.Elementary.elm_progressbar_span_size_get(RealHandle);
95 Interop.Elementary.elm_progressbar_span_size_set(RealHandle, value);
100 /// Sets or gets the value wheather a given ProgressBar widget is horizontal.
102 public bool IsHorizontal
106 return Interop.Elementary.elm_progressbar_horizontal_get(RealHandle);
110 Interop.Elementary.elm_progressbar_horizontal_set(RealHandle, value);
115 /// Sets or gets the value whether a given progress bar widget's displaying values are inverted.
117 public bool IsInverted
121 return Interop.Elementary.elm_progressbar_inverted_get(RealHandle);
125 Interop.Elementary.elm_progressbar_inverted_set(RealHandle, value);
130 /// Sets or gets format string for a given progress bar widget's units label.
133 /// If NULL is passed on format, it makes obj units area to be hidden completely.
134 /// If not, it sets the format string for the units label's text.
135 /// The units label is provided with a floating point value, so the units text displays at most one floating point value.
136 /// Note that the units label is optional. Use a format string such as "%1.2f meters" for example.
137 /// The default format string for a progress bar is an integer percentage, as in "%.0f %%".
139 public string UnitFormat
143 return Interop.Elementary.elm_progressbar_unit_format_get(RealHandle);
147 Interop.Elementary.elm_progressbar_unit_format_set(RealHandle, value);
152 /// Starts a given progress bar "pulsing" animation, if its under that mode.
154 public void PlayPulse()
156 Interop.Elementary.elm_progressbar_pulse(RealHandle, true);
159 [Obsolete("use StopPulse instead")]
160 public void StopPluse()
162 Interop.Elementary.elm_progressbar_pulse(RealHandle, false);
166 /// Stops a given progress bar "pulsing" animation, if its under that mode.
168 public void StopPulse()
170 Interop.Elementary.elm_progressbar_pulse(RealHandle, false);
173 protected override IntPtr CreateHandle(EvasObject parent)
175 IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle);
176 Interop.Elementary.elm_layout_theme_set(handle, "layout", "elm_widget", "default");
178 RealHandle = Interop.Elementary.elm_progressbar_add(handle);
179 Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle);