diff --git a/legacy/elementary/src/examples/gengrid_example.c b/legacy/elementary/src/examples/gengrid_example.c index bba0f70660..b3c145eabf 100644 --- a/legacy/elementary/src/examples/gengrid_example.c +++ b/legacy/elementary/src/examples/gengrid_example.c @@ -288,6 +288,16 @@ _double_click(void *data __UNUSED__, fprintf(stdout, "Double click on item with handle %p\n", event_info); } +/* item long press callback */ +static void +_long_pressed(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info) +{ + fprintf(stdout, "Long press on item with handle %p\n", event_info); +} + + /* label fetching callback */ static char * _grid_label_get(void *data, @@ -428,6 +438,7 @@ elm_main(int argc __UNUSED__, evas_object_size_hint_min_set(grid, 600, 500); elm_box_pack_end(bx, grid); evas_object_smart_callback_add(grid, "clicked,double", _double_click, NULL); + evas_object_smart_callback_add(grid, "longpressed", _long_pressed, NULL); evas_object_show(grid); hbx_1 = elm_box_add(win); diff --git a/legacy/elementary/src/lib/Elementary.h.in b/legacy/elementary/src/lib/Elementary.h.in index e1ee82f476..ed97b3019b 100644 --- a/legacy/elementary/src/lib/Elementary.h.in +++ b/legacy/elementary/src/lib/Elementary.h.in @@ -7835,6 +7835,8 @@ extern "C" { * is the gengrid item that was activated. * - @c "clicked,double" - The user has double-clicked an item. * The @c event_info parameter is the gengrid item that was double-clicked. + * - @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 * @c event_info parameter is the gengrid item that was selected. * - @c "unselected" - The user has made an item unselected. The diff --git a/legacy/elementary/src/lib/elm_gengrid.c b/legacy/elementary/src/lib/elm_gengrid.c index f422c53e7f..dc7ebb9ef9 100644 --- a/legacy/elementary/src/lib/elm_gengrid.c +++ b/legacy/elementary/src/lib/elm_gengrid.c @@ -135,6 +135,7 @@ static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); static const char SIG_ACTIVATED[] = "activated"; static const char SIG_CLICKED_DOUBLE[] = "clicked,double"; +static const char SIG_LONGPRESSED[] = "longpressed"; static const char SIG_SELECTED[] = "selected"; static const char SIG_UNSELECTED[] = "unselected"; static const char SIG_REALIZED[] = "realized"; @@ -156,6 +157,7 @@ static const char SIG_MOVED[] = "moved"; static const Evas_Smart_Cb_Description _signals[] = { {SIG_ACTIVATED, ""}, {SIG_CLICKED_DOUBLE, ""}, + {SIG_LONGPRESSED, ""}, {SIG_SELECTED, ""}, {SIG_UNSELECTED, ""}, {SIG_REALIZED, ""}, @@ -762,7 +764,7 @@ _long_press(void *data) item->long_timer = NULL; if ((item->disabled) || (item->dragging)) return ECORE_CALLBACK_CANCEL; item->wd->longpressed = EINA_TRUE; - evas_object_smart_callback_call(item->wd->self, "longpressed", item); + evas_object_smart_callback_call(item->wd->self, SIG_LONGPRESSED, item); if (item->wd->reorder_mode) { item->wd->reorder_item = item;