1 #include <Elementary.h>
9 * A spinner is a widget which allows the user to increase or decrease
10 * numeric values. By default the spinner will not wrap and has a label
11 * of "%.0f" (just showing the integer value of the double).
13 * A spinner has a label that is formatted with floating
14 * point values and thus accepts a printf-style format string, like
17 * Signals that you can add callbacks for are:
19 * "changed" - Whenever the spinner value is changed by the user.
20 * "delay,changed" - A short time after the value is changed by the user.
21 * This will be called only when the user stops dragging for a very short
22 * period or when they release their finger/mouse, so it avoids possibly
23 * expensive reactions to the value change.
25 typedef struct _Widget_Data Widget_Data;
26 typedef struct _Elm_Spinner_Special_Value Elm_Spinner_Special_Value;
30 Evas_Object *spinner, *ent;
32 double val, val_min, val_max, orig_val, step;
33 double drag_start_pos, spin_speed, interval, first_interval;
34 Ecore_Timer *delay, *spin;
35 Eina_List *special_values;
37 Eina_Bool entry_visible : 1;
38 Eina_Bool dragging : 1;
39 Eina_Bool editable : 1;
42 struct _Elm_Spinner_Special_Value
48 static const char *widtype = NULL;
49 static void _del_hook(Evas_Object *obj);
50 static void _disable_hook(Evas_Object *obj);
51 static void _write_label(Evas_Object *obj);
52 static void _sizing_eval(Evas_Object *obj);
53 //static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
54 static Eina_Bool _value_set(Evas_Object *obj, double delta);
55 static void _on_focus_hook(void *data, Evas_Object *obj);
56 static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src,
57 Evas_Callback_Type type, void *event_info);
59 static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
61 static const char SIG_CHANGED[] = "changed";
62 static const char SIG_DELAY_CHANGED[] = "delay,changed";
64 static const Evas_Smart_Cb_Description _signals[] = {
66 {SIG_DELAY_CHANGED, ""},
71 _del_hook(Evas_Object *obj)
73 Elm_Spinner_Special_Value *sv;
74 Widget_Data *wd = elm_widget_data_get(obj);
76 if (wd->label) eina_stringshare_del(wd->label);
77 if (wd->delay) ecore_timer_del(wd->delay);
78 if (wd->spin) ecore_timer_del(wd->spin);
79 if (wd->special_values)
81 EINA_LIST_FREE(wd->special_values, sv)
83 eina_stringshare_del(sv->label);
91 _disable_hook(Evas_Object *obj)
93 Widget_Data *wd = elm_widget_data_get(obj);
95 if (elm_widget_disabled_get(obj))
96 edje_object_signal_emit(wd->spinner, "elm,state,disabled", "elm");
98 edje_object_signal_emit(wd->spinner, "elm,state,enabled", "elm");
102 _signal_emit_hook(Evas_Object *obj, const char *emission, const char *source)
104 Widget_Data *wd = elm_widget_data_get(obj);
106 edje_object_signal_emit(wd->spinner, emission, source);
110 _signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
112 Widget_Data *wd = elm_widget_data_get(obj);
114 edje_object_signal_callback_add(wd->spinner, emission,
115 source, func_cb, data);
119 _signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
121 Widget_Data *wd = elm_widget_data_get(obj);
122 edje_object_signal_callback_del_full(wd->spinner, emission, source,
127 _mirrored_set(Evas_Object *obj, Eina_Bool rtl)
129 Widget_Data *wd = elm_widget_data_get(obj);
131 edje_object_mirrored_set(wd->spinner, rtl);
135 _theme_hook(Evas_Object *obj)
137 Widget_Data *wd = elm_widget_data_get(obj);
139 _elm_widget_mirrored_reload(obj);
140 _mirrored_set(obj, elm_widget_mirrored_get(obj));
141 _elm_theme_object_set(obj, wd->spinner, "spinner", "base", elm_widget_style_get(obj));
142 edje_object_part_swallow(wd->spinner, "elm.swallow.entry", wd->ent);
144 if (elm_widget_focus_get(obj))
145 edje_object_signal_emit(wd->spinner, "elm,action,focus", "elm");
147 edje_object_signal_emit(wd->spinner, "elm,action,unfocus", "elm");
148 if (elm_widget_disabled_get(obj))
149 edje_object_signal_emit(wd->spinner, "elm,state,disabled", "elm");
150 edje_object_message_signal_process(wd->spinner);
151 edje_object_scale_set(wd->spinner, elm_widget_scale_get(obj) * _elm_config->scale);
156 _on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
158 Widget_Data *wd = elm_widget_data_get(obj);
160 if (elm_widget_focus_get(obj))
162 edje_object_signal_emit(wd->spinner, "elm,action,focus", "elm");
163 evas_object_focus_set(wd->spinner, EINA_TRUE);
167 edje_object_signal_emit(wd->spinner, "elm,action,unfocus", "elm");
168 evas_object_focus_set(wd->spinner, EINA_FALSE);
173 _delay_change(void *data)
175 Widget_Data *wd = elm_widget_data_get(data);
176 if (!wd) return ECORE_CALLBACK_CANCEL;
178 evas_object_smart_callback_call(data, SIG_DELAY_CHANGED, NULL);
179 return ECORE_CALLBACK_CANCEL;
183 _entry_show(Widget_Data *wd)
185 char buf[32], fmt[32] = "%0.f";
187 /* try to construct just the format from given label
188 * completely ignoring pre/post words
192 const char *start = strchr(wd->label, '%');
199 start = strchr(start + 2, '%');
204 const char *itr, *end = NULL;
205 for (itr = start + 1; *itr != '\0'; itr++)
207 /* allowing '%d' is quite dangerous, remove it? */
208 if ((*itr == 'd') || (*itr == 'f'))
215 if ((end) && ((size_t)(end - start + 1) < sizeof(fmt)))
217 memcpy(fmt, start, end - start);
218 fmt[end - start] = '\0';
222 snprintf(buf, sizeof(buf), fmt, wd->val);
223 elm_entry_entry_set(wd->ent, buf);
227 _write_label(Evas_Object *obj)
230 Elm_Spinner_Special_Value *sv;
231 Widget_Data *wd = elm_widget_data_get(obj);
234 EINA_LIST_FOREACH(wd->special_values, l, sv)
236 if (sv->value == wd->val)
238 snprintf(buf, sizeof(buf), "%s", sv->label);
243 snprintf(buf, sizeof(buf), wd->label, wd->val);
245 snprintf(buf, sizeof(buf), "%.0f", wd->val);
248 edje_object_part_text_set(wd->spinner, "elm.text", buf);
249 if (wd->entry_visible) _entry_show(wd);
253 _value_set(Evas_Object *obj, double delta)
255 Widget_Data *wd = elm_widget_data_get(obj);
257 if (!wd) return EINA_FALSE;
258 new_val = wd->val + delta;
261 while (new_val < wd->val_min)
262 new_val = wd->val_max + new_val + 1 - wd->val_min;
263 while (new_val > wd->val_max)
264 new_val = wd->val_min + new_val - wd->val_max - 1;
268 if (new_val < wd->val_min)
269 new_val = wd->val_min;
270 else if (new_val > wd->val_max)
271 new_val = wd->val_max;
274 if (new_val == wd->val) return EINA_FALSE;
277 evas_object_smart_callback_call(obj, SIG_CHANGED, NULL);
278 if (wd->delay) ecore_timer_del(wd->delay);
279 wd->delay = ecore_timer_add(0.2, _delay_change, obj);
285 _sizing_eval(Evas_Object *obj)
287 Widget_Data *wd = elm_widget_data_get(obj);
288 Evas_Coord minw = -1, minh = -1;
290 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
291 edje_object_size_min_restricted_calc(wd->spinner, &minw, &minh, minw, minh);
292 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
293 evas_object_size_hint_min_set(obj, minw, minh);
294 evas_object_size_hint_max_set(obj, -1, -1);
299 _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info)
306 _val_set(Evas_Object *obj)
308 Widget_Data *wd = elm_widget_data_get(obj);
311 if (wd->val_max > wd->val_min)
312 pos = ((wd->val - wd->val_min) / (wd->val_max - wd->val_min));
313 if (pos < 0.0) pos = 0.0;
314 else if (pos > 1.0) pos = 1.0;
315 edje_object_part_drag_value_set(wd->spinner, "elm.dragable.slider",
320 _drag(void *data, Evas_Object *_obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
322 Evas_Object *obj = data;
323 Widget_Data *wd = elm_widget_data_get(obj);
324 double pos = 0.0, offset, delta;
326 if (wd->entry_visible) return;
327 edje_object_part_drag_value_get(wd->spinner, "elm.dragable.slider",
330 delta = (pos - wd->drag_start_pos) * offset;
331 /* If we are on rtl mode, change the delta to be negative on such changes */
332 if (elm_widget_mirrored_get(obj))
334 if (_value_set(data, delta)) _write_label(data);
335 wd->drag_start_pos = pos;
340 _drag_start(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
342 Widget_Data *wd = elm_widget_data_get(data);
345 edje_object_part_drag_value_get(wd->spinner, "elm.dragable.slider",
347 wd->drag_start_pos = pos;
351 _drag_stop(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
353 Widget_Data *wd = elm_widget_data_get(data);
355 wd->drag_start_pos = 0;
356 edje_object_part_drag_value_set(wd->spinner, "elm.dragable.slider", 0.0, 0.0);
360 _hide_entry(Evas_Object *obj)
362 Widget_Data *wd = elm_widget_data_get(obj);
364 edje_object_signal_emit(wd->spinner, "elm,state,inactive", "elm");
365 wd->entry_visible = 0;
369 _reset_value(Evas_Object *obj)
371 Widget_Data *wd = elm_widget_data_get(obj);
374 elm_spinner_value_set(obj, wd->orig_val);
378 _apply_entry_value(Evas_Object *obj)
380 Widget_Data *wd = elm_widget_data_get(obj);
387 str = elm_entry_entry_get(wd->ent);
389 val = strtod(str, &end);
390 if ((*end != '\0') && (!isspace(*end))) return;
391 elm_spinner_value_set(obj, val);
395 _toggle_entry(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
397 Widget_Data *wd = elm_widget_data_get(data);
404 if (elm_widget_disabled_get(data)) return;
405 if (!wd->editable) return;
406 if (wd->entry_visible) _apply_entry_value(data);
409 wd->orig_val = wd->val;
410 edje_object_signal_emit(wd->spinner, "elm,state,active", "elm");
412 elm_entry_select_all(wd->ent);
413 elm_widget_focus_set(wd->ent, 1);
414 wd->entry_visible = 1;
419 _spin_value(void *data)
421 Widget_Data *wd = elm_widget_data_get(data);
422 if (!wd) return ECORE_CALLBACK_CANCEL;
423 if (_value_set(data, wd->spin_speed)) _write_label(data);
424 wd->interval = wd->interval / 1.05;
425 ecore_timer_interval_set(wd->spin, wd->interval);
426 return ECORE_CALLBACK_RENEW;
430 _val_inc_start(Evas_Object *obj)
432 Widget_Data *wd = elm_widget_data_get(obj);
434 wd->interval = wd->first_interval;
435 wd->spin_speed = wd->step;
436 if (wd->spin) ecore_timer_del(wd->spin);
437 wd->spin = ecore_timer_add(wd->interval, _spin_value, obj);
442 _val_inc_stop(Evas_Object *obj)
444 Widget_Data *wd = elm_widget_data_get(obj);
446 wd->interval = wd->first_interval;
448 if (wd->spin) ecore_timer_del(wd->spin);
453 _val_dec_start(Evas_Object *obj)
455 Widget_Data *wd = elm_widget_data_get(obj);
457 wd->interval = wd->first_interval;
458 wd->spin_speed = -wd->step;
459 if (wd->spin) ecore_timer_del(wd->spin);
460 wd->spin = ecore_timer_add(wd->interval, _spin_value, obj);
465 _val_dec_stop(Evas_Object *obj)
467 Widget_Data *wd = elm_widget_data_get(obj);
469 wd->interval = wd->first_interval;
471 if (wd->spin) ecore_timer_del(wd->spin);
476 _button_inc_start(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
478 Widget_Data *wd = elm_widget_data_get(data);
480 if (wd->entry_visible)
485 _val_inc_start(data);
489 _button_inc_stop(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
491 Widget_Data *wd = elm_widget_data_get(data);
497 _button_dec_start(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
499 Widget_Data *wd = elm_widget_data_get(data);
501 if (wd->entry_visible)
506 _val_dec_start(data);
510 _button_dec_stop(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
512 Widget_Data *wd = elm_widget_data_get(data);
518 _entry_activated(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
520 Widget_Data *wd = elm_widget_data_get(data);
522 _apply_entry_value(data);
523 evas_object_smart_callback_call(data, SIG_CHANGED, NULL);
524 if (wd->delay) ecore_timer_del(wd->delay);
525 wd->delay = ecore_timer_add(0.2, _delay_change, data);
529 _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
531 Widget_Data *wd = elm_widget_data_get(obj);
532 if (!wd) return EINA_FALSE;
533 if (elm_widget_disabled_get(obj)) return EINA_FALSE;
534 if (type == EVAS_CALLBACK_KEY_DOWN)
536 Evas_Event_Key_Down *ev = event_info;
537 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
538 else if (!strcmp(ev->keyname, "Left") || !strcmp(ev->keyname, "KP_Left")
539 || !strcmp(ev->keyname, "Down") || !strcmp(ev->keyname, "KP_Down"))
542 edje_object_signal_emit(wd->spinner, "elm,left,anim,activate", "elm");
543 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
546 else if (!strcmp(ev->keyname, "Right") || !strcmp(ev->keyname, "KP_Right")
547 || !strcmp(ev->keyname, "Up") || !strcmp(ev->keyname, "KP_Up"))
550 edje_object_signal_emit(wd->spinner, "elm,right,anim,activate", "elm");
551 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
555 else if (type == EVAS_CALLBACK_KEY_UP)
557 Evas_Event_Key_Down *ev = event_info;
558 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
559 if (!strcmp(ev->keyname, "Right") || !strcmp(ev->keyname, "KP_Right")
560 || !strcmp(ev->keyname, "Up") || !strcmp(ev->keyname, "KP_Up"))
562 else if (!strcmp(ev->keyname, "Left") || !strcmp(ev->keyname, "KP_Left")
563 || !strcmp(ev->keyname, "Down") || !strcmp(ev->keyname, "KP_Down"))
565 else return EINA_FALSE;
566 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
573 * Add a new spinner to the parent
575 * @param parent The parent object
576 * @return The new object or NULL if it cannot be created
581 elm_spinner_add(Evas_Object *parent)
587 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
589 ELM_SET_WIDTYPE(widtype, "spinner");
590 elm_widget_type_set(obj, "spinner");
591 elm_widget_sub_object_add(parent, obj);
592 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
593 elm_widget_data_set(obj, wd);
594 elm_widget_del_hook_set(obj, _del_hook);
595 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
596 elm_widget_theme_hook_set(obj, _theme_hook);
597 elm_widget_disable_hook_set(obj, _disable_hook);
598 elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
599 elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook);
600 elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook);
601 elm_widget_can_focus_set(obj, EINA_TRUE);
602 elm_widget_event_hook_set(obj, _event_hook);
609 wd->first_interval = 0.85;
610 wd->entry_visible = 0;
611 wd->editable = EINA_TRUE;
613 wd->spinner = edje_object_add(e);
614 _elm_theme_object_set(obj, wd->spinner, "spinner", "base", "default");
615 elm_widget_resize_object_set(obj, wd->spinner);
616 edje_object_signal_callback_add(wd->spinner, "drag", "*", _drag, obj);
617 edje_object_signal_callback_add(wd->spinner, "drag,start", "*",
619 edje_object_signal_callback_add(wd->spinner, "drag,stop", "*",
621 edje_object_signal_callback_add(wd->spinner, "drag,step", "*",
623 edje_object_signal_callback_add(wd->spinner, "drag,page", "*",
626 edje_object_signal_callback_add(wd->spinner, "elm,action,increment,start",
627 "*", _button_inc_start, obj);
628 edje_object_signal_callback_add(wd->spinner, "elm,action,increment,stop",
629 "*", _button_inc_stop, obj);
630 edje_object_signal_callback_add(wd->spinner, "elm,action,decrement,start",
631 "*", _button_dec_start, obj);
632 edje_object_signal_callback_add(wd->spinner, "elm,action,decrement,stop",
633 "*", _button_dec_stop, obj);
634 edje_object_part_drag_value_set(wd->spinner, "elm.dragable.slider",
637 wd->ent = elm_entry_add(obj);
638 elm_entry_single_line_set(wd->ent, 1);
639 evas_object_smart_callback_add(wd->ent, "activated", _entry_activated, obj);
640 edje_object_part_swallow(wd->spinner, "elm.swallow.entry", wd->ent);
641 edje_object_signal_callback_add(wd->spinner, "elm,action,entry,toggle",
642 "*", _toggle_entry, obj);
644 evas_object_smart_callbacks_descriptions_set(obj, _signals);
646 _mirrored_set(obj, elm_widget_mirrored_get(obj));
653 * Set the format string of the label area
655 * If NULL, this sets the format to "%.0f". If not it sets the format
656 * string for the label text. The label text is provided a floating point
657 * value, so the label text can display up to 1 floating point value. Note that
658 * this is optional. Use a format string such as "%1.2f meters" for example.
660 * @param obj The spinner object
661 * @param fmt The format string for the label display
666 elm_spinner_label_format_set(Evas_Object *obj, const char *fmt)
668 ELM_CHECK_WIDTYPE(obj, widtype);
669 Widget_Data *wd = elm_widget_data_get(obj);
671 eina_stringshare_replace(&wd->label, fmt);
677 * Get the label format of the spinner
679 * @param obj The spinner object
680 * @return The text label format string in UTF-8
685 elm_spinner_label_format_get(const Evas_Object *obj)
687 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
688 Widget_Data *wd = elm_widget_data_get(obj);
689 if (!wd) return NULL;
694 * Set the minimum and maximum values for the spinner
696 * Maximum must be greater than minimum.
698 * @param obj The spinner object
699 * @param min The minimum value
700 * @param max The maximum value
705 elm_spinner_min_max_set(Evas_Object *obj, double min, double max)
707 ELM_CHECK_WIDTYPE(obj, widtype);
708 Widget_Data *wd = elm_widget_data_get(obj);
710 if ((wd->val_min == min) && (wd->val_max == max)) return;
713 if (wd->val < wd->val_min) wd->val = wd->val_min;
714 if (wd->val > wd->val_max) wd->val = wd->val_max;
720 * Get the minimum and maximum values of the spinner
722 * @param obj The spinner object
723 * @param min The minimum value
724 * @param max The maximum value
729 elm_spinner_min_max_get(const Evas_Object *obj, double *min, double *max)
733 ELM_CHECK_WIDTYPE(obj, widtype);
734 Widget_Data *wd = elm_widget_data_get(obj);
736 if (min) *min = wd->val_min;
737 if (max) *max = wd->val_max;
741 * Set the step for the spinner
743 * @param obj The spinner object
744 * @param step The step value
749 elm_spinner_step_set(Evas_Object *obj, double step)
751 ELM_CHECK_WIDTYPE(obj, widtype);
752 Widget_Data *wd = elm_widget_data_get(obj);
758 * Get the step of the spinner
760 * @param obj The spinner object
761 * @return The step value
766 elm_spinner_step_get(const Evas_Object *obj)
768 ELM_CHECK_WIDTYPE(obj, widtype) 0.0;
769 Widget_Data *wd = elm_widget_data_get(obj);
774 * Set the value the spinner indicates
776 * @param obj The spinner object
777 * @param val The value (must be between min and max for the spinner)
782 elm_spinner_value_set(Evas_Object *obj, double val)
784 ELM_CHECK_WIDTYPE(obj, widtype);
785 Widget_Data *wd = elm_widget_data_get(obj);
787 if (wd->val == val) return;
789 if (wd->val < wd->val_min) wd->val = wd->val_min;
790 if (wd->val > wd->val_max) wd->val = wd->val_max;
796 * Get the value the spinner has
798 * @param obj The spinner object
799 * @return The value of the spinner
804 elm_spinner_value_get(const Evas_Object *obj)
806 ELM_CHECK_WIDTYPE(obj, widtype) 0.0;
807 Widget_Data *wd = elm_widget_data_get(obj);
813 * Sets whether the spinner should wrap when it reaches its
814 * minimum/maximum value
816 * @param obj The spinner object
817 * @param wrap True if it should wrap, false otherwise
822 elm_spinner_wrap_set(Evas_Object *obj, Eina_Bool wrap)
824 ELM_CHECK_WIDTYPE(obj, widtype);
825 Widget_Data *wd = elm_widget_data_get(obj);
831 * Gets whether the spinner should wrap when it reaches its
832 * minimum/maximum value
834 * @param obj The spinner object
835 * @return Bool value of wrap option
836 * (0 = disabled, 1 = enabled)
841 elm_spinner_wrap_get(const Evas_Object *obj)
843 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
844 Widget_Data *wd = elm_widget_data_get(obj);
845 if (!wd) return EINA_FALSE;
850 * Set a special value to display in the place of the numerical one.
852 * @param obj The spinner object
853 * @param value The value to be replaced
854 * @param label The label to be used
859 elm_spinner_special_value_add(Evas_Object *obj, double value, const char *label)
861 Elm_Spinner_Special_Value *sv;
862 ELM_CHECK_WIDTYPE(obj, widtype);
863 Widget_Data *wd = elm_widget_data_get(obj);
866 sv = calloc(1, sizeof(*sv));
869 sv->label = eina_stringshare_add(label);
871 wd->special_values = eina_list_append(wd->special_values, sv);
876 * Set whether the spinner can be directly edited by the user or not.
877 * Default is editable.
879 * @param obj The spinner object
880 * @param editable Bool value of the edit option
881 * (EINA_FALSE = not editable, EINA_TRUE = editable)
884 elm_spinner_editable_set(Evas_Object *obj, Eina_Bool editable)
886 ELM_CHECK_WIDTYPE(obj, widtype);
887 Widget_Data *wd = elm_widget_data_get(obj);
889 wd->editable = editable;
893 * Gets whether the spinner is editable.
895 * @param obj The spinner object
896 * @return Bool value of edit option
897 * (EINA_FALSE = not editable, EINA_TRUE = editable)
900 elm_spinner_editable_get(const Evas_Object *obj)
902 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
903 Widget_Data *wd = elm_widget_data_get(obj);
904 if (!wd) return EINA_FALSE;
909 * Set the interval for the spinner
911 * @param obj The spinner object
912 * @param interval The interval value in seconds
914 * The interval value is decreased while the user increments or decrements
915 * the spinner value. The next interval value is the previous interval / 1.05,
916 * so it speed up a bit. Default value is 0.85 seconds.
921 elm_spinner_interval_set(Evas_Object *obj, double interval)
923 ELM_CHECK_WIDTYPE(obj, widtype);
924 Widget_Data *wd = elm_widget_data_get(obj);
926 wd->first_interval = interval;
930 * Get the interval of the spinner
932 * @param obj The spinner object
933 * @return The value of the first interval in seconds
935 * The interval value is decreased while the user increments or decrements
936 * the spinner value. The next interval value is the previous interval / 1.05,
937 * so it speed up a bit. Default value is 0.85 seconds.
942 elm_spinner_interval_get(const Evas_Object *obj)
944 ELM_CHECK_WIDTYPE(obj, widtype) 0.0;
945 Widget_Data *wd = elm_widget_data_get(obj);
947 return wd->first_interval;