Hello,
it looks like a typo.

--- test_genlist.c
+++ test_genlist.c.modified
@@ -1216,8 +1216,8 @@
    static struct genlist7_data info;
    static Testitem tit[3];

-   win = elm_win_add(NULL, "genlist-3", ELM_WIN_BASIC);
-   elm_win_title_set(win, "Genlist 3");
+   win = elm_win_add(NULL, "genlist-7", ELM_WIN_BASIC);
+   elm_win_title_set(win, "Genlist 7");
    elm_win_autodel_set(win, 1);
    info.win = win;

Thanks.
Daniel Juyung Seo.

On Fri, Oct 15, 2010 at 8:25 PM, Enlightenment SVN
<[email protected]> wrote:
> Log:
>  swipe event for the elm_list
>
>  By: ceolin <[email protected]>
>
>
> Author:       lucas
> Date:         2010-10-15 04:25:02 -0700 (Fri, 15 Oct 2010)
> New Revision: 53442
>
> Modified:
>  trunk/TMP/st/elementary/src/bin/test.c 
> trunk/TMP/st/elementary/src/bin/test_list.c 
> trunk/TMP/st/elementary/src/lib/elm_list.c
>
> Modified: trunk/TMP/st/elementary/src/bin/test.c
> ===================================================================
> --- trunk/TMP/st/elementary/src/bin/test.c      2010-10-15 11:24:46 UTC (rev 
> 53441)
> +++ trunk/TMP/st/elementary/src/bin/test.c      2010-10-15 11:25:02 UTC (rev 
> 53442)
> @@ -33,6 +33,8 @@
>  void test_list(void *data, Evas_Object *obj, void *event_info);
>  void test_list2(void *data, Evas_Object *obj, void *event_info);
>  void test_list3(void *data, Evas_Object *obj, void *event_info);
> +void test_list4(void *data, Evas_Object *obj, void *event_info);
> +void test_list5(void *data, Evas_Object *obj, void *event_info);
>  void test_carousel(void *data, Evas_Object *obj, void *event_info);
>  void test_inwin(void *data, Evas_Object *obj, void *event_info);
>  void test_inwin2(void *data, Evas_Object *obj, void *event_info);
> @@ -246,6 +248,8 @@
>    ADD_TEST("List", test_list);
>    ADD_TEST("List 2", test_list2);
>    ADD_TEST("List 3", test_list3);
> +   ADD_TEST("List 4", test_list4);
> +   ADD_TEST("List 5", test_list5);
>    ADD_TEST("Carousel", test_carousel);
>    ADD_TEST("Inwin", test_inwin);
>    ADD_TEST("Inwin 2", test_inwin2);
>
> Modified: trunk/TMP/st/elementary/src/bin/test_list.c
> ===================================================================
> --- trunk/TMP/st/elementary/src/bin/test_list.c 2010-10-15 11:24:46 UTC (rev 
> 53441)
> +++ trunk/TMP/st/elementary/src/bin/test_list.c 2010-10-15 11:25:02 UTC (rev 
> 53442)
> @@ -387,4 +387,215 @@
>    evas_object_resize(win, 320, 300);
>    evas_object_show(win);
>  }
> +
> +///////////////////////////////////////////////////////////////////////////////////////
> +
> +struct Pginfo {
> +    Evas_Object *pager, *win;
> +};
> +
> +static void
> +test_list4_back_cb(void *data, Evas_Object *obj, void *event_info)
> +{
> +    struct Pginfo *info = data;
> +    if (!info) return;
> +
> +    elm_pager_content_pop(info->pager);
> +}
> +
> +static void
> +test_list4_swipe(void *data, Evas_Object *obj, void *event_info)
> +{
> +    Evas_Object *box, *entry, *button;
> +    const char *item_label = NULL;
> +    struct Pginfo *info = data;
> +    char *item_data;
> +    if (!event_info || !data) return;
> +
> +    item_data = elm_list_item_data_get(event_info);
> +
> +    box = elm_box_add(info->win);
> +    elm_box_horizontal_set(box, 0);
> +    elm_box_homogenous_set(box, 0);
> +    evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, 
> EVAS_HINT_EXPAND);
> +    evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
> +    evas_object_show(box);
> +
> +    entry = elm_scrolled_entry_add(info->win);
> +    elm_scrolled_entry_editable_set(entry, EINA_FALSE);
> +    elm_scrolled_entry_entry_set(entry, item_data);
> +    evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, 
> EVAS_HINT_EXPAND);
> +    evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
> +    evas_object_show(entry);
> +
> +    button = elm_button_add(info->win);
> +    elm_button_label_set(button, "back");
> +    evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, 0);
> +    evas_object_size_hint_align_set(button, EVAS_HINT_FILL, 0);
> +    evas_object_smart_callback_add(button, "clicked", test_list4_back_cb, 
> info);
> +    evas_object_show(button);
> +
> +    elm_box_pack_start(box, entry);
> +    elm_box_pack_end(box, button);
> +
> +    elm_pager_content_push(info->pager, box);
> +}
> +
> +void
> +test_list4(void *data, Evas_Object *obj, void *event_info)
> +{
> +   Evas_Object *win, *bg, *li, *ic, *ic2, *pager;
> +   static struct Pginfo info = {NULL, NULL};
> +   char buf[PATH_MAX];
> +
> +   win = elm_win_add(NULL, "list-4", ELM_WIN_BASIC);
> +   elm_win_title_set(win, "List 4");
> +   elm_win_autodel_set(win, 1);
> +   info.win = win;
> +
> +   bg = elm_bg_add(win);
> +   elm_win_resize_object_add(win, bg);
> +   evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
> +   evas_object_show(bg);
> +
> +   pager = elm_pager_add(win);
> +   elm_win_resize_object_add(win, pager);
> +   evas_object_size_hint_weight_set(pager, EVAS_HINT_EXPAND, 
> EVAS_HINT_EXPAND);
> +   evas_object_size_hint_align_set(pager, EVAS_HINT_FILL, EVAS_HINT_FILL);
> +   evas_object_show(pager);
> +   info.pager = pager;
> +
> +   li = elm_list_add(win);
> +   evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
> +   elm_list_horizontal_mode_set(li, ELM_LIST_COMPRESS);
> +   evas_object_smart_callback_add(li, "swipe", test_list4_swipe, &info);
> +   elm_pager_content_push(pager, li);
> +
> +   static char pf_data[] = "Pink Floyd were formed in 1965, and originally 
> consisted of university" \
> +       "students Roger Waters, Nick Mason, Richard Wright, and Syd Barrett. 
> The group were a popular"\
> +       "fixture on London's underground music scene, and under Barrett's 
> leadership released two "\
> +       "charting singles, \"Arnold Layne\" and \"See Emily Play\", and a 
> successful debut album, "\
> +       "ThePiper at the Gates of Dawn. In 1968, guitarist and singer David 
> Gilmour joined the "\
> +       "line-up. Barrett was soon removed, due to his increasingly erratic 
> behaviour. Following "\
> +       "Barrett's departure, bass player and singer Roger Waters became the 
> band's lyricist and "\
> +       "conceptual leader, with Gilmour assuming lead guitar and much of the 
> vocals. With this "\
> +       "line-up, Floyd went on to achieve worldwide critical and commercial 
> success with the "\
> +       "conceptalbums The Dark Side of the Moon, Wish You Were Here, 
> Animals, and The Wall.";
> +   ic = elm_icon_add(win);
> +   snprintf(buf, sizeof(buf), "%s/images/mystrale.jpg", PACKAGE_DATA_DIR);
> +   elm_icon_scale_set(ic, 0, 0);
> +   elm_icon_file_set(ic, buf, NULL);
> +   elm_list_item_append(li, "Pink Floyd", ic, NULL,  NULL, &pf_data);
> +
> +   static char ds_data[] = "Dire Straits were a British rock band, formed by 
> Mark Knopfler "\
> +       "(lead vocals and lead guitar), his younger brother David Knopfler 
> (rhythm guitar and "\
> +       "backing vocals), John Illsley (bass guitar and backing vocals), and 
> Pick Withers (drums "\
> +       "and percussion), and managed by Ed Bicknell, active between 1977 and 
> 1995. Although the "\
> +       "band was formed in an era when punk rock was at the forefront, Dire 
> Straits played a more "
> +       "bluesy style, albeit with a stripped-down sound that appealed to 
> audiences weary of the "\
> +       "overproduced stadium rock of the 1970s.[citation needed] In their 
> early days, Mark and "\
> +       "David requested that pub owners turn down their sound so that 
> patrons could converse "\
> +       "while the band played, an indication of their unassuming demeanor. 
> Despite this oddly "\
> +       "self-effacing approach to rock and roll, Dire Straits soon became 
> hugely successful, with "\
> +       "their first album going multi-platinum globally.";
> +   ic = elm_icon_add(win);
> +   snprintf(buf, sizeof(buf), "%s/images/mystrale_2.jpg", PACKAGE_DATA_DIR);
> +   elm_icon_scale_set(ic, 0, 0);
> +   elm_icon_file_set(ic, buf, NULL);
> +   elm_list_item_append(li, "Dire Straits", ic, NULL,  NULL, &ds_data);
> +
> +   static char uh_data[] = "Uriah Heep are an English hard rock band. The 
> band released several "\
> +       "commercially successful albums in the 1970s such as Uriah Heep Live 
> (1973), but their "\
> +       "audience declined by the 1980s, to the point where they became 
> essentially a cult band in "\
> +       "the United States and United Kingdom. Uriah Heep maintain a 
> significant following in "\
> +       "Germany, the Netherlands, Scandinavia, the Balkans, Japan and 
> Russia, where they still "\
> +       "perform at stadium-sized venues.";
> +   ic = elm_icon_add(win);
> +   snprintf(buf, sizeof(buf), "%s/images/icon_17.png", PACKAGE_DATA_DIR);
> +   elm_icon_scale_set(ic, 1, 1);
> +   elm_icon_file_set(ic, buf, NULL);
> +   elm_list_item_append(li, "Uriah Heep", ic, NULL,  NULL, &uh_data);
> +
> +   static char r_data[] = "Rush is a Canadian rock band formed in August 
> 1968, in the Willowdale "\
> +       "neighbourhood of Toronto, Ontario. The band is composed of bassist, 
> keyboardist, and lead "\
> +       "vocalist Geddy Lee, guitarist Alex Lifeson, and drummer and lyricist 
> Neil Peart. The band "\
> +       "and its membership went through a number of re-configurations 
> between 1968 and 1974, "\
> +       "achieving their current form when Peart replaced original drummer 
> John Rutsey in July 1974, "\
> +       "two weeks before the group's first United States tour.";
> +   ic = elm_icon_add(win);
> +   snprintf(buf, sizeof(buf), "%s/images/icon_21.png", PACKAGE_DATA_DIR);
> +   elm_icon_scale_set(ic, 0, 0);
> +   elm_icon_file_set(ic, buf, NULL);
> +   ic2 = elm_icon_add(win);
> +   elm_icon_standard_set(ic2, "clock");
> +   elm_icon_scale_set(ic2, 0, 0);
> +   elm_list_item_append(li, "Rush", ic, ic2,  NULL, &r_data);
> +
> +   elm_list_go(li);
> +
> +   evas_object_show(li);
> +   evas_object_resize(win, 320, 300);
> +   evas_object_show(win);
> +}
> +
> +/////////////////////////////////////////////////////////////////////////////////////////
> +struct list5_data_cb {
> +  Evas_Object *win, *list;
> +};
> +
> +static void
> +test_list5_item_del(void *data, Evas_Object *obj, void *event_info)
> +{
> +   elm_list_item_del(data);
> +}
> +
> +static void
> +test_list5_swipe(void *data, Evas_Object *obj, void *event_info)
> +{
> +    Evas_Object *button;
> +    struct list5_data_cb *info = elm_list_item_data_get(event_info);
> +
> +    if ((button = elm_list_item_end_get(event_info))) return;
> +
> +    button = elm_button_add(info->win);
> +    elm_button_label_set(button, "delete");
> +    evas_object_propagate_events_set(button, 0);
> +    evas_object_smart_callback_add(button, "clicked", test_list5_item_del,
> +                                   event_info);
> +    elm_list_item_end_set(event_info, button);
> +}
> +
> +void
> +test_list5(void *data, Evas_Object *obj, void *event_info)
> +{
> +   Evas_Object *win, *bg, *li, *ic, *ic2;
> +   static struct list5_data_cb info;
> +   char buf[PATH_MAX];
> +
> +   win = elm_win_add(NULL, "list-5", ELM_WIN_BASIC);
> +   elm_win_title_set(win, "List 5");
> +   elm_win_autodel_set(win, 1);
> +   info.win = win;
> +
> +   bg = elm_bg_add(win);
> +   elm_win_resize_object_add(win, bg);
> +   evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
> +   evas_object_show(bg);
> +
> +   li = elm_list_add(win);
> +   evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
> +   elm_list_horizontal_mode_set(li, ELM_LIST_COMPRESS);
> +   evas_object_smart_callback_add(li, "swipe", test_list5_swipe, NULL);
> +   elm_win_resize_object_add(win, li);
> +   evas_object_show(li);
> +   info.list = li;
> +
> +   elm_list_item_append(li, "Network", NULL, NULL,  NULL, &info);
> +   elm_list_item_append(li, "Audio", NULL, NULL,  NULL, &info);
> +
> +   elm_list_go(li);
> +   evas_object_resize(win, 320, 300);
> +   evas_object_show(win);
> +}
> +
>  #endif
>
> Modified: trunk/TMP/st/elementary/src/lib/elm_list.c
> ===================================================================
> --- trunk/TMP/st/elementary/src/lib/elm_list.c  2010-10-15 11:24:46 UTC (rev 
> 53441)
> +++ trunk/TMP/st/elementary/src/lib/elm_list.c  2010-10-15 11:25:02 UTC (rev 
> 53442)
> @@ -1,6 +1,8 @@
>  #include <Elementary.h>
>  #include "elm_priv.h"
>
> +#define SWIPE_MOVES 12
> +
>  /**
>  * @defgroup List List
>  *
> @@ -20,6 +22,11 @@
>    Eina_Bool scr_minw : 1;
>    Eina_Bool scr_minh : 1;
>    int walking;
> +   int movements;
> +   struct {
> +     Evas_Coord x, y;
> +   } history[SWIPE_MOVES];
> +   Eina_Bool swipe : 1;
>    Eina_Bool fix_pending : 1;
>    Eina_Bool on_hold : 1;
>    Eina_Bool multi : 1;
> @@ -37,6 +44,7 @@
>    Evas_Object *icon, *end;
>    Evas_Smart_Cb func;
>    Ecore_Timer *long_timer;
> +   Ecore_Timer *swipe_timer;
>    Eina_Bool deleted : 1;
>    Eina_Bool even : 1;
>    Eina_Bool is_even : 1;
> @@ -102,6 +110,7 @@
>
>    eina_stringshare_del(it->label);
>
> +   if (it->swipe_timer) ecore_timer_del(it->swipe_timer);
>    if (it->long_timer) ecore_timer_del(it->long_timer);
>    if (it->icon) evas_object_del(it->icon);
>    if (it->end) evas_object_del(it->end);
> @@ -593,6 +602,19 @@
>    _elm_list_unwalk(wd);
>  }
>
> +static Eina_Bool
> +_swipe_cancel(void *data)
> +{
> +   Elm_List_Item *it = data;
> +   Widget_Data *wd = elm_widget_data_get(it->base.widget);
> +
> +   if (!wd) return ECORE_CALLBACK_CANCEL;
> +   ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, ECORE_CALLBACK_CANCEL);
> +   wd->swipe = EINA_FALSE;
> +   wd->movements = 0;
> +   return ECORE_CALLBACK_RENEW;
> +}
> +
>  static void
>  _mouse_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, 
> void *event_info)
>  {
> @@ -615,6 +637,16 @@
>              if (!wd->wasselected)
>                _item_unselect(it);
>          }
> +        if (wd->movements == SWIPE_MOVES) wd->swipe = EINA_TRUE;
> +        else
> +          {
> +             wd->history[wd->movements].x = ev->cur.canvas.x;
> +             wd->history[wd->movements].y = ev->cur.canvas.y;
> +             if (abs((wd->history[wd->movements].x - wd->history[0].x)) > 40)
> +                wd->swipe = EINA_TRUE;
> +             else
> +                wd->movements++;
> +          }
>      }
>  }
>
> @@ -633,6 +665,26 @@
>  }
>
>  static void
> +_swipe(Elm_List_Item *it)
> +{
> +   int i, sum = 0;
> +   Widget_Data *wd = elm_widget_data_get(it->base.widget);
> +
> +   ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
> +   if (!wd) return;
> +   wd->swipe = EINA_FALSE;
> +   for (i = 0; i < wd->movements; i++)
> +     {
> +        sum += wd->history[i].x;
> +        if (abs(wd->history[0].y - wd->history[i].y) > 10) return;
> +     }
> +
> +   sum /= wd->movements;
> +   if (abs(sum - wd->history[0].x) <= 10) return;
> +   evas_object_smart_callback_call(it->base.widget, "swipe", it);
> +}
> +
> +static void
>  _mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, 
> void *event_info)
>  {
>    Elm_List_Item *it = data;
> @@ -649,9 +701,13 @@
>    wd->longpressed = EINA_FALSE;
>    if (it->long_timer) ecore_timer_del(it->long_timer);
>    it->long_timer = ecore_timer_add(1.0, _long_press, it);
> +   if (it->swipe_timer) ecore_timer_del(it->swipe_timer);
> +   it->swipe_timer = ecore_timer_add(0.4, _swipe_cancel, it);
>    /* Always call the callbacks last - the user may delete our context! */
>    if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
>      evas_object_smart_callback_call(it->base.widget, "clicked", it);
> +   wd->swipe = EINA_FALSE;
> +   wd->movements = 0;
>  }
>
>  static void
> @@ -672,8 +728,14 @@
>         ecore_timer_del(it->long_timer);
>         it->long_timer = NULL;
>      }
> +   if (it->swipe_timer)
> +     {
> +        ecore_timer_del(it->swipe_timer);
> +        it->swipe_timer = NULL;
> +     }
>    if (wd->on_hold)
>      {
> +        if (wd->swipe) _swipe(data);
>        wd->on_hold = EINA_FALSE;
>        return;
>      }
>
>
> ------------------------------------------------------------------------------
> Download new Adobe(R) Flash(R) Builder(TM) 4
> The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly
> Flex(R) Builder(TM)) enable the development of rich applications that run
> across multiple browsers and platforms. Download your free trials today!
> http://p.sf.net/sfu/adobe-dev2dev
> _______________________________________________
> enlightenment-svn mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/enlightenment-svn
>

------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to