[actionslider]:enable the mouse event
authorprashant <pb.ingale@samsung.com>
Mon, 13 Jan 2014 06:44:44 +0000 (15:44 +0900)
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>
Mon, 13 Jan 2014 06:44:44 +0000 (15:44 +0900)
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

data/themes/edc/elm/actionslider.edc
src/lib/elm_actionslider.c

index eb4f4bc..613dd92 100644 (file)
@@ -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";
index bb20e2c..52771d9 100644 (file)
@@ -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)))