aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Juyung Seo <seojuyung2@gmail.com>2014-04-27 13:43:37 +0900
committerDaniel Juyung Seo <seojuyung2@gmail.com>2014-04-27 13:54:37 +0900
commit535fe6bd974532e771caf5e0ed801f969a2a53cb (patch)
treeaf92110ab83fb497ecae490daf67e52687e9f26a
parentgengrid: removed unnecessary return value check. (diff)
downloadefl-535fe6bd974532e771caf5e0ed801f969a2a53cb.tar.gz
gengrid: Added elm_gengrid_wheel_disabled_set/get() APIs.
Summary: The basic idea is from Abhinandan Aryadipta and I implemented this in upstream. Special thanks to JackDanielZ for eolian madness. @feature Reviewers: JackDanielZ Differential Revision: https://phab.enlightenment.org/D803
-rw-r--r--legacy/elementary/src/bin/test_gengrid.c15
-rw-r--r--legacy/elementary/src/lib/elm_gengrid.c17
-rw-r--r--legacy/elementary/src/lib/elm_gengrid.eo31
-rw-r--r--legacy/elementary/src/lib/elm_widget_gengrid.h1
4 files changed, 64 insertions, 0 deletions
diff --git a/legacy/elementary/src/bin/test_gengrid.c b/legacy/elementary/src/bin/test_gengrid.c
index 1f02d322a0..3beb6dc15f 100644
--- a/legacy/elementary/src/bin/test_gengrid.c
+++ b/legacy/elementary/src/bin/test_gengrid.c
@@ -298,6 +298,12 @@ multi_select_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
}
static void
+wheel_disable_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ elm_gengrid_wheel_disabled_set(data, elm_check_state_get(obj));
+}
+
+static void
clear_bt_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
api_data *api = data;
@@ -541,6 +547,15 @@ test_gengrid(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_i
elm_box_pack_end(bx, ck);
evas_object_show(ck);
+ ck = elm_check_add(win);
+ evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(ck, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_text_set(ck, "Wheel Disable");
+ evas_object_smart_callback_add(ck, "changed", wheel_disable_cb,
+ api->grid);
+ elm_box_pack_end(bx, ck);
+ evas_object_show(ck);
+
/* Gengrid Options 2 */
bx = elm_box_add(win);
elm_box_horizontal_set(bx, EINA_TRUE);
diff --git a/legacy/elementary/src/lib/elm_gengrid.c b/legacy/elementary/src/lib/elm_gengrid.c
index 1d0e1b6ce4..12d1a2eb85 100644
--- a/legacy/elementary/src/lib/elm_gengrid.c
+++ b/legacy/elementary/src/lib/elm_gengrid.c
@@ -4341,6 +4341,23 @@ _elm_gengrid_elm_widget_focused_item_get(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *
}
EOLIAN static void
+_elm_gengrid_wheel_disabled_set(Eo *obj, Elm_Gengrid_Data *sd, Eina_Bool disabled)
+{
+ disabled = !!disabled;
+ if (sd->wheel_disabled != disabled)
+ eo_do(obj,
+ elm_interface_scrollable_wheel_disabled_set(disabled));
+
+ sd->wheel_disabled = disabled;
+}
+
+EOLIAN static Eina_Bool
+_elm_gengrid_wheel_disabled_get(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd)
+{
+ return sd->wheel_disabled;
+}
+
+EOLIAN static void
_elm_gengrid_class_constructor(Eo_Class *klass)
{
if (_elm_config->access_mode)
diff --git a/legacy/elementary/src/lib/elm_gengrid.eo b/legacy/elementary/src/lib/elm_gengrid.eo
index fe0380c793..65ceb6b225 100644
--- a/legacy/elementary/src/lib/elm_gengrid.eo
+++ b/legacy/elementary/src/lib/elm_gengrid.eo
@@ -429,6 +429,37 @@ class Elm_Gengrid (Elm_Layout, Elm_Interface_Scrollable, Evas_Clickable_Interfac
return Elm_Object_Item *;
}
}
+ wheel_disabled {
+ set {
+ /*@
+ Enable or disable mouse wheel to be used to scroll the gengrid.
+
+ Mouse wheel can be used for the user to scroll up and down the gengrid.
+
+ It's enabled by default.
+
+ @see elm_gengrid_wheel_disabled_get()
+
+ @ingroup Gengrid */
+ }
+ get {
+ /*@
+ Get a value whether mouse wheel is enabled or not.
+
+ @return @c EINA_TRUE means gengrid wheel is disabled. @c EINA_FALSE indicates
+ it is enabled.
+
+ Mouse wheel can be used for the user to scroll up and down the gengrid.
+
+ @see elm_gengrid_wheel_disabled_set()
+
+ @ingroup Gengrid */
+ }
+ values {
+ Eina_Bool disabled; /*@ Use @c EINA_TRUE to disable mouse wheel or @c EINA_FALSE
+ to enable it. */
+ }
+ }
}
methods {
item_insert_before {
diff --git a/legacy/elementary/src/lib/elm_widget_gengrid.h b/legacy/elementary/src/lib/elm_widget_gengrid.h
index 01af248c7b..df67408106 100644
--- a/legacy/elementary/src/lib/elm_widget_gengrid.h
+++ b/legacy/elementary/src/lib/elm_widget_gengrid.h
@@ -119,6 +119,7 @@ struct _Elm_Gengrid_Data
Eina_Bool show_region : 1;
Eina_Bool bring_in : 1;
Eina_Bool mouse_down : 1; /**< a flag that mouse is down on the list at the moment. this flag is set to true on mouse and reset to false on mouse up */
+ Eina_Bool wheel_disabled : 1; /**< a flag that shows mouse wheel is disabled or not. */
};
struct Elm_Gen_Item_Type