2 * @defgroup Spinner Spinner
5 * @image html spinner_inheritance_tree.png
6 * @image latex spinner_inheritance_tree.eps
8 * @image html img/widget/spinner/preview-00.png
9 * @image latex img/widget/spinner/preview-00.eps
11 * A spinner is a widget which allows the user to increase or decrease
12 * numeric values using arrow buttons, or edit values directly, clicking
13 * over it and typing the new value.
15 * By default the spinner will not wrap and has a label
16 * of "%.0f" (just showing the integer value of the double).
18 * A spinner has a label that is formatted with floating
19 * point values and thus accepts a printf-style format string, like
22 * It also allows specific values to be replaced by pre-defined labels.
24 * This widget inherits from the @ref Layout one, so that all the
25 * functions acting on it also work for spinner objects.
27 * This widget emits the following signals, besides the ones sent from
29 * - @c "changed" - Whenever the spinner value is changed.
30 * - @c "delay,changed" - A short time after the value is changed by
31 * the user. This will be called only when the user stops dragging
32 * for a very short period or when they release their finger/mouse,
33 * so it avoids possibly expensive reactions to the value change.
34 * - @c "language,changed" - the program's language changed
36 * Available styles for it:
38 * - @c "vertical": up/down buttons at the right side and text left aligned.
40 * Supported elm_object common APIs.
41 * @li @ref elm_object_signal_emit
42 * @li @ref elm_object_signal_callback_add
43 * @li @ref elm_object_signal_callback_del
44 * @li @ref elm_object_disabled_set
45 * @li @ref elm_object_disabled_get
47 * Here is an example on its usage:
48 * @ref spinner_example
57 * Add a new spinner widget to the given parent Elementary
60 * @param parent The parent object.
61 * @return a new spinner widget handle or @c NULL, on errors.
63 * This function inserts a new spinner widget on the canvas.
68 EAPI Evas_Object *elm_spinner_add(Evas_Object *parent);
71 * Set the format string of the displayed label.
73 * @param obj The spinner object.
74 * @param fmt The format string for the label display.
76 * If @c NULL, this sets the format to "%.0f". If not it sets the format
77 * string for the label text. The label text is provided a floating point
78 * value, so the label text can display up to 1 floating point value.
79 * Note that this is optional.
81 * Use a format string such as "%1.2f meters" for example, and it will
82 * display values like: "3.14 meters" for a value equal to 3.14159.
86 * @see elm_spinner_label_format_get()
90 EAPI void elm_spinner_label_format_set(Evas_Object *obj, const char *fmt);
93 * Get the label format of the spinner.
95 * @param obj The spinner object.
96 * @return The text label format string in UTF-8.
98 * @see elm_spinner_label_format_set() for details.
102 EAPI const char *elm_spinner_label_format_get(const Evas_Object *obj);
105 * Set the minimum and maximum values for the spinner.
107 * @param obj The spinner object.
108 * @param min The minimum value.
109 * @param max The maximum value.
111 * Define the allowed range of values to be selected by the user.
113 * If actual value is less than @p min, it will be updated to @p min. If it
114 * is bigger then @p max, will be updated to @p max. Actual value can be
115 * get with elm_spinner_value_get().
117 * By default, min is equal to 0, and max is equal to 100.
119 * @warning Maximum must be greater than minimum.
121 * @see elm_spinner_min_max_get()
125 EAPI void elm_spinner_min_max_set(Evas_Object *obj, double min, double max);
128 * Get the minimum and maximum values of the spinner.
130 * @param obj The spinner object.
131 * @param min Pointer to store the minimum value.
132 * @param max Pointer to store the maximum value.
134 * @note If only one value is needed, the other pointer can be passed
137 * @see elm_spinner_min_max_set() for details.
141 EAPI void elm_spinner_min_max_get(const Evas_Object *obj, double *min, double *max);
144 * Set the step used to increment or decrement the spinner value.
146 * @param obj The spinner object.
147 * @param step The step value.
149 * This value will be incremented or decremented to the displayed value.
150 * It will be incremented while the user keep right or top arrow pressed,
151 * and will be decremented while the user keep left or bottom arrow pressed.
153 * The interval to increment / decrement can be set with
154 * elm_spinner_interval_set().
156 * By default step value is equal to 1.
158 * @see elm_spinner_step_get()
162 EAPI void elm_spinner_step_set(Evas_Object *obj, double step);
165 * Get the step used to increment or decrement the spinner value.
167 * @param obj The spinner object.
168 * @return The step value.
170 * @see elm_spinner_step_get() for more details.
174 EAPI double elm_spinner_step_get(const Evas_Object *obj);
177 * Set the value the spinner displays.
179 * @param obj The spinner object.
180 * @param val The value to be displayed.
182 * Value will be presented on the label following format specified with
183 * elm_spinner_format_set().
185 * @warning The value must to be between min and max values. This values
186 * are set by elm_spinner_min_max_set().
188 * @see elm_spinner_value_get().
189 * @see elm_spinner_format_set().
190 * @see elm_spinner_min_max_set().
194 EAPI void elm_spinner_value_set(Evas_Object *obj, double val);
197 * Get the value displayed by the spinner.
199 * @param obj The spinner object.
200 * @return The value displayed.
202 * @see elm_spinner_value_set() for details.
206 EAPI double elm_spinner_value_get(const Evas_Object *obj);
209 * Set whether the spinner should wrap when it reaches its
210 * minimum or maximum value.
212 * @param obj The spinner object.
213 * @param wrap @c EINA_TRUE to enable wrap or @c EINA_FALSE to
216 * Disabled by default. If disabled, when the user tries to increment the
218 * but displayed value plus step value is bigger than maximum value,
219 * the new value will be the maximum value.
220 * The same happens when the user tries to decrement it,
221 * but the value less step is less than minimum value. In this case,
222 * the new displayed value will be the minimum value.
224 * When wrap is enabled, when the user tries to increment the value,
225 * but displayed value plus step value is bigger than maximum value,
226 * the new value will be the minimum value. When the the user tries to
227 * decrement it, but the value less step is less than minimum value,
228 * the new displayed value will be the maximum value.
233 * @li step value = 20
234 * @li displayed value = 20
236 * When the user decrement value (using left or bottom arrow), it will
239 * @see elm_spinner_wrap_get().
243 EAPI void elm_spinner_wrap_set(Evas_Object *obj, Eina_Bool wrap);
246 * Get whether the spinner should wrap when it reaches its
247 * minimum or maximum value.
249 * @param obj The spinner object
250 * @return @c EINA_TRUE means wrap is enabled. @c EINA_FALSE indicates
251 * it's disabled. If @p obj is @c NULL, @c EINA_FALSE is returned.
253 * @see elm_spinner_wrap_set() for details.
257 EAPI Eina_Bool elm_spinner_wrap_get(const Evas_Object *obj);
260 * Set whether the spinner can be directly edited by the user or not.
262 * @param obj The spinner object.
263 * @param editable @c EINA_TRUE to allow users to edit it or @c EINA_FALSE to
264 * don't allow users to edit it directly.
266 * Spinner objects can have edition @b disabled, in which state they will
267 * be changed only by arrows.
268 * Useful for contexts
269 * where you don't want your users to interact with it writing the value.
271 * when using special values, the user can see real value instead
272 * of special label on edition.
274 * It's enabled by default.
276 * @see elm_spinner_editable_get()
280 EAPI void elm_spinner_editable_set(Evas_Object *obj, Eina_Bool editable);
283 * Get whether the spinner can be directly edited by the user or not.
285 * @param obj The spinner object.
286 * @return @c EINA_TRUE means edition is enabled. @c EINA_FALSE indicates
287 * it's disabled. If @p obj is @c NULL, @c EINA_FALSE is returned.
289 * @see elm_spinner_editable_set() for details.
293 EAPI Eina_Bool elm_spinner_editable_get(const Evas_Object *obj);
296 * Set a special string to display in the place of the numerical value.
298 * @param obj The spinner object.
299 * @param value The value to be replaced.
300 * @param label The label to be used.
302 * It's useful for cases when a user should select an item that is
303 * better indicated by a label than a value. For example, weekdays or months.
307 * sp = elm_spinner_add(win);
308 * elm_spinner_min_max_set(sp, 1, 3);
309 * elm_spinner_special_value_add(sp, 1, "January");
310 * elm_spinner_special_value_add(sp, 2, "February");
311 * elm_spinner_special_value_add(sp, 3, "March");
312 * evas_object_show(sp);
315 * @note If another label was previously set to @p value, it will be replaced
318 * @see elm_spinner_special_value_get().
319 * @see elm_spinner_special_value_del().
323 EAPI void elm_spinner_special_value_add(Evas_Object *obj, double value, const char *label);
326 * Delete the special string display in the place of the numerical value.
328 * @param obj The spinner object.
329 * @param value The replaced value.
331 * It will remove a previously added special value. After this, the spinner
332 * will display the value itself instead of a label.
334 * @see elm_spinner_special_value_add() for more details.
339 EAPI void elm_spinner_special_value_del(Evas_Object *obj, double value);
342 * Get the special string display in the place of the numerical value.
344 * @param obj The spinner object.
345 * @param value The replaced value.
346 * @return The used label.
348 * @see elm_spinner_special_value_add() for more details.
353 EAPI const char *elm_spinner_special_value_get(Evas_Object *obj, double value);
356 * Set the interval on time updates for an user mouse button hold
357 * on spinner widgets' arrows.
359 * @param obj The spinner object.
360 * @param interval The interval value in seconds.
362 * This interval value is @b decreased while the user holds the
363 * mouse pointer either incrementing or decrementing spinner's value.
365 * This helps the user to get to a given value distant from the
366 * current one easier/faster, as it updates the value in that set interval time
367 * on mouse button holds.
369 * The default starting interval value for automatic changes is
372 * @see elm_spinner_interval_get()
376 EAPI void elm_spinner_interval_set(Evas_Object *obj, double interval);
379 * Get the interval on time updates for an user mouse button hold
380 * on spinner widgets' arrows.
382 * @param obj The spinner object.
383 * @return The interval value, in seconds, set on it.
385 * @see elm_spinner_interval_set() for more details.
389 EAPI double elm_spinner_interval_get(const Evas_Object *obj);
392 * Set the base for rounding
394 * @param obj The spinner object
395 * @param base The base value
397 * Rounding works as follows:
399 * rounded_val = base + (double)(((value - base) / round) * round)
401 * Where rounded_val, value and base are doubles, and round is an integer.
403 * This means that things will be rounded to increments (or decrements) of
404 * "round" starting from value @p base. The default base for rounding is 0.
406 * Example: round = 3, base = 2
407 * Values: 3, 6, 9, 12, 15, ...
409 * Example: round = 2, base = 5.5
410 * Values: 5.5, 7.5, 9.5, 11.5, ...
412 * @see elm_spinner_round_get()
413 * @see elm_spinner_base_get() too.
417 EAPI void elm_spinner_base_set(Evas_Object *obj, double base);
420 * Get the base for rounding
422 * @param obj The spinner object
423 * @return The base rounding value
425 * This returns the base for rounding.
427 * @see elm_spinner_round_set() too.
428 * @see elm_spinner_base_set() too.
432 EAPI double elm_spinner_base_get(const Evas_Object *obj);
435 * Set the round value for rounding
437 * @param obj The spinner object
438 * @param rnd The rounding value
440 * Sets the rounding value used for value rounding in the spinner.
442 * @see elm_spinner_round_get()
443 * @see elm_spinner_base_set()
447 EAPI void elm_spinner_round_set(Evas_Object *obj, int rnd);
450 * Get the round value for rounding
452 * @param obj The spinner object
453 * @return The rounding value
455 * This returns the round value for rounding.
457 * @see elm_spinner_round_set() too.
458 * @see elm_spinner_base_set() too.
462 EAPI int elm_spinner_round_get(const Evas_Object *obj);