summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUmesh Tanwar <umesh.tanwar@samsung.com>2015-06-22 11:57:51 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-06-22 12:36:57 +0200
commitf69cb53594f969b2a7d07bfe24f2d8eb43d44faa (patch)
tree571e62ffe031278d1adc052f7d8782ca359bb2cb
parent55766647c69d3dc2c38b50ec0cbcfd7d3c0086c7 (diff)
elm_scroller: add wheel_disable_set API
Summary: This API can be used by widgets like Genlist/Gengrid, which implements Elm_Interface_Scrollable interface.Mouse wheel is used to scroll up and down on widget. @feature Test Plan: elementary_test -> Scroller -> Wheel Disable Reviewers: raster, Hermet, cedric, SanghyeonLee, singh.amitesh Subscribers: JackDanielZ, herdsman, cedric, sachin.dev Differential Revision: https://phab.enlightenment.org/D2715 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
-rw-r--r--src/bin/test_scroller.c17
-rw-r--r--src/lib/elm_scroller.c18
-rw-r--r--src/lib/elm_scroller_legacy.h33
3 files changed, 67 insertions, 1 deletions
diff --git a/src/bin/test_scroller.c b/src/bin/test_scroller.c
index 23b2e320c..4c0150897 100644
--- a/src/bin/test_scroller.c
+++ b/src/bin/test_scroller.c
@@ -135,6 +135,15 @@ _my_bt_loop_y_axis(void *data, Evas_Object *obj EINA_UNUSED,
135} 135}
136 136
137static void 137static void
138_my_bt_wheel_disable_cb(void *data, Evas_Object *obj EINA_UNUSED,
139 void *event_info EINA_UNUSED)
140{
141 Evas_Object *scroller = (Evas_Object *)data;
142
143 elm_scroller_wheel_disabled_set(scroller, elm_check_state_get(obj));
144}
145
146static void
138_page_change_cb(void *data EINA_UNUSED, 147_page_change_cb(void *data EINA_UNUSED,
139 Evas_Object *obj, 148 Evas_Object *obj,
140 void *event_info EINA_UNUSED) 149 void *event_info EINA_UNUSED)
@@ -174,7 +183,7 @@ void
174test_scroller(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 183test_scroller(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
175{ 184{
176 Evas_Object *win, *bg2, *tb, *tb2, *sc, *bt, *ck1, *ck2, *bx, *bx2, *fr, 185 Evas_Object *win, *bg2, *tb, *tb2, *sc, *bt, *ck1, *ck2, *bx, *bx2, *fr,
177 *ck3, *ck4, *ck5, *ck6, *ck7; 186 *ck3, *ck4, *ck5, *ck6, *ck7, *ck8;
178 int i, j, n; 187 int i, j, n;
179 char buf[PATH_MAX]; 188 char buf[PATH_MAX];
180 Evas_Coord x = 0, y = 0, w = 0, h = 0; 189 Evas_Coord x = 0, y = 0, w = 0, h = 0;
@@ -246,6 +255,11 @@ test_scroller(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_
246 elm_box_pack_end(bx2, ck7); 255 elm_box_pack_end(bx2, ck7);
247 evas_object_show(ck7); 256 evas_object_show(ck7);
248 257
258 ck8 = elm_check_add(win);
259 elm_object_text_set(ck8, "Wheel Disable");
260 elm_box_pack_end(bx2, ck8);
261 evas_object_show(ck8);
262
249 sc = elm_scroller_add(win); 263 sc = elm_scroller_add(win);
250 evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 264 evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
251 evas_object_size_hint_align_set(sc, EVAS_HINT_FILL, EVAS_HINT_FILL); 265 evas_object_size_hint_align_set(sc, EVAS_HINT_FILL, EVAS_HINT_FILL);
@@ -290,6 +304,7 @@ test_scroller(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_
290 evas_object_smart_callback_add(ck5, "changed", _my_bt_snap_to_pages, sc); 304 evas_object_smart_callback_add(ck5, "changed", _my_bt_snap_to_pages, sc);
291 evas_object_smart_callback_add(ck6, "changed", _my_bt_loop_x_axis, sc); 305 evas_object_smart_callback_add(ck6, "changed", _my_bt_loop_x_axis, sc);
292 evas_object_smart_callback_add(ck7, "changed", _my_bt_loop_y_axis, sc); 306 evas_object_smart_callback_add(ck7, "changed", _my_bt_loop_y_axis, sc);
307 evas_object_smart_callback_add(ck8, "changed", _my_bt_wheel_disable_cb, sc);
293 308
294 bt = elm_spinner_add(win); 309 bt = elm_spinner_add(win);
295 elm_spinner_min_max_set(bt, 0, 500); 310 elm_spinner_min_max_set(bt, 0, 500);
diff --git a/src/lib/elm_scroller.c b/src/lib/elm_scroller.c
index 2e174c9c7..00f18b881 100644
--- a/src/lib/elm_scroller.c
+++ b/src/lib/elm_scroller.c
@@ -1284,6 +1284,24 @@ elm_scroller_loop_get(const Evas_Object *obj,
1284 eo_do(obj, elm_interface_scrollable_loop_get(loop_h, loop_v)); 1284 eo_do(obj, elm_interface_scrollable_loop_get(loop_h, loop_v));
1285} 1285}
1286 1286
1287EAPI void
1288elm_scroller_wheel_disabled_set(Evas_Object *obj, Eina_Bool disabled)
1289{
1290 ELM_SCROLLABLE_CHECK(obj);
1291
1292 eo_do((Eo *)obj, elm_interface_scrollable_wheel_disabled_set(disabled));
1293}
1294
1295EAPI Eina_Bool
1296elm_scroller_wheel_disabled_get(const Evas_Object *obj)
1297{
1298 ELM_SCROLLABLE_CHECK(obj, EINA_FALSE);
1299
1300 Eina_Bool ret;
1301
1302 return eo_do_ret((Eo *) obj, ret, elm_interface_scrollable_wheel_disabled_get());
1303}
1304
1287EOLIAN static void 1305EOLIAN static void
1288_elm_scroller_propagate_events_set(Eo *obj, Elm_Scroller_Data *_pd EINA_UNUSED, Eina_Bool propagation) 1306_elm_scroller_propagate_events_set(Eo *obj, Elm_Scroller_Data *_pd EINA_UNUSED, Eina_Bool propagation)
1289{ 1307{
diff --git a/src/lib/elm_scroller_legacy.h b/src/lib/elm_scroller_legacy.h
index bf4d361e1..576ea6c59 100644
--- a/src/lib/elm_scroller_legacy.h
+++ b/src/lib/elm_scroller_legacy.h
@@ -525,3 +525,36 @@ EAPI void elm_scroller_loop_set(Evas_Object *obj, Eina_
525 * @ingroup Scroller 525 * @ingroup Scroller
526 */ 526 */
527EAPI void elm_scroller_loop_get(const Evas_Object *obj, Eina_Bool *loop_h, Eina_Bool *loop_v); 527EAPI void elm_scroller_loop_get(const Evas_Object *obj, Eina_Bool *loop_h, Eina_Bool *loop_v);
528
529/**
530 * @brief Enable or disable mouse wheel to be used to scroll the scroller.
531 *
532 * @param obj The scroller object
533 * @param disabled The mouse wheel disabled over the scroller.
534 *
535 * Mouse wheel can be used to scroll up and down the scroller.
536 * Wheel is enabled by default.
537 *
538 * @since 1.15
539 *
540 * @see elm_scroller_wheel_disabled_get()
541 *
542 * @ingroup Scroller
543 */
544 EAPI void elm_scroller_wheel_disabled_set(Evas_Object *obj, Eina_Bool disabled);
545
546 /**
547 * @brief Get a value whether mouse wheel is enabled or not over the scroller.
548 *
549 * @param obj The scroller object
550 * @return @c EINA_TRUE means scroller wheel is disabled. @c EINA_FALSE indicates it is enabled.
551 *
552 * Mouse wheel can be used to scroll up and down the scroller.
553 *
554 * @since 1.15
555 *
556 * @see elm_scroller_wheel_disabled_set()
557 *
558 * @ingroup Scroller
559 */
560 EAPI Eina_Bool elm_scroller_wheel_disabled_get(const Evas_Object *obj);