2 * @defgroup Slider Slider
5 * @image html img/widget/slider/preview-00.png
6 * @image latex img/widget/slider/preview-00.eps width=\textwidth
8 * The slider adds a draggable “slider” widget for selecting the value of
9 * something within a range.
11 * A slider can be horizontal or vertical. It can contain an Icon and has a
12 * primary label as well as a units label (that is formatted with floating
13 * point values and thus accepts a printf-style format string, like
14 * “%1.2f units”. There is also an indicator string that may be somewhere
15 * else (like on the slider itself) that also accepts a format string like
16 * units. Label, Icon Unit and Indicator strings/objects are optional.
18 * A slider may be inverted which means values invert, with high vales being
19 * on the left or top and low values on the right or bottom (as opposed to
20 * normally being low on the left or top and high on the bottom and right).
22 * The slider should have its minimum and maximum values set by the
23 * application with elm_slider_min_max_set() and value should also be set by
24 * the application before use with elm_slider_value_set(). The span of the
25 * slider is its length (horizontally or vertically). This will be scaled by
26 * the object or applications scaling factor. At any point code can query the
27 * slider for its value with elm_slider_value_get().
29 * Smart callbacks one can listen to:
30 * - "changed" - Whenever the slider value is changed by the user.
31 * - "slider,drag,start" - dragging the slider indicator around has started.
32 * - "slider,drag,stop" - dragging the slider indicator around has stopped.
33 * - "delay,changed" - A short time after the value is changed by the user.
34 * This will be called only when the user stops dragging for
35 * a very short period or when they release their
36 * finger/mouse, so it avoids possibly expensive reactions to
39 * Available styles for it:
42 * Default contents parts of the slider widget that you can use for are:
43 * @li "icon" - An icon of the slider
44 * @li "end" - A end part content of the slider
46 * Default text parts of the slider widget that you can use for are:
47 * @li "default" - Label of the slider
49 * Supported elm_object common APIs.
50 * @li elm_object_disabled_set
51 * @li elm_object_disabled_get
52 * @li elm_object_part_text_set
53 * @li elm_object_part_text_get
54 * @li elm_object_part_content_set
55 * @li elm_object_part_content_get
56 * @li elm_object_part_content_unset
58 * Here is an example on its usage:
59 * @li @ref slider_example
68 * Add a new slider widget to the given parent Elementary
71 * @param parent The parent object.
72 * @return a new slider widget handle or @c NULL, on errors.
74 * This function inserts a new slider widget on the canvas.
78 EAPI Evas_Object *elm_slider_add(Evas_Object *parent);
81 * Set the (exact) length of the bar region of a given slider widget.
83 * @param obj The slider object.
84 * @param size The length of the slider's bar region.
86 * This sets the minimum width (when in horizontal mode) or height
87 * (when in vertical mode) of the actual bar area of the slider
88 * @p obj. This in turn affects the object's minimum size. Use
89 * this when you're not setting other size hints expanding on the
90 * given direction (like weight and alignment hints) and you would
91 * like it to have a specific size.
93 * @note Icon, end, label, indicator and unit text around @p obj
95 * own space, which will make @p obj to require more the @p size,
98 * @see elm_slider_span_size_get()
102 EAPI void elm_slider_span_size_set(Evas_Object *obj, Evas_Coord size);
105 * Get the length set for the bar region of a given slider widget
107 * @param obj The slider object.
108 * @return The length of the slider's bar region.
110 * If that size was not set previously, with
111 * elm_slider_span_size_set(), this call will return @c 0.
115 EAPI Evas_Coord elm_slider_span_size_get(const Evas_Object *obj);
118 * Set the format string for the unit label.
120 * @param obj The slider object.
121 * @param format The format string for the unit display.
123 * Unit label is displayed all the time, if set, after slider's bar.
124 * In horizontal mode, at right and in vertical mode, at bottom.
126 * If @c NULL, unit label won't be visible. If not it sets the format
127 * string for the label text. To the label text is provided a floating point
128 * value, so the label text can display up to 1 floating point value.
129 * Note that this is optional.
131 * Use a format string such as "%1.2f meters" for example, and it will
132 * display values like: "3.14 meters" for a value equal to 3.14159.
134 * Default is unit label disabled.
136 * @see elm_slider_indicator_format_get()
140 EAPI void elm_slider_unit_format_set(Evas_Object *obj, const char *format);
143 * Get the unit label format of the slider.
145 * @param obj The slider object.
146 * @return The unit label format string in UTF-8.
148 * Unit label is displayed all the time, if set, after slider's bar.
149 * In horizontal mode, at right and in vertical mode, at bottom.
151 * @see elm_slider_unit_format_set() for more
152 * information on how this works.
156 EAPI const char *elm_slider_unit_format_get(const Evas_Object *obj);
159 * Set the format string for the indicator label.
161 * @param obj The slider object.
162 * @param indicator The format string for the indicator display.
164 * The slider may display its value somewhere else then unit label,
165 * for example, above the slider knob that is dragged around. This function
166 * sets the format string used for this.
168 * If @c NULL, indicator label won't be visible. If not it sets the format
169 * string for the label text. To the label text is provided a floating point
170 * value, so the label text can display up to 1 floating point value.
171 * Note that this is optional.
173 * Use a format string such as "%1.2f meters" for example, and it will
174 * display values like: "3.14 meters" for a value equal to 3.14159.
176 * Default is indicator label disabled.
178 * @see elm_slider_indicator_format_get()
182 EAPI void elm_slider_indicator_format_set(Evas_Object *obj, const char *indicator);
185 * Get the indicator label format of the slider.
187 * @param obj The slider object.
188 * @return The indicator label format string in UTF-8.
190 * The slider may display its value somewhere else then unit label,
191 * for example, above the slider knob that is dragged around. This function
192 * gets the format string used for this.
194 * @see elm_slider_indicator_format_set() for more
195 * information on how this works.
199 EAPI const char *elm_slider_indicator_format_get(const Evas_Object *obj);
202 * Set the format function pointer for the indicator label
204 * @param obj The slider object.
205 * @param func The indicator format function.
206 * @param free_func The freeing function for the format string.
208 * Set the callback function to format the indicator string.
210 * @see elm_slider_indicator_format_set() for more info on how this works.
214 EAPI void elm_slider_indicator_format_function_set(Evas_Object *obj, const char *(*func)(double val), void (*free_func)(const char *str));
217 * Set the format function pointer for the units label
219 * @param obj The slider object.
220 * @param func The units format function.
221 * @param free_func The freeing function for the format string.
223 * Set the callback function to format the indicator string.
225 * @see elm_slider_units_format_set() for more info on how this works.
229 EAPI void elm_slider_units_format_function_set(Evas_Object *obj, const char *(*func)(double val), void (*free_func)(const char *str));
232 * Set the orientation of a given slider widget.
234 * @param obj The slider object.
235 * @param horizontal Use @c EINA_TRUE to make @p obj to be
236 * @b horizontal, @c EINA_FALSE to make it @b vertical.
238 * Use this function to change how your slider is to be
239 * disposed: vertically or horizontally.
241 * By default it's displayed horizontally.
243 * @see elm_slider_horizontal_get()
247 EAPI void elm_slider_horizontal_set(Evas_Object *obj, Eina_Bool horizontal);
250 * Retrieve the orientation of a given slider widget
252 * @param obj The slider object.
253 * @return @c EINA_TRUE, if @p obj is set to be @b horizontal,
254 * @c EINA_FALSE if it's @b vertical (and on errors).
256 * @see elm_slider_horizontal_set() for more details.
260 EAPI Eina_Bool elm_slider_horizontal_get(const Evas_Object *obj);
263 * Set the minimum and maximum values for the slider.
265 * @param obj The slider object.
266 * @param min The minimum value.
267 * @param max The maximum value.
269 * Define the allowed range of values to be selected by the user.
271 * If actual value is less than @p min, it will be updated to @p min. If it
272 * is bigger then @p max, will be updated to @p max. Actual value can be
273 * get with elm_slider_value_get().
275 * By default, min is equal to 0.0, and max is equal to 1.0.
277 * @warning Maximum must be greater than minimum, otherwise behavior
280 * @see elm_slider_min_max_get()
284 EAPI void elm_slider_min_max_set(Evas_Object *obj, double min, double max);
287 * Get the minimum and maximum values of the slider.
289 * @param obj The slider object.
290 * @param min Pointer to store the minimum value.
291 * @param max Pointer to store the maximum value.
293 * @note If only one value is needed, the other pointer can be passed
296 * @see elm_slider_min_max_set() for details.
300 EAPI void elm_slider_min_max_get(const Evas_Object *obj, double *min, double *max);
303 * Set the value the slider displays.
305 * @param obj The slider object.
306 * @param val The value to be displayed.
308 * Value will be presented on the unit label following format specified with
309 * elm_slider_unit_format_set() and on indicator with
310 * elm_slider_indicator_format_set().
312 * @warning The value must to be between min and max values. This values
313 * are set by elm_slider_min_max_set().
315 * @see elm_slider_value_get()
316 * @see elm_slider_unit_format_set()
317 * @see elm_slider_indicator_format_set()
318 * @see elm_slider_min_max_set()
322 EAPI void elm_slider_value_set(Evas_Object *obj, double val);
325 * Get the value displayed by the spinner.
327 * @param obj The spinner object.
328 * @return The value displayed.
330 * @see elm_spinner_value_set() for details.
334 EAPI double elm_slider_value_get(const Evas_Object *obj);
337 * Invert a given slider widget's displaying values order
339 * @param obj The slider object.
340 * @param inverted Use @c EINA_TRUE to make @p obj inverted,
341 * @c EINA_FALSE to bring it back to default, non-inverted values.
343 * A slider may be @b inverted, in which state it gets its
344 * values inverted, with high vales being on the left or top and
345 * low values on the right or bottom, as opposed to normally have
346 * the low values on the former and high values on the latter,
347 * respectively, for horizontal and vertical modes.
349 * @see elm_slider_inverted_get()
353 EAPI void elm_slider_inverted_set(Evas_Object *obj, Eina_Bool inverted);
356 * Get whether a given slider widget's displaying values are
359 * @param obj The slider object.
360 * @return @c EINA_TRUE, if @p obj has inverted values,
361 * @c EINA_FALSE otherwise (and on errors).
363 * @see elm_slider_inverted_set() for more details.
367 EAPI Eina_Bool elm_slider_inverted_get(const Evas_Object *obj);
370 * Set whether to enlarge slider indicator (augmented knob) or not.
372 * @param obj The slider object.
373 * @param show @c EINA_TRUE will make it enlarge, @c EINA_FALSE will
374 * let the knob always at default size.
376 * By default, indicator will be bigger while dragged by the user.
378 * @warning It won't display values set with
379 * elm_slider_indicator_format_set() if you disable indicator.
383 EAPI void elm_slider_indicator_show_set(Evas_Object *obj, Eina_Bool show);
386 * Get whether a given slider widget's enlarging indicator or not.
388 * @param obj The slider object.
389 * @return @c EINA_TRUE, if @p obj is enlarging indicator, or
390 * @c EINA_FALSE otherwise (and on errors).
392 * @see elm_slider_indicator_show_set() for details.
396 EAPI Eina_Bool elm_slider_indicator_show_get(const Evas_Object *obj);