From ffa041fe58f63ad961ca88e3bbe1f696b1f8e1ea Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Tue, 29 Aug 2017 17:49:38 +0900 Subject: [PATCH] scroll: Rename elm enum to efl.ui This scroll block enum should also be used in widget itself. Ref T5363 --- src/lib/elementary/elm_general.eot | 14 ++++++++ src/lib/elementary/elm_interface_scrollable.c | 46 +++++++++++++------------- src/lib/elementary/elm_interface_scrollable.eo | 26 +++------------ src/lib/elementary/elm_interface_scrollable.h | 2 +- src/lib/elementary/elm_panel.c | 32 +++++++++--------- src/lib/elementary/elm_scroller.c | 18 ++++++++-- src/lib/elementary/elm_scroller_legacy.h | 15 +++++++++ 7 files changed, 89 insertions(+), 64 deletions(-) diff --git a/src/lib/elementary/elm_general.eot b/src/lib/elementary/elm_general.eot index 2c6ffb6..3ce39e5 100644 --- a/src/lib/elementary/elm_general.eot +++ b/src/lib/elementary/elm_general.eot @@ -195,6 +195,20 @@ enum Efl.Ui.Softcursor_Mode off [[Never use a softcursor.]] } +enum Efl.Ui.Scroll_Block +{ + [[Direction in which a scroller should be blocked. + + Note: These options may be effective only in case of thumbscroll (i.e. + when scrolling by dragging). + + @since 1.21 + ]] + none = 0, [[Don't block any movement.]] + vertical = 1, [[Block vertical movement.]] + horizontal = 2 [[Block horizontal movement.]] +} + enum Elm.Icon.Type { [[Elementary icon types]] diff --git a/src/lib/elementary/elm_interface_scrollable.c b/src/lib/elementary/elm_interface_scrollable.c index 8588161..718417e 100644 --- a/src/lib/elementary/elm_interface_scrollable.c +++ b/src/lib/elementary/elm_interface_scrollable.c @@ -2125,11 +2125,11 @@ _elm_scroll_wheel_event_cb(void *data, return; if (direction) { - if (sid->block & ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL) return; + if (sid->block & EFL_UI_SCROLL_BLOCK_HORIZONTAL) return; } else { - if (sid->block & ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL) return; + if (sid->block & EFL_UI_SCROLL_BLOCK_VERTICAL) return; } evas_post_event_callback_push(e, _scroll_wheel_post_event_cb, sid); @@ -2514,8 +2514,8 @@ _elm_scroll_mouse_up_event_cb(void *data, if (!sid->pan_obj) return; - if ((sid->block & ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL) && - (sid->block & ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL)) + if ((sid->block & EFL_UI_SCROLL_BLOCK_VERTICAL) && + (sid->block & EFL_UI_SCROLL_BLOCK_HORIZONTAL)) return; #ifdef SMOOTHDBG @@ -2700,7 +2700,7 @@ _elm_scroll_mouse_up_event_cb(void *data, pgx = _elm_scroll_page_x_get(sid, ox, EINA_TRUE); if (pgx != x && !(sid->block & - ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL)) + EFL_UI_SCROLL_BLOCK_HORIZONTAL)) { ev->event_flags |= EVAS_EVENT_FLAG_ON_SCROLL; _elm_scroll_scroll_to_x @@ -2714,7 +2714,7 @@ _elm_scroll_mouse_up_event_cb(void *data, pgy = _elm_scroll_page_y_get(sid, oy, EINA_TRUE); if (pgy != y && !(sid->block & - ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL)) + EFL_UI_SCROLL_BLOCK_VERTICAL)) { ev->event_flags |= EVAS_EVENT_FLAG_ON_SCROLL; _elm_scroll_scroll_to_y @@ -2801,8 +2801,8 @@ _elm_scroll_mouse_down_event_cb(void *data, sid = data; ev = event_info; - if ((sid->block & ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL) && - (sid->block & ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL)) + if ((sid->block & EFL_UI_SCROLL_BLOCK_VERTICAL) && + (sid->block & EFL_UI_SCROLL_BLOCK_HORIZONTAL)) return; #ifdef SMOOTHDBG @@ -3267,8 +3267,8 @@ _elm_scroll_mouse_move_event_cb(void *data, if (!sid->pan_obj) return; - if ((sid->block & ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL) && - (sid->block & ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL)) + if ((sid->block & EFL_UI_SCROLL_BLOCK_VERTICAL) && + (sid->block & EFL_UI_SCROLL_BLOCK_HORIZONTAL)) return; ev = event_info; @@ -3283,7 +3283,7 @@ _elm_scroll_mouse_move_event_cb(void *data, if (!sid->down.now) return; if ((sid->scrollto.x.animator) && (!sid->hold) && (!sid->freeze) && - !(sid->block & ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL)) + !(sid->block & EFL_UI_SCROLL_BLOCK_HORIZONTAL)) { Evas_Coord px = 0; ELM_ANIMATOR_DISCONNECT(sid->obj, sid->scrollto.x.animator, _elm_scroll_scroll_to_x_animator, sid); @@ -3293,7 +3293,7 @@ _elm_scroll_mouse_move_event_cb(void *data, } if ((sid->scrollto.y.animator) && (!sid->hold) && (!sid->freeze) && - !(sid->block & ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL)) + !(sid->block & EFL_UI_SCROLL_BLOCK_VERTICAL)) { Evas_Coord py = 0; ELM_ANIMATOR_DISCONNECT(sid->obj, sid->scrollto.y.animator, _elm_scroll_scroll_to_y_animator, sid); @@ -3347,7 +3347,7 @@ _elm_scroll_mouse_move_event_cb(void *data, if (x > (y * 2)) { if (!(sid->block & - ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL)) + EFL_UI_SCROLL_BLOCK_HORIZONTAL)) { sid->down.dir_x = EINA_TRUE; } @@ -3358,7 +3358,7 @@ _elm_scroll_mouse_move_event_cb(void *data, { sid->down.dir_x = EINA_FALSE; if (!(sid->block & - ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL)) + EFL_UI_SCROLL_BLOCK_VERTICAL)) { sid->down.dir_y = EINA_TRUE; } @@ -3367,12 +3367,12 @@ _elm_scroll_mouse_move_event_cb(void *data, if (!dodir) { if (!(sid->block & - ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL)) + EFL_UI_SCROLL_BLOCK_HORIZONTAL)) { sid->down.dir_x = EINA_TRUE; } if (!(sid->block & - ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL)) + EFL_UI_SCROLL_BLOCK_VERTICAL)) { sid->down.dir_y = EINA_TRUE; } @@ -3384,7 +3384,7 @@ _elm_scroll_mouse_move_event_cb(void *data, if (x > y) { if (!(sid->block & - ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL)) + EFL_UI_SCROLL_BLOCK_HORIZONTAL)) { sid->down.dir_x = EINA_TRUE; } @@ -3394,7 +3394,7 @@ _elm_scroll_mouse_move_event_cb(void *data, { sid->down.dir_x = EINA_FALSE; if (!(sid->block & - ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL)) + EFL_UI_SCROLL_BLOCK_VERTICAL)) { sid->down.dir_y = EINA_TRUE; } @@ -3405,12 +3405,12 @@ _elm_scroll_mouse_move_event_cb(void *data, else { if (!(sid->block & - ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL)) + EFL_UI_SCROLL_BLOCK_HORIZONTAL)) { sid->down.dir_x = EINA_TRUE; } if (!(sid->block & - ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL)) + EFL_UI_SCROLL_BLOCK_VERTICAL)) { sid->down.dir_y = EINA_TRUE; } @@ -4547,12 +4547,12 @@ _elm_interface_scrollable_gravity_get(Eo *obj EINA_UNUSED, Elm_Scrollable_Smart_ } EOLIAN static void -_elm_interface_scrollable_movement_block_set(Eo *obj EINA_UNUSED, Elm_Scrollable_Smart_Interface_Data *sid, Elm_Scroller_Movement_Block block) +_elm_interface_scrollable_movement_block_set(Eo *obj EINA_UNUSED, Elm_Scrollable_Smart_Interface_Data *sid, Efl_Ui_Scroll_Block block) { sid->block = block; } -EOLIAN static Elm_Scroller_Movement_Block +EOLIAN static Efl_Ui_Scroll_Block _elm_interface_scrollable_movement_block_get(Eo *obj EINA_UNUSED, Elm_Scrollable_Smart_Interface_Data *sid) { return sid->block; @@ -4614,7 +4614,7 @@ _elm_interface_scrollable_efl_canvas_group_group_add(Eo *obj, Elm_Scrollable_Sma sid->one_direction_at_a_time = ELM_SCROLLER_SINGLE_DIRECTION_SOFT; sid->momentum_animator_disabled = EINA_FALSE; sid->bounce_animator_disabled = EINA_FALSE; - sid->block = ELM_SCROLLER_MOVEMENT_NO_BLOCK; + sid->block = EFL_UI_SCROLL_BLOCK_NONE; _elm_scroll_scroll_bar_reset(sid); diff --git a/src/lib/elementary/elm_interface_scrollable.eo b/src/lib/elementary/elm_interface_scrollable.eo index 40462fc..452cee7 100644 --- a/src/lib/elementary/elm_interface_scrollable.eo +++ b/src/lib/elementary/elm_interface_scrollable.eo @@ -29,19 +29,6 @@ enum Elm.Scroller.Single_Direction last [[Sentinel value to indicate last enum field during iteration]] } -enum Elm.Scroller.Movement_Block -{ - [[Type that blocks the scroll movement in one or more direction. - - @since 1.8 - ]] - legacy: elm_scroller_movement; - no_block = 1 << 0, [[Do not block movements]] - block_vertical = 1 << 1, [[Block vertical movements]] - block_horizontal = 1 << 2 [[Block horizontal movements]] -} - - mixin Elm.Interface_Scrollable(Efl.Ui.Scrollable, Efl.Canvas.Group, Efl.Ui.Focus.Manager, Elm.Widget) { [[Elm scrollable mixin]] @@ -104,22 +91,17 @@ mixin Elm.Interface_Scrollable(Efl.Ui.Scrollable, Efl.Canvas.Group, Efl.Ui.Focus This function will block scrolling movement (by input of a user) in a given direction. One can disable movements in the X axis, the Y - axis or both. The default value is #ELM_SCROLLER_MOVEMENT_NO_BLOCK, - where movements are allowed in both directions. + axis or both. The default value is $none, where movements are + allowed in both directions. What makes this function different from freeze_push(), hold_push() and lock_x_set() (or lock_y_set()) is that it doesn't propagate its effects to any parent or child widget of $obj. Only the target scrollable widget will be locked with regard to scrolling. - - @since 1.8]] - set { - } - get { - } + ]] values { - block: Elm.Scroller.Movement_Block; [[Which axis (or axes) to block]] + block: Efl.Ui.Scroll_Block(none); [[Which axis (or axes) to block]] } } @property momentum_animator_disabled { diff --git a/src/lib/elementary/elm_interface_scrollable.h b/src/lib/elementary/elm_interface_scrollable.h index 385cd5e..db99249 100644 --- a/src/lib/elementary/elm_interface_scrollable.h +++ b/src/lib/elementary/elm_interface_scrollable.h @@ -82,7 +82,7 @@ struct _Elm_Scrollable_Smart_Interface_Data Elm_Scroller_Policy hbar_flags, vbar_flags; Elm_Scroller_Single_Direction one_direction_at_a_time; - Elm_Scroller_Movement_Block block; + Efl_Ui_Scroll_Block block; struct { diff --git a/src/lib/elementary/elm_panel.c b/src/lib/elementary/elm_panel.c index 5112f7e..cd01d6a 100644 --- a/src/lib/elementary/elm_panel.c +++ b/src/lib/elementary/elm_panel.c @@ -364,7 +364,7 @@ _drawer_open(Evas_Object *obj, Evas_Coord w, Evas_Coord h, Eina_Bool anim) if (sd->freeze) { elm_interface_scrollable_movement_block_set - (obj, ELM_SCROLLER_MOVEMENT_NO_BLOCK); + (obj, EFL_UI_SCROLL_BLOCK_NONE); sd->freeze = EINA_FALSE; elm_layout_signal_emit(sd->scr_ly, "elm,state,content,visible", "elm"); } @@ -431,7 +431,7 @@ _drawer_close(Evas_Object *obj, Evas_Coord w, Evas_Coord h, Eina_Bool anim) if (sd->freeze) { elm_interface_scrollable_movement_block_set - (obj, ELM_SCROLLER_MOVEMENT_NO_BLOCK); + (obj, EFL_UI_SCROLL_BLOCK_NONE); sd->freeze = EINA_FALSE; elm_layout_signal_emit(sd->scr_ly, "elm,state,content,visible", "elm"); } @@ -444,10 +444,10 @@ _drawer_close(Evas_Object *obj, Evas_Coord w, Evas_Coord h, Eina_Bool anim) { if (horizontal) elm_interface_scrollable_movement_block_set - (obj, ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL); + (obj, EFL_UI_SCROLL_BLOCK_HORIZONTAL); else elm_interface_scrollable_movement_block_set - (obj, ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL); + (obj, EFL_UI_SCROLL_BLOCK_VERTICAL); sd->freeze = EINA_TRUE; elm_layout_signal_emit(sd->scr_ly, "elm,state,content,hidden", "elm"); } @@ -575,7 +575,7 @@ _timer_cb(void *data) if (sd->freeze) { elm_interface_scrollable_movement_block_set - (obj, ELM_SCROLLER_MOVEMENT_NO_BLOCK); + (obj, EFL_UI_SCROLL_BLOCK_NONE); sd->freeze = EINA_FALSE; elm_layout_signal_emit(sd->scr_ly, "elm,state,content,visible", "elm"); evas_object_geometry_get(obj, NULL, NULL, &w, &h); @@ -683,7 +683,7 @@ _on_mouse_move(void *data, if (sd->timer && ((cur_y - sd->down_y) > finger_size)) { elm_interface_scrollable_movement_block_set - (obj, ELM_SCROLLER_MOVEMENT_NO_BLOCK); + (obj, EFL_UI_SCROLL_BLOCK_NONE); sd->freeze = EINA_FALSE; elm_layout_signal_emit(sd->scr_ly, "elm,state,content,visible", "elm"); } @@ -692,7 +692,7 @@ _on_mouse_move(void *data, if (sd->timer && ((sd->down_y - cur_y) > finger_size)) { elm_interface_scrollable_movement_block_set - (obj, ELM_SCROLLER_MOVEMENT_NO_BLOCK); + (obj, EFL_UI_SCROLL_BLOCK_NONE); sd->freeze = EINA_FALSE; elm_layout_signal_emit(sd->scr_ly, "elm,state,content,visible", "elm"); } @@ -702,7 +702,7 @@ _on_mouse_move(void *data, ((is_mirrored) && (sd->timer) && ((sd->down_x - cur_x) > finger_size))) { elm_interface_scrollable_movement_block_set - (obj, ELM_SCROLLER_MOVEMENT_NO_BLOCK); + (obj, EFL_UI_SCROLL_BLOCK_NONE); sd->freeze = EINA_FALSE; elm_layout_signal_emit(sd->scr_ly, "elm,state,content,visible", "elm"); } @@ -712,7 +712,7 @@ _on_mouse_move(void *data, (!is_mirrored && (sd->timer) && ((sd->down_x - cur_x) > finger_size))) { elm_interface_scrollable_movement_block_set - (obj, ELM_SCROLLER_MOVEMENT_NO_BLOCK); + (obj, EFL_UI_SCROLL_BLOCK_NONE); sd->freeze = EINA_FALSE; elm_layout_signal_emit(sd->scr_ly, "elm,state,content,visible", "elm"); } @@ -1050,12 +1050,12 @@ _elm_panel_orient_set(Eo *obj, Elm_Panel_Data *sd, Elm_Panel_Orient orient) case ELM_PANEL_ORIENT_TOP: case ELM_PANEL_ORIENT_BOTTOM: elm_interface_scrollable_movement_block_set - (obj, ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL); + (obj, EFL_UI_SCROLL_BLOCK_VERTICAL); break; case ELM_PANEL_ORIENT_LEFT: case ELM_PANEL_ORIENT_RIGHT: elm_interface_scrollable_movement_block_set - (obj, ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL); + (obj, EFL_UI_SCROLL_BLOCK_HORIZONTAL); break; } @@ -1196,10 +1196,10 @@ _anim_stop_cb(Evas_Object *obj, void *data EINA_UNUSED) { if (horizontal) elm_interface_scrollable_movement_block_set - (obj, ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL); + (obj, EFL_UI_SCROLL_BLOCK_HORIZONTAL); else elm_interface_scrollable_movement_block_set - (obj, ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL); + (obj, EFL_UI_SCROLL_BLOCK_VERTICAL); sd->freeze = EINA_TRUE; elm_layout_signal_emit(sd->scr_ly, "elm,state,content,hidden", "elm"); @@ -1229,7 +1229,7 @@ _scroll_cb(Evas_Object *obj, void *data EINA_UNUSED) if (sd->freeze) { elm_interface_scrollable_movement_block_set - (obj, ELM_SCROLLER_MOVEMENT_NO_BLOCK); + (obj, EFL_UI_SCROLL_BLOCK_NONE); sd->freeze = EINA_FALSE; elm_layout_signal_emit(sd->scr_ly, "elm,state,content,visible", "elm"); } @@ -1415,12 +1415,12 @@ _elm_panel_scrollable_set(Eo *obj, Elm_Panel_Data *sd, Eina_Bool scrollable) case ELM_PANEL_ORIENT_TOP: case ELM_PANEL_ORIENT_BOTTOM: elm_interface_scrollable_movement_block_set - (obj, ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL); + (obj, EFL_UI_SCROLL_BLOCK_VERTICAL); break; case ELM_PANEL_ORIENT_LEFT: case ELM_PANEL_ORIENT_RIGHT: elm_interface_scrollable_movement_block_set - (obj, ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL); + (obj, EFL_UI_SCROLL_BLOCK_HORIZONTAL); break; } diff --git a/src/lib/elementary/elm_scroller.c b/src/lib/elementary/elm_scroller.c index 662b141..8de8038 100644 --- a/src/lib/elementary/elm_scroller.c +++ b/src/lib/elementary/elm_scroller.c @@ -1306,18 +1306,32 @@ elm_scroller_movement_block_set(Evas_Object *obj, Elm_Scroller_Movement_Block block) { ELM_SCROLLABLE_CHECK(obj); + Efl_Ui_Scroll_Block mode = EFL_UI_SCROLL_BLOCK_NONE; - elm_interface_scrollable_movement_block_set(obj, block); + // legacy -> eo + if (block & ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL) + mode |= EFL_UI_SCROLL_BLOCK_HORIZONTAL; + if (block & ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL) + mode |= EFL_UI_SCROLL_BLOCK_VERTICAL; + + elm_interface_scrollable_movement_block_set(obj, mode); } EAPI Elm_Scroller_Movement_Block elm_scroller_movement_block_get(const Evas_Object *obj) { Elm_Scroller_Movement_Block block = ELM_SCROLLER_MOVEMENT_NO_BLOCK; + Efl_Ui_Scroll_Block mode; ELM_SCROLLABLE_CHECK(obj, ELM_SCROLLER_MOVEMENT_NO_BLOCK); - block = elm_interface_scrollable_movement_block_get((Eo *) obj); + mode = elm_interface_scrollable_movement_block_get(obj); + + // eo -> legacy + if (mode & EFL_UI_SCROLL_BLOCK_HORIZONTAL) + block |= ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL; + if (mode & EFL_UI_SCROLL_BLOCK_VERTICAL) + block |= ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL; return block; } diff --git a/src/lib/elementary/elm_scroller_legacy.h b/src/lib/elementary/elm_scroller_legacy.h index 3b8dffa..f39a2ba 100644 --- a/src/lib/elementary/elm_scroller_legacy.h +++ b/src/lib/elementary/elm_scroller_legacy.h @@ -1,5 +1,20 @@ #include "elm_interface_scrollable.eo.legacy.h" #include "elm_scroller.eo.legacy.h" + +/** + * Type that blocks the scroll movement in one or more direction. + * + * @since 1.8 + * + * @ingroup Elm_Scroller + */ +typedef enum +{ + ELM_SCROLLER_MOVEMENT_NO_BLOCK = 1, /**< Do not block movements */ + ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL = 2, /**< Block vertical movements */ + ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL = 4 /**< Block horizontal movements */ +} Elm_Scroller_Movement_Block; + /** * @brief Add a new scroller to the parent * -- 2.7.4