aboutsummaryrefslogtreecommitdiffstats
path: root/legacy
diff options
context:
space:
mode:
authorDave Andreoli <dave@gurumeditation.it>2014-12-29 11:38:17 +0100
committerDave Andreoli <dave@gurumeditation.it>2014-12-29 11:38:17 +0100
commita6486bc1b6491e726b334caf13beed7d6fcb9512 (patch)
tree634e427a0ebf03eb6563debd0c0b9bd8cb852c57 /legacy
parentGenlist: do not fire clicked,right while dragging in progress (diff)
downloadefl-a6486bc1b6491e726b334caf13beed7d6fcb9512.tar.gz
Gengrid: new signal: clicked,right with proper test
@feature
Diffstat (limited to 'legacy')
-rw-r--r--legacy/elementary/src/bin/test_gengrid.c7
-rw-r--r--legacy/elementary/src/lib/elm_gengrid.c22
-rw-r--r--legacy/elementary/src/lib/elm_gengrid.h2
3 files changed, 31 insertions, 0 deletions
diff --git a/legacy/elementary/src/bin/test_gengrid.c b/legacy/elementary/src/bin/test_gengrid.c
index 6412840baa..9a155aa912 100644
--- a/legacy/elementary/src/bin/test_gengrid.c
+++ b/legacy/elementary/src/bin/test_gengrid.c
@@ -223,6 +223,12 @@ grid_double_clicked(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *
}
static void
+grid_right_clicked(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
+{
+ printf("Right clicked: %p\n", event_info);
+}
+
+static void
grid_longpressed(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{
printf("longpressed %p\n", event_info);
@@ -358,6 +364,7 @@ create_gengrid(Evas_Object *obj, int items)
evas_object_smart_callback_add(grid, "selected", grid_selected, NULL);
evas_object_smart_callback_add(grid, "unselected", grid_unselected, NULL);
evas_object_smart_callback_add(grid, "clicked,double", grid_double_clicked, NULL);
+ evas_object_smart_callback_add(grid, "clicked,right", grid_right_clicked, NULL);
evas_object_smart_callback_add(grid, "longpressed", grid_longpressed, NULL);
evas_object_smart_callback_add(grid, "pressed", grid_pressed, NULL);
evas_object_smart_callback_add(grid, "released", grid_released, NULL);
diff --git a/legacy/elementary/src/lib/elm_gengrid.c b/legacy/elementary/src/lib/elm_gengrid.c
index 5ed5c844ff..c9a94d372e 100644
--- a/legacy/elementary/src/lib/elm_gengrid.c
+++ b/legacy/elementary/src/lib/elm_gengrid.c
@@ -39,6 +39,7 @@ EAPI const char ELM_GENGRID_PAN_SMART_NAME[] = "elm_gengrid_pan";
#define ELM_PRIV_GENGRID_SIGNALS(cmd) \
cmd(SIG_ACTIVATED, "activated", "") \
cmd(SIG_CLICKED_DOUBLE, "clicked,double", "") \
+ cmd(SIG_CLICKED_RIGHT, "clicked,right", "") \
cmd(SIG_LONGPRESSED, "longpressed", "") \
cmd(SIG_SELECTED, "selected", "") \
cmd(SIG_UNSELECTED, "unselected", "") \
@@ -569,6 +570,14 @@ _item_mouse_down_cb(void *data,
Evas_Coord x, y;
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
+ if (ev->button == 3)
+ {
+ evas_object_geometry_get(obj, &x, &y, NULL, NULL);
+ it->dx = ev->canvas.x - x;
+ it->dy = ev->canvas.y - y;
+ return;
+ }
+
if (ev->button != 1) return;
it->down = 1;
@@ -644,6 +653,19 @@ _item_mouse_up_cb(void *data,
Elm_Gen_Item *it = data;
Elm_Object_Item *eo_it = EO_OBJ(it);
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
+ Evas_Coord x, y, dx, dy;
+
+ if ((ev->button == 3) && (!it->dragging))
+ {
+ evas_object_geometry_get(obj, &x, &y, NULL, NULL);
+ dx = it->dx - (ev->canvas.x - x);
+ dy = it->dy - (ev->canvas.y - y);
+ if (dx < 0) dx = -dx;
+ if (dy < 0) dy = -dy;
+ if ((dx < 5) && (dy < 5))
+ evas_object_smart_callback_call(WIDGET(it), SIG_CLICKED_RIGHT, EO_OBJ(it));
+ return;
+ }
if (ev->button != 1) return;
diff --git a/legacy/elementary/src/lib/elm_gengrid.h b/legacy/elementary/src/lib/elm_gengrid.h
index 2184ac3952..6def65cec7 100644
--- a/legacy/elementary/src/lib/elm_gengrid.h
+++ b/legacy/elementary/src/lib/elm_gengrid.h
@@ -172,6 +172,8 @@
* parameter is the item that was released.
* - @c "clicked,double" - The user has double-clicked an item.
* The @p event_info parameter is the gengrid item that was double-clicked.
+ * - @c "clicked,right" - The user has right-clicked an item. The @p
+ * event_info parameter is the item that was right-clicked. (since 1.13)
* - @c "longpressed" - This is called when the item is pressed for a certain
* amount of time. By default it's 1 second.
* - @c "selected" - The user has made an item selected. The