From: prashant Date: Mon, 13 Jan 2014 06:44:44 +0000 (+0900) Subject: [actionslider]:enable the mouse event X-Git-Tag: v1.9.0-alpha1~242 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=07edb31d7c5d0652d3cd0ece36e743fee8f045b8;p=platform%2Fupstream%2Felementary.git [actionslider]:enable the mouse event Summary: On mouse click move the knob on action slider Test Plan: elementary_test -to actionslider Reviewers: seoz, singh.amitesh, raster Reviewed By: raster CC: raster Differential Revision: https://phab.enlightenment.org/D384 --- diff --git a/data/themes/edc/elm/actionslider.edc b/data/themes/edc/elm/actionslider.edc index eb4f4bc..613dd92 100644 --- a/data/themes/edc/elm/actionslider.edc +++ b/data/themes/edc/elm/actionslider.edc @@ -42,7 +42,7 @@ group { name: "elm/actionslider/base/default"; rel2.to: "bg"; } } - part { name: "elm.text.left"; type: TEXT; mouse_events: 0; + part { name: "elm.text.left"; type: TEXT; effect: SHADOW BOTTOM; scale: 1; description { state: "default" 0.0; @@ -60,7 +60,7 @@ group { name: "elm/actionslider/base/default"; color_class: "button_text_disabled"; } } - part { name: "elm.text.center"; type: TEXT; mouse_events: 0; + part { name: "elm.text.center"; type: TEXT; effect: SHADOW BOTTOM; scale: 1; description { state: "default" 0.0; @@ -78,7 +78,7 @@ group { name: "elm/actionslider/base/default"; color_class: "button_text_disabled"; } } - part { name: "elm.text.right"; type: TEXT; mouse_events: 0; + part { name: "elm.text.right"; type: TEXT; effect: SHADOW BOTTOM; scale: 1; description { state: "default" 0.0; @@ -230,6 +230,18 @@ group { name: "elm/actionslider/base/default"; action: SIGNAL_EMIT "elm.drag_button,mouse,move" "elm"; } program { + signal: "mouse,down,1*"; source: "elm.text.right"; + action: SIGNAL_EMIT "elm,right,mouse,down" "elm"; + } + program { + signal: "mouse,down,1*"; source: "elm.text.left"; + action: SIGNAL_EMIT "elm,left,mouse,down" "elm"; + } + program { + signal: "mouse,down,1*"; source: "elm.text.center"; + action: SIGNAL_EMIT "elm,center,mouse,down" "elm"; + } + program { signal: "elm,state,disabled"; source: "elm"; action: STATE_SET "disabled" 0.0; target: "bg"; diff --git a/src/lib/elm_actionslider.c b/src/lib/elm_actionslider.c index bb20e2c..52771d9 100644 --- a/src/lib/elm_actionslider.c +++ b/src/lib/elm_actionslider.c @@ -351,6 +351,73 @@ _drag_button_up_cb(void *data, } static void +_track_move_cb(void *data, + Evas_Object *o __UNUSED__, + const char *emission, + const char *source __UNUSED__) +{ + Evas_Object *obj = data; + + ELM_ACTIONSLIDER_DATA_GET(obj, sd); + ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); + + if (!strcmp(emission, "elm.right,mouse,down")) + { + if (sd->final_position == 0.0) + { + if (sd->enabled_position & ELM_ACTIONSLIDER_CENTER) + { + evas_object_smart_callback_call(obj, SIG_CHANGED, "center"); + sd->final_position = 0.5; + } + else if (sd->enabled_position & ELM_ACTIONSLIDER_RIGHT) + { + evas_object_smart_callback_call(obj, SIG_CHANGED, "right"); + sd->final_position = 1.0; + } + } + else if ((sd->final_position == 0.5) && + (sd->enabled_position & ELM_ACTIONSLIDER_RIGHT)) + { + evas_object_smart_callback_call(obj, SIG_CHANGED, "right"); + sd->final_position = 1.0; + } + } + else if (!strcmp(emission, "elm.center,mouse,down")) + { + if (sd->enabled_position & ELM_ACTIONSLIDER_CENTER) + { + evas_object_smart_callback_call(obj, SIG_CHANGED, "center"); + sd->final_position = 0.5; + } + } + else + { + if (sd->final_position == 1.0) + { + if (sd->enabled_position & ELM_ACTIONSLIDER_CENTER) + { + evas_object_smart_callback_call(obj, SIG_CHANGED, "center"); + sd->final_position = 0.5; + } + else if (sd->enabled_position & ELM_ACTIONSLIDER_LEFT) + { + evas_object_smart_callback_call(obj, SIG_CHANGED, "left"); + sd->final_position = 0.0; + } + } + else if (sd->final_position == 0.5 && + (sd->enabled_position & ELM_ACTIONSLIDER_LEFT)) + { + evas_object_smart_callback_call(obj, SIG_CHANGED, "left"); + sd->final_position = 0.0; + } + } + if (sd->button_animator) ecore_animator_del(sd->button_animator); + sd->button_animator = ecore_animator_add(_button_animator, obj); +} + +static void _mirrored_part_fix(const Evas_Object *obj, const char **part) { @@ -417,6 +484,15 @@ _elm_actionslider_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED) edje_object_signal_callback_add (wd->resize_obj, "elm.drag_button,mouse,move", "*", _drag_button_move_cb, obj); + edje_object_signal_callback_add + (wd->resize_obj, "elm,right,mouse,down", "*", + _track_move_cb, obj); + edje_object_signal_callback_add + (wd->resize_obj, "elm,left,mouse,down", "*", + _track_move_cb, obj); + edje_object_signal_callback_add + (wd->resize_obj, "elm,center,mouse,down", "*", + _track_move_cb, obj); if (!elm_layout_theme_set (obj, "actionslider", "base", elm_widget_style_get(obj)))