forked from enlightenment/efl
Add elm genlist scroller policy setter/getter
Author: "Marco Trevisan (Treviño)" <mail at 3v1n0.net> And add NULL check in elm_list scroller policy getter/setter. SVN revision: 54797
This commit is contained in:
parent
f4294f8d2c
commit
80fc46f893
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue