summaryrefslogtreecommitdiff
path: root/src/lib/elementary/efl_ui_list.c
diff options
context:
space:
mode:
authorSangHyeon Lee <sh10233.lee@samsung.com>2017-12-20 12:30:29 +0900
committerSangHyeon Lee <sh10233.lee@samsung.com>2017-12-20 15:22:22 +0900
commit0c579c82c3787620f395e7cc34499a064eac4a7f (patch)
tree15a3aa1cbe18eabbf6e8a264c21a9a0c8a3caa71 /src/lib/elementary/efl_ui_list.c
parent0d85525dc895a414d0f50d4a7e82049aa0afc69d (diff)
elm: apply new scroll interface in efl_ui_list
Summary: Apply new scroll inteface in efl_ui_list. Test Plan: tested by examples Reviewers: jpeg, eagleeye Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D5690
Diffstat (limited to 'src/lib/elementary/efl_ui_list.c')
-rw-r--r--src/lib/elementary/efl_ui_list.c503
1 files changed, 426 insertions, 77 deletions
diff --git a/src/lib/elementary/efl_ui_list.c b/src/lib/elementary/efl_ui_list.c
index 1b3d8ce9ee..7a69106042 100644
--- a/src/lib/elementary/efl_ui_list.c
+++ b/src/lib/elementary/efl_ui_list.c
@@ -4,6 +4,12 @@
4#define ELM_ACCESS_PROTECTED 4#define ELM_ACCESS_PROTECTED
5#define ELM_ACCESS_WIDGET_ACTION_PROTECTED 5#define ELM_ACCESS_WIDGET_ACTION_PROTECTED
6#define EFL_ACCESS_SELECTION_PROTECTED 6#define EFL_ACCESS_SELECTION_PROTECTED
7#define EFL_UI_SCROLL_MANAGER_PROTECTED
8#define EFL_UI_SCROLLBAR_PROTECTED
9#define EFL_UI_SCROLLBAR_BETA
10#define EFL_GFX_SIZE_HINT_PROTECTED
11#define EFL_UI_LIST_PROTECTED
12
7 13
8#include <Elementary.h> 14#include <Elementary.h>
9#include "efl_ui_list_private.h" 15#include "efl_ui_list_private.h"
@@ -49,57 +55,54 @@ _efl_ui_list_pan_efl_canvas_group_group_calculate(Eo *obj EINA_UNUSED, Efl_Ui_Li
49 55
50 56
51EOLIAN static void 57EOLIAN static void
52_efl_ui_list_pan_elm_pan_pos_set(Eo *obj EINA_UNUSED, Efl_Ui_List_Pan_Data *psd, Evas_Coord x, Evas_Coord y) 58_efl_ui_list_pan_efl_ui_pan_pan_position_set(Eo *obj EINA_UNUSED, Efl_Ui_List_Pan_Data *psd, Eina_Position2D pos)
53{ 59{
54 if ((x == psd->x) && (y == psd->y)) return; 60 if ((pos.x == psd->gmt.x) && (pos.y == psd->gmt.y)) return;
55 61
56 psd->x = x; 62 psd->gmt.x = pos.x;
57 psd->y = y; 63 psd->gmt.y = pos.y;
58 64
65 efl_event_callback_call(obj, EFL_UI_PAN_EVENT_POSITION_CHANGED, NULL);
59 evas_object_smart_changed(psd->wobj); 66 evas_object_smart_changed(psd->wobj);
60} 67}
61 68
62EOLIAN static void 69EOLIAN static Eina_Position2D
63_efl_ui_list_pan_elm_pan_pos_get(Eo *obj EINA_UNUSED, Efl_Ui_List_Pan_Data *psd, Evas_Coord *x, Evas_Coord *y) 70_efl_ui_list_pan_efl_ui_pan_pan_position_get(Eo *obj EINA_UNUSED, Efl_Ui_List_Pan_Data *psd)
64{ 71{
65 if (x) *x = psd->x; 72 return psd->gmt.pos;
66 if (y) *y = psd->y;
67} 73}
68 74
69EOLIAN static void 75EOLIAN static Eina_Position2D
70_efl_ui_list_pan_elm_pan_pos_max_get(Eo *obj EINA_UNUSED, Efl_Ui_List_Pan_Data *psd, Evas_Coord *x, Evas_Coord *y) 76_efl_ui_list_pan_efl_ui_pan_pan_position_max_get(Eo *obj EINA_UNUSED, Efl_Ui_List_Pan_Data *psd)
71{ 77{
72 Evas_Coord ow, oh; 78 EFL_UI_LIST_DATA_GET(psd->wobj, pd);
73 Eina_Size2D min; 79 Eina_Rect vgmt = {};
74 80 Eina_Size2D min = {};
75 elm_interface_scrollable_content_viewport_geometry_get
76 (psd->wobj, NULL, NULL, &ow, &oh);
77 81
82 vgmt = efl_ui_scrollable_viewport_geometry_get(pd->scrl_mgr);
78 min = efl_ui_list_model_min_size_get(psd->wobj); 83 min = efl_ui_list_model_min_size_get(psd->wobj);
79 ow = min.w - ow;
80 if (ow < 0) ow = 0;
81 oh = min.h - oh;
82 if (oh < 0) oh = 0;
83 84
84 if (x) *x = ow; 85 min.w = min.w - vgmt.w;
85 if (y) *y = oh; 86 if (min.w < 0) min.w = 0;
87 min.h = min.h - vgmt.h;
88 if (min.h < 0) min.h = 0;
89
90 return EINA_POSITION2D(min.w, min.h);
86} 91}
87 92
88EOLIAN static void 93EOLIAN static Eina_Position2D
89_efl_ui_list_pan_elm_pan_pos_min_get(Eo *obj EINA_UNUSED, Efl_Ui_List_Pan_Data *psd EINA_UNUSED, Evas_Coord *x, Evas_Coord *y) 94_efl_ui_list_pan_efl_ui_pan_pan_position_min_get(Eo *obj EINA_UNUSED, Efl_Ui_List_Pan_Data *psd EINA_UNUSED)
90{ 95{
91 if (x) *x = 0; 96 return EINA_POSITION2D(0, 0);
92 if (y) *y = 0;
93} 97}
94 98
95EOLIAN static void 99EOLIAN static Eina_Size2D
96_efl_ui_list_pan_elm_pan_content_size_get(Eo *obj EINA_UNUSED, Efl_Ui_List_Pan_Data *psd, Evas_Coord *w, Evas_Coord *h) 100_efl_ui_list_pan_efl_ui_pan_content_size_get(Eo *obj EINA_UNUSED, Efl_Ui_List_Pan_Data *psd)
97{ 101{
98 Eina_Size2D min; 102 Eina_Size2D min = {};
99 min = efl_ui_list_model_min_size_get(psd->wobj); 103 min = efl_ui_list_model_min_size_get(psd->wobj);
100 104
101 if (w) *w = min.w; 105 return min;
102 if (h) *h = min.h;
103} 106}
104 107
105EOLIAN static void 108EOLIAN static void
@@ -110,6 +113,33 @@ _efl_ui_list_pan_efl_object_destructor(Eo *obj, Efl_Ui_List_Pan_Data *psd EINA_U
110 113
111#include "efl_ui_list_pan.eo.c" 114#include "efl_ui_list_pan.eo.c"
112 115
116EOLIAN static void
117_efl_ui_list_efl_ui_scrollable_interactive_content_pos_set(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *psd, Eina_Position2D pos)
118{
119 efl_ui_scrollable_content_pos_set(psd->scrl_mgr, pos);
120}
121
122EOLIAN static Eina_Position2D
123_efl_ui_list_efl_ui_scrollable_interactive_content_pos_get(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *psd)
124{
125 Eina_Position2D pos = efl_ui_scrollable_content_pos_get(psd->scrl_mgr);
126 return pos;
127}
128
129EOLIAN static Eina_Size2D
130_efl_ui_list_efl_ui_scrollable_interactive_content_size_get(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *psd)
131{
132 Eina_Size2D size = efl_ui_scrollable_content_size_get(psd->scrl_mgr);
133 return size;
134}
135
136EOLIAN static Eina_Rect
137_efl_ui_list_efl_ui_scrollable_interactive_viewport_geometry_get(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *psd)
138{
139 Eina_Rect gmt = efl_ui_scrollable_viewport_geometry_get(psd->scrl_mgr);
140 return gmt;
141}
142
113static Eina_Bool 143static Eina_Bool
114_efl_model_properties_has(Efl_Model *model, Eina_Stringshare *propfind) 144_efl_model_properties_has(Efl_Model *model, Eina_Stringshare *propfind)
115{ 145{
@@ -173,12 +203,6 @@ _children_slice_error(void * data EINA_UNUSED, Efl_Event const* event EINA_UNUSE
173 pd->slice_future = NULL; 203 pd->slice_future = NULL;
174} 204}
175 205
176static void
177_show_region_hook(void *data EINA_UNUSED, Evas_Object *obj, Eina_Rect r)
178{
179 elm_interface_scrollable_content_region_show(obj, r.x, r.y, r.w, r.h);
180}
181
182EOLIAN static void 206EOLIAN static void
183_efl_ui_list_select_mode_set(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *pd, Elm_Object_Select_Mode mode) 207_efl_ui_list_select_mode_set(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *pd, Elm_Object_Select_Mode mode)
184{ 208{
@@ -219,35 +243,21 @@ _efl_ui_list_homogeneous_get(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *pd)
219} 243}
220 244
221EOLIAN static void 245EOLIAN static void
222_efl_ui_list_efl_gfx_position_set(Eo *obj, Efl_Ui_List_Data *pd, Eina_Position2D p) 246_efl_ui_list_efl_gfx_position_set(Eo *obj, Efl_Ui_List_Data *pd, Eina_Position2D pos)
223{ 247{
224 int pan_x, pan_y; 248 if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y))
225 if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, p.x, p.y))
226 return; 249 return;
227 250
228 efl_gfx_position_set(efl_super(obj, MY_CLASS), p); 251 efl_gfx_position_set(efl_super(obj, MY_CLASS), pos);
229
230 elm_pan_pos_get(pd->pan_obj, &pan_x, &pan_y);
231 evas_object_move(pd->hit_rect, p.x, p.y);
232 evas_object_move(pd->pan_obj, p.x - pan_x, p.y - pan_y);
233 evas_object_smart_changed(pd->obj); 252 evas_object_smart_changed(pd->obj);
234} 253}
235 254
236EOLIAN static void 255EOLIAN static void
237_efl_ui_list_elm_interface_scrollable_region_bring_in(Eo *obj, Efl_Ui_List_Data *pd, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
238{
239 int pan_x, pan_y;
240 elm_pan_pos_get(pd->pan_obj, &pan_x, &pan_y);
241 elm_interface_scrollable_region_bring_in(efl_super(obj, MY_CLASS), x + pan_x, y + pan_y, w, h);
242}
243
244EOLIAN static void
245_efl_ui_list_efl_gfx_size_set(Eo *obj, Efl_Ui_List_Data *pd, Eina_Size2D size) 256_efl_ui_list_efl_gfx_size_set(Eo *obj, Efl_Ui_List_Data *pd, Eina_Size2D size)
246{ 257{
247 if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_RESIZE, 0, size.w, size.h)) 258 if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_RESIZE, 0, size.w, size.h))
248 return; 259 return;
249 260
250 evas_object_resize(pd->hit_rect, size.w, size.h);
251 efl_gfx_size_set(efl_super(obj, MY_CLASS), size); 261 efl_gfx_size_set(efl_super(obj, MY_CLASS), size);
252 262
253 evas_object_smart_changed(pd->obj); 263 evas_object_smart_changed(pd->obj);
@@ -263,16 +273,345 @@ EOLIAN static void
263_efl_ui_list_efl_canvas_group_group_member_add(Eo *obj, Efl_Ui_List_Data *pd, Evas_Object *member) 273_efl_ui_list_efl_canvas_group_group_member_add(Eo *obj, Efl_Ui_List_Data *pd, Evas_Object *member)
264{ 274{
265 efl_canvas_group_member_add(efl_super(obj, MY_CLASS), member); 275 efl_canvas_group_member_add(efl_super(obj, MY_CLASS), member);
276}
277
278//Scrollable Implement
279static void
280_efl_ui_list_bar_read_and_update(Eo *obj)
281{
282 EFL_UI_LIST_DATA_GET(obj, pd);
283 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
284 double vx, vy;
285
286 edje_object_part_drag_value_get
287 (wd->resize_obj, "elm.dragable.vbar", NULL, &vy);
288 edje_object_part_drag_value_get
289 (wd->resize_obj, "elm.dragable.hbar", &vx, NULL);
290
291 efl_ui_scrollbar_bar_position_set(pd->scrl_mgr, vx, vy);
292
293 efl_canvas_group_change(pd->pan_obj);
294}
295
296static void
297_efl_ui_list_reload_cb(void *data,
298 Evas_Object *obj EINA_UNUSED,
299 const char *emission EINA_UNUSED,
300 const char *source EINA_UNUSED)
301{
302 EFL_UI_LIST_DATA_GET(data, pd);
303
304 efl_ui_scrollbar_bar_visibility_update(pd->scrl_mgr);
305}
306
307static void
308_efl_ui_list_vbar_drag_cb(void *data,
309 Evas_Object *obj EINA_UNUSED,
310 const char *emission EINA_UNUSED,
311 const char *source EINA_UNUSED)
312{
313 _efl_ui_list_bar_read_and_update(data);
314
315 Efl_Ui_Scrollbar_Direction type = EFL_UI_SCROLLBAR_DIRECTION_VERTICAL;
316 efl_event_callback_call(data, EFL_UI_SCROLLBAR_EVENT_BAR_DRAG, &type);
317}
318
319static void
320_efl_ui_list_vbar_press_cb(void *data,
321 Evas_Object *obj EINA_UNUSED,
322 const char *emission EINA_UNUSED,
323 const char *source EINA_UNUSED)
324{
325 Efl_Ui_Scrollbar_Direction type = EFL_UI_SCROLLBAR_DIRECTION_VERTICAL;
326 efl_event_callback_call(data, EFL_UI_SCROLLBAR_EVENT_BAR_PRESS, &type);
327}
328
329static void
330_efl_ui_list_vbar_unpress_cb(void *data,
331 Evas_Object *obj EINA_UNUSED,
332 const char *emission EINA_UNUSED,
333 const char *source EINA_UNUSED)
334{
335 Efl_Ui_Scrollbar_Direction type = EFL_UI_SCROLLBAR_DIRECTION_VERTICAL;
336 efl_event_callback_call(data, EFL_UI_SCROLLBAR_EVENT_BAR_UNPRESS, &type);
337}
338
339static void
340_efl_ui_list_edje_drag_start_cb(void *data,
341 Evas_Object *obj EINA_UNUSED,
342 const char *emission EINA_UNUSED,
343 const char *source EINA_UNUSED)
344{
345 EFL_UI_LIST_DATA_GET(data, pd);
346
347 _efl_ui_list_bar_read_and_update(data);
348
349 pd->scrl_freeze = efl_ui_scrollable_scroll_freeze_get(pd->scrl_mgr);
350 efl_ui_scrollable_scroll_freeze_set(pd->scrl_mgr, EINA_TRUE);
351 efl_event_callback_call(data, EFL_UI_EVENT_SCROLL_DRAG_START, NULL);
352}
353
354static void
355_efl_ui_list_edje_drag_stop_cb(void *data,
356 Evas_Object *obj EINA_UNUSED,
357 const char *emission EINA_UNUSED,
358 const char *source EINA_UNUSED)
359{
360 EFL_UI_LIST_DATA_GET(data, pd);
361
362 _efl_ui_list_bar_read_and_update(data);
363
364 efl_ui_scrollable_scroll_freeze_set(pd->scrl_mgr, pd->scrl_freeze);
365 efl_event_callback_call(data, EFL_UI_EVENT_SCROLL_DRAG_STOP, NULL);
366}
367
368static void
369_efl_ui_list_edje_drag_cb(void *data,
370 Evas_Object *obj EINA_UNUSED,
371 const char *emission EINA_UNUSED,
372 const char *source EINA_UNUSED)
373{
374 _efl_ui_list_bar_read_and_update(data);
375}
376
377static void
378_efl_ui_list_hbar_drag_cb(void *data,
379 Evas_Object *obj EINA_UNUSED,
380 const char *emission EINA_UNUSED,
381 const char *source EINA_UNUSED)
382{
383 _efl_ui_list_bar_read_and_update(data);
384
385 Efl_Ui_Scrollbar_Direction type = EFL_UI_SCROLLBAR_DIRECTION_HORIZONTAL;
386 efl_event_callback_call(data, EFL_UI_SCROLLBAR_EVENT_BAR_DRAG, &type);
387}
266 388
267 if (pd->hit_rect) 389static void
268 evas_object_raise(pd->hit_rect); 390_efl_ui_list_hbar_press_cb(void *data,
391 Evas_Object *obj EINA_UNUSED,
392 const char *emission EINA_UNUSED,
393 const char *source EINA_UNUSED)
394{
395 Efl_Ui_Scrollbar_Direction type = EFL_UI_SCROLLBAR_DIRECTION_HORIZONTAL;
396 efl_event_callback_call(data, EFL_UI_SCROLLBAR_EVENT_BAR_PRESS, &type);
397}
398
399static void
400_efl_ui_list_hbar_unpress_cb(void *data,
401 Evas_Object *obj EINA_UNUSED,
402 const char *emission EINA_UNUSED,
403 const char *source EINA_UNUSED)
404{
405 Efl_Ui_Scrollbar_Direction type = EFL_UI_SCROLLBAR_DIRECTION_HORIZONTAL;
406 efl_event_callback_call(data, EFL_UI_SCROLLBAR_EVENT_BAR_UNPRESS, &type);
407}
408
409static void
410_scroll_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
411{
412 //scroll cb
413}
414
415static void
416_efl_ui_list_bar_size_changed_cb(void *data, const Efl_Event *event EINA_UNUSED)
417{
418 Eo *obj = data;
419 EFL_UI_LIST_DATA_GET(obj, pd);
420 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
421
422 double width = 0.0, height = 0.0;
423
424 efl_ui_scrollbar_bar_size_get(pd->scrl_mgr, &width, &height);
425
426 edje_object_part_drag_size_set(wd->resize_obj, "elm.dragable.hbar", width, 1.0);
427 edje_object_part_drag_size_set(wd->resize_obj, "elm.dragable.vbar", 1.0, height);
428}
429
430static void
431_efl_ui_list_bar_pos_changed_cb(void *data, const Efl_Event *event EINA_UNUSED)
432{
433 Eo *obj = data;
434 EFL_UI_LIST_DATA_GET(obj, pd);
435 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
436
437 double posx = 0.0, posy = 0.0;
438
439 efl_ui_scrollbar_bar_position_get(pd->scrl_mgr, &posx, &posy);
440
441 edje_object_part_drag_value_set(wd->resize_obj, "elm.dragable.hbar", posx, 0.0);
442 edje_object_part_drag_value_set(wd->resize_obj, "elm.dragable.vbar", 0.0, posy);
443}
444
445static void
446_efl_ui_list_bar_show_cb(void *data, const Efl_Event *event)
447{
448 Eo *obj = data;
449 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
450 Efl_Ui_Scrollbar_Direction type = *(Efl_Ui_Scrollbar_Direction *)(event->info);
451
452 if (type == EFL_UI_SCROLLBAR_DIRECTION_HORIZONTAL)
453 edje_object_signal_emit(wd->resize_obj, "elm,action,show,hbar", "elm");
454 else if (type == EFL_UI_SCROLLBAR_DIRECTION_VERTICAL)
455 edje_object_signal_emit(wd->resize_obj, "elm,action,show,vbar", "elm");
456}
457
458static void
459_efl_ui_list_bar_hide_cb(void *data, const Efl_Event *event)
460{
461 Eo *obj = data;
462 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
463 Efl_Ui_Scrollbar_Direction type = *(Efl_Ui_Scrollbar_Direction *)(event->info);
464
465 if (type == EFL_UI_SCROLLBAR_DIRECTION_HORIZONTAL)
466 edje_object_signal_emit(wd->resize_obj, "elm,action,hide,hbar", "elm");
467 else if (type == EFL_UI_SCROLLBAR_DIRECTION_VERTICAL)
468 edje_object_signal_emit(wd->resize_obj, "elm,action,hide,vbar", "elm");
469}
470
471EOLIAN static Eina_Bool
472_efl_ui_list_efl_layout_signal_signal_callback_add(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *sd EINA_UNUSED, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
473{
474 Eina_Bool ok;
475 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
476
477 ok = efl_layout_signal_callback_add(wd->resize_obj, emission, source, func_cb, data);
478
479 return ok;
480}
481
482EOLIAN static Eina_Bool
483_efl_ui_list_efl_layout_signal_signal_callback_del(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *sd EINA_UNUSED, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
484{
485 Eina_Bool ok;
486 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
487
488 ok = efl_layout_signal_callback_del(wd->resize_obj, emission, source, func_cb, data);
489
490 return ok;
491}
492
493static void
494_efl_ui_list_edje_object_attach(Eo *obj)
495{
496 efl_layout_signal_callback_add
497 (obj, "reload", "elm", _efl_ui_list_reload_cb, obj);
498 //Vertical bar
499 efl_layout_signal_callback_add
500 (obj, "drag", "elm.dragable.vbar", _efl_ui_list_vbar_drag_cb,
501 obj);
502 efl_layout_signal_callback_add
503 (obj, "drag,set", "elm.dragable.vbar",
504 _efl_ui_list_edje_drag_cb, obj);
505 efl_layout_signal_callback_add
506 (obj, "drag,start", "elm.dragable.vbar",
507 _efl_ui_list_edje_drag_start_cb, obj);
508 efl_layout_signal_callback_add
509 (obj, "drag,stop", "elm.dragable.vbar",
510 _efl_ui_list_edje_drag_stop_cb, obj);
511 efl_layout_signal_callback_add
512 (obj, "drag,step", "elm.dragable.vbar",
513 _efl_ui_list_edje_drag_cb, obj);
514 efl_layout_signal_callback_add
515 (obj, "drag,page", "elm.dragable.vbar",
516 _efl_ui_list_edje_drag_cb, obj);
517 efl_layout_signal_callback_add
518 (obj, "elm,vbar,press", "elm",
519 _efl_ui_list_vbar_press_cb, obj);
520 efl_layout_signal_callback_add
521 (obj, "elm,vbar,unpress", "elm",
522 _efl_ui_list_vbar_unpress_cb, obj);
523
524 //Horizontal bar
525 efl_layout_signal_callback_add
526 (obj, "drag", "elm.dragable.hbar", _efl_ui_list_hbar_drag_cb,
527 obj);
528 efl_layout_signal_callback_add
529 (obj, "drag,set", "elm.dragable.hbar",
530 _efl_ui_list_edje_drag_cb, obj);
531 efl_layout_signal_callback_add
532 (obj, "drag,start", "elm.dragable.hbar",
533 _efl_ui_list_edje_drag_start_cb, obj);
534 efl_layout_signal_callback_add
535 (obj, "drag,stop", "elm.dragable.hbar",
536 _efl_ui_list_edje_drag_stop_cb, obj);
537 efl_layout_signal_callback_add
538 (obj, "drag,step", "elm.dragable.hbar",
539 _efl_ui_list_edje_drag_cb, obj);
540 efl_layout_signal_callback_add
541 (obj, "drag,page", "elm.dragable.hbar",
542 _efl_ui_list_edje_drag_cb, obj);
543 efl_layout_signal_callback_add
544 (obj, "elm,hbar,press", "elm",
545 _efl_ui_list_hbar_press_cb, obj);
546 efl_layout_signal_callback_add
547 (obj, "elm,hbar,unpress", "elm",
548 _efl_ui_list_hbar_unpress_cb, obj);
549}
550
551static void
552_efl_ui_list_edje_object_detach(Evas_Object *obj)
553{
554 efl_layout_signal_callback_del
555 (obj, "reload", "elm", _efl_ui_list_reload_cb, obj);
556 //Vertical bar
557 efl_layout_signal_callback_del
558 (obj, "drag", "elm.dragable.vbar", _efl_ui_list_vbar_drag_cb,
559 obj);
560 efl_layout_signal_callback_del
561 (obj, "drag,set", "elm.dragable.vbar",
562 _efl_ui_list_edje_drag_cb, obj);
563 efl_layout_signal_callback_del
564 (obj, "drag,start", "elm.dragable.vbar",
565 _efl_ui_list_edje_drag_start_cb, obj);
566 efl_layout_signal_callback_del
567 (obj, "drag,stop", "elm.dragable.vbar",
568 _efl_ui_list_edje_drag_stop_cb, obj);
569 efl_layout_signal_callback_del
570 (obj, "drag,step", "elm.dragable.vbar",
571 _efl_ui_list_edje_drag_cb, obj);
572 efl_layout_signal_callback_del
573 (obj, "drag,page", "elm.dragable.vbar",
574 _efl_ui_list_edje_drag_cb, obj);
575 efl_layout_signal_callback_del
576 (obj, "elm,vbar,press", "elm",
577 _efl_ui_list_vbar_press_cb, obj);
578 efl_layout_signal_callback_del
579 (obj, "elm,vbar,unpress", "elm",
580 _efl_ui_list_vbar_unpress_cb, obj);
581
582 //Horizontal bar
583 efl_layout_signal_callback_del
584 (obj, "drag", "elm.dragable.hbar", _efl_ui_list_hbar_drag_cb,
585 obj);
586 efl_layout_signal_callback_del
587 (obj, "drag,set", "elm.dragable.hbar",
588 _efl_ui_list_edje_drag_cb, obj);
589 efl_layout_signal_callback_del
590 (obj, "drag,start", "elm.dragable.hbar",
591 _efl_ui_list_edje_drag_start_cb, obj);
592 efl_layout_signal_callback_del
593 (obj, "drag,stop", "elm.dragable.hbar",
594 _efl_ui_list_edje_drag_stop_cb, obj);
595 efl_layout_signal_callback_del
596 (obj, "drag,step", "elm.dragable.hbar",
597 _efl_ui_list_edje_drag_cb, obj);
598 efl_layout_signal_callback_del
599 (obj, "drag,page", "elm.dragable.hbar",
600 _efl_ui_list_edje_drag_cb, obj);
601 efl_layout_signal_callback_del
602 (obj, "elm,hbar,press", "elm",
603 _efl_ui_list_hbar_press_cb, obj);
604 efl_layout_signal_callback_del
605 (obj, "elm,hbar,unpress", "elm",
606 _efl_ui_list_hbar_unpress_cb, obj);
269} 607}
270 608
271EOLIAN static void 609EOLIAN static void
272_efl_ui_list_efl_canvas_group_group_add(Eo *obj, Efl_Ui_List_Data *pd) 610_efl_ui_list_efl_canvas_group_group_add(Eo *obj, Efl_Ui_List_Data *pd)
273{ 611{
274 Efl_Ui_List_Pan_Data *pan_data; 612 Efl_Ui_List_Pan_Data *pan_data;
275 Evas_Coord minw, minh; 613 Eina_Size2D min = {};
614 Eina_Bool bounce = _elm_config->thumbscroll_bounce_enable;
276 615
277 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); 616 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
278 617
@@ -284,34 +623,38 @@ _efl_ui_list_efl_canvas_group_group_add(Eo *obj, Efl_Ui_List_Data *pd)
284 if (!elm_layout_theme_set(obj, "list", "base", elm_widget_style_get(obj))) 623 if (!elm_layout_theme_set(obj, "list", "base", elm_widget_style_get(obj)))
285 CRI("Failed to set layout!"); 624 CRI("Failed to set layout!");
286 625
287 pd->hit_rect = evas_object_rectangle_add(evas_object_evas_get(obj)); 626 pd->scrl_mgr = efl_add(EFL_UI_SCROLL_MANAGER_CLASS, obj,
288 evas_object_data_set(pd->hit_rect, "_elm_leaveme", obj); 627 efl_ui_mirrored_set(efl_added, efl_ui_mirrored_get(obj)));
289 evas_object_smart_member_add(pd->hit_rect, obj); 628 pd->pan_obj = efl_add(MY_PAN_CLASS, obj);
290 elm_widget_sub_object_add(obj, pd->hit_rect); 629 pan_data = efl_data_scope_get(pd->pan_obj, MY_PAN_CLASS);
291 630 pan_data->wobj = obj;
292 /* common scroller hit rectangle setup */
293 evas_object_color_set(pd->hit_rect, 0, 0, 0, 0);
294 evas_object_show(pd->hit_rect);
295 evas_object_repeat_events_set(pd->hit_rect, EINA_TRUE);
296 631
297 elm_widget_on_show_region_hook_set(obj, NULL, _show_region_hook, NULL); 632 efl_ui_scroll_manager_pan_set(pd->scrl_mgr, pd->pan_obj);
633 efl_ui_scrollable_bounce_enabled_set(pd->scrl_mgr, bounce, bounce);
298 634
299 elm_interface_scrollable_objects_set(obj, wd->resize_obj, pd->hit_rect); 635 edje_object_part_swallow(wd->resize_obj, "elm.swallow.content", pd->pan_obj);
300 elm_interface_scrollable_bounce_allow_set 636 efl_gfx_stack_raise((Eo *)edje_object_part_object_get(wd->resize_obj, "elm.dragable.vbar"));
301 (obj, EINA_FALSE, _elm_config->thumbscroll_bounce_enable);
302 637
303 pd->mode = ELM_LIST_COMPRESS; 638 pd->mode = ELM_LIST_COMPRESS;
304 639
640 efl_gfx_visible_set(pd->pan_obj, EINA_TRUE);
641
305 efl_access_type_set(obj, EFL_ACCESS_TYPE_DISABLED); 642 efl_access_type_set(obj, EFL_ACCESS_TYPE_DISABLED);
306 pd->pan_obj = efl_add(MY_PAN_CLASS, evas_object_evas_get(obj));
307 pan_data = efl_data_scope_get(pd->pan_obj, MY_PAN_CLASS);
308 pan_data->wobj = obj;
309 643
310 elm_interface_scrollable_extern_pan_set(obj, pd->pan_obj); 644 edje_object_size_min_calc(wd->resize_obj, &min.w, &min.h);
311 evas_object_show(pd->pan_obj); 645 efl_gfx_size_hint_restricted_min_set(obj, min);
646
647 efl_event_callback_add(obj, EFL_UI_EVENT_SCROLL, _scroll_cb, obj);
648 efl_event_callback_add(obj, EFL_UI_SCROLLBAR_EVENT_BAR_SIZE_CHANGED,
649 _efl_ui_list_bar_size_changed_cb, obj);
650 efl_event_callback_add(obj, EFL_UI_SCROLLBAR_EVENT_BAR_POS_CHANGED,
651 _efl_ui_list_bar_pos_changed_cb, obj);
652 efl_event_callback_add(obj, EFL_UI_SCROLLBAR_EVENT_BAR_SHOW,
653 _efl_ui_list_bar_show_cb, obj);
654 efl_event_callback_add(obj, EFL_UI_SCROLLBAR_EVENT_BAR_HIDE,
655 _efl_ui_list_bar_hide_cb, obj);
312 656
313 edje_object_size_min_calc(wd->resize_obj, &minw, &minh); 657 _efl_ui_list_edje_object_attach(obj);
314 evas_object_size_hint_min_set(obj, minw, minh);
315 658
316 elm_layout_sizing_eval(obj); 659 elm_layout_sizing_eval(obj);
317} 660}
@@ -386,6 +729,12 @@ _efl_ui_list_efl_object_destructor(Eo *obj, Efl_Ui_List_Data *pd)
386 efl_unref(pd->model); 729 efl_unref(pd->model);
387 eina_stringshare_del(pd->style); 730 eina_stringshare_del(pd->style);
388 731
732 efl_event_callback_del(obj, EFL_UI_EVENT_SCROLL, _scroll_cb, obj);
733 _efl_ui_list_edje_object_detach(obj);
734
735 ELM_SAFE_FREE(pd->pan_obj, evas_object_del);
736 efl_canvas_group_del(efl_super(obj, MY_CLASS));
737
389 efl_ui_list_segarray_flush(&pd->segarray); 738 efl_ui_list_segarray_flush(&pd->segarray);
390 739
391 efl_destructor(efl_super(obj, MY_CLASS)); 740 efl_destructor(efl_super(obj, MY_CLASS));
@@ -592,7 +941,7 @@ _efl_ui_list_efl_ui_list_model_min_size_set(Eo *obj, Efl_Ui_List_Data *pd, Eina_
592 pd->min.h = min.h; 941 pd->min.h = min.h;
593 942
594 evas_object_size_hint_min_set(wd->resize_obj, pd->min.w, pd->min.h); 943 evas_object_size_hint_min_set(wd->resize_obj, pd->min.w, pd->min.h);
595 efl_event_callback_legacy_call(pd->pan_obj, ELM_PAN_EVENT_CHANGED, NULL); 944 efl_event_callback_call(pd->pan_obj, EFL_UI_PAN_EVENT_CONTENT_CHANGED, NULL);
596} 945}
597 946
598EOLIAN static Efl_Ui_List_LayoutItem * 947EOLIAN static Efl_Ui_List_LayoutItem *