int viewer_list_title_item_set(Elm_Object_Item *target) { if (viewer_list_item_size_get() == 0) { // To use multiline textblock/entry/editfield in genlist, set height_for_width mode // then the item's height is calculated while the item's width fits to genlist width. elm_genlist_mode_set(viewer_list, ELM_LIST_COMPRESS); grouptitle_itc.item_style = "dialogue/title"; grouptitle_itc.func.text_get = _gl_text_title_get; grouptitle_itc.func.content_get = _gl_content_title_get; grouptitle_itc.func.state_get = NULL; grouptitle_itc.func.del = NULL; assertm_if(NULL != grouptitle, "Err!!"); grouptitle = elm_genlist_item_insert_after(viewer_list, &grouptitle_itc, NULL, NULL, target, ELM_GENLIST_ITEM_NONE, NULL, NULL); assertm_if(NULL == grouptitle, "NULL!!"); elm_genlist_item_select_mode_set(grouptitle, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); return TRUE; } else { return FALSE; } }
Elm_Object_Item* viewer_list_item_insert_after(Evas_Object* list, void* list_data, Elm_Object_Item *after, Evas_Smart_Cb callback_func, void* callback_data) { Elm_Object_Item* ret = NULL; assertm_if(NULL == callback_data, "NULL!!"); if (!list || !list_data) { assertm_if(NULL == list, "NULL!!"); assertm_if(NULL == list_data, "NULL!!"); return NULL; } ug_genlist_data_t* gdata = NULL; gdata = (ug_genlist_data_t*) g_malloc0(sizeof(ug_genlist_data_t)); assertm_if(NULL == gdata, "NULL!!"); gdata->device_info = (wifi_device_info_t *)list_data; gdata->radio_mode = VIEWER_ITEM_RADIO_MODE_OFF; // DEBUG_LOG(UG_NAME_NORMAL, "ssid[%s] image[%s]", gdata->device_info->ssid, gdata->device_info->ap_image_path); if (!after) { /* If the after item is NULL then insert it as first item */ // DEBUG_LOG(UG_NAME_NORMAL, "first added AP item!"); after = grouptitle; } ret = elm_genlist_item_insert_after( list, /*obj*/ &itc,/*itc*/ gdata,/*data*/ NULL,/*parent*/ after, /*after than*/ ELM_GENLIST_ITEM_NONE, /*flags*/ callback_func,/*func*/ callback_data);/*func_data*/ if (!ret) { assertm_if(NULL == ret, "NULL!!"); g_free(gdata->device_info->ap_image_path); g_free(gdata->device_info->ap_status_txt); g_free(gdata->device_info->ssid); g_free(gdata->device_info); g_free(gdata); return NULL; } container = g_slist_append(container, ret); DEBUG_LOG(UG_NAME_NORMAL, "* item add complete ssid:[%s] size:[%d]", gdata->device_info->ssid, viewer_list_item_size_get()); elm_genlist_item_update(ret); return ret; }
void GenlistItemBase::InsertAfter(Evas_Object *_genlist, GenlistItemBase *after, GenlistItemBase *gparent) { genlist = _genlist; item = elm_genlist_item_insert_after(genlist, &item_class, this, (gparent)?gparent->item:NULL, /* parent item */ after->item, flags, _item_sel_cb, /* select function */ this); /* select function data */ elm_object_item_data_set(item, this); itemAdded(); }
static void _insert_after_cb(void *data, Evas_Object *o, void *event_info) { Evas_Object *list = data; Elm_Object_Item *glit = elm_genlist_selected_item_get(list); if (!glit) return; elm_genlist_item_insert_after(list, _itc, (void *)(long)nitems++, NULL, glit, ELM_GENLIST_ITEM_NONE, _item_sel_cb, NULL); }
void create_new_task(void *data, Evas_Object *obj, void *event_info) { int i = total_tasks; total_tasks ++; if(strcmp(sel_category, "Deleted") == 0) { purge_tasks(); elm_genlist_clear(list); return; } time_t curtime; struct tm *loctime; char dt[6]; //get the time curtime = time (NULL); loctime = localtime (&curtime); strftime(dt, 6, "%d-%m", loctime); //get selected task if any Evas_Object *li = data; Elm_Object_Item *item = (Elm_Object_Item *)elm_genlist_selected_item_get(li); if (!item) item = elm_genlist_last_item_get(list); //insert new line at end of list Task[i].no = i; Task[i].cb = 0; Task[i].pr = 1; strcpy(Task[i].text, "Task"); strcpy(Task[i].date, dt); if(strcmp(sel_category, " All Tasks ")==0) strcpy(Task[i].cat, "Personal"); else strcpy(Task[i].cat, sel_category); if(item) { task_list[i] = elm_genlist_item_insert_after(list, &itc1, &Task[i], NULL, item, ELM_GENLIST_ITEM_NONE, NULL, NULL); } //cater for no items in list else task_list[i] = elm_genlist_item_append(list, &itc1, &Task[i], NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); last_rec = -1; WRITE = 0; //insert record //printf("total %d\n", i); insert_record(i); elm_genlist_item_selected_set(task_list[i], 1); }
Elm_Object_Item *common_utils_add_edit_box_to_list(Evas_Object *list, Elm_Object_Item *insert_after, char *title, char *entry_txt, char *guide_txt, Elm_Input_Panel_Layout panel_type) { static common_utils_entry_info_t entry_info; static Elm_Genlist_Item_Class entry_itc; Evas_Object *layout = NULL; common_utils_set_entry_info(&entry_info, title, entry_txt, guide_txt, panel_type); layout = common_utils_add_edit_box(list, &entry_info); evas_object_ref(layout); /* We need to ref the layout object inorder to inform EFL not to delete it */ entry_itc.item_style = "dialogue/1icon"; entry_itc.func.text_get = NULL; entry_itc.func.content_get = __common_utils_entry_content_get; entry_itc.func.state_get = NULL; entry_itc.func.del = __common_utils_entry_del; if (insert_after) return elm_genlist_item_insert_after(list, &entry_itc, layout, NULL, insert_after, ELM_GENLIST_ITEM_NONE, NULL, NULL); else return elm_genlist_item_append(list, &entry_itc, layout, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); }