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.
73 /// Use this property to set the progress bar levels.
74 /// If you pass a value out of the specified range(0.0~1.0),
75 /// it is interpreted as the closest of the boundary values in the range.
81 return Interop.Elementary.elm_progressbar_value_get(RealHandle);
85 Interop.Elementary.elm_progressbar_value_set(RealHandle, value);
90 /// Sets or gets the span value of ProgressBar.
96 return Interop.Elementary.elm_progressbar_span_size_get(RealHandle);
100 Interop.Elementary.elm_progressbar_span_size_set(RealHandle, value);
105 /// Sets or gets the value wheather a given ProgressBar widget is horizontal.
107 public bool IsHorizontal
111 return Interop.Elementary.elm_progressbar_horizontal_get(RealHandle);
115 Interop.Elementary.elm_progressbar_horizontal_set(RealHandle, value);
120 /// Sets or gets the value whether a given progress bar widget's displaying values are inverted.
122 public bool IsInverted
126 return Interop.Elementary.elm_progressbar_inverted_get(RealHandle);
130 Interop.Elementary.elm_progressbar_inverted_set(RealHandle, value);
135 /// Sets or gets format string for a given progress bar widget's units label.
138 /// If NULL is passed on format, it makes obj units area to be hidden completely.
139 /// If not, it sets the format string for the units label's text.
140 /// The units label is provided with a floating point value, so the units text displays at most one floating point value.
141 /// Note that the units label is optional. Use a format string such as "%1.2f meters" for example.
142 /// The default format string for a progress bar is an integer percentage, as in "%.0f %%".
144 public string UnitFormat
148 return Interop.Elementary.elm_progressbar_unit_format_get(RealHandle);
152 Interop.Elementary.elm_progressbar_unit_format_set(RealHandle, value);
157 /// Starts a given progress bar "pulsing" animation, if its under that mode.
159 public void PlayPulse()
161 Interop.Elementary.elm_progressbar_pulse(RealHandle, true);
164 [Obsolete("use StopPulse instead")]
165 public void StopPluse()
167 Interop.Elementary.elm_progressbar_pulse(RealHandle, false);
171 /// Stops a given progress bar "pulsing" animation, if its under that mode.
173 public void StopPulse()
175 Interop.Elementary.elm_progressbar_pulse(RealHandle, false);
178 protected override IntPtr CreateHandle(EvasObject parent)
180 IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle);
181 Interop.Elementary.elm_layout_theme_set(handle, "layout", "elm_widget", "default");
183 RealHandle = Interop.Elementary.elm_progressbar_add(handle);
184 Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle);