web: popup for <select> shlould be scrollable if there are many items.
authorRyuan Choi <ryuan.choi@gmail.com>
Sat, 21 Dec 2013 00:48:05 +0000 (09:48 +0900)
committerRyuan Choi <ryuan.choi@gmail.com>
Sat, 21 Dec 2013 00:54:02 +0000 (09:54 +0900)
Now, the height of select popup is the minimum value between the half size of window and
the height of items.

legacy/elementary/src/lib/elm_web.c

index fc19139..3575c1f 100644 (file)
@@ -968,12 +968,14 @@ _ewk_view_popup_create_cb(void *data,
                           void *event_info)
 {
    ELM_WEB_DATA_GET(data, sd);
-   Evas_Object *notify, *list;
+   Evas_Object *notify, *list, *grid, *win;
    Ewk_Menu *m = event_info;
    Ewk_Menu_Item *it;
    Elm_Web_Menu m2;
    Eina_List *itr;
 
+   int h, ww, wh;
+
    m2.items = m->items;
    m2.x = m->x;
    m2.y = m->y;
@@ -984,7 +986,9 @@ _ewk_view_popup_create_cb(void *data,
      (sd->obj, "popup,create", &m2);
    if (m2.handled) return;
 
-   notify = elm_notify_add(data);
+   win = elm_widget_top_get(data);
+
+   notify = elm_notify_add(win);
    elm_notify_allow_events_set(notify, EINA_FALSE);
    elm_notify_align_set(notify, 0.5, 1.0);
 
@@ -994,7 +998,6 @@ _ewk_view_popup_create_cb(void *data,
    elm_list_mode_set(list, ELM_LIST_EXPAND);
    evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL);
-   elm_object_content_set(notify, list);
    evas_object_show(list);
 
    EINA_LIST_FOREACH(m->items, itr, it)
@@ -1002,6 +1005,16 @@ _ewk_view_popup_create_cb(void *data,
                           obj);
    elm_list_go(list);
 
+   grid = elm_grid_add(data);
+   elm_grid_size_set(grid, 1, 1);
+   elm_grid_pack(grid, list, 0, 0, 1, 1);
+   evas_object_geometry_get(win, NULL, NULL, &ww, &wh);
+   //FIXME: it should be the real height of items in the list.
+   h = m->height * eina_list_count(m->items);
+   evas_object_size_hint_min_set(grid, ww, h < wh / 2 ? h : wh / 2);
+   elm_object_content_set(notify, grid);
+   evas_object_show(grid);
+
    evas_object_show(notify);
 
    evas_object_smart_callback_add