forked from enlightenment/efl
Add the API elm_scroller_single_direction_set/get.
This sets how the content is scrolled.
This commit is contained in:
parent
774cff2858
commit
87fc1389b9
|
@ -1237,3 +1237,8 @@
|
|||
2013-04-10 Jaehwan Kim
|
||||
|
||||
* Fix the region_show/region_bring_in don't have a limit at a paging movement.
|
||||
|
||||
2013-04-10 Jaehwan Kim
|
||||
|
||||
* Add the API elm_scroller_single_direction_set/get.
|
||||
This sets how the content is scrolled.
|
||||
|
|
|
@ -59,6 +59,7 @@ Additions:
|
|||
* Add convenient macros - elm_object_translatable_part_text_set(), elm_object_item_translatable_part_text_set().
|
||||
* Add the API elm_scroller_page_scroll_limit_set/get.
|
||||
* Add elm_mapbuf_auto_set/get.
|
||||
* Add the API elm_scroller_single_direction_set/get.
|
||||
|
||||
Improvements:
|
||||
|
||||
|
|
|
@ -2910,7 +2910,6 @@ _elm_scroll_mouse_move_event_cb(void *data,
|
|||
Elm_Scrollable_Smart_Interface_Data *sid = data;
|
||||
Evas_Event_Mouse_Move *ev;
|
||||
Evas_Coord x = 0, y = 0;
|
||||
int dodir = 0;
|
||||
|
||||
if (!sid->pan_obj) return;
|
||||
|
||||
|
@ -2977,33 +2976,51 @@ _elm_scroll_mouse_move_event_cb(void *data,
|
|||
if (x < 0) x = -x;
|
||||
if (y < 0) y = -y;
|
||||
|
||||
if ((sid->one_direction_at_a_time) &&
|
||||
(((sid->down.dir_x) || (sid->down.dir_y))))
|
||||
if (sid->one_direction_at_a_time)
|
||||
{
|
||||
if (x > _elm_config->thumbscroll_threshold)
|
||||
if (!((sid->down.dir_x) || (sid->down.dir_y)) &&
|
||||
(((x * x) + (y * y)) >
|
||||
(_elm_config->thumbscroll_threshold *
|
||||
_elm_config->thumbscroll_threshold)))
|
||||
{
|
||||
if (sid->one_direction_at_a_time ==
|
||||
ELM_SCROLLER_SINGLE_DIRECTION_SOFT)
|
||||
{
|
||||
int dodir = 0;
|
||||
if (x > (y * 2))
|
||||
{
|
||||
sid->down.dir_x = EINA_TRUE;
|
||||
sid->down.dir_y = EINA_FALSE;
|
||||
dodir++;
|
||||
}
|
||||
}
|
||||
if (y > _elm_config->thumbscroll_threshold)
|
||||
{
|
||||
if (y > (x * 2))
|
||||
{
|
||||
sid->down.dir_x = EINA_FALSE;
|
||||
sid->down.dir_y = EINA_TRUE;
|
||||
dodir++;
|
||||
}
|
||||
}
|
||||
if (!dodir)
|
||||
{
|
||||
sid->down.dir_x = EINA_TRUE;
|
||||
sid->down.dir_y = EINA_TRUE;
|
||||
}
|
||||
}
|
||||
else if (sid->one_direction_at_a_time ==
|
||||
ELM_SCROLLER_SINGLE_DIRECTION_HARD)
|
||||
{
|
||||
if (x > y)
|
||||
{
|
||||
sid->down.dir_x = EINA_TRUE;
|
||||
sid->down.dir_y = EINA_FALSE;
|
||||
}
|
||||
if (y > x)
|
||||
{
|
||||
sid->down.dir_x = EINA_FALSE;
|
||||
sid->down.dir_y = EINA_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sid->down.dir_x = EINA_TRUE;
|
||||
|
@ -3942,7 +3959,8 @@ static void
|
|||
_elm_scroll_single_direction_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
|
||||
{
|
||||
Elm_Scrollable_Smart_Interface_Data *sid = _pd;
|
||||
Eina_Bool single_dir = va_arg(*list, int);
|
||||
Elm_Scroller_Single_Direction single_dir =
|
||||
va_arg(*list, Elm_Scroller_Single_Direction);
|
||||
|
||||
sid->one_direction_at_a_time = single_dir;
|
||||
}
|
||||
|
@ -3951,7 +3969,8 @@ static void
|
|||
_elm_scroll_single_direction_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
|
||||
{
|
||||
Elm_Scrollable_Smart_Interface_Data *sid = _pd;
|
||||
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
|
||||
Elm_Scroller_Single_Direction *ret =
|
||||
va_arg(*list, Elm_Scroller_Single_Direction *);
|
||||
|
||||
*ret = sid->one_direction_at_a_time;
|
||||
}
|
||||
|
@ -4249,7 +4268,7 @@ _elm_scroll_interface_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
|
|||
sid->bounce_horiz = EINA_TRUE;
|
||||
sid->bounce_vert = EINA_TRUE;
|
||||
|
||||
sid->one_direction_at_a_time = EINA_TRUE;
|
||||
sid->one_direction_at_a_time = ELM_SCROLLER_SINGLE_DIRECTION_SOFT;
|
||||
sid->momentum_animator_disabled = EINA_FALSE;
|
||||
sid->bounce_animator_disabled = EINA_FALSE;
|
||||
|
||||
|
|
|
@ -652,7 +652,7 @@ enum
|
|||
* @param[out] single_dir
|
||||
*
|
||||
*/
|
||||
#define elm_scrollable_interface_single_direction_get(single_dir) ELM_SCROLLABLE_INTERFACE_ID(ELM_SCROLLABLE_INTERFACE_SUB_ID_SINGLE_DIRECTION_GET), EO_TYPECHECK(Eina_Bool *, single_dir)
|
||||
#define elm_scrollable_interface_single_direction_get(single_dir) ELM_SCROLLABLE_INTERFACE_ID(ELM_SCROLLABLE_INTERFACE_SUB_ID_SINGLE_DIRECTION_GET), EO_TYPECHECK(Elm_Scroller_Single_Direction *, single_dir)
|
||||
|
||||
/**
|
||||
* @def elm_scrollable_interface_repeat_events_set
|
||||
|
@ -975,6 +975,7 @@ struct _Elm_Scrollable_Smart_Interface_Data
|
|||
Evas_Object *parent_widget;
|
||||
|
||||
Elm_Scroller_Policy hbar_flags, vbar_flags;
|
||||
Elm_Scroller_Single_Direction one_direction_at_a_time;
|
||||
|
||||
struct
|
||||
{
|
||||
|
@ -1084,7 +1085,6 @@ struct _Elm_Scrollable_Smart_Interface_Data
|
|||
|
||||
Eina_Bool momentum_animator_disabled : 1;
|
||||
Eina_Bool bounce_animator_disabled : 1;
|
||||
Eina_Bool one_direction_at_a_time : 1;
|
||||
Eina_Bool wheel_disabled : 1;
|
||||
Eina_Bool hbar_visible : 1;
|
||||
Eina_Bool vbar_visible : 1;
|
||||
|
|
|
@ -923,6 +923,46 @@ elm_scroller_policy_get(const Evas_Object *obj,
|
|||
eo_do((Eo *) obj, elm_scrollable_interface_policy_get(policy_h, policy_v));
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_scroller_single_direction_set(Evas_Object *obj,
|
||||
Elm_Scroller_Single_Direction single_dir)
|
||||
{
|
||||
ELM_SCROLLABLE_CHECK(obj);
|
||||
eo_do(obj, elm_scrollable_interface_single_direction_set(single_dir));
|
||||
}
|
||||
|
||||
static void
|
||||
_single_direction_set(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
|
||||
{
|
||||
Elm_Scroller_Single_Direction single_dir = va_arg(*list, Elm_Scroller_Single_Direction);
|
||||
|
||||
if (single_dir >= ELM_SCROLLER_SINGLE_DIRECTION_LAST)
|
||||
return;
|
||||
|
||||
eo_do_super(obj, MY_CLASS,
|
||||
elm_scrollable_interface_single_direction_set(single_dir));
|
||||
}
|
||||
|
||||
EAPI Elm_Scroller_Single_Direction
|
||||
elm_scroller_single_direction_get(const Evas_Object *obj)
|
||||
{
|
||||
ELM_SCROLLABLE_CHECK(obj, ELM_SCROLLER_SINGLE_DIRECTION_NONE);
|
||||
Elm_Scroller_Single_Direction single_dir;
|
||||
|
||||
eo_do((Eo *) obj, elm_scrollable_interface_single_direction_get(&single_dir));
|
||||
return single_dir;
|
||||
}
|
||||
|
||||
static void
|
||||
_single_direction_get(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
|
||||
{
|
||||
Elm_Scroller_Single_Direction *ret =
|
||||
va_arg(*list, Elm_Scroller_Single_Direction *);
|
||||
|
||||
eo_do_super(obj, MY_CLASS,
|
||||
elm_scrollable_interface_single_direction_get(ret));
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_scroller_region_get(const Evas_Object *obj,
|
||||
Evas_Coord *x,
|
||||
|
@ -1226,6 +1266,8 @@ _class_constructor(Eo_Class *klass)
|
|||
EO_OP_FUNC(ELM_OBJ_LAYOUT_ID(ELM_OBJ_LAYOUT_SUB_ID_SIZING_EVAL), _elm_scroller_smart_sizing_eval),
|
||||
|
||||
EO_OP_FUNC(ELM_SCROLLABLE_INTERFACE_ID(ELM_SCROLLABLE_INTERFACE_SUB_ID_POLICY_SET), _policy_set),
|
||||
EO_OP_FUNC(ELM_SCROLLABLE_INTERFACE_ID(ELM_SCROLLABLE_INTERFACE_SUB_ID_SINGLE_DIRECTION_SET), _single_direction_set),
|
||||
EO_OP_FUNC(ELM_SCROLLABLE_INTERFACE_ID(ELM_SCROLLABLE_INTERFACE_SUB_ID_SINGLE_DIRECTION_GET), _single_direction_get),
|
||||
EO_OP_FUNC(ELM_SCROLLABLE_INTERFACE_ID(ELM_SCROLLABLE_INTERFACE_SUB_ID_PAGE_SIZE_SET), _page_size_set),
|
||||
|
||||
EO_OP_FUNC(ELM_OBJ_SCROLLER_ID(ELM_OBJ_SCROLLER_SUB_ID_CUSTOM_WIDGET_BASE_THEME_SET), _custom_widget_base_theme_set),
|
||||
|
|
|
@ -200,6 +200,19 @@ typedef enum
|
|||
ELM_SCROLLER_POLICY_LAST
|
||||
} Elm_Scroller_Policy;
|
||||
|
||||
/**
|
||||
* @brief Type that controls how the content is scrolled.
|
||||
*
|
||||
* @see elm_scroller_single_direction_set()
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
ELM_SCROLLER_SINGLE_DIRECTION_NONE = 0, /**< Scroll every direction */
|
||||
ELM_SCROLLER_SINGLE_DIRECTION_SOFT, /**< Scroll single direction if the direction is certain*/
|
||||
ELM_SCROLLER_SINGLE_DIRECTION_HARD, /**< Scroll only single direction */
|
||||
ELM_SCROLLER_SINGLE_DIRECTION_LAST
|
||||
} Elm_Scroller_Single_Direction;
|
||||
|
||||
/**
|
||||
* @brief Add a new scroller to the parent
|
||||
*
|
||||
|
@ -273,6 +286,34 @@ EAPI void elm_scroller_policy_set(Evas_Object *obj, Elm_
|
|||
*/
|
||||
EAPI void elm_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v);
|
||||
|
||||
/**
|
||||
* @brief Set the type of single direction scroll
|
||||
*
|
||||
* @param obj The scroller object
|
||||
* @param single_dir The type of single direction
|
||||
*
|
||||
* @see elm_scroller_single_direction_get()
|
||||
*
|
||||
* @since 1.8
|
||||
*
|
||||
* @ingroup Scroller
|
||||
*/
|
||||
EAPI void elm_scroller_single_direction_set(Evas_Object *obj, Elm_Scroller_Single_Direction single_dir);
|
||||
|
||||
/**
|
||||
* @brief Get the type of single direction scroll
|
||||
*
|
||||
* @param obj The scroller object
|
||||
* @return the type of single direction
|
||||
*
|
||||
* @see elm_scroller_single_direction_get()
|
||||
*
|
||||
* @since 1.8
|
||||
*
|
||||
* @ingroup Scroller
|
||||
*/
|
||||
EAPI Elm_Scroller_Single_Direction elm_scroller_single_direction_get(const Evas_Object *obj);
|
||||
|
||||
/**
|
||||
* @brief Get the currently visible content region
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue