diff --git a/legacy/elementary/src/lib/Elementary.h.in b/legacy/elementary/src/lib/Elementary.h.in index 433907544f..434769629c 100644 --- a/legacy/elementary/src/lib/Elementary.h.in +++ b/legacy/elementary/src/lib/Elementary.h.in @@ -1683,6 +1683,8 @@ extern "C" { EAPI Elm_Genlist_Item *elm_genlist_at_xy_item_get(const Evas_Object *obj, Evas_Coord x, Evas_Coord y, int *posret); EAPI Elm_Genlist_Item *elm_genlist_first_item_get(const Evas_Object *obj); EAPI Elm_Genlist_Item *elm_genlist_last_item_get(const Evas_Object *obj); + EAPI void elm_genlist_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v); + EAPI void elm_genlist_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v); /* available item styles: * default * default_style - The text part is a textblock diff --git a/legacy/elementary/src/lib/elm_genlist.c b/legacy/elementary/src/lib/elm_genlist.c index 0a2c12f1a8..6d85425746 100644 --- a/legacy/elementary/src/lib/elm_genlist.c +++ b/legacy/elementary/src/lib/elm_genlist.c @@ -2197,11 +2197,11 @@ elm_genlist_add(Evas_Object *parent) wd->scr = elm_smart_scroller_add(e); elm_smart_scroller_widget_set(wd->scr, obj); - elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base", elm_widget_style_get(obj)); - elm_widget_resize_object_set(obj, wd->scr); - + elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base", + elm_widget_style_get(obj)); elm_smart_scroller_bounce_allow_set(wd->scr, EINA_FALSE, _elm_config->thumbscroll_bounce_enable); + elm_widget_resize_object_set(obj, wd->scr); evas_object_smart_callback_add(wd->scr, "edge,left", _scroll_edge_left, obj); evas_object_smart_callback_add(wd->scr, "edge,right", _scroll_edge_right, obj); @@ -4310,3 +4310,43 @@ elm_genlist_longpress_timeout_get(const Evas_Object *obj) if (!wd) return 0; return wd->longpress_timeout; } + +/** + * Set the scrollbar policy + * + * This sets the scrollbar visibility policy for the given genlist scroller. + * ELM_SMART_SCROLLER_POLICY_AUTO means the scrollber is made visible if it + * is needed, and otherwise kept hidden. ELM_SMART_SCROLLER_POLICY_ON turns + * it on all the time, and ELM_SMART_SCROLLER_POLICY_OFF always keeps it off. + * This applies respectively for the horizontal and vertical scrollbars. + * + * @param obj The genlist object + * @param policy_h Horizontal scrollbar policy + * @param policy_v Vertical scrollbar policy + * + * @ingroup List + */ +EAPI void +elm_genlist_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if ((policy_h >= ELM_SCROLLER_POLICY_LAST) || + (policy_v >= ELM_SCROLLER_POLICY_LAST)) + return; + if (wd->scr) + elm_smart_scroller_policy_set(wd->scr, policy_h, policy_v); +} + +EAPI void +elm_genlist_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + Elm_Smart_Scroller_Policy s_policy_h, s_policy_v; + if ((!wd) || (!wd->scr)) return; + elm_smart_scroller_policy_get(wd->scr, &s_policy_h, &s_policy_v); + if (policy_h) *policy_h = (Elm_Scroller_Policy) s_policy_h; + if (policy_v) *policy_v = (Elm_Scroller_Policy) s_policy_v; +} diff --git a/legacy/elementary/src/lib/elm_list.c b/legacy/elementary/src/lib/elm_list.c index 8ff3c303a7..f2ec0c5dc2 100644 --- a/legacy/elementary/src/lib/elm_list.c +++ b/legacy/elementary/src/lib/elm_list.c @@ -2399,7 +2399,7 @@ elm_list_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bo /** * Set the scrollbar policy * - * This sets the scrollbar visibility policy for the given scroller. + * This sets the scrollbar visibility policy for the given list scroller. * ELM_SMART_SCROLLER_POLICY_AUTO means the scrollber is made visible if it * is needed, and otherwise kept hidden. ELM_SMART_SCROLLER_POLICY_ON turns * it on all the time, and ELM_SMART_SCROLLER_POLICY_OFF always keeps it off. @@ -2417,7 +2417,8 @@ elm_list_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; - if ((policy_h >= 3) || (policy_v >= 3)) return; + if ((policy_h >= ELM_SCROLLER_POLICY_LAST) || + (policy_v >= ELM_SCROLLER_POLICY_LAST)) if (wd->scr) elm_smart_scroller_policy_set(wd->scr, policy_h, policy_v); } @@ -2430,8 +2431,8 @@ elm_list_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy Elm_Smart_Scroller_Policy s_policy_h, s_policy_v; if ((!wd) || (!wd->scr)) return; elm_smart_scroller_policy_get(wd->scr, &s_policy_h, &s_policy_v); - *policy_h = (Elm_Scroller_Policy) s_policy_h; - *policy_v = (Elm_Scroller_Policy) s_policy_v; + if (policy_h) *policy_h = (Elm_Scroller_Policy) s_policy_h; + if (policy_v) *policy_v = (Elm_Scroller_Policy) s_policy_v; } /**