From: Jaehwan Kim Date: Fri, 15 Mar 2013 11:32:40 +0000 (+0900) Subject: [Scroller] Add the smart signals in scroller. scroll,left, scroll,right, scroll,up... X-Git-Tag: 2.1b_release~126 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c8d8e5a5e4d51546ce46010e0ed299e0e028d4bd;p=framework%2Fuifw%2Felementary.git [Scroller] Add the smart signals in scroller. scroll,left, scroll,right, scroll,up, scroll,down. Change-Id: Ia67514b197aaf77096288fc456d0bdb587b77d81 --- diff --git a/src/lib/elm_interface_scrollable.c b/src/lib/elm_interface_scrollable.c index 0365eed..d7ac688 100644 --- a/src/lib/elm_interface_scrollable.c +++ b/src/lib/elm_interface_scrollable.c @@ -1364,8 +1364,6 @@ _elm_scroll_content_pos_set(Evas_Object *obj, edje_object_part_drag_value_set (sid->edje_obj, "elm.dragable.hbar", vx, 0.0); - if (sig && ((px != x) || (py != y))) - edje_object_signal_emit(sid->edje_obj, "elm,action,scroll", "elm"); if (!sid->down.bounce_x_animator) { if (((x < minx) && (0 <= sid->down.dx)) || @@ -1389,13 +1387,38 @@ _elm_scroll_content_pos_set(Evas_Object *obj, sid->bouncemey = EINA_FALSE; } - if ((x != px) || (y != py)) - { - if (sid->cb_func.scroll) - sid->cb_func.scroll(obj, NULL); - } if (sig) { + if ((x != px) || (y != py)) + { + if (sid->cb_func.scroll) + sid->cb_func.scroll(obj, NULL); + edje_object_signal_emit(sid->edje_obj, "elm,action,scroll", "elm"); + if (x < px) + { + if (sid->cb_func.scroll_left) + sid->cb_func.scroll_left(obj, NULL); + edje_object_signal_emit(sid->edje_obj, "elm,action,scroll,left", "elm"); + } + if (x > px) + { + if (sid->cb_func.scroll_right) + sid->cb_func.scroll_right(obj, NULL); + edje_object_signal_emit(sid->edje_obj, "elm,action,scroll,right", "elm"); + } + if (y < py) + { + if (sid->cb_func.scroll_up) + sid->cb_func.scroll_up(obj, NULL); + edje_object_signal_emit(sid->edje_obj, "elm,action,scroll,up", "elm"); + } + if (y > py) + { + if (sid->cb_func.scroll_down) + sid->cb_func.scroll_down(obj, NULL); + edje_object_signal_emit(sid->edje_obj, "elm,action,scroll,down", "elm"); + } + } if (x != px) { if (x == minx) @@ -3343,6 +3366,46 @@ _elm_scroll_scroll_cb_set(Evas_Object *obj, } static void +_elm_scroll_scroll_left_cb_set(Evas_Object *obj, + void (*scroll_left_cb)(Evas_Object *obj, + void *data)) +{ + ELM_SCROLL_IFACE_DATA_GET_OR_RETURN(obj, sid); + + sid->cb_func.scroll_left = scroll_left_cb; +} + +static void +_elm_scroll_scroll_right_cb_set(Evas_Object *obj, + void (*scroll_right_cb)(Evas_Object *obj, + void *data)) +{ + ELM_SCROLL_IFACE_DATA_GET_OR_RETURN(obj, sid); + + sid->cb_func.scroll_right = scroll_right_cb; +} + +static void +_elm_scroll_scroll_up_cb_set(Evas_Object *obj, + void (*scroll_up_cb)(Evas_Object *obj, + void *data)) +{ + ELM_SCROLL_IFACE_DATA_GET_OR_RETURN(obj, sid); + + sid->cb_func.scroll_up = scroll_up_cb; +} + +static void +_elm_scroll_scroll_down_cb_set(Evas_Object *obj, + void (*scroll_down_cb)(Evas_Object *obj, + void *data)) +{ + ELM_SCROLL_IFACE_DATA_GET_OR_RETURN(obj, sid); + + sid->cb_func.scroll_down = scroll_down_cb; +} + +static void _elm_scroll_edge_left_cb_set(Evas_Object *obj, void (*edge_left_cb)(Evas_Object *obj, void *data)) @@ -3952,6 +4015,10 @@ EAPI const Elm_Scrollable_Smart_Interface ELM_SCROLLABLE_IFACE = _elm_scroll_animate_start_cb_set, _elm_scroll_animate_stop_cb_set, _elm_scroll_scroll_cb_set, + _elm_scroll_scroll_left_cb_set, + _elm_scroll_scroll_right_cb_set, + _elm_scroll_scroll_up_cb_set, + _elm_scroll_scroll_down_cb_set, _elm_scroll_edge_left_cb_set, _elm_scroll_edge_right_cb_set, _elm_scroll_edge_top_cb_set, diff --git a/src/lib/elm_interface_scrollable.h b/src/lib/elm_interface_scrollable.h index e87c9d1..c478f62 100644 --- a/src/lib/elm_interface_scrollable.h +++ b/src/lib/elm_interface_scrollable.h @@ -261,6 +261,14 @@ struct _Elm_Scrollable_Smart_Interface_Data void *data); void (*scroll)(Evas_Object *obj, void *data); + void (*scroll_left)(Evas_Object *obj, + void *data); + void (*scroll_right)(Evas_Object *obj, + void *data); + void (*scroll_up)(Evas_Object *obj, + void *data); + void (*scroll_down)(Evas_Object *obj, + void *data); void (*edge_left)(Evas_Object *obj, void *data); void (*edge_right)(Evas_Object *obj, @@ -350,6 +358,18 @@ struct _Elm_Scrollable_Smart_Interface void (*scroll_cb_set)(Evas_Object *obj, void (*s_cb)(Evas_Object *obj, void *data)); + void (*scroll_left_cb_set)(Evas_Object *obj, + void (*s_left_cb)(Evas_Object *obj, + void *data)); + void (*scroll_right_cb_set)(Evas_Object *obj, + void (*s_right_cb)(Evas_Object *obj, + void *data)); + void (*scroll_up_cb_set)(Evas_Object *obj, + void (*s_up_cb)(Evas_Object *obj, + void *data)); + void (*scroll_down_cb_set)(Evas_Object *obj, + void (*s_down_cb)(Evas_Object *obj, + void *data)); void (*edge_left_cb_set)(Evas_Object *obj, void (*e_left_cb)(Evas_Object *obj, void *data)); diff --git a/src/lib/elm_scroller.c b/src/lib/elm_scroller.c index b8252a1..ef4079e 100644 --- a/src/lib/elm_scroller.c +++ b/src/lib/elm_scroller.c @@ -4,6 +4,10 @@ EAPI const char ELM_SCROLLER_SMART_NAME[] = "elm_scroller"; static const char SIG_SCROLL[] = "scroll"; +static const char SIG_SCROLL_LEFT[] = "scroll,left"; +static const char SIG_SCROLL_RIGHT[] = "scroll,right"; +static const char SIG_SCROLL_UP[] = "scroll,up"; +static const char SIG_SCROLL_DOWN[] = "scroll,down"; static const char SIG_SCROLL_ANIM_START[] = "scroll,anim,start"; static const char SIG_SCROLL_ANIM_STOP[] = "scroll,anim,stop"; static const char SIG_SCROLL_DRAG_START[] = "scroll,drag,start"; @@ -21,6 +25,10 @@ static const char SIG_HBAR_UNPRESS[] = "hbar,unpress"; static const Evas_Smart_Cb_Description _smart_callbacks[] = { {SIG_SCROLL, ""}, + {SIG_SCROLL_LEFT, ""}, + {SIG_SCROLL_RIGHT, ""}, + {SIG_SCROLL_UP, ""}, + {SIG_SCROLL_DOWN, ""}, {SIG_SCROLL_ANIM_START, ""}, {SIG_SCROLL_ANIM_STOP, ""}, {SIG_SCROLL_DRAG_START, ""}, @@ -541,6 +549,34 @@ _scroll_cb(Evas_Object *obj, } static void +_scroll_left_cb(Evas_Object *obj, + void *data __UNUSED__) +{ + evas_object_smart_callback_call(obj, SIG_SCROLL_LEFT, NULL); +} + +static void +_scroll_right_cb(Evas_Object *obj, + void *data __UNUSED__) +{ + evas_object_smart_callback_call(obj, SIG_SCROLL_RIGHT, NULL); +} + +static void +_scroll_up_cb(Evas_Object *obj, + void *data __UNUSED__) +{ + evas_object_smart_callback_call(obj, SIG_SCROLL_UP, NULL); +} + +static void +_scroll_down_cb(Evas_Object *obj, + void *data __UNUSED__) +{ + evas_object_smart_callback_call(obj, SIG_SCROLL_DOWN, NULL); +} + +static void _scroll_anim_start_cb(Evas_Object *obj, void *data __UNUSED__) { @@ -690,6 +726,10 @@ _elm_scroller_smart_add(Evas_Object *obj) priv->s_iface->hbar_press_cb_set(obj, _hbar_press_cb); priv->s_iface->hbar_unpress_cb_set(obj, _hbar_unpress_cb); priv->s_iface->scroll_cb_set(obj, _scroll_cb); + priv->s_iface->scroll_left_cb_set(obj, _scroll_left_cb); + priv->s_iface->scroll_right_cb_set(obj, _scroll_right_cb); + priv->s_iface->scroll_up_cb_set(obj, _scroll_up_cb); + priv->s_iface->scroll_down_cb_set(obj, _scroll_down_cb); priv->s_iface->animate_start_cb_set(obj, _scroll_anim_start_cb); priv->s_iface->animate_stop_cb_set(obj, _scroll_anim_stop_cb); priv->s_iface->drag_start_cb_set(obj, _scroll_drag_start_cb);