summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-07-09 08:49:12 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-07-09 08:49:12 -0400
commitd76d5db5cbfe98eebb2f59d8227bb429d1b867f7 (patch)
treee01f592dcb84ed00fa9d96f7b89576fda4f04e07
parent70a3b71abaea38839da21247a86c483ae12bc783 (diff)
Introduce efl_ui_scroll_util files.
Summary: this brings API that connects the theme to the object. This reduces the amount of code that you need to write in order to develop a widget that can be scrollable. For now efl_ui_grid and efl_ui_scroller are replaced with it. efl_ui_list / efl_ui_list_view are not handeled with this, as they will be replaced with newer widgets. Right now this is only avaiable in the C API. However, wrapping this into a mixin should be easy. Reviewers: zmike, segfaultxavi Reviewed By: zmike Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9245
-rw-r--r--src/lib/elementary/efl_ui_grid.c220
-rw-r--r--src/lib/elementary/efl_ui_scroll_util.c329
-rw-r--r--src/lib/elementary/efl_ui_scroller.c351
-rw-r--r--src/lib/elementary/elm_priv.h14
-rw-r--r--src/lib/elementary/meson.build1
5 files changed, 350 insertions, 565 deletions
diff --git a/src/lib/elementary/efl_ui_grid.c b/src/lib/elementary/efl_ui_grid.c
index 5e1f50638d..d27899d907 100644
--- a/src/lib/elementary/efl_ui_grid.c
+++ b/src/lib/elementary/efl_ui_grid.c
@@ -264,138 +264,6 @@ _item_scroll_internal(Eo *obj,
264} 264}
265 265
266static void 266static void
267_efl_ui_grid_bar_read_and_update(Eo *obj)
268{
269 EFL_UI_GRID_DATA_GET_OR_RETURN(obj, pd);
270 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
271 double vx = 0.0, vy = 0.0;
272
273 edje_object_part_drag_value_get
274 (wd->resize_obj, "efl.dragable.vbar", NULL, &vy);
275
276 edje_object_part_drag_value_get
277 (wd->resize_obj, "efl.dragable.hbar", &vx, NULL);
278
279 efl_ui_scrollbar_bar_position_set(pd->smanager, vx, vy);
280}
281
282static void
283_efl_ui_grid_reload_cb(void *data,
284 Evas_Object *obj EINA_UNUSED,
285 const char *emission EINA_UNUSED,
286 const char *source EINA_UNUSED)
287{
288 Eo *list = data;
289 EFL_UI_GRID_DATA_GET_OR_RETURN(list, pd);
290
291 efl_ui_scrollbar_bar_visibility_update(pd->smanager);
292}
293
294static void
295_efl_ui_grid_vbar_drag_cb(void *data,
296 Evas_Object *obj EINA_UNUSED,
297 const char *emission EINA_UNUSED,
298 const char *source EINA_UNUSED)
299{
300 _efl_ui_grid_bar_read_and_update(data);
301
302 Efl_Ui_Scrollbar_Direction type = EFL_UI_SCROLLBAR_DIRECTION_VERTICAL;
303 efl_event_callback_call(data, EFL_UI_SCROLLBAR_EVENT_BAR_DRAG, &type);
304}
305
306static void
307_efl_ui_grid_vbar_press_cb(void *data,
308 Evas_Object *obj EINA_UNUSED,
309 const char *emission EINA_UNUSED,
310 const char *source EINA_UNUSED)
311{
312 Efl_Ui_Scrollbar_Direction type = EFL_UI_SCROLLBAR_DIRECTION_VERTICAL;
313 efl_event_callback_call(data, EFL_UI_SCROLLBAR_EVENT_BAR_PRESS, &type);
314}
315
316static void
317_efl_ui_grid_vbar_unpress_cb(void *data,
318 Evas_Object *obj EINA_UNUSED,
319 const char *emission EINA_UNUSED,
320 const char *source EINA_UNUSED)
321{
322 Efl_Ui_Scrollbar_Direction type = EFL_UI_SCROLLBAR_DIRECTION_VERTICAL;
323 efl_event_callback_call(data, EFL_UI_SCROLLBAR_EVENT_BAR_UNPRESS, &type);
324}
325
326static void
327_efl_ui_grid_edje_drag_start_cb(void *data,
328 Evas_Object *obj EINA_UNUSED,
329 const char *emission EINA_UNUSED,
330 const char *source EINA_UNUSED)
331{
332 Eo *list = data;
333 EFL_UI_GRID_DATA_GET_OR_RETURN(list, pd);
334
335 _efl_ui_grid_bar_read_and_update(list);
336
337 pd->freeze_want = efl_ui_scrollable_scroll_freeze_get(pd->smanager);
338 efl_ui_scrollable_scroll_freeze_set(pd->smanager, EINA_TRUE);
339 efl_event_callback_call(list, EFL_UI_EVENT_SCROLL_DRAG_START, NULL);
340}
341
342static void
343_efl_ui_grid_edje_drag_stop_cb(void *data,
344 Evas_Object *obj EINA_UNUSED,
345 const char *emission EINA_UNUSED,
346 const char *source EINA_UNUSED)
347{
348 Eo *list = data;
349 EFL_UI_GRID_DATA_GET_OR_RETURN(list, pd);
350
351 _efl_ui_grid_bar_read_and_update(list);
352
353 efl_ui_scrollable_scroll_freeze_set(pd->smanager, pd->freeze_want);
354 efl_event_callback_call(list, EFL_UI_EVENT_SCROLL_DRAG_STOP, NULL);
355}
356
357static void
358_efl_ui_grid_edje_drag_cb(void *data,
359 Evas_Object *obj EINA_UNUSED,
360 const char *emission EINA_UNUSED,
361 const char *source EINA_UNUSED)
362{
363 _efl_ui_grid_bar_read_and_update(data);
364}
365
366static void
367_efl_ui_grid_hbar_drag_cb(void *data,
368 Evas_Object *obj EINA_UNUSED,
369 const char *emission EINA_UNUSED,
370 const char *source EINA_UNUSED)
371{
372 _efl_ui_grid_bar_read_and_update(data);
373
374 Efl_Ui_Scrollbar_Direction type = EFL_UI_SCROLLBAR_DIRECTION_HORIZONTAL;
375 efl_event_callback_call(data, EFL_UI_SCROLLBAR_EVENT_BAR_DRAG, &type);
376}
377
378static void
379_efl_ui_grid_hbar_press_cb(void *data,
380 Evas_Object *obj EINA_UNUSED,
381 const char *emission EINA_UNUSED,
382 const char *source EINA_UNUSED)
383{
384 Efl_Ui_Scrollbar_Direction type = EFL_UI_SCROLLBAR_DIRECTION_HORIZONTAL;
385 efl_event_callback_call(data, EFL_UI_SCROLLBAR_EVENT_BAR_PRESS, &type);
386}
387
388static void
389_efl_ui_grid_hbar_unpress_cb(void *data,
390 Evas_Object *obj EINA_UNUSED,
391 const char *emission EINA_UNUSED,
392 const char *source EINA_UNUSED)
393{
394 Efl_Ui_Scrollbar_Direction type = EFL_UI_SCROLLBAR_DIRECTION_HORIZONTAL;
395 efl_event_callback_call(data, EFL_UI_SCROLLBAR_EVENT_BAR_UNPRESS, &type);
396}
397
398static void
399_efl_ui_grid_bar_size_changed_cb(void *data, const Efl_Event *event EINA_UNUSED) 267_efl_ui_grid_bar_size_changed_cb(void *data, const Efl_Event *event EINA_UNUSED)
400{ 268{
401 Eo *obj = data; 269 Eo *obj = data;
@@ -453,90 +321,6 @@ _efl_ui_grid_bar_hide_cb(void *data, const Efl_Event *event)
453} 321}
454 322
455static void 323static void
456_scroll_edje_object_attach(Eo *obj)
457{
458 EFL_UI_GRID_DATA_GET_OR_RETURN(obj, pd);
459
460 efl_layout_signal_callback_add(obj, "reload", "efl",
461 obj, _efl_ui_grid_reload_cb, NULL);
462 efl_layout_signal_callback_add(obj, "drag", "efl.dragable.vbar",
463 obj, _efl_ui_grid_vbar_drag_cb, NULL);
464 efl_layout_signal_callback_add(obj, "drag,set", "efl.dragable.vbar",
465 obj, _efl_ui_grid_edje_drag_cb, NULL);
466 efl_layout_signal_callback_add(obj, "drag,start", "efl.dragable.vbar",
467 obj, _efl_ui_grid_edje_drag_start_cb, NULL);
468 efl_layout_signal_callback_add(obj, "drag,stop", "efl.dragable.vbar",
469 obj, _efl_ui_grid_edje_drag_stop_cb, NULL);
470 efl_layout_signal_callback_add(obj, "drag,step", "efl.dragable.vbar",
471 obj, _efl_ui_grid_edje_drag_cb, NULL);
472 efl_layout_signal_callback_add(obj, "drag,page", "efl.dragable.vbar",
473 obj, _efl_ui_grid_edje_drag_cb, NULL);
474 efl_layout_signal_callback_add(obj, "efl,vbar,press", "efl",
475 obj, _efl_ui_grid_vbar_press_cb, NULL);
476 efl_layout_signal_callback_add(obj, "efl,vbar,unpress", "efl",
477 obj, _efl_ui_grid_vbar_unpress_cb, NULL);
478
479 efl_layout_signal_callback_add(obj, "drag", "efl.dragable.hbar",
480 obj, _efl_ui_grid_hbar_drag_cb, NULL);
481 efl_layout_signal_callback_add(obj, "drag,set", "efl.dragable.hbar",
482 obj, _efl_ui_grid_edje_drag_cb, NULL);
483 efl_layout_signal_callback_add(obj, "drag,start", "efl.dragable.hbar",
484 obj, _efl_ui_grid_edje_drag_start_cb, NULL);
485 efl_layout_signal_callback_add(obj, "drag,stop", "efl.dragable.hbar",
486 obj, _efl_ui_grid_edje_drag_stop_cb, NULL);
487 efl_layout_signal_callback_add(obj, "drag,step", "efl.dragable.hbar",
488 obj, _efl_ui_grid_edje_drag_cb, NULL);
489 efl_layout_signal_callback_add(obj, "drag,page", "efl.dragable.hbar",
490 obj, _efl_ui_grid_edje_drag_cb, NULL);
491 efl_layout_signal_callback_add(obj, "efl,hbar,press", "efl",
492 obj, _efl_ui_grid_hbar_press_cb, NULL);
493 efl_layout_signal_callback_add(obj, "efl,hbar,unpress", "efl",
494 obj, _efl_ui_grid_hbar_unpress_cb, NULL);
495}
496
497static void
498_scroll_edje_object_detach(Eo *obj)
499{
500 EFL_UI_GRID_DATA_GET_OR_RETURN(obj, pd);
501
502 efl_layout_signal_callback_del(obj, "reload", "efl",
503 obj, _efl_ui_grid_reload_cb, NULL);
504 efl_layout_signal_callback_del(obj, "drag", "efl.dragable.vbar",
505 obj, _efl_ui_grid_vbar_drag_cb, NULL);
506 efl_layout_signal_callback_del(obj, "drag,set", "efl.dragable.vbar",
507 obj, _efl_ui_grid_edje_drag_cb, NULL);
508 efl_layout_signal_callback_del(obj, "drag,start", "efl.dragable.vbar",
509 obj, _efl_ui_grid_edje_drag_start_cb, NULL);
510 efl_layout_signal_callback_del(obj, "drag,stop", "efl.dragable.vbar",
511 obj, _efl_ui_grid_edje_drag_stop_cb, NULL);
512 efl_layout_signal_callback_del(obj, "drag,step", "efl.dragable.vbar",
513 obj, _efl_ui_grid_edje_drag_cb, NULL);
514 efl_layout_signal_callback_del(obj, "drag,page", "efl.dragable.vbar",
515 obj, _efl_ui_grid_edje_drag_cb, NULL);
516 efl_layout_signal_callback_del(obj, "efl,vbar,press", "efl",
517 obj, _efl_ui_grid_vbar_press_cb, NULL);
518 efl_layout_signal_callback_del(obj, "efl,vbar,unpress", "efl",
519 obj, _efl_ui_grid_vbar_unpress_cb, NULL);
520
521 efl_layout_signal_callback_del(obj, "drag", "efl.dragable.hbar",
522 obj, _efl_ui_grid_hbar_drag_cb, NULL);
523 efl_layout_signal_callback_del(obj, "drag,set", "efl.dragable.hbar",
524 obj, _efl_ui_grid_edje_drag_cb, NULL);
525 efl_layout_signal_callback_del(obj, "drag,start", "efl.dragable.hbar",
526 obj, _efl_ui_grid_edje_drag_start_cb, NULL);
527 efl_layout_signal_callback_del(obj, "drag,stop", "efl.dragable.hbar",
528 obj, _efl_ui_grid_edje_drag_stop_cb, NULL);
529 efl_layout_signal_callback_del(obj, "drag,step", "efl.dragable.hbar",
530 obj, _efl_ui_grid_edje_drag_cb, NULL);
531 efl_layout_signal_callback_del(obj, "drag,page", "efl.dragable.hbar",
532 obj, _efl_ui_grid_edje_drag_cb, NULL);
533 efl_layout_signal_callback_del(obj, "efl,hbar,press", "efl",
534 obj, _efl_ui_grid_hbar_press_cb, NULL);
535 efl_layout_signal_callback_del(obj, "efl,hbar,unpress", "efl",
536 obj, _efl_ui_grid_hbar_unpress_cb, NULL);
537}
538
539static void
540_efl_ui_grid_content_moved_cb(void *data, const Efl_Event *ev EINA_UNUSED) 324_efl_ui_grid_content_moved_cb(void *data, const Efl_Event *ev EINA_UNUSED)
541{ 325{
542 Eo *obj = data; 326 Eo *obj = data;
@@ -608,7 +392,7 @@ _efl_ui_grid_efl_object_finalize(Eo *obj,
608 pd->item.size.h = 1; 392 pd->item.size.h = 1;
609 } 393 }
610 394
611 _scroll_edje_object_attach(obj); 395 efl_ui_scroll_connector_bind(obj, pd->smanager);
612 396
613 //FIXME: Workaround code! fake Content for pan resize. 397 //FIXME: Workaround code! fake Content for pan resize.
614 // to remove this code, we need to customize pan class. 398 // to remove this code, we need to customize pan class.
@@ -642,7 +426,7 @@ _efl_ui_grid_efl_object_finalize(Eo *obj,
642EOLIAN static void 426EOLIAN static void
643_efl_ui_grid_efl_object_invalidate(Eo *obj, Efl_Ui_Grid_Data *pd) 427_efl_ui_grid_efl_object_invalidate(Eo *obj, Efl_Ui_Grid_Data *pd)
644{ 428{
645 _scroll_edje_object_detach(obj); 429 efl_ui_scroll_connector_unbind(obj);
646 430
647 efl_event_callback_del(obj, EFL_UI_SCROLLBAR_EVENT_BAR_SIZE_CHANGED, 431 efl_event_callback_del(obj, EFL_UI_SCROLLBAR_EVENT_BAR_SIZE_CHANGED,
648 _efl_ui_grid_bar_size_changed_cb, obj); 432 _efl_ui_grid_bar_size_changed_cb, obj);
diff --git a/src/lib/elementary/efl_ui_scroll_util.c b/src/lib/elementary/efl_ui_scroll_util.c
new file mode 100644
index 0000000000..45ba2d3f6e
--- /dev/null
+++ b/src/lib/elementary/efl_ui_scroll_util.c
@@ -0,0 +1,329 @@
1#ifdef HAVE_CONFIG_H
2#include "elementary_config.h"
3#endif
4#define EFL_UI_SCROLL_MANAGER_PROTECTED
5#define EFL_UI_SCROLLBAR_PROTECTED
6
7#include <Elementary.h>
8#include <Efl_Ui.h>
9#include "elm_priv.h"
10
11typedef struct {
12 Eo *obj;
13 Eo *smanager;
14 int freeze_want;
15} Scroll_Connector_Context;
16
17static void
18_scroll_connector_bar_read_and_update(Scroll_Connector_Context *ctx)
19{
20 ELM_WIDGET_DATA_GET_OR_RETURN(ctx->obj, wd);
21 double vx = 0.0, vy = 0.0;
22
23 edje_object_part_drag_value_get
24 (wd->resize_obj, "efl.dragable.vbar", NULL, &vy);
25
26 edje_object_part_drag_value_get
27 (wd->resize_obj, "efl.dragable.hbar", &vx, NULL);
28
29 efl_ui_scrollbar_bar_position_set(ctx->smanager, vx, vy);
30}
31
32static void
33_scroll_connector_reload_cb(void *data,
34 Evas_Object *obj EINA_UNUSED,
35 const char *emission EINA_UNUSED,
36 const char *source EINA_UNUSED)
37{
38 Scroll_Connector_Context *ctx = data;
39
40 efl_ui_scrollbar_bar_visibility_update(ctx->smanager);
41}
42
43
44static void
45_scroll_connector_edje_drag_cb(void *data,
46 Evas_Object *obj EINA_UNUSED,
47 const char *emission EINA_UNUSED,
48 const char *source EINA_UNUSED)
49{
50 Scroll_Connector_Context *ctx = data;
51
52 _scroll_connector_bar_read_and_update(ctx);
53}
54
55static void
56_scroll_connector_edje_drag_start_cb(void *data,
57 Evas_Object *obj EINA_UNUSED,
58 const char *emission EINA_UNUSED,
59 const char *source EINA_UNUSED)
60{
61 Scroll_Connector_Context *ctx = data;
62
63 _scroll_connector_bar_read_and_update(ctx);
64
65 ctx->freeze_want = efl_ui_scrollable_scroll_freeze_get(ctx->smanager);
66 efl_ui_scrollable_scroll_freeze_set(ctx->smanager, EINA_TRUE);
67 efl_event_callback_call(ctx->obj, EFL_UI_EVENT_SCROLL_DRAG_START, NULL);
68}
69
70static void
71_scroll_connector_edje_drag_stop_cb(void *data,
72 Evas_Object *obj EINA_UNUSED,
73 const char *emission EINA_UNUSED,
74 const char *source EINA_UNUSED)
75{
76 Scroll_Connector_Context *ctx = data;
77
78 _scroll_connector_bar_read_and_update(ctx);
79 EINA_SAFETY_ON_TRUE_RETURN(ctx->freeze_want == -1);
80 efl_ui_scrollable_scroll_freeze_set(ctx->smanager, ctx->freeze_want);
81 ctx->freeze_want = -1;
82 efl_event_callback_call(ctx->obj, EFL_UI_EVENT_SCROLL_DRAG_STOP, NULL);
83}
84
85static void
86_scroll_connector_vbar_drag_cb(void *data,
87 Evas_Object *obj EINA_UNUSED,
88 const char *emission EINA_UNUSED,
89 const char *source EINA_UNUSED)
90{
91 Scroll_Connector_Context *ctx = data;
92 Efl_Ui_Scrollbar_Direction type;
93
94 _scroll_connector_bar_read_and_update(ctx);
95
96 type = EFL_UI_SCROLLBAR_DIRECTION_VERTICAL;
97 efl_event_callback_call(ctx->obj, EFL_UI_SCROLLBAR_EVENT_BAR_DRAG, &type);
98}
99
100static void
101_scroll_connector_vbar_press_cb(void *data,
102 Evas_Object *obj EINA_UNUSED,
103 const char *emission EINA_UNUSED,
104 const char *source EINA_UNUSED)
105{
106 Scroll_Connector_Context *ctx = data;
107 Efl_Ui_Scrollbar_Direction type = EFL_UI_SCROLLBAR_DIRECTION_VERTICAL;
108
109 efl_event_callback_call(ctx->obj, EFL_UI_SCROLLBAR_EVENT_BAR_PRESS, &type);
110}
111
112static void
113_scroll_connector_vbar_unpress_cb(void *data,
114 Evas_Object *obj EINA_UNUSED,
115 const char *emission EINA_UNUSED,
116 const char *source EINA_UNUSED)
117{
118 Scroll_Connector_Context *ctx = data;
119 Efl_Ui_Scrollbar_Direction type = EFL_UI_SCROLLBAR_DIRECTION_VERTICAL;
120
121 efl_event_callback_call(ctx->obj, EFL_UI_SCROLLBAR_EVENT_BAR_UNPRESS, &type);
122}
123
124static void
125_scroll_connector_hbar_drag_cb(void *data,
126 Evas_Object *obj EINA_UNUSED,
127 const char *emission EINA_UNUSED,
128 const char *source EINA_UNUSED)
129{
130 Scroll_Connector_Context *ctx = data;
131 Efl_Ui_Scrollbar_Direction type = EFL_UI_SCROLLBAR_DIRECTION_HORIZONTAL;
132
133 _scroll_connector_bar_read_and_update(ctx);
134 efl_event_callback_call(ctx->obj, EFL_UI_SCROLLBAR_EVENT_BAR_DRAG, &type);
135}
136
137static void
138_scroll_connector_hbar_press_cb(void *data,
139 Evas_Object *obj EINA_UNUSED,
140 const char *emission EINA_UNUSED,
141 const char *source EINA_UNUSED)
142{
143 Scroll_Connector_Context *ctx = data;
144 Efl_Ui_Scrollbar_Direction type = EFL_UI_SCROLLBAR_DIRECTION_HORIZONTAL;
145
146 efl_event_callback_call(ctx->obj, EFL_UI_SCROLLBAR_EVENT_BAR_PRESS, &type);
147}
148
149static void
150_scroll_connector_hbar_unpress_cb(void *data,
151 Evas_Object *obj EINA_UNUSED,
152 const char *emission EINA_UNUSED,
153 const char *source EINA_UNUSED)
154{
155 Scroll_Connector_Context *ctx = data;
156 Efl_Ui_Scrollbar_Direction type = EFL_UI_SCROLLBAR_DIRECTION_HORIZONTAL;
157
158 efl_event_callback_call(ctx->obj, EFL_UI_SCROLLBAR_EVENT_BAR_UNPRESS, &type);
159}
160
161static void
162_scroll_connector_bar_size_changed_cb(void *data, const Efl_Event *event EINA_UNUSED)
163{
164 Scroll_Connector_Context *ctx = data;
165 ELM_WIDGET_DATA_GET_OR_RETURN(ctx->obj, wd);
166
167 double width = 0.0, height = 0.0;
168
169 edje_object_calc_force(wd->resize_obj);
170 efl_ui_scrollbar_bar_size_get(ctx->smanager, &width, &height);
171 edje_object_part_drag_size_set(wd->resize_obj, "efl.dragable.hbar", width, 1.0);
172 edje_object_part_drag_size_set(wd->resize_obj, "efl.dragable.vbar", 1.0, height);
173}
174
175static void
176_scroll_connector_bar_pos_changed_cb(void *data, const Efl_Event *event EINA_UNUSED)
177{
178 Scroll_Connector_Context *ctx = data;
179 ELM_WIDGET_DATA_GET_OR_RETURN(ctx->obj, wd);
180
181 double posx = 0.0, posy = 0.0;
182
183 efl_ui_scrollbar_bar_position_get(ctx->smanager, &posx, &posy);
184 edje_object_part_drag_value_set(wd->resize_obj, "efl.dragable.hbar", posx, 0.0);
185 edje_object_part_drag_value_set(wd->resize_obj, "efl.dragable.vbar", 0.0, posy);
186}
187
188static void
189_scroll_connector_bar_show_cb(void *data, const Efl_Event *event)
190{
191 Scroll_Connector_Context *ctx = data;
192 ELM_WIDGET_DATA_GET_OR_RETURN(ctx->obj, wd);
193 Efl_Ui_Scrollbar_Direction type = *(Efl_Ui_Scrollbar_Direction *)(event->info);
194
195 if (type == EFL_UI_SCROLLBAR_DIRECTION_HORIZONTAL)
196 efl_layout_signal_emit(wd->resize_obj, "efl,action,show,hbar", "efl");
197 else if (type == EFL_UI_SCROLLBAR_DIRECTION_VERTICAL)
198 efl_layout_signal_emit(wd->resize_obj, "efl,action,show,vbar", "efl");
199}
200
201static void
202_scroll_connector_bar_hide_cb(void *data, const Efl_Event *event)
203{
204 Scroll_Connector_Context *ctx = data;
205 ELM_WIDGET_DATA_GET_OR_RETURN(ctx->obj, wd);
206 Efl_Ui_Scrollbar_Direction type = *(Efl_Ui_Scrollbar_Direction *)(event->info);
207
208 if (type == EFL_UI_SCROLLBAR_DIRECTION_HORIZONTAL)
209 efl_layout_signal_emit(wd->resize_obj, "efl,action,hide,hbar", "efl");
210 else if (type == EFL_UI_SCROLLBAR_DIRECTION_VERTICAL)
211 efl_layout_signal_emit(wd->resize_obj, "efl,action,hide,vbar", "efl");
212}
213static void
214_scroll_connector_resized_cb(void *data, const Efl_Event *ev EINA_UNUSED)
215{
216 Scroll_Connector_Context *ctx = data;
217 elm_layout_sizing_eval(ctx->obj);
218}
219
220static void
221_scroll_connector_size_hint_changed_cb(void *data, const Efl_Event *ev EINA_UNUSED)
222{
223 Scroll_Connector_Context *ctx = data;
224 elm_layout_sizing_eval(ctx->obj);
225}
226
227void
228efl_ui_scroll_connector_bind(Eo *obj, Eo *manager)
229{
230 Scroll_Connector_Context *ctx = calloc(1, sizeof(Scroll_Connector_Context));
231 ctx->obj = obj;
232 ctx->smanager = manager;
233 efl_key_data_set(obj, "__context", ctx);
234
235 //from the theme to the object
236 efl_layout_signal_callback_add(obj, "reload", "efl",
237 ctx, _scroll_connector_reload_cb, NULL);
238 efl_layout_signal_callback_add(obj, "drag", "efl.dragable.vbar",
239 ctx, _scroll_connector_vbar_drag_cb, NULL);
240 efl_layout_signal_callback_add(obj, "drag,set", "efl.dragable.vbar",
241 ctx, _scroll_connector_edje_drag_cb, NULL);
242 efl_layout_signal_callback_add(obj, "drag,start", "efl.dragable.vbar",
243 ctx, _scroll_connector_edje_drag_start_cb, NULL);
244 efl_layout_signal_callback_add(obj, "drag,stop", "efl.dragable.vbar",
245 ctx, _scroll_connector_edje_drag_stop_cb, NULL);
246 efl_layout_signal_callback_add(obj, "drag,step", "efl.dragable.vbar",
247 ctx, _scroll_connector_edje_drag_cb, NULL);
248 efl_layout_signal_callback_add(obj, "drag,page", "efl.dragable.vbar",
249 ctx, _scroll_connector_edje_drag_cb, NULL);
250 efl_layout_signal_callback_add(obj, "efl,vbar,press", "efl",
251 ctx, _scroll_connector_vbar_press_cb, NULL);
252 efl_layout_signal_callback_add(obj, "efl,vbar,unpress", "efl",
253 ctx, _scroll_connector_vbar_unpress_cb, NULL);
254 efl_layout_signal_callback_add(obj, "drag", "efl.dragable.hbar",
255 ctx, _scroll_connector_hbar_drag_cb, NULL);
256 efl_layout_signal_callback_add(obj, "drag,set", "efl.dragable.hbar",
257 ctx, _scroll_connector_edje_drag_cb, NULL);
258 efl_layout_signal_callback_add(obj, "drag,start", "efl.dragable.hbar",
259 ctx, _scroll_connector_edje_drag_start_cb, NULL);
260 efl_layout_signal_callback_add(obj, "drag,stop", "efl.dragable.hbar",
261 ctx, _scroll_connector_edje_drag_stop_cb, NULL);
262 efl_layout_signal_callback_add(obj, "drag,step", "efl.dragable.hbar",
263 ctx, _scroll_connector_edje_drag_cb, NULL);
264 efl_layout_signal_callback_add(obj, "drag,page", "efl.dragable.hbar",
265 ctx, _scroll_connector_edje_drag_cb, NULL);
266 efl_layout_signal_callback_add(obj, "efl,hbar,press", "efl",
267 ctx, _scroll_connector_hbar_press_cb, NULL);
268 efl_layout_signal_callback_add(obj, "efl,hbar,unpress", "efl",
269 ctx, _scroll_connector_hbar_unpress_cb, NULL);
270 //from the object to the theme
271 efl_event_callback_add(obj, EFL_UI_SCROLLBAR_EVENT_BAR_SIZE_CHANGED,
272 _scroll_connector_bar_size_changed_cb, ctx);
273 efl_event_callback_add(obj, EFL_UI_SCROLLBAR_EVENT_BAR_POS_CHANGED,
274 _scroll_connector_bar_pos_changed_cb, ctx);
275 efl_event_callback_add(obj, EFL_UI_SCROLLBAR_EVENT_BAR_SHOW,
276 _scroll_connector_bar_show_cb, ctx);
277 efl_event_callback_add(obj, EFL_UI_SCROLLBAR_EVENT_BAR_HIDE,
278 _scroll_connector_bar_hide_cb, ctx);
279 efl_event_callback_add(obj, EFL_GFX_ENTITY_EVENT_SIZE_CHANGED,
280 _scroll_connector_resized_cb, ctx);
281 efl_event_callback_add(obj, EFL_GFX_ENTITY_EVENT_HINTS_CHANGED,
282 _scroll_connector_size_hint_changed_cb, ctx);
283}
284
285void
286efl_ui_scroll_connector_unbind(Eo *obj)
287{
288 Scroll_Connector_Context *ctx;
289
290 ctx = efl_key_data_get(obj, "__context");
291 EINA_SAFETY_ON_NULL_RETURN(ctx);
292
293 efl_layout_signal_callback_del(obj, "reload", "efl",
294 ctx, _scroll_connector_reload_cb, NULL);
295 efl_layout_signal_callback_del(obj, "drag", "efl.dragable.vbar",
296 ctx, _scroll_connector_vbar_drag_cb, NULL);
297 efl_layout_signal_callback_del(obj, "drag,set", "efl.dragable.vbar",
298 ctx, _scroll_connector_edje_drag_cb, NULL);
299 efl_layout_signal_callback_del(obj, "drag,start", "efl.dragable.vbar",
300 ctx, _scroll_connector_edje_drag_start_cb, NULL);
301 efl_layout_signal_callback_del(obj, "drag,stop", "efl.dragable.vbar",
302 ctx, _scroll_connector_edje_drag_stop_cb, NULL);
303 efl_layout_signal_callback_del(obj, "drag,step", "efl.dragable.vbar",
304 ctx, _scroll_connector_edje_drag_cb, NULL);
305 efl_layout_signal_callback_del(obj, "drag,page", "efl.dragable.vbar",
306 ctx, _scroll_connector_edje_drag_cb, NULL);
307 efl_layout_signal_callback_del(obj, "efl,vbar,press", "efl",
308 ctx, _scroll_connector_vbar_press_cb, NULL);
309 efl_layout_signal_callback_del(obj, "efl,vbar,unpress", "efl",
310 ctx, _scroll_connector_vbar_unpress_cb, NULL);
311
312 efl_layout_signal_callback_del(obj, "drag", "efl.dragable.hbar",
313 ctx, _scroll_connector_hbar_drag_cb, NULL);
314 efl_layout_signal_callback_del(obj, "drag,set", "efl.dragable.hbar",
315 ctx, _scroll_connector_edje_drag_cb, NULL);
316 efl_layout_signal_callback_del(obj, "drag,start", "efl.dragable.hbar",
317 ctx, _scroll_connector_edje_drag_start_cb, NULL);
318 efl_layout_signal_callback_del(obj, "drag,stop", "efl.dragable.hbar",
319 ctx, _scroll_connector_edje_drag_stop_cb, NULL);
320 efl_layout_signal_callback_del(obj, "drag,step", "efl.dragable.hbar",
321 ctx, _scroll_connector_edje_drag_cb, NULL);
322 efl_layout_signal_callback_del(obj, "drag,page", "efl.dragable.hbar",
323 ctx, _scroll_connector_edje_drag_cb, NULL);
324 efl_layout_signal_callback_del(obj, "efl,hbar,press", "efl",
325 ctx, _scroll_connector_hbar_press_cb, NULL);
326 efl_layout_signal_callback_del(obj, "efl,hbar,unpress", "efl",
327 ctx, _scroll_connector_hbar_unpress_cb, NULL);
328 free(ctx);
329}
diff --git a/src/lib/elementary/efl_ui_scroller.c b/src/lib/elementary/efl_ui_scroller.c
index 50113c12b1..c731fe6572 100644
--- a/src/lib/elementary/efl_ui_scroller.c
+++ b/src/lib/elementary/efl_ui_scroller.c
@@ -212,329 +212,12 @@ _efl_ui_scroller_efl_content_content_unset(Eo *obj EINA_UNUSED, Efl_Ui_Scroller_
212} 212}
213 213
214static void 214static void
215_efl_ui_scroller_bar_read_and_update(Eo *obj)
216{
217 EFL_UI_SCROLLER_DATA_GET_OR_RETURN(obj, sd);
218 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
219 double vx, vy;
220
221 edje_object_part_drag_value_get
222 (wd->resize_obj, "efl.dragable.vbar", NULL, &vy);
223 edje_object_part_drag_value_get
224 (wd->resize_obj, "efl.dragable.hbar", &vx, NULL);
225
226 efl_ui_scrollbar_bar_position_set(sd->smanager, vx, vy);
227}
228
229static void
230_efl_ui_scroller_reload_cb(void *data,
231 Evas_Object *obj EINA_UNUSED,
232 const char *emission EINA_UNUSED,
233 const char *source EINA_UNUSED)
234{
235 Eo *scroller = data;
236 EFL_UI_SCROLLER_DATA_GET_OR_RETURN(scroller, sd);
237
238 efl_ui_scrollbar_bar_visibility_update(sd->smanager);
239}
240
241static void
242_efl_ui_scroller_vbar_drag_cb(void *data,
243 Evas_Object *obj EINA_UNUSED,
244 const char *emission EINA_UNUSED,
245 const char *source EINA_UNUSED)
246{
247 _efl_ui_scroller_bar_read_and_update(data);
248
249 Efl_Ui_Scrollbar_Direction type = EFL_UI_SCROLLBAR_DIRECTION_VERTICAL;
250 efl_event_callback_call(data, EFL_UI_SCROLLBAR_EVENT_BAR_DRAG, &type);
251}
252
253static void
254_efl_ui_scroller_vbar_press_cb(void *data,
255 Evas_Object *obj EINA_UNUSED,
256 const char *emission EINA_UNUSED,
257 const char *source EINA_UNUSED)
258{
259 Efl_Ui_Scrollbar_Direction type = EFL_UI_SCROLLBAR_DIRECTION_VERTICAL;
260 efl_event_callback_call(data, EFL_UI_SCROLLBAR_EVENT_BAR_PRESS, &type);
261}
262
263static void
264_efl_ui_scroller_vbar_unpress_cb(void *data,
265 Evas_Object *obj EINA_UNUSED,
266 const char *emission EINA_UNUSED,
267 const char *source EINA_UNUSED)
268{
269 Efl_Ui_Scrollbar_Direction type = EFL_UI_SCROLLBAR_DIRECTION_VERTICAL;
270 efl_event_callback_call(data, EFL_UI_SCROLLBAR_EVENT_BAR_UNPRESS, &type);
271}
272
273static void
274_efl_ui_scroller_edje_drag_start_cb(void *data,
275 Evas_Object *obj EINA_UNUSED,
276 const char *emission EINA_UNUSED,
277 const char *source EINA_UNUSED)
278{
279 Eo *scroller = data;
280 EFL_UI_SCROLLER_DATA_GET_OR_RETURN(scroller, sd);
281
282 _efl_ui_scroller_bar_read_and_update(scroller);
283
284 sd->freeze_want = efl_ui_scrollable_scroll_freeze_get(sd->smanager);
285 efl_ui_scrollable_scroll_freeze_set(sd->smanager, EINA_TRUE);
286 efl_event_callback_call(scroller, EFL_UI_EVENT_SCROLL_DRAG_START, NULL);
287}
288
289static void
290_efl_ui_scroller_edje_drag_stop_cb(void *data,
291 Evas_Object *obj EINA_UNUSED,
292 const char *emission EINA_UNUSED,
293 const char *source EINA_UNUSED)
294{
295 Eo *scroller = data;
296 EFL_UI_SCROLLER_DATA_GET_OR_RETURN(scroller, sd);
297
298 _efl_ui_scroller_bar_read_and_update(scroller);
299
300 efl_ui_scrollable_scroll_freeze_set(sd->smanager, sd->freeze_want);
301 efl_event_callback_call(scroller, EFL_UI_EVENT_SCROLL_DRAG_STOP, NULL);
302}
303
304static void
305_efl_ui_scroller_edje_drag_cb(void *data,
306 Evas_Object *obj EINA_UNUSED,
307 const char *emission EINA_UNUSED,
308 const char *source EINA_UNUSED)
309{
310 _efl_ui_scroller_bar_read_and_update(data);
311}
312
313static void
314_efl_ui_scroller_hbar_drag_cb(void *data,
315 Evas_Object *obj EINA_UNUSED,
316 const char *emission EINA_UNUSED,
317 const char *source EINA_UNUSED)
318{
319 _efl_ui_scroller_bar_read_and_update(data);
320
321 Efl_Ui_Scrollbar_Direction type = EFL_UI_SCROLLBAR_DIRECTION_HORIZONTAL;
322 efl_event_callback_call(data, EFL_UI_SCROLLBAR_EVENT_BAR_DRAG, &type);
323}
324
325static void
326_efl_ui_scroller_hbar_press_cb(void *data,
327 Evas_Object *obj EINA_UNUSED,
328 const char *emission EINA_UNUSED,
329 const char *source EINA_UNUSED)
330{
331 Efl_Ui_Scrollbar_Direction type = EFL_UI_SCROLLBAR_DIRECTION_HORIZONTAL;
332 efl_event_callback_call(data, EFL_UI_SCROLLBAR_EVENT_BAR_PRESS, &type);
333}
334
335static void
336_efl_ui_scroller_hbar_unpress_cb(void *data,
337 Evas_Object *obj EINA_UNUSED,
338 const char *emission EINA_UNUSED,
339 const char *source EINA_UNUSED)
340{
341 Efl_Ui_Scrollbar_Direction type = EFL_UI_SCROLLBAR_DIRECTION_HORIZONTAL;
342 efl_event_callback_call(data, EFL_UI_SCROLLBAR_EVENT_BAR_UNPRESS, &type);
343}
344
345static void
346_efl_ui_scroller_bar_size_changed_cb(void *data, const Efl_Event *event EINA_UNUSED)
347{
348 Eo *obj = data;
349 EFL_UI_SCROLLER_DATA_GET_OR_RETURN(obj, sd);
350 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
351
352 double width = 0.0, height = 0.0;
353
354 edje_object_calc_force(wd->resize_obj);
355 efl_ui_scrollbar_bar_size_get(sd->smanager, &width, &height);
356 edje_object_part_drag_size_set(wd->resize_obj, "efl.dragable.hbar", width, 1.0);
357 edje_object_part_drag_size_set(wd->resize_obj, "efl.dragable.vbar", 1.0, height);
358}
359
360static void
361_efl_ui_scroller_bar_pos_changed_cb(void *data, const Efl_Event *event EINA_UNUSED)
362{
363 Eo *obj = data;
364 EFL_UI_SCROLLER_DATA_GET_OR_RETURN(obj, sd);
365 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
366
367 double posx = 0.0, posy = 0.0;
368
369 efl_ui_scrollbar_bar_position_get(sd->smanager, &posx, &posy);
370 edje_object_part_drag_value_set(wd->resize_obj, "efl.dragable.hbar", posx, 0.0);
371 edje_object_part_drag_value_set(wd->resize_obj, "efl.dragable.vbar", 0.0, posy);
372 edje_object_signal_emit(wd->resize_obj, "efl,action,scroll", "efl");
373}
374
375static void
376_efl_ui_scroller_bar_show_cb(void *data, const Efl_Event *event)
377{
378 Eo *obj = data;
379 EFL_UI_SCROLLER_DATA_GET_OR_RETURN(obj, sd);
380 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
381 Efl_Ui_Scrollbar_Direction type = *(Efl_Ui_Scrollbar_Direction *)(event->info);
382
383 if (type == EFL_UI_SCROLLBAR_DIRECTION_HORIZONTAL)
384 edje_object_signal_emit(wd->resize_obj, "efl,action,show,hbar", "efl");
385 else if (type == EFL_UI_SCROLLBAR_DIRECTION_VERTICAL)
386 edje_object_signal_emit(wd->resize_obj, "efl,action,show,vbar", "efl");
387}
388
389static void
390_efl_ui_scroller_bar_hide_cb(void *data, const Efl_Event *event)
391{
392 Eo *obj = data;
393 EFL_UI_SCROLLER_DATA_GET_OR_RETURN(obj, sd);
394 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
395 Efl_Ui_Scrollbar_Direction type = *(Efl_Ui_Scrollbar_Direction *)(event->info);
396
397 if (type == EFL_UI_SCROLLBAR_DIRECTION_HORIZONTAL)
398 edje_object_signal_emit(wd->resize_obj, "efl,action,hide,hbar", "efl");
399 else if (type == EFL_UI_SCROLLBAR_DIRECTION_VERTICAL)
400 edje_object_signal_emit(wd->resize_obj, "efl,action,hide,vbar", "efl");
401}
402
403static void
404_scroll_edje_object_attach(Eo *obj)
405{
406 EFL_UI_SCROLLER_DATA_GET_OR_RETURN(obj, sd);
407
408 efl_layout_signal_callback_add
409 (obj, "reload", "efl",
410 obj, _efl_ui_scroller_reload_cb, NULL);
411 efl_layout_signal_callback_add
412 (obj, "drag", "efl.dragable.vbar",
413 obj, _efl_ui_scroller_vbar_drag_cb, NULL);
414 efl_layout_signal_callback_add
415 (obj, "drag,set", "efl.dragable.vbar",
416 obj, _efl_ui_scroller_edje_drag_cb, NULL);
417 efl_layout_signal_callback_add
418 (obj, "drag,start", "efl.dragable.vbar",
419 obj, _efl_ui_scroller_edje_drag_start_cb, NULL);
420 efl_layout_signal_callback_add
421 (obj, "drag,stop", "efl.dragable.vbar",
422 obj, _efl_ui_scroller_edje_drag_stop_cb, NULL);
423 efl_layout_signal_callback_add
424 (obj, "drag,step", "efl.dragable.vbar",
425 obj, _efl_ui_scroller_edje_drag_cb, NULL);
426 efl_layout_signal_callback_add
427 (obj, "drag,page", "efl.dragable.vbar",
428 obj, _efl_ui_scroller_edje_drag_cb, NULL);
429 efl_layout_signal_callback_add
430 (obj, "efl,vbar,press", "efl",
431 obj, _efl_ui_scroller_vbar_press_cb, NULL);
432 efl_layout_signal_callback_add
433 (obj, "efl,vbar,unpress", "efl",
434 obj, _efl_ui_scroller_vbar_unpress_cb, NULL);
435 efl_layout_signal_callback_add
436 (obj, "drag", "efl.dragable.hbar",
437 obj, _efl_ui_scroller_hbar_drag_cb, NULL);
438 efl_layout_signal_callback_add
439 (obj, "drag,set", "efl.dragable.hbar",
440 obj, _efl_ui_scroller_edje_drag_cb, NULL);
441 efl_layout_signal_callback_add
442 (obj, "drag,start", "efl.dragable.hbar",
443 obj, _efl_ui_scroller_edje_drag_start_cb, NULL);
444 efl_layout_signal_callback_add
445 (obj, "drag,stop", "efl.dragable.hbar",
446 obj, _efl_ui_scroller_edje_drag_stop_cb, NULL);
447 efl_layout_signal_callback_add
448 (obj, "drag,step", "efl.dragable.hbar",
449 obj, _efl_ui_scroller_edje_drag_cb, NULL);
450 efl_layout_signal_callback_add
451 (obj, "drag,page", "efl.dragable.hbar",
452 obj, _efl_ui_scroller_edje_drag_cb, NULL);
453 efl_layout_signal_callback_add
454 (obj, "efl,hbar,press", "efl",
455 obj, _efl_ui_scroller_hbar_press_cb, NULL);
456 efl_layout_signal_callback_add
457 (obj, "efl,hbar,unpress", "efl",
458 obj, _efl_ui_scroller_hbar_unpress_cb, NULL);
459}
460
461static void
462_scroll_edje_object_detach(Evas_Object *obj)
463{
464 EFL_UI_SCROLLER_DATA_GET_OR_RETURN(obj, sd);
465
466 efl_layout_signal_callback_del
467 (obj, "reload", "efl",
468 obj, _efl_ui_scroller_reload_cb, NULL);
469 efl_layout_signal_callback_del
470 (obj, "drag", "efl.dragable.vbar",
471 obj, _efl_ui_scroller_vbar_drag_cb, NULL);
472 efl_layout_signal_callback_del
473 (obj, "drag,set", "efl.dragable.vbar",
474 obj, _efl_ui_scroller_edje_drag_cb, NULL);
475 efl_layout_signal_callback_del
476 (obj, "drag,start", "efl.dragable.vbar",
477 obj, _efl_ui_scroller_edje_drag_start_cb, NULL);
478 efl_layout_signal_callback_del
479 (obj, "drag,stop", "efl.dragable.vbar",
480 obj, _efl_ui_scroller_edje_drag_stop_cb, NULL);
481 efl_layout_signal_callback_del
482 (obj, "drag,step", "efl.dragable.vbar",
483 obj, _efl_ui_scroller_edje_drag_cb, NULL);
484 efl_layout_signal_callback_del
485 (obj, "drag,page", "efl.dragable.vbar",
486 obj, _efl_ui_scroller_edje_drag_cb, NULL);
487 efl_layout_signal_callback_del
488 (obj, "efl,vbar,press", "efl",
489 obj, _efl_ui_scroller_vbar_press_cb, NULL);
490 efl_layout_signal_callback_del
491 (obj, "efl,vbar,unpress", "efl",
492 obj, _efl_ui_scroller_vbar_unpress_cb, NULL);
493 efl_layout_signal_callback_del
494 (obj, "drag", "efl.dragable.hbar",
495 obj, _efl_ui_scroller_hbar_drag_cb, NULL);
496 efl_layout_signal_callback_del
497 (obj, "drag,set", "efl.dragable.hbar",
498 obj, _efl_ui_scroller_edje_drag_cb, NULL);
499 efl_layout_signal_callback_del
500 (obj, "drag,start", "efl.dragable.hbar",
501 obj, _efl_ui_scroller_edje_drag_start_cb, NULL);
502 efl_layout_signal_callback_del
503 (obj, "drag,stop", "efl.dragable.hbar",
504 obj, _efl_ui_scroller_edje_drag_stop_cb, NULL);
505 efl_layout_signal_callback_del
506 (obj, "drag,step", "efl.dragable.hbar",
507 obj, _efl_ui_scroller_edje_drag_cb, NULL);
508 efl_layout_signal_callback_del
509 (obj, "drag,page", "efl.dragable.hbar",
510 obj, _efl_ui_scroller_edje_drag_cb, NULL);
511 efl_layout_signal_callback_del
512 (obj, "efl,hbar,press", "efl",
513 obj, _efl_ui_scroller_hbar_press_cb, NULL);
514 efl_layout_signal_callback_del
515 (obj, "efl,hbar,unpress", "efl",
516 obj, _efl_ui_scroller_hbar_unpress_cb, NULL);
517}
518
519static void
520_efl_ui_scroller_pan_resized_cb(void *data, const Efl_Event *ev EINA_UNUSED) 215_efl_ui_scroller_pan_resized_cb(void *data, const Efl_Event *ev EINA_UNUSED)
521{ 216{
522 elm_layout_sizing_eval(data); 217 elm_layout_sizing_eval(data);
523} 218}
524 219
525static void 220static void
526_efl_ui_scroller_resized_cb(void *data, const Efl_Event *ev EINA_UNUSED)
527{
528 elm_layout_sizing_eval(data);
529}
530
531static void
532_efl_ui_scroller_size_hint_changed_cb(void *data, const Efl_Event *ev EINA_UNUSED)
533{
534 elm_layout_sizing_eval(data);
535}
536
537static void
538_focused_element(void *data, const Efl_Event *event) 221_focused_element(void *data, const Efl_Event *event)
539{ 222{
540 Eina_Rect geom; 223 Eina_Rect geom;
@@ -566,7 +249,7 @@ _efl_ui_scroller_efl_object_constructor(Eo *obj,
566 249
567EOLIAN static Eo * 250EOLIAN static Eo *
568_efl_ui_scroller_efl_object_finalize(Eo *obj, 251_efl_ui_scroller_efl_object_finalize(Eo *obj,
569 Efl_Ui_Scroller_Data *sd EINA_UNUSED) 252 Efl_Ui_Scroller_Data *sd)
570{ 253{
571 obj = efl_finalize(efl_super(obj, MY_CLASS)); 254 obj = efl_finalize(efl_super(obj, MY_CLASS));
572 255
@@ -583,20 +266,7 @@ _efl_ui_scroller_efl_object_finalize(Eo *obj,
583 266
584 elm_widget_can_focus_set(obj, EINA_TRUE); 267 elm_widget_can_focus_set(obj, EINA_TRUE);
585 268
586 _scroll_edje_object_attach(obj); 269 efl_ui_scroll_connector_bind(obj, sd->smanager);
587
588 efl_event_callback_add(obj, EFL_UI_SCROLLBAR_EVENT_BAR_SIZE_CHANGED,
589 _efl_ui_scroller_bar_size_changed_cb, obj);
590 efl_event_callback_add(obj, EFL_UI_SCROLLBAR_EVENT_BAR_POS_CHANGED,
591 _efl_ui_scroller_bar_pos_changed_cb, obj);
592 efl_event_callback_add(obj, EFL_UI_SCROLLBAR_EVENT_BAR_SHOW,
593 _efl_ui_scroller_bar_show_cb, obj);
594 efl_event_callback_add(obj, EFL_UI_SCROLLBAR_EVENT_BAR_HIDE,
595 _efl_ui_scroller_bar_hide_cb, obj);
596 efl_event_callback_add(obj, EFL_GFX_ENTITY_EVENT_SIZE_CHANGED,
597 _efl_ui_scroller_resized_cb, obj);
598 efl_event_callback_add(obj, EFL_GFX_ENTITY_EVENT_HINTS_CHANGED,
599 _efl_ui_scroller_size_hint_changed_cb, obj);
600 efl_event_callback_add(sd->pan_obj, EFL_GFX_ENTITY_EVENT_SIZE_CHANGED, 270 efl_event_callback_add(sd->pan_obj, EFL_GFX_ENTITY_EVENT_SIZE_CHANGED,
601 _efl_ui_scroller_pan_resized_cb, obj); 271 _efl_ui_scroller_pan_resized_cb, obj);
602 272
@@ -606,22 +276,9 @@ _efl_ui_scroller_efl_object_finalize(Eo *obj,
606 276
607EOLIAN static void 277EOLIAN static void
608_efl_ui_scroller_efl_object_destructor(Eo *obj, 278_efl_ui_scroller_efl_object_destructor(Eo *obj,
609 Efl_Ui_Scroller_Data *sd EINA_UNUSED) 279 Efl_Ui_Scroller_Data *sd)
610{ 280{
611 _scroll_edje_object_detach(obj); 281 efl_ui_scroll_connector_unbind(obj);
612
613 efl_event_callback_del(obj, EFL_UI_SCROLLBAR_EVENT_BAR_SIZE_CHANGED,
614 _efl_ui_scroller_bar_size_changed_cb, obj);
615 efl_event_callback_del(obj, EFL_UI_SCROLLBAR_EVENT_BAR_POS_CHANGED,
616 _efl_ui_scroller_bar_pos_changed_cb, obj);
617 efl_event_callback_del(obj, EFL_UI_SCROLLBAR_EVENT_BAR_SHOW,
618 _efl_ui_scroller_bar_show_cb, obj);
619 efl_event_callback_del(obj, EFL_UI_SCROLLBAR_EVENT_BAR_HIDE,
620 _efl_ui_scroller_bar_hide_cb, obj);
621 efl_event_callback_del(obj, EFL_GFX_ENTITY_EVENT_SIZE_CHANGED,
622 _efl_ui_scroller_resized_cb, obj);
623 efl_event_callback_del(obj, EFL_GFX_ENTITY_EVENT_HINTS_CHANGED,
624 _efl_ui_scroller_size_hint_changed_cb, obj);
625 efl_event_callback_del(sd->pan_obj, EFL_GFX_ENTITY_EVENT_SIZE_CHANGED, 282 efl_event_callback_del(sd->pan_obj, EFL_GFX_ENTITY_EVENT_SIZE_CHANGED,
626 _efl_ui_scroller_pan_resized_cb, obj); 283 _efl_ui_scroller_pan_resized_cb, obj);
627 efl_del(sd->pan_obj); 284 efl_del(sd->pan_obj);
diff --git a/src/lib/elementary/elm_priv.h b/src/lib/elementary/elm_priv.h
index 6af1ae3744..e621edf3c0 100644
--- a/src/lib/elementary/elm_priv.h
+++ b/src/lib/elementary/elm_priv.h
@@ -1025,5 +1025,19 @@ void _efl_ui_focus_event_redirector(Efl_Ui_Focus_Object *obj, Efl_Ui_Focus_Objec
1025void efl_ui_widget_internal_set(Eo *obj, Eina_Bool internal); 1025void efl_ui_widget_internal_set(Eo *obj, Eina_Bool internal);
1026Eina_Bool efl_ui_widget_internal_get(Eo *obj); 1026Eina_Bool efl_ui_widget_internal_get(Eo *obj);
1027 1027
1028/**
1029 * Connect the default scrollable theme signals with the object events and vice versa
1030 *
1031 * @param obj The object where to listen for theme signals
1032 * @param manager The scroll manager object where to listen for events
1033 */
1034void efl_ui_scroll_connector_bind(Eo *obj, Eo *manager);
1035
1036/**
1037 * Connect the default scrollable theme signals with the object events and vice versa
1038 *
1039 * @param obj The object where we are listening for events
1040 */
1041void efl_ui_scroll_connector_unbind(Eo *obj);
1028 1042
1029#endif 1043#endif
diff --git a/src/lib/elementary/meson.build b/src/lib/elementary/meson.build
index 59d355cc71..92e780d728 100644
--- a/src/lib/elementary/meson.build
+++ b/src/lib/elementary/meson.build
@@ -937,6 +937,7 @@ elementary_src = [
937 'efl_ui_clickable.c', 937 'efl_ui_clickable.c',
938 'efl_ui_clickable_util.c', 938 'efl_ui_clickable_util.c',
939 'efl_ui_format.c', 939 'efl_ui_format.c',
940 'efl_ui_scroll_util.c',
940] 941]
941 942
942elementary_deps = [emile, eo, efl, edje, ethumb, ethumb_client, emotion, ecore_imf, ecore_con, eldbus, efreet, efreet_mime, efreet_trash, eio, atspi, dl, intl] 943elementary_deps = [emile, eo, efl, edje, ethumb, ethumb_client, emotion, ecore_imf, ecore_con, eldbus, efreet, efreet_mime, efreet_trash, eio, atspi, dl, intl]