From 1c2b2b215a9f3864c12ae14247ed7b4bc60dc0ed Mon Sep 17 00:00:00 2001 From: Prince Kumar Dubey Date: Thu, 15 Jul 2010 10:03:49 +0530 Subject: [PATCH] [ScrollBar (Handler)] Modification Added. --- src/lib/Elementary.h.in | 3 +++ src/lib/elm_genlist.c | 22 ++++++++++++++++++++++ src/lib/elm_index.c | 2 +- src/lib/elm_list.c | 22 ++++++++++++++++++++++ src/lib/elm_scroller.c | 18 ++++++++++++++++++ src/lib/els_scroller.c | 20 +++++++++++++++++++- src/lib/els_scroller.h | 1 + 7 files changed, 86 insertions(+), 2 deletions(-) mode change 100644 => 100755 src/lib/elm_index.c mode change 100644 => 100755 src/lib/els_scroller.c diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in index 432040d..d481d6d 100755 --- a/src/lib/Elementary.h.in +++ b/src/lib/Elementary.h.in @@ -517,6 +517,7 @@ extern "C" { EAPI void elm_scroller_page_size_set(Evas_Object *obj, Evas_Coord h_pagesize, Evas_Coord v_pagesize); EAPI void elm_scroller_region_bring_in(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h); EAPI void elm_scroller_page_move_set(Evas_Object *obj, Eina_Bool set); + EAPI void elm_scroller_scrollbar_handler_set(Evas_Object *obj, Eina_Bool set); /* smart callbacks called: * "edge,left" * "edge,right" @@ -1064,6 +1065,7 @@ extern "C" { EAPI void elm_list_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce); EAPI void elm_list_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v); EAPI void elm_list_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v); + EAPI void elm_list_scrollbar_handler_set(Evas_Object *obj, Eina_Bool set); /* smart callbacks called: * "clicked" - when the user double-clicked an item * "selected" - when the user selected an item @@ -1215,6 +1217,7 @@ extern "C" { EAPI void elm_genlist_block_count_set(Evas_Object *obj, int n); EAPI void elm_genlist_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v); EAPI void elm_genlist_set_edit_mode(Evas_Object *obj, int emode, Elm_Genlist_Edit_Class *ec); + EAPI void elm_genlist_scrollbar_handler_set(Evas_Object *obj, Eina_Bool set); EAPI Evas_Object *elm_check_add(Evas_Object *parent); EAPI void elm_check_label_set(Evas_Object *obj, const char *label); diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c index 576a0d7..2604c0c 100644 --- a/src/lib/elm_genlist.c +++ b/src/lib/elm_genlist.c @@ -4410,3 +4410,25 @@ elm_genlist_set_edit_mode(Evas_Object *obj, int emode, Elm_Genlist_Edit_Class *e if (wd->calc_job) ecore_job_del(wd->calc_job); wd->calc_job = ecore_job_add(_calc_job, wd); } + +/** + * Set Scrollbar Handler mode + * + * This will activate the scrollbar handler mode for the genlist. + * + * @param obj The genlist object + * @param set if EINA_TRUE, activate handler. + * + * @ingroup Genlist + */ + +EAPI void +elm_genlist_scrollbar_handler_set(Evas_Object *obj, Eina_Bool set) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if(!set) return; + elm_smart_scroller_bounce_allow_set(wd->scr, 0, 0); + elm_smart_scroller_handler_set(wd->scr); +} diff --git a/src/lib/elm_index.c b/src/lib/elm_index.c old mode 100644 new mode 100755 index 0c70bd9..fba8b22 --- a/src/lib/elm_index.c +++ b/src/lib/elm_index.c @@ -326,7 +326,7 @@ _sel_eval(Evas_Object *obj, Evas_Coord evx, Evas_Coord evy) dist = 0x7fffffff; evas_object_geometry_get(wd->bx[i], &bx, &by, &bw, &bh); dmin = (double)(wd->min_1st_level_obj_height*wd->tot_items_count[1])/(2*(double)bh); - dmax = 1-dmin; + dmax = 1.0-dmin-0.08; EINA_LIST_FOREACH(wd->items, l, it) { if (!((it->level == i) && (it->base))) continue; diff --git a/src/lib/elm_list.c b/src/lib/elm_list.c index 34a7a52..fcda32f 100644 --- a/src/lib/elm_list.c +++ b/src/lib/elm_list.c @@ -1497,3 +1497,25 @@ elm_list_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy if (wd->scr) elm_scroller_policy_get(wd->scr, policy_h, policy_v); } + +/** + * Set Scrollbar Handler mode + * + * This will activate the scrollbar handler mode for the list. + * + * @param obj The list object + * @param set if EINA_TRUE, activate handler. + * + * @ingroup Genlist + */ +EAPI void +elm_list_scrollbar_handler_set(Evas_Object *obj, Eina_Bool set) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if(!set) return; + + elm_scroller_bounce_set(wd->scr, 0, 0); + elm_scroller_scrollbar_handler_set(wd->scr, set); +} diff --git a/src/lib/elm_scroller.c b/src/lib/elm_scroller.c index f6f788c..e63599b 100644 --- a/src/lib/elm_scroller.c +++ b/src/lib/elm_scroller.c @@ -669,3 +669,21 @@ elm_scroller_page_move_set(Evas_Object *obj, Eina_Bool set) elm_smart_scroller_page_move_set(wd->scr, set); } + +/** + * Set scrollbar handler + * + * @param obj The scroller object + * @param set Flag + * + * @ingroup Scroller + */ +EAPI void +elm_scroller_scrollbar_handler_set(Evas_Object *obj, Eina_Bool set) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + if(!set) return; + elm_smart_scroller_handler_set(wd->scr); +} diff --git a/src/lib/els_scroller.c b/src/lib/els_scroller.c old mode 100644 new mode 100755 index 802320f..120c4dc --- a/src/lib/els_scroller.c +++ b/src/lib/els_scroller.c @@ -20,7 +20,7 @@ struct _Smart_Data Evas_Object *event_obj; Evas_Object *widget; - + Elm_Smart_Scroller_Policy hbar_flags, vbar_flags; struct { @@ -1157,6 +1157,22 @@ elm_smart_scroller_widget_set(Evas_Object *obj, Evas_Object *wid) sd->widget = wid; } +EAPI void +elm_smart_scroller_handler_set(Evas_Object *obj) +{ + API_ENTRY return; + Elm_Smart_Scroller_Policy *policy_h, *policy_v; + policy_h = ELM_SMART_SCROLLER_POLICY_OFF; + policy_v = ELM_SMART_SCROLLER_POLICY_OFF; + + elm_smart_scroller_policy_get(obj, &policy_h, &policy_v); + + if(policy_v != ELM_SMART_SCROLLER_POLICY_ON) + elm_smart_scroller_policy_set(obj, ELM_SMART_SCROLLER_POLICY_OFF, ELM_SMART_SCROLLER_POLICY_AUTO); + + edje_object_signal_emit(sd->edje_obj, "elm,activate,handler", "elm"); +} + /* local subsystem functions */ static void _smart_edje_drag_v_start(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) @@ -1472,6 +1488,7 @@ _smart_event_mouse_up(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *ev sd = data; ev = event_info; sd->down.hold_parent = 0; + // if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return ; evas_post_event_callback_push(e, _smart_event_post_up, sd); // FIXME: respect elm_widget_scroll_hold_get of parent container @@ -1749,6 +1766,7 @@ _smart_event_mouse_move(void *data, Evas *e, Evas_Object *obj __UNUSED__, void * sd = data; ev = event_info; + // if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return ; if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) sd->down.hold_parent = 1; evas_post_event_callback_push(e, _smart_event_post_move, sd); diff --git a/src/lib/els_scroller.h b/src/lib/els_scroller.h index 4a750b3..714a208 100644 --- a/src/lib/els_scroller.h +++ b/src/lib/els_scroller.h @@ -32,3 +32,4 @@ void elm_smart_scroller_paging_set (Evas_Object *obj, double pagere void elm_smart_scroller_region_bring_in (Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h); void elm_smart_scroller_widget_set (Evas_Object *obj, Evas_Object *wid); void elm_smart_scroller_page_move_set (Evas_Object *obj, Eina_Bool set); +void elm_smart_scroller_handler_set (Evas_Object *obj); -- 2.7.4