summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHosang Kim <hosang12.kim@samsung.com>2014-11-20 17:48:36 +0900
committerDaniel Juyung Seo <seojuyung2@gmail.com>2014-11-20 20:29:41 +0900
commit033e68302755ffdc60a1bf76e96f50dab6928cb7 (patch)
tree64f99b6ce4e88ee903521b1e2dd4c91e87c952a5
parentb2611690bd2a1d3fdfc109c14ba3ca46fa71db6e (diff)
Scroller: Add step size set API
Summary: Application do not change step size because only interface API is existed. @feature Test Plan: elementary_test -> scroller -> change step size Reviewers: seoz, Hermet Differential Revision: https://phab.enlightenment.org/D1677
-rw-r--r--src/bin/test_scroller.c18
-rw-r--r--src/lib/elm_scroller.c20
-rw-r--r--src/lib/elm_scroller_legacy.h32
3 files changed, 70 insertions, 0 deletions
diff --git a/src/bin/test_scroller.c b/src/bin/test_scroller.c
index de738797c..8628ca28e 100644
--- a/src/bin/test_scroller.c
+++ b/src/bin/test_scroller.c
@@ -140,6 +140,14 @@ _sc_resize_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_inf
140 evas_object_resize(data, w, h); 140 evas_object_resize(data, w, h);
141} 141}
142 142
143static void
144_size_changed(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
145{
146 Evas_Object *sc = data;
147 int size = elm_spinner_value_get(obj);
148 elm_scroller_step_size_set(sc, ELM_SCALE_SIZE(size), ELM_SCALE_SIZE(size));
149}
150
143void 151void
144test_scroller(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 152test_scroller(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
145{ 153{
@@ -249,6 +257,16 @@ test_scroller(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_
249 sc); 257 sc);
250 evas_object_smart_callback_add(ck5, "changed", my_bt_snap_to_pages, sc); 258 evas_object_smart_callback_add(ck5, "changed", my_bt_snap_to_pages, sc);
251 259
260 bt = elm_spinner_add(win);
261 elm_spinner_min_max_set(bt, 0, 500);
262 elm_scroller_step_size_get(sc, &x, &y);
263 elm_spinner_value_set(bt, x);
264 elm_spinner_editable_set(bt, EINA_TRUE);
265 elm_spinner_label_format_set(bt, "Step size: %.0f");
266 evas_object_smart_callback_add(bt, "changed", _size_changed, sc);
267 elm_box_pack_end(bx, bt);
268 evas_object_show(bt);
269
252 tb2 = elm_table_add(win); 270 tb2 = elm_table_add(win);
253 271
254 bt = elm_button_add(win); 272 bt = elm_button_add(win);
diff --git a/src/lib/elm_scroller.c b/src/lib/elm_scroller.c
index c59c0fbd3..b48bb0869 100644
--- a/src/lib/elm_scroller.c
+++ b/src/lib/elm_scroller.c
@@ -1105,6 +1105,26 @@ elm_scroller_movement_block_get(const Evas_Object *obj)
1105 return block; 1105 return block;
1106} 1106}
1107 1107
1108EAPI void
1109elm_scroller_step_size_set(Evas_Object *obj,
1110 Evas_Coord x,
1111 Evas_Coord y)
1112{
1113 ELM_SCROLLABLE_CHECK(obj);
1114
1115 eo_do(obj, elm_interface_scrollable_step_size_set(x, y));
1116}
1117
1118EAPI void
1119elm_scroller_step_size_get(const Evas_Object *obj,
1120 Evas_Coord *x,
1121 Evas_Coord *y)
1122{
1123 ELM_SCROLLABLE_CHECK(obj);
1124
1125 eo_do((Eo *) obj, elm_interface_scrollable_step_size_get(x, y));
1126}
1127
1108EOLIAN static void 1128EOLIAN static void
1109_elm_scroller_propagate_events_set(Eo *obj, Elm_Scroller_Data *_pd EINA_UNUSED, Eina_Bool propagation) 1129_elm_scroller_propagate_events_set(Eo *obj, Elm_Scroller_Data *_pd EINA_UNUSED, Eina_Bool propagation)
1110{ 1130{
diff --git a/src/lib/elm_scroller_legacy.h b/src/lib/elm_scroller_legacy.h
index 235a3c10d..b0d87b69a 100644
--- a/src/lib/elm_scroller_legacy.h
+++ b/src/lib/elm_scroller_legacy.h
@@ -462,4 +462,36 @@ EAPI void elm_scroller_movement_block_set(Evas_Object *o
462 */ 462 */
463EAPI Elm_Scroller_Movement_Block elm_scroller_movement_block_get(const Evas_Object *obj); 463EAPI Elm_Scroller_Movement_Block elm_scroller_movement_block_get(const Evas_Object *obj);
464 464
465/**
466 * @brief Set scroll step size.
467 *
468 * @param obj The scroller object
469 * @param x The horizontal step size
470 * @param y The vertical step size
471 *
472 * This sets the step size to move scroller by key event.
473 *
474 * @see elm_scroller_step_size_get() for more details
475 *
476 * @since 1.13
477 *
478 * @ingroup Scroller
479 */
480EAPI void elm_scroller_step_size_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
481
482/**
483 * @brief Get the current step size of the scroller object.
484 *
485 * @param obj The scroller object
486 * @param x Where to store its x axis step size
487 * @param y Where to store its y axis step size
488 *
489 * @see elm_scroller_step_size_set() for more details
490 *
491 * @since 1.13
492 *
493 * @ingroup Scroller
494 */
495EAPI void elm_scroller_step_size_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
496
465#include "elm_scroller.eo.legacy.h" 497#include "elm_scroller.eo.legacy.h"