Hello ~ I'm WooHyun Jung.

I made one patch for elm_slider.c file.

If you click the bar of the slider, the button will be located at there.

(If you keep your "mouse_down" after moving of the button, you can
continuously move the button.)

Thanks.

Index: src/lib/elm_slider.c
===================================================================
--- src/lib/elm_slider.c        (revision 55558)
+++ src/lib/elm_slider.c        (working copy)
@@ -78,6 +78,7 @@ static void _drag_down(void *data, Evas_Object *ob
                     const char *emission, const char *source);
 static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src,
                              Evas_Callback_Type type, void *event_info);
+static void _spacer_cb(void *data, Evas * e, Evas_Object * obj, void 
*event_info);
 
 static const char SIG_CHANGED[] = "changed";
 static const char SIG_DELAY_CHANGED[] = "delay,changed";
@@ -434,6 +435,33 @@ _drag_down(void *data, Evas_Object *obj __UNUSED__
    edje_object_part_drag_step(wd->slider, "elm.dragable.slider", step, step);
 }
 
+static void
+_spacer_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
+{
+   Widget_Data *wd = elm_widget_data_get(data);
+   Evas_Event_Mouse_Down *ev = event_info;
+   Evas_Coord x, y, w, h;
+   double button_x, button_y;
+
+   evas_object_geometry_get(wd->spacer, &x, &y, &w, &h);
+   edje_object_part_drag_value_get(wd->slider, "elm.dragable.slider", 
&button_x, &button_y);
+   if(wd->horizontal)
+     {
+        button_x = ((double)ev->output.x - (double)x) / (double)w;
+        if (button_x > 1) button_x = 1;
+        if (button_x < 0) button_x = 0;
+     }
+   else 
+     {
+        button_y = ((double)ev->output.y - (double)y) / (double)h;
+        if (button_y > 1) button_y = 1;
+        if (button_y < 0) button_y = 0;
+     }
+   edje_object_part_drag_value_set(wd->slider, "elm.dragable.slider", 
button_x, button_y);
+   evas_event_feed_mouse_cancel(e, 0, NULL);
+   evas_event_feed_mouse_down(e, 1, EVAS_BUTTON_NONE, 0, NULL);  
+}
+
 /**
  * Add a new slider to the parent
  *
@@ -488,7 +516,7 @@ elm_slider_add(Evas_Object *parent)
    evas_object_pass_events_set(wd->spacer, EINA_TRUE);
    elm_widget_sub_object_add(obj, wd->spacer);
    edje_object_part_swallow(wd->slider, "elm.swallow.bar", wd->spacer);
-
+   evas_object_event_callback_add(wd->spacer, EVAS_CALLBACK_MOUSE_DOWN, 
_spacer_cb, obj);
    evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
 
    _sizing_eval(obj);
------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to