web: popup for <select> shlould be scrollable if there are many items.

Now, the height of select popup is the minimum value between the half size of window and
the height of items.
This commit is contained in:
Ryuan Choi 2013-12-21 09:48:05 +09:00
parent 175f7cb5fb
commit afe9c97bb2
1 changed files with 16 additions and 3 deletions

View 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