elm gengrid: Gengrid longpress documentation. Patch by Benjamin Drucker <benjamin...
authorseoz <seoz@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 11 Sep 2011 12:24:40 +0000 (12:24 +0000)
committerseoz <seoz@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 11 Sep 2011 12:24:40 +0000 (12:24 +0000)
On Fri, Sep 9, 2011 at 4:18 PM, Benjamin Drucker <benjamin.t.drucker@alum.mit.edu> wrote:
> gengrid already emits "longpressed" signals, but it is not currently
> documented nor demonstrated in the examples.  See the attached patch,
> please.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@63323 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/examples/gengrid_example.c
src/lib/Elementary.h.in
src/lib/elm_gengrid.c

index bba0f70..b3c145e 100644 (file)
@@ -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);
index e1ee82f..ed97b30 100644 (file)
@@ -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
index f422c53..dc7ebb9 100644 (file)
@@ -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;