{
Ewk_Popup_Picker* picker = static_cast<Ewk_Popup_Picker*>(data);
- Elm_Object_Item* selected = elm_list_selected_item_get(obj);
+ Elm_Object_Item* selected = elm_genlist_selected_item_get(obj);
void* it;
- const Eina_List* l;
- const Eina_List* items;
Elm_Object_Item* currentItem = picker->firstItem;
int i = 0;
- items = elm_list_items_get(obj);
- EINA_LIST_FOREACH(items, l, it) {
+
+ while (currentItem) {
if(currentItem == selected)
break;
-
- currentItem = elm_list_item_next(currentItem);
+ currentItem = elm_genlist_item_next_get(currentItem);
i++;
}
+
picker->selectedIndex = i;
ewk_view_popup_menu_select(picker->parent, i);
}
ewk_view_popup_menu_close(picker->parent);
}
+static char* _listLabelGet(void* data, Evas_Object* obj, const char* part)
+{
+ Ewk_Popup_Menu_Item* menuItem = static_cast<Ewk_Popup_Menu_Item*>(data);
+
+ if (!strncmp(part, "elm.text", strlen("elm.text")))
+ return strdup(ewk_popup_menu_item_text_get(menuItem));
+}
+
Ewk_Popup_Picker* ewk_popup_picker_new(Evas_Object* parent, Eina_List* items, int selectedIndex)
{
Ewk_Popup_Picker* picker = new Ewk_Popup_Picker;
"mouse,clicked,1", "dimm", listClosed, picker);
}
- picker->popupList = elm_list_add(parent);
+ picker->popupList = elm_genlist_add(parent);
evas_object_size_hint_weight_set(picker->popupList, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(picker->popupList, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ static Elm_Genlist_Item_Class itemClass;
+
+ itemClass.item_style = "1text";
+ itemClass.func.text_get = _listLabelGet;
+ itemClass.func.content_get = 0;
+ itemClass.func.state_get = 0;
+ itemClass.func.del = 0;
+
void* itemv;
const Eina_List* l;
EINA_LIST_FOREACH(items, l, itemv) {
Ewk_Popup_Menu_Item* menuItem = static_cast<Ewk_Popup_Menu_Item*>(itemv);
- Elm_Object_Item* itemObject = elm_list_item_append(picker->popupList, menuItem->text, 0, 0, 0, 0);
+ Elm_Object_Item* itemObject = elm_genlist_item_append(picker->popupList, &itemClass, menuItem, 0, ELM_GENLIST_ITEM_NONE, 0, 0);
if (!index)
picker->firstItem = itemObject;
if (selectedIndex == index)
- elm_list_item_selected_set(itemObject, true);
+ elm_genlist_item_selected_set(itemObject, true);
index++;
}