spinner: After long press of inc/dec buttons, start continuously increasing/decreasing

Summary:
When inc/dec buttons are pressed, start changing value after longpress has happened on buttons and not immediately.
Signed-off by: Mohammad Irfan (mohammad.i@samsung.com)
Signed-off by: Shilpa Singh(shilpa.singh@samsung.com)

Test Plan: Long press on inc/dec buttons of spinner.

Reviewers: seoz, woohyun

CC: Hermet, jchanwook, raster

Differential Revision: https://phab.enlightenment.org/D365
This commit is contained in:
Shilpa Singh 2014-02-05 01:29:14 +09:00 committed by Daniel Juyung Seo
parent 940d49cd82
commit d1ef22bccd
4 changed files with 38 additions and 12 deletions

View File

@ -88,3 +88,4 @@ Sanghyeon Lee <sh10233.lee@samsung.com>
Anil Kumar Nahak <ak.nahak@samsung.com>
Michal Jagiello <m.jagiello@samsung.com>
Chinmaya Panigrahi <c.panigrahi@samsung.com>
Mohammad Irfan <mohammad.i@samsung.com>

View File

@ -90,6 +90,7 @@
* @author Anil Kumar Nahak <ak.nahak@@samsung.com>
* @author Michal Jagiello <m.jagiello@@samsung.com>
* @author Chinmaya Panigrahi <c.panigrahi@@samsung.com>
* @author Mohammad Irfan <mohammad.i@@samsung.com>
*
* Please contact <enlightenment-devel@lists.sourceforge.net> to get in
* contact with the developers and maintainers.

View File

@ -323,16 +323,18 @@ _spin_value(void *data)
return ECORE_CALLBACK_RENEW;
}
static void
_val_inc_start(Evas_Object *obj)
static Eina_Bool
_val_inc_start(void *data)
{
ELM_SPINNER_DATA_GET(obj, sd);
ELM_SPINNER_DATA_GET(data, sd);
sd->interval = sd->first_interval;
sd->spin_speed = sd->step;
sd->longpress_timer = NULL;
ecore_timer_del(sd->spin_timer);
sd->spin_timer = ecore_timer_add(sd->interval, _spin_value, obj);
_spin_value(obj);
sd->spin_timer = ecore_timer_add(sd->interval, _spin_value, data);
_spin_value(data);
return ECORE_CALLBACK_CANCEL;
}
static void
@ -345,16 +347,18 @@ _val_inc_stop(Evas_Object *obj)
ELM_SAFE_FREE(sd->spin_timer, ecore_timer_del);
}
static void
_val_dec_start(Evas_Object *obj)
static Eina_Bool
_val_dec_start(void *data)
{
ELM_SPINNER_DATA_GET(obj, sd);
ELM_SPINNER_DATA_GET(data, sd);
sd->interval = sd->first_interval;
sd->spin_speed = -sd->step;
sd->longpress_timer = NULL;
ecore_timer_del(sd->spin_timer);
sd->spin_timer = ecore_timer_add(sd->interval, _spin_value, obj);
_spin_value(obj);
sd->spin_timer = ecore_timer_add(sd->interval, _spin_value, data);
_spin_value(data);
return ECORE_CALLBACK_CANCEL;
}
static void
@ -381,7 +385,9 @@ _button_inc_start_cb(void *data,
if ((sd->val_updated) && (sd->val == sd->val_min)) return;
return;
}
_val_inc_start(data);
ecore_timer_del(sd->longpress_timer);
sd->longpress_timer = ecore_timer_add
(_elm_config->longpress_timeout, _val_inc_start, data);
}
static void
@ -390,6 +396,13 @@ _button_inc_stop_cb(void *data,
const char *emission EINA_UNUSED,
const char *source EINA_UNUSED)
{
ELM_SPINNER_DATA_GET(data, sd);
if (sd->longpress_timer)
{
ELM_SAFE_FREE(sd->longpress_timer, ecore_timer_del);
sd->spin_speed = sd->step;
_spin_value(data);
}
_val_inc_stop(data);
}
@ -406,7 +419,9 @@ _button_dec_start_cb(void *data,
_entry_value_apply(obj);
if ((sd->val_updated) && (sd->val == sd->val_max)) return;
}
_val_dec_start(data);
ecore_timer_del(sd->longpress_timer);
sd->longpress_timer = ecore_timer_add
(_elm_config->longpress_timeout, _val_dec_start, data);
}
static void
@ -415,6 +430,13 @@ _button_dec_stop_cb(void *data,
const char *emission EINA_UNUSED,
const char *source EINA_UNUSED)
{
ELM_SPINNER_DATA_GET(data, sd);
if (sd->longpress_timer)
{
ELM_SAFE_FREE(sd->longpress_timer, ecore_timer_del);
sd->spin_speed = -sd->step;
_spin_value(data);
}
_val_dec_stop(data);
}

View File

@ -32,6 +32,8 @@ struct _Elm_Spinner_Smart_Data
int round;
Ecore_Timer *delay_change_timer; /*<< a timer for a delay,changed smart callback */
Ecore_Timer *spin_timer; /*<< a timer for a repeated spinner value change on mouse down */
Ecore_Timer *longpress_timer; /*<< a timer to detect long press. After lonpress timeout,
start continuous change of values until mouse up */
Eina_List *special_values;
Eina_Bool entry_visible : 1;