summaryrefslogtreecommitdiff
path: root/src/lib/elementary/efl_ui_panel.c
diff options
context:
space:
mode:
authorYeongjong Lee <yj34.lee@samsung.com>2019-08-20 04:43:15 +0000
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-08-21 11:59:14 +0200
commit1c1382e09bb4e58bfdfd752bdb58694a8c8c1042 (patch)
treea90f19a50c6faac43bef2b682de8539a0e98ae2a /src/lib/elementary/efl_ui_panel.c
parente7986cc6468b4f99b4c8abdb4a900992d9e525ad (diff)
efl_ui_panel: remove dependency with elm_interface_scrollable
`elm_interface_scrollable` is replaced with `efl_ui_scrollable_interative`. Legacy code related to `SCROLL` event is removed because eo `SCROLL` event have `void` event info. ``` in lib/efl/inferfaces/efl_ui_scrollable.eo scroll: void; [[Called when scrolling]] ``` I think we need to add new `PANEL_SCROLL` event that have `Efl_Ui_Panel_Scroll_Info` Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D9637
Diffstat (limited to 'src/lib/elementary/efl_ui_panel.c')
-rw-r--r--src/lib/elementary/efl_ui_panel.c210
1 files changed, 78 insertions, 132 deletions
diff --git a/src/lib/elementary/efl_ui_panel.c b/src/lib/elementary/efl_ui_panel.c
index f714580..489569b 100644
--- a/src/lib/elementary/efl_ui_panel.c
+++ b/src/lib/elementary/efl_ui_panel.c
@@ -6,6 +6,7 @@
6#define EFL_ACCESS_WIDGET_ACTION_PROTECTED 6#define EFL_ACCESS_WIDGET_ACTION_PROTECTED
7#define EFL_UI_FOCUS_LAYER_PROTECTED 7#define EFL_UI_FOCUS_LAYER_PROTECTED
8#define EFL_PART_PROTECTED 8#define EFL_PART_PROTECTED
9#define EFL_UI_SCROLL_MANAGER_PROTECTED
9 10
10#include <Elementary.h> 11#include <Elementary.h>
11 12
@@ -254,20 +255,20 @@ _handler_open(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
254 switch (sd->orient) 255 switch (sd->orient)
255 { 256 {
256 case EFL_UI_PANEL_ORIENT_TOP: 257 case EFL_UI_PANEL_ORIENT_TOP:
257 elm_interface_scrollable_region_bring_in 258 efl_ui_scrollable_scroll
258 (obj, 0, (h * sd->content_size_ratio) - sd->handler_size, w, h); 259 (obj, EINA_RECT(0, (h * sd->content_size_ratio) - sd->handler_size, w, h), EINA_TRUE);
259 break; 260 break;
260 case EFL_UI_PANEL_ORIENT_BOTTOM: 261 case EFL_UI_PANEL_ORIENT_BOTTOM:
261 elm_interface_scrollable_region_bring_in 262 efl_ui_scrollable_scroll
262 (obj, 0, sd->handler_size, w, h); 263 (obj, EINA_RECT(0, sd->handler_size, w, h), EINA_TRUE);
263 break; 264 break;
264 case EFL_UI_PANEL_ORIENT_LEFT: 265 case EFL_UI_PANEL_ORIENT_LEFT:
265 elm_interface_scrollable_region_bring_in 266 efl_ui_scrollable_scroll
266 (obj, (w * sd->content_size_ratio) - sd->handler_size, 0, w, h); 267 (obj, EINA_RECT((w * sd->content_size_ratio) - sd->handler_size, 0, w, h), EINA_TRUE);
267 break; 268 break;
268 case EFL_UI_PANEL_ORIENT_RIGHT: 269 case EFL_UI_PANEL_ORIENT_RIGHT:
269 elm_interface_scrollable_region_bring_in 270 efl_ui_scrollable_scroll
270 (obj, sd->handler_size, 0, w, h); 271 (obj, EINA_RECT(sd->handler_size, 0, w, h), EINA_TRUE);
271 break; 272 break;
272 } 273 }
273} 274}
@@ -280,8 +281,7 @@ _drawer_open(Evas_Object *obj, Evas_Coord w, Evas_Coord h, Eina_Bool anim)
280 281
281 if (sd->freeze) 282 if (sd->freeze)
282 { 283 {
283 elm_interface_scrollable_movement_block_set 284 efl_ui_scrollable_movement_block_set(obj, EFL_UI_SCROLL_BLOCK_NONE);
284 (obj, EFL_UI_SCROLL_BLOCK_NONE);
285 sd->freeze = EINA_FALSE; 285 sd->freeze = EINA_FALSE;
286 elm_layout_signal_emit(sd->scr_ly, "efl,state,content,visible", "efl"); 286 elm_layout_signal_emit(sd->scr_ly, "efl,state,content,visible", "efl");
287 } 287 }
@@ -304,21 +304,16 @@ _drawer_open(Evas_Object *obj, Evas_Coord w, Evas_Coord h, Eina_Bool anim)
304 x = w * sd->content_size_ratio; 304 x = w * sd->content_size_ratio;
305 break; 305 break;
306 } 306 }
307 307 efl_ui_scrollable_scroll(obj, EINA_RECT(x, y, w, h), anim);
308 if (anim)
309 elm_interface_scrollable_region_bring_in
310 (obj, x, y, w, h);
311 else
312 elm_interface_scrollable_content_region_show
313 (obj, x, y, w, h);
314} 308}
315 309
316static void 310static void
317_drawer_close(Evas_Object *obj, Evas_Coord w, Evas_Coord h, Eina_Bool anim) 311_drawer_close(Evas_Object *obj, Evas_Coord w, Evas_Coord h, Eina_Bool anim)
318{ 312{
319 EFL_UI_PANEL_DATA_GET(obj, sd); 313 EFL_UI_PANEL_DATA_GET(obj, sd);
320 int x = 0, y = 0, cx, cy; 314 int x = 0, y = 0;
321 Eina_Bool horizontal = EINA_FALSE; 315 Eina_Bool horizontal = EINA_FALSE;
316 Eina_Position2D c;
322 317
323 elm_widget_tree_unfocusable_set(obj, EINA_TRUE); 318 elm_widget_tree_unfocusable_set(obj, EINA_TRUE);
324 switch (sd->orient) 319 switch (sd->orient)
@@ -343,17 +338,17 @@ _drawer_close(Evas_Object *obj, Evas_Coord w, Evas_Coord h, Eina_Bool anim)
343 break; 338 break;
344 } 339 }
345 340
346 elm_interface_scrollable_content_pos_get(obj, &cx, &cy); 341 c = efl_ui_scrollable_content_pos_get(obj);
347 342
348 if ((x == cx) && (y == cy)) 343 if ((x == c.x) && (y == c.y))
349 { 344 {
350 if (!sd->freeze) 345 if (!sd->freeze)
351 { 346 {
352 if (horizontal) 347 if (horizontal)
353 elm_interface_scrollable_movement_block_set 348 efl_ui_scrollable_movement_block_set
354 (obj, EFL_UI_SCROLL_BLOCK_HORIZONTAL); 349 (obj, EFL_UI_SCROLL_BLOCK_HORIZONTAL);
355 else 350 else
356 elm_interface_scrollable_movement_block_set 351 efl_ui_scrollable_movement_block_set
357 (obj, EFL_UI_SCROLL_BLOCK_VERTICAL); 352 (obj, EFL_UI_SCROLL_BLOCK_VERTICAL);
358 sd->freeze = EINA_TRUE; 353 sd->freeze = EINA_TRUE;
359 elm_layout_signal_emit(sd->scr_ly, "efl,state,content,hidden", "efl"); 354 elm_layout_signal_emit(sd->scr_ly, "efl,state,content,hidden", "efl");
@@ -366,23 +361,23 @@ _drawer_close(Evas_Object *obj, Evas_Coord w, Evas_Coord h, Eina_Bool anim)
366 { 361 {
367 if (sd->freeze) 362 if (sd->freeze)
368 { 363 {
369 elm_interface_scrollable_movement_block_set 364 efl_ui_scrollable_movement_block_set
370 (obj, EFL_UI_SCROLL_BLOCK_NONE); 365 (obj, EFL_UI_SCROLL_BLOCK_NONE);
371 sd->freeze = EINA_FALSE; 366 sd->freeze = EINA_FALSE;
372 elm_layout_signal_emit(sd->scr_ly, "efl,state,content,visible", "efl"); 367 elm_layout_signal_emit(sd->scr_ly, "efl,state,content,visible", "efl");
373 } 368 }
374 elm_interface_scrollable_region_bring_in(obj, x, y, w, h); 369 efl_ui_scrollable_scroll(obj, EINA_RECT(x, y, w, h), anim);
375 } 370 }
376 else 371 else
377 { 372 {
378 elm_interface_scrollable_content_region_show(obj, x, y, w, h); 373 efl_ui_scrollable_scroll(obj, EINA_RECT(x, y, w, h), anim);
379 if (!sd->freeze) 374 if (!sd->freeze)
380 { 375 {
381 if (horizontal) 376 if (horizontal)
382 elm_interface_scrollable_movement_block_set 377 efl_ui_scrollable_movement_block_set
383 (obj, EFL_UI_SCROLL_BLOCK_HORIZONTAL); 378 (obj, EFL_UI_SCROLL_BLOCK_HORIZONTAL);
384 else 379 else
385 elm_interface_scrollable_movement_block_set 380 efl_ui_scrollable_movement_block_set
386 (obj, EFL_UI_SCROLL_BLOCK_VERTICAL); 381 (obj, EFL_UI_SCROLL_BLOCK_VERTICAL);
387 sd->freeze = EINA_TRUE; 382 sd->freeze = EINA_TRUE;
388 elm_layout_signal_emit(sd->scr_ly, "efl,state,content,hidden", "efl"); 383 elm_layout_signal_emit(sd->scr_ly, "efl,state,content,hidden", "efl");
@@ -446,6 +441,7 @@ _state_sync(Evas_Object *obj)
446 EFL_UI_PANEL_DATA_GET(obj, sd); 441 EFL_UI_PANEL_DATA_GET(obj, sd);
447 Evas_Coord pos, panel_size, w, h, threshold; 442 Evas_Coord pos, panel_size, w, h, threshold;
448 Eina_Bool horizontal = EINA_FALSE, reverse = EINA_FALSE; 443 Eina_Bool horizontal = EINA_FALSE, reverse = EINA_FALSE;
444 Eina_Position2D c;
449 445
450 evas_object_geometry_get(obj, NULL, NULL, &w, &h); 446 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
451 447
@@ -466,12 +462,13 @@ _state_sync(Evas_Object *obj)
466 break; 462 break;
467 } 463 }
468 464
465 c = efl_ui_scrollable_content_pos_get(obj);
469 if (horizontal) 466 if (horizontal)
470 { 467 {
471 if (w <= 0) return EINA_TRUE; 468 if (w <= 0) return EINA_TRUE;
472 469
473 panel_size = w * sd->content_size_ratio; 470 panel_size = w * sd->content_size_ratio;
474 elm_interface_scrollable_content_pos_get(obj, &pos, NULL); 471 pos = c.x;
475 reverse ^= efl_ui_mirrored_get(obj); 472 reverse ^= efl_ui_mirrored_get(obj);
476 } 473 }
477 else 474 else
@@ -479,7 +476,7 @@ _state_sync(Evas_Object *obj)
479 if (h <= 0) return EINA_TRUE; 476 if (h <= 0) return EINA_TRUE;
480 477
481 panel_size = h * sd->content_size_ratio; 478 panel_size = h * sd->content_size_ratio;
482 elm_interface_scrollable_content_pos_get(obj, NULL, &pos); 479 pos = c.y;
483 } 480 }
484 threshold = (sd->hidden) ? panel_size - (panel_size / 4) : (panel_size / 4); 481 threshold = (sd->hidden) ? panel_size - (panel_size / 4) : (panel_size / 4);
485 482
@@ -508,7 +505,7 @@ _timer_cb(void *data)
508 505
509 if (sd->freeze) 506 if (sd->freeze)
510 { 507 {
511 elm_interface_scrollable_movement_block_set 508 efl_ui_scrollable_movement_block_set
512 (obj, EFL_UI_SCROLL_BLOCK_NONE); 509 (obj, EFL_UI_SCROLL_BLOCK_NONE);
513 sd->freeze = EINA_FALSE; 510 sd->freeze = EINA_FALSE;
514 elm_layout_signal_emit(sd->scr_ly, "efl,state,content,visible", "efl"); 511 elm_layout_signal_emit(sd->scr_ly, "efl,state,content,visible", "efl");
@@ -616,7 +613,7 @@ _on_mouse_move(void *data,
616 case EFL_UI_PANEL_ORIENT_TOP: 613 case EFL_UI_PANEL_ORIENT_TOP:
617 if (sd->timer && ((cur_y - sd->down_y) > finger_size)) 614 if (sd->timer && ((cur_y - sd->down_y) > finger_size))
618 { 615 {
619 elm_interface_scrollable_movement_block_set 616 efl_ui_scrollable_movement_block_set
620 (obj, EFL_UI_SCROLL_BLOCK_NONE); 617 (obj, EFL_UI_SCROLL_BLOCK_NONE);
621 sd->freeze = EINA_FALSE; 618 sd->freeze = EINA_FALSE;
622 elm_layout_signal_emit(sd->scr_ly, "efl,state,content,visible", "efl"); 619 elm_layout_signal_emit(sd->scr_ly, "efl,state,content,visible", "efl");
@@ -625,7 +622,7 @@ _on_mouse_move(void *data,
625 case EFL_UI_PANEL_ORIENT_BOTTOM: 622 case EFL_UI_PANEL_ORIENT_BOTTOM:
626 if (sd->timer && ((sd->down_y - cur_y) > finger_size)) 623 if (sd->timer && ((sd->down_y - cur_y) > finger_size))
627 { 624 {
628 elm_interface_scrollable_movement_block_set 625 efl_ui_scrollable_movement_block_set
629 (obj, EFL_UI_SCROLL_BLOCK_NONE); 626 (obj, EFL_UI_SCROLL_BLOCK_NONE);
630 sd->freeze = EINA_FALSE; 627 sd->freeze = EINA_FALSE;
631 elm_layout_signal_emit(sd->scr_ly, "efl,state,content,visible", "efl"); 628 elm_layout_signal_emit(sd->scr_ly, "efl,state,content,visible", "efl");
@@ -635,7 +632,7 @@ _on_mouse_move(void *data,
635 if ((!is_mirrored && (sd->timer) && ((cur_x - sd->down_x) > finger_size)) || 632 if ((!is_mirrored && (sd->timer) && ((cur_x - sd->down_x) > finger_size)) ||
636 ((is_mirrored) && (sd->timer) && ((sd->down_x - cur_x) > finger_size))) 633 ((is_mirrored) && (sd->timer) && ((sd->down_x - cur_x) > finger_size)))
637 { 634 {
638 elm_interface_scrollable_movement_block_set 635 efl_ui_scrollable_movement_block_set
639 (obj, EFL_UI_SCROLL_BLOCK_NONE); 636 (obj, EFL_UI_SCROLL_BLOCK_NONE);
640 sd->freeze = EINA_FALSE; 637 sd->freeze = EINA_FALSE;
641 elm_layout_signal_emit(sd->scr_ly, "efl,state,content,visible", "efl"); 638 elm_layout_signal_emit(sd->scr_ly, "efl,state,content,visible", "efl");
@@ -645,7 +642,7 @@ _on_mouse_move(void *data,
645 if ((is_mirrored && (sd->timer) && ((cur_x - sd->down_x) > finger_size)) || 642 if ((is_mirrored && (sd->timer) && ((cur_x - sd->down_x) > finger_size)) ||
646 (!is_mirrored && (sd->timer) && ((sd->down_x - cur_x) > finger_size))) 643 (!is_mirrored && (sd->timer) && ((sd->down_x - cur_x) > finger_size)))
647 { 644 {
648 elm_interface_scrollable_movement_block_set 645 efl_ui_scrollable_movement_block_set
649 (obj, EFL_UI_SCROLL_BLOCK_NONE); 646 (obj, EFL_UI_SCROLL_BLOCK_NONE);
650 sd->freeze = EINA_FALSE; 647 sd->freeze = EINA_FALSE;
651 elm_layout_signal_emit(sd->scr_ly, "efl,state,content,visible", "efl"); 648 elm_layout_signal_emit(sd->scr_ly, "efl,state,content,visible", "efl");
@@ -750,16 +747,6 @@ _efl_ui_panel_efl_content_content_unset(Eo *obj EINA_UNUSED, Efl_Ui_Panel_Data *
750 return ret; 747 return ret;
751} 748}
752 749
753EOLIAN static void
754_efl_ui_panel_efl_gfx_entity_position_set(Eo *obj, Efl_Ui_Panel_Data *sd, Eina_Position2D pos)
755{
756 if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y))
757 return;
758
759 efl_gfx_entity_position_set(efl_super(obj, MY_CLASS), pos);
760 efl_gfx_entity_position_set(sd->hit_rect, pos);
761}
762
763static void 750static void
764_scrollable_layout_resize(Eo *obj, Efl_Ui_Panel_Data *sd, Evas_Coord w, Evas_Coord h) 751_scrollable_layout_resize(Eo *obj, Efl_Ui_Panel_Data *sd, Evas_Coord w, Evas_Coord h)
765{ 752{
@@ -793,7 +780,6 @@ _efl_ui_panel_efl_gfx_entity_size_set(Eo *obj, Efl_Ui_Panel_Data *sd, Eina_Size2
793 780
794 if (!sd->scrollable) return; 781 if (!sd->scrollable) return;
795 782
796 efl_gfx_entity_size_set(sd->hit_rect, sz);
797 _scrollable_layout_resize(obj, sd, sz.w, sz.h); 783 _scrollable_layout_resize(obj, sd, sz.w, sz.h);
798} 784}
799 785
@@ -802,7 +788,7 @@ _efl_ui_panel_efl_canvas_group_group_member_add(Eo *obj, Efl_Ui_Panel_Data *sd,
802{ 788{
803 efl_canvas_group_member_add(efl_super(obj, MY_CLASS), member); 789 efl_canvas_group_member_add(efl_super(obj, MY_CLASS), member);
804 790
805 if (sd->hit_rect) evas_object_raise(sd->hit_rect); 791 if (sd->scr_event) evas_object_raise(sd->scr_event);
806} 792}
807 793
808EOLIAN static void 794EOLIAN static void
@@ -923,12 +909,12 @@ _efl_ui_panel_orient_set(Eo *obj, Efl_Ui_Panel_Data *sd, Efl_Ui_Panel_Orient ori
923 { 909 {
924 case EFL_UI_PANEL_ORIENT_TOP: 910 case EFL_UI_PANEL_ORIENT_TOP:
925 case EFL_UI_PANEL_ORIENT_BOTTOM: 911 case EFL_UI_PANEL_ORIENT_BOTTOM:
926 elm_interface_scrollable_movement_block_set 912 efl_ui_scrollable_movement_block_set
927 (obj, EFL_UI_SCROLL_BLOCK_VERTICAL); 913 (obj, EFL_UI_SCROLL_BLOCK_VERTICAL);
928 break; 914 break;
929 case EFL_UI_PANEL_ORIENT_LEFT: 915 case EFL_UI_PANEL_ORIENT_LEFT:
930 case EFL_UI_PANEL_ORIENT_RIGHT: 916 case EFL_UI_PANEL_ORIENT_RIGHT:
931 elm_interface_scrollable_movement_block_set 917 efl_ui_scrollable_movement_block_set
932 (obj, EFL_UI_SCROLL_BLOCK_HORIZONTAL); 918 (obj, EFL_UI_SCROLL_BLOCK_HORIZONTAL);
933 break; 919 break;
934 } 920 }
@@ -984,8 +970,9 @@ EOLIAN static Eina_Rect
984_efl_ui_panel_efl_ui_widget_interest_region_get(const Eo *obj, Efl_Ui_Panel_Data *sd) 970_efl_ui_panel_efl_ui_widget_interest_region_get(const Eo *obj, Efl_Ui_Panel_Data *sd)
985{ 971{
986 Eina_Rect r = {}; 972 Eina_Rect r = {};
973 Eina_Position2D p;
987 974
988 elm_interface_scrollable_content_pos_get(obj, &r.x, &r.y); 975 p = efl_ui_scrollable_content_pos_get(obj);
989 evas_object_geometry_get(obj, NULL, NULL, &r.w, &r.h); 976 evas_object_geometry_get(obj, NULL, NULL, &r.w, &r.h);
990 switch (sd->orient) 977 switch (sd->orient)
991 { 978 {
@@ -1000,17 +987,21 @@ _efl_ui_panel_efl_ui_widget_interest_region_get(const Eo *obj, Efl_Ui_Panel_Data
1000 } 987 }
1001 if (r.w < 1) r.w = 1; 988 if (r.w < 1) r.w = 1;
1002 if (r.h < 1) r.h = 1; 989 if (r.h < 1) r.h = 1;
990 r.x = p.x;
991 r.y = p.y;
1003 992
1004 return r; 993 return r;
1005} 994}
1006 995
1007static void 996static void
1008_anim_stop_cb(Evas_Object *obj, void *data EINA_UNUSED) 997_anim_stop_cb(void *data EINA_UNUSED, const Efl_Event *event)
1009{ 998{
999 Eo *obj = event->object;
1010 EFL_UI_PANEL_DATA_GET(obj, sd); 1000 EFL_UI_PANEL_DATA_GET(obj, sd);
1011 Evas_Object *ao; 1001 Evas_Object *ao;
1012 Evas_Coord pos, w, h, panel_size = 0; 1002 Evas_Coord pos, w, h, panel_size = 0;
1013 Eina_Bool open = EINA_FALSE, horizontal = EINA_FALSE, reverse = EINA_FALSE; 1003 Eina_Bool open = EINA_FALSE, horizontal = EINA_FALSE, reverse = EINA_FALSE;
1004 Eina_Position2D c;
1014 1005
1015 if (elm_widget_disabled_get(obj)) return; 1006 if (elm_widget_disabled_get(obj)) return;
1016 1007
@@ -1029,13 +1020,14 @@ _anim_stop_cb(Evas_Object *obj, void *data EINA_UNUSED)
1029 break; 1020 break;
1030 } 1021 }
1031 1022
1023 c = efl_ui_scrollable_content_pos_get(obj);
1032 evas_object_geometry_get(obj, NULL, NULL, &w, &h); 1024 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
1033 if (horizontal) 1025 if (horizontal)
1034 { 1026 {
1035 if (w <= 0) return; 1027 if (w <= 0) return;
1036 1028
1037 panel_size = w * sd->content_size_ratio; 1029 panel_size = w * sd->content_size_ratio;
1038 elm_interface_scrollable_content_pos_get(obj, &pos, NULL); 1030 pos = c.x;
1039 reverse ^= efl_ui_mirrored_get(obj); 1031 reverse ^= efl_ui_mirrored_get(obj);
1040 } 1032 }
1041 else 1033 else
@@ -1043,7 +1035,7 @@ _anim_stop_cb(Evas_Object *obj, void *data EINA_UNUSED)
1043 if (h <= 0) return; 1035 if (h <= 0) return;
1044 1036
1045 panel_size = h * sd->content_size_ratio; 1037 panel_size = h * sd->content_size_ratio;
1046 elm_interface_scrollable_content_pos_get(obj, NULL, &pos); 1038 pos = c.y;
1047 } 1039 }
1048 1040
1049 if (pos == 0) open = !reverse; 1041 if (pos == 0) open = !reverse;
@@ -1052,9 +1044,6 @@ _anim_stop_cb(Evas_Object *obj, void *data EINA_UNUSED)
1052 1044
1053 if (open) 1045 if (open)
1054 { 1046 {
1055 elm_interface_scrollable_single_direction_set
1056 (obj, ELM_SCROLLER_SINGLE_DIRECTION_HARD);
1057
1058 //focus & access 1047 //focus & access
1059 elm_object_tree_focus_allow_set(obj, EINA_TRUE); 1048 elm_object_tree_focus_allow_set(obj, EINA_TRUE);
1060 if (_elm_config->access_mode == ELM_ACCESS_MODE_ON) 1049 if (_elm_config->access_mode == ELM_ACCESS_MODE_ON)
@@ -1069,17 +1058,14 @@ _anim_stop_cb(Evas_Object *obj, void *data EINA_UNUSED)
1069 else 1058 else
1070 { 1059 {
1071 if (horizontal) 1060 if (horizontal)
1072 elm_interface_scrollable_movement_block_set 1061 efl_ui_scrollable_movement_block_set
1073 (obj, EFL_UI_SCROLL_BLOCK_HORIZONTAL); 1062 (obj, EFL_UI_SCROLL_BLOCK_HORIZONTAL);
1074 else 1063 else
1075 elm_interface_scrollable_movement_block_set 1064 efl_ui_scrollable_movement_block_set
1076 (obj, EFL_UI_SCROLL_BLOCK_VERTICAL); 1065 (obj, EFL_UI_SCROLL_BLOCK_VERTICAL);
1077 sd->freeze = EINA_TRUE; 1066 sd->freeze = EINA_TRUE;
1078 elm_layout_signal_emit(sd->scr_ly, "efl,state,content,hidden", "efl"); 1067 elm_layout_signal_emit(sd->scr_ly, "efl,state,content,hidden", "efl");
1079 1068
1080 elm_interface_scrollable_single_direction_set
1081 (obj, ELM_SCROLLER_SINGLE_DIRECTION_NONE);
1082
1083 //focus & access 1069 //focus & access
1084 elm_object_tree_focus_allow_set(obj, EINA_FALSE); 1070 elm_object_tree_focus_allow_set(obj, EINA_FALSE);
1085 if (_elm_config->access_mode == ELM_ACCESS_MODE_ON) 1071 if (_elm_config->access_mode == ELM_ACCESS_MODE_ON)
@@ -1091,63 +1077,21 @@ _anim_stop_cb(Evas_Object *obj, void *data EINA_UNUSED)
1091} 1077}
1092 1078
1093static void 1079static void
1094_scroll_cb(Evas_Object *obj, void *data EINA_UNUSED) 1080_scroll_cb(void *data EINA_UNUSED, const Efl_Event *event_info EINA_UNUSED)
1095{ 1081{
1082 Eo *obj = event_info->object;
1096 EFL_UI_PANEL_DATA_GET(obj, sd); 1083 EFL_UI_PANEL_DATA_GET(obj, sd);
1097 Efl_Ui_Panel_Scroll_Info event;
1098 Evas_Coord x, y, w, h;
1099 1084
1100 if (elm_widget_disabled_get(obj)) return; 1085 if (elm_widget_disabled_get(obj)) return;
1101 // in the case of 1086 // in the case of
1102 // freeze_set(FALSE) -> mouse_up -> freeze_set(TRUE) -> scroll 1087 // freeze_set(FALSE) -> mouse_up -> freeze_set(TRUE) -> scroll
1103 if (sd->freeze) 1088 if (sd->freeze)
1104 { 1089 {
1105 elm_interface_scrollable_movement_block_set 1090 efl_ui_scrollable_movement_block_set
1106 (obj, EFL_UI_SCROLL_BLOCK_NONE); 1091 (obj, EFL_UI_SCROLL_BLOCK_NONE);
1107 sd->freeze = EINA_FALSE; 1092 sd->freeze = EINA_FALSE;
1108 elm_layout_signal_emit(sd->scr_ly, "efl,state,content,visible", "efl"); 1093 elm_layout_signal_emit(sd->scr_ly, "efl,state,content,visible", "efl");
1109 } 1094 }
1110
1111 elm_interface_scrollable_content_pos_get(obj, &x, &y);
1112 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
1113
1114 switch (sd->orient)
1115 {
1116 case EFL_UI_PANEL_ORIENT_TOP:
1117 event.rel_x = 1;
1118 event.rel_y = 1 - ((double) y / (double) ((sd->content_size_ratio) * h));
1119 break;
1120 case EFL_UI_PANEL_ORIENT_BOTTOM:
1121 event.rel_x = 1;
1122 event.rel_y = (double) y / (double) ((sd->content_size_ratio) * h);
1123 break;
1124 case EFL_UI_PANEL_ORIENT_LEFT:
1125 if (!efl_ui_mirrored_get(obj))
1126 {
1127 event.rel_x = 1 - ((double) x / (double) ((sd->content_size_ratio) * w));
1128 event.rel_y = 1;
1129 }
1130 else
1131 {
1132 event.rel_x = (double) x / (double) ((sd->content_size_ratio) * w);
1133 event.rel_y = 1;
1134 }
1135 break;
1136 case EFL_UI_PANEL_ORIENT_RIGHT:
1137 if (efl_ui_mirrored_get(obj))
1138 {
1139 event.rel_x = 1 - ((double) x / (double) ((sd->content_size_ratio) * w));
1140 event.rel_y = 1;
1141 }
1142 else
1143 {
1144 event.rel_x = (double) x / (double) ((sd->content_size_ratio) * w);
1145 event.rel_y = 1;
1146 }
1147 break;
1148 }
1149 efl_event_callback_legacy_call
1150 (obj, EFL_UI_EVENT_SCROLL, (void *) &event);
1151} 1095}
1152 1096
1153EOLIAN static void 1097EOLIAN static void
@@ -1163,13 +1107,13 @@ _efl_ui_panel_efl_ui_widget_disabled_set(Eo *obj, Efl_Ui_Panel_Data *sd, Eina_Bo
1163 { 1107 {
1164 case ELM_PANEL_ORIENT_BOTTOM: 1108 case ELM_PANEL_ORIENT_BOTTOM:
1165 case ELM_PANEL_ORIENT_TOP: 1109 case ELM_PANEL_ORIENT_TOP:
1166 elm_interface_scrollable_movement_block_set 1110 efl_ui_scrollable_movement_block_set
1167 (obj, EFL_UI_SCROLL_BLOCK_VERTICAL); 1111 (obj, EFL_UI_SCROLL_BLOCK_VERTICAL);
1168 break; 1112 break;
1169 1113
1170 case ELM_PANEL_ORIENT_RIGHT: 1114 case ELM_PANEL_ORIENT_RIGHT:
1171 case ELM_PANEL_ORIENT_LEFT: 1115 case ELM_PANEL_ORIENT_LEFT:
1172 elm_interface_scrollable_movement_block_set 1116 efl_ui_scrollable_movement_block_set
1173 (obj, EFL_UI_SCROLL_BLOCK_HORIZONTAL); 1117 (obj, EFL_UI_SCROLL_BLOCK_HORIZONTAL);
1174 break; 1118 break;
1175 } 1119 }
@@ -1191,13 +1135,13 @@ _efl_ui_panel_efl_ui_widget_disabled_set(Eo *obj, Efl_Ui_Panel_Data *sd, Eina_Bo
1191 { 1135 {
1192 case ELM_PANEL_ORIENT_BOTTOM: 1136 case ELM_PANEL_ORIENT_BOTTOM:
1193 case ELM_PANEL_ORIENT_TOP: 1137 case ELM_PANEL_ORIENT_TOP:
1194 elm_interface_scrollable_movement_block_set 1138 efl_ui_scrollable_movement_block_set
1195 (obj, EFL_UI_SCROLL_BLOCK_HORIZONTAL); 1139 (obj, EFL_UI_SCROLL_BLOCK_HORIZONTAL);
1196 break; 1140 break;
1197 1141
1198 case ELM_PANEL_ORIENT_RIGHT: 1142 case ELM_PANEL_ORIENT_RIGHT:
1199 case ELM_PANEL_ORIENT_LEFT: 1143 case ELM_PANEL_ORIENT_LEFT:
1200 elm_interface_scrollable_movement_block_set 1144 efl_ui_scrollable_movement_block_set
1201 (obj, EFL_UI_SCROLL_BLOCK_VERTICAL); 1145 (obj, EFL_UI_SCROLL_BLOCK_VERTICAL);
1202 break; 1146 break;
1203 } 1147 }
@@ -1278,29 +1222,33 @@ _efl_ui_panel_scrollable_set(Eo *obj, Efl_Ui_Panel_Data *sd, Eina_Bool scrollabl
1278 1222
1279 elm_widget_resize_object_set(obj, sd->scr_edje); 1223 elm_widget_resize_object_set(obj, sd->scr_edje);
1280 1224
1281 if (!sd->hit_rect) 1225 if (!sd->smanager)
1226 {
1227 sd->smanager = efl_add(EFL_UI_SCROLL_MANAGER_CLASS, obj);
1228 efl_ui_mirrored_set(sd->smanager, efl_ui_mirrored_get(obj));
1229
1230 efl_event_callback_add(obj, EFL_UI_EVENT_SCROLL_ANIM_STOP, _anim_stop_cb, NULL);
1231 efl_event_callback_add(obj, EFL_UI_EVENT_SCROLL, _scroll_cb, NULL);
1232 }
1233
1234 efl_composite_attach(obj, sd->smanager);
1235 efl_ui_scroll_connector_bind(obj, sd->smanager);
1236
1237 if (!sd->pan_obj)
1282 { 1238 {
1283 sd->hit_rect = evas_object_rectangle_add(evas_object_evas_get(obj)); 1239 sd->pan_obj = efl_add(EFL_UI_PAN_CLASS, obj);
1284 evas_object_smart_member_add(sd->hit_rect, obj); 1240 efl_ui_scroll_manager_pan_set(sd->smanager, sd->pan_obj);
1285 elm_widget_sub_object_add(obj, sd->hit_rect); 1241 efl_content_set(efl_part(sd->scr_edje, "efl.content"), sd->pan_obj);
1286 evas_object_color_set(sd->hit_rect, 0, 0, 0, 0);
1287 evas_object_show(sd->hit_rect);
1288 evas_object_repeat_events_set(sd->hit_rect, EINA_TRUE);
1289
1290 elm_interface_scrollable_objects_set(obj, sd->scr_edje, sd->hit_rect);
1291 elm_interface_scrollable_animate_stop_cb_set(obj, _anim_stop_cb);
1292 elm_interface_scrollable_scroll_cb_set(obj, _scroll_cb);
1293 } 1242 }
1294 1243
1295 if (!sd->scr_ly) 1244 if (!sd->scr_ly)
1296 { 1245 {
1297 sd->scr_ly = efl_add(EFL_UI_LAYOUT_CLASS, obj, 1246 sd->scr_ly = efl_add(EFL_UI_LAYOUT_CLASS, obj,
1298 elm_layout_theme_set(efl_added, 1247 efl_ui_layout_theme_set(efl_added,
1299 "panel", 1248 "panel", "scrollable/left",
1300 "scrollable/left", 1249 efl_ui_widget_style_get(obj)));
1301 elm_widget_style_get(obj)));
1302 1250
1303 evas_object_smart_member_add(sd->scr_ly, obj); 1251 efl_canvas_group_member_add(obj, sd->scr_ly);
1304 elm_widget_sub_object_add(obj, sd->scr_ly); 1252 elm_widget_sub_object_add(obj, sd->scr_ly);
1305 _scrollable_layout_theme_set(obj, sd); 1253 _scrollable_layout_theme_set(obj, sd);
1306 1254
@@ -1317,7 +1265,7 @@ _efl_ui_panel_scrollable_set(Eo *obj, Efl_Ui_Panel_Data *sd, Eina_Bool scrollabl
1317 elm_layout_content_set(sd->scr_ly, "event_area", sd->scr_event); 1265 elm_layout_content_set(sd->scr_ly, "event_area", sd->scr_event);
1318 } 1266 }
1319 1267
1320 elm_interface_scrollable_content_set(obj, sd->scr_ly); 1268 efl_content_set(sd->pan_obj, sd->scr_ly);
1321 sd->freeze = EINA_TRUE; 1269 sd->freeze = EINA_TRUE;
1322 efl_content_set(efl_part(sd->scr_ly, "efl.content"), sd->bx); 1270 efl_content_set(efl_part(sd->scr_ly, "efl.content"), sd->bx);
1323 if (sd->content) elm_widget_sub_object_add(sd->scr_ly, sd->content); 1271 if (sd->content) elm_widget_sub_object_add(sd->scr_ly, sd->content);
@@ -1326,19 +1274,16 @@ _efl_ui_panel_scrollable_set(Eo *obj, Efl_Ui_Panel_Data *sd, Eina_Bool scrollabl
1326 { 1274 {
1327 case EFL_UI_PANEL_ORIENT_TOP: 1275 case EFL_UI_PANEL_ORIENT_TOP:
1328 case EFL_UI_PANEL_ORIENT_BOTTOM: 1276 case EFL_UI_PANEL_ORIENT_BOTTOM:
1329 elm_interface_scrollable_movement_block_set 1277 efl_ui_scrollable_movement_block_set
1330 (obj, EFL_UI_SCROLL_BLOCK_VERTICAL); 1278 (obj, EFL_UI_SCROLL_BLOCK_VERTICAL);
1331 break; 1279 break;
1332 case EFL_UI_PANEL_ORIENT_LEFT: 1280 case EFL_UI_PANEL_ORIENT_LEFT:
1333 case EFL_UI_PANEL_ORIENT_RIGHT: 1281 case EFL_UI_PANEL_ORIENT_RIGHT:
1334 elm_interface_scrollable_movement_block_set 1282 efl_ui_scrollable_movement_block_set
1335 (obj, EFL_UI_SCROLL_BLOCK_HORIZONTAL); 1283 (obj, EFL_UI_SCROLL_BLOCK_HORIZONTAL);
1336 break; 1284 break;
1337 } 1285 }
1338 1286
1339 elm_interface_scrollable_single_direction_set
1340 (obj, ELM_SCROLLER_SINGLE_DIRECTION_NONE);
1341
1342 if (!elm_widget_disabled_get(obj) && !sd->callback_added) 1287 if (!elm_widget_disabled_get(obj) && !sd->callback_added)
1343 { 1288 {
1344 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_DOWN, 1289 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_DOWN,
@@ -1356,7 +1301,8 @@ _efl_ui_panel_scrollable_set(Eo *obj, Efl_Ui_Panel_Data *sd, Eina_Bool scrollabl
1356 } 1301 }
1357 else 1302 else
1358 { 1303 {
1359 elm_interface_scrollable_content_set(obj, NULL); 1304 efl_ui_scroll_connector_unbind(obj);
1305 efl_composite_detach(obj, sd->smanager);
1360 1306
1361 if (sd->callback_added) 1307 if (sd->callback_added)
1362 { 1308 {