summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorJaehyun Cho <jae_hyun.cho@samsung.com>2019-07-30 07:05:02 +0000
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-07-31 08:42:08 +0200
commit959c68ca2e607c19c2b3e9c43decf8db0a41f4fb (patch)
tree026725d49af9cd83b3ace53d8c712b6a2bb6d019 /src/lib
parente092878d11ab7cfca104cf64b900c6af26e3a576 (diff)
efl_ui_spotlight: add scroll_block to Manager_Scroll
To support blocking of scrolling movement, @property scroll_block has been added to Manager_Scroll. If scroll_block is set to be true, then scrolling movement by mouse input is blocked. Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D9444
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/elementary/efl_ui_spotlight_manager_scroll.c25
-rw-r--r--src/lib/elementary/efl_ui_spotlight_manager_scroll.eo17
2 files changed, 42 insertions, 0 deletions
diff --git a/src/lib/elementary/efl_ui_spotlight_manager_scroll.c b/src/lib/elementary/efl_ui_spotlight_manager_scroll.c
index 778079d864..bd0000faa8 100644
--- a/src/lib/elementary/efl_ui_spotlight_manager_scroll.c
+++ b/src/lib/elementary/efl_ui_spotlight_manager_scroll.c
@@ -22,6 +22,7 @@ typedef struct {
22 Eina_Position2D mouse_start; 22 Eina_Position2D mouse_start;
23 } mouse_move; 23 } mouse_move;
24 Eina_Bool animation; 24 Eina_Bool animation;
25 Eina_Bool scroll_block;
25} Efl_Ui_Spotlight_Manager_Scroll_Data; 26} Efl_Ui_Spotlight_Manager_Scroll_Data;
26 27
27#define MY_CLASS EFL_UI_SPOTLIGHT_MANAGER_SCROLL_CLASS 28#define MY_CLASS EFL_UI_SPOTLIGHT_MANAGER_SCROLL_CLASS
@@ -100,6 +101,8 @@ _mouse_down_cb(void *data,
100 101
101 if (efl_content_count(pd->container) == 0) return; 102 if (efl_content_count(pd->container) == 0) return;
102 103
104 if (pd->scroll_block) return;
105
103 efl_event_callback_del(pd->container, EFL_CANVAS_OBJECT_EVENT_ANIMATOR_TICK, _page_set_animation, obj); 106 efl_event_callback_del(pd->container, EFL_CANVAS_OBJECT_EVENT_ANIMATOR_TICK, _page_set_animation, obj);
104 107
105 pd->mouse_move.active = EINA_TRUE; 108 pd->mouse_move.active = EINA_TRUE;
@@ -123,6 +126,7 @@ _mouse_move_cb(void *data,
123 126
124 if (efl_input_event_flags_get(ev) & EFL_INPUT_FLAGS_PROCESSED) return; 127 if (efl_input_event_flags_get(ev) & EFL_INPUT_FLAGS_PROCESSED) return;
125 if (!pd->mouse_move.active) return; 128 if (!pd->mouse_move.active) return;
129 if (pd->scroll_block) return;
126 130
127 pos = efl_input_pointer_position_get(ev); 131 pos = efl_input_pointer_position_get(ev);
128 pos_y_diff = pd->mouse_move.mouse_start.x - pos.x; 132 pos_y_diff = pd->mouse_move.mouse_start.x - pos.x;
@@ -149,6 +153,7 @@ _mouse_up_cb(void *data,
149 153
150 if (efl_input_event_flags_get(ev) & EFL_INPUT_FLAGS_PROCESSED) return; 154 if (efl_input_event_flags_get(ev) & EFL_INPUT_FLAGS_PROCESSED) return;
151 if (!pd->mouse_move.active) return; 155 if (!pd->mouse_move.active) return;
156 if (pd->scroll_block) return;
152 157
153 double absolut_current_position = (double)pd->transition.from + pd->transition.progress; 158 double absolut_current_position = (double)pd->transition.from + pd->transition.progress;
154 int result = round(absolut_current_position); 159 int result = round(absolut_current_position);
@@ -332,5 +337,25 @@ _efl_ui_spotlight_manager_scroll_efl_object_invalidate(Eo *obj, Efl_Ui_Spotlight
332 efl_invalidate(efl_super(obj, MY_CLASS)); 337 efl_invalidate(efl_super(obj, MY_CLASS));
333} 338}
334 339
340EOLIAN static void
341_efl_ui_spotlight_manager_scroll_scroll_block_set(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Scroll_Data *pd, Eina_Bool scroll_block)
342{
343 if (pd->scroll_block == scroll_block) return;
344
345 pd->scroll_block = scroll_block;
346 if (scroll_block && pd->mouse_move.active)
347 {
348 pd->mouse_move.active = EINA_FALSE;
349 pd->transition.active = EINA_FALSE;
350 pd->transition.progress = 0.0;
351 _apply_box_properties(obj, pd);
352 }
353}
354
355EOLIAN static Eina_Bool
356_efl_ui_spotlight_manager_scroll_scroll_block_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Scroll_Data *pd)
357{
358 return pd->scroll_block;
359}
335 360
336#include "efl_ui_spotlight_manager_scroll.eo.c" 361#include "efl_ui_spotlight_manager_scroll.eo.c"
diff --git a/src/lib/elementary/efl_ui_spotlight_manager_scroll.eo b/src/lib/elementary/efl_ui_spotlight_manager_scroll.eo
index 942ad192ca..2ac04924c6 100644
--- a/src/lib/elementary/efl_ui_spotlight_manager_scroll.eo
+++ b/src/lib/elementary/efl_ui_spotlight_manager_scroll.eo
@@ -1,5 +1,22 @@
1class @beta Efl.Ui.Spotlight.Manager_Scroll extends Efl.Ui.Spotlight.Manager 1class @beta Efl.Ui.Spotlight.Manager_Scroll extends Efl.Ui.Spotlight.Manager
2{ 2{
3 methods {
4 @property scroll_block {
5 [[Blocking of scrolling
6
7 This function will block scrolling movement (by input of a user).
8 You can disable scrolling movement. The default value is $false,
9 where the scrolling movement is allowed.
10 ]]
11 set {
12 }
13 get {
14 }
15 values {
16 scroll_block: bool; [[$true if block scrolling movement, $false otherwise]]
17 }
18 }
19 }
3 implements { 20 implements {
4 Efl.Ui.Spotlight.Manager.bind; 21 Efl.Ui.Spotlight.Manager.bind;
5 Efl.Ui.Spotlight.Manager.content_add; 22 Efl.Ui.Spotlight.Manager.content_add;