static void _item_up_cb(void *data, Evas_Object *obj, const char* emission, const char* source) { Evas_Object *icon_image; Evas_Object *item; item = evas_object_data_get(obj, "item"); ret_if(NULL == item); _D("ITEM: mouse up event callback is invoked for %p", item); PRINT_APPFWK(); icon_image = evas_object_data_get(item, "icon_image"); evas_object_color_set(icon_image, 255, 255, 255, 255); ret_if(NULL == item_event_info.pressed_item); if (item_event_info.pressed_item == item) { bool item_enable_long_press; item_enable_long_press = (bool) evas_object_data_get(item, "item_enable_long_press"); _D("Not Edit Mode"); if (mouse_is_scrolling()) { return; } item_launch(item); } item_event_info.pressed_item = NULL; }
//testing ui reflection on prefs data changes static Eina_Bool _elm_prefs_items_change(void *data) { Evas_Object *prefs, *notify = data; Elm_Prefs_Data *prefs_data; Elm_Prefs_Item_Type type; Eina_Value value; prefs = evas_object_data_get(notify, "prefs"); prefs_data = evas_object_data_get(notify, "prefs_data"); visible = !visible; elm_prefs_item_visible_set(prefs, "main:floatsp", visible); disabled = !disabled; elm_prefs_item_disabled_set(prefs, "main:checkb", disabled); editable = !editable; elm_prefs_item_editable_set(prefs, "main:text", editable); if (elm_prefs_data_value_get(prefs_data, "main:text", &type, &value)) { eina_value_set(&value, editable ? "This is a editable text entry" : "This is a non-editable text entry"); elm_prefs_data_value_set(prefs_data, "main:text", type, &value); } evas_object_show(notify); return ECORE_CALLBACK_RENEW; }
void panel_camera_light_fini(Evas_Object *navigation) { Panel_Struct *pobject = evas_object_data_get(navigation, pb); Axis_Key *ckey = evas_object_data_get(pobject->cspangle, axiskeys); Axis_Key *lkey = evas_object_data_get(pobject->lspangle, axiskeys); free(pobject); free(ckey); free(lkey); }
static void resize_glview(Evas_Object *obj) { LOGI_ENTRY; appdata_s *ad = static_cast<appdata_s *>(evas_object_data_get(obj, "ad")); elm_glview_size_get(obj, &ad->glview_w, &ad->glview_h); SampleView *sv = static_cast<SampleView *>(evas_object_data_get(obj, "sv")); sv->OnWindowUpdate(ad->glview_w, ad->glview_h); LOGI_EXIT; }
static void mouse_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) { appdata_s *ad = static_cast<appdata_s *>(evas_object_data_get(obj, "ad")); SampleView *sv = static_cast<SampleView *>(evas_object_data_get(obj, "sv")); Evas_Event_Mouse_Down *ev = static_cast<Evas_Event_Mouse_Down *>(event_info); sv->TouchOn(); sv->SetTouchPoint(static_cast<float>(ev->canvas.x), static_cast<float>(ev->canvas.y)); ad->mouse_down = EINA_TRUE; }
static DB * _page_db_get(const Evas_Object *obj) { Page *page, *ppage; page = evas_object_data_get(obj, "_enjoy_page"); EINA_SAFETY_ON_NULL_RETURN_VAL(page, NULL); ppage = evas_object_data_get(page->parent, "_enjoy_page"); if (ppage) return _page_db_get(page->parent); return list_db_get(page->parent); }
static Evas_Object *_animated_unpack_item(Evas_Object *scroller, Evas_Object *page, unsigned int pos) { Evas_Object *out = NULL; Evas_Object *item; Evas_Object *next_page; char buf[32]; unsigned int page_max_app; unsigned int page_no; page_scroller_sort_type_e sort_type; out = page_unpack_item_at(page, pos); retv_if(NULL == out, NULL); page_no = page_scroller_get_page_no(scroller, page); page_max_app = (unsigned int) evas_object_data_get(scroller, "page_max_app"); sort_type = (page_scroller_sort_type_e) evas_object_data_get(scroller, "sort_type"); pos ++; while (page && page_no < MAX_PAGE_NO) { if (0 == page_count_item(page)) { page_destroy(scroller, page); break; } for (; pos < page_max_app; pos ++) { item = page_unpack_item_at(page, pos); if (NULL == item) continue; page_pack_item(page, pos - 1, item); snprintf(buf, 32, "menu%d", pos - 1); edje_object_signal_emit(_EDJ(page), STR_MOVE_NEXT, buf); edje_object_signal_emit(_EDJ(page), STR_ANI_RETURN, buf); } if (sort_type == PAGE_SCROLLER_SORT_MAX) { return NULL; } page_no ++; next_page = page_scroller_get_page_at(scroller, page_no); if (next_page) { item = page_unpack_item_at(next_page, 0); if (NULL == item) continue; page_pack_item(page, page_max_app - 1, item); } else break; pos = 1; page = next_page; } return out; }
static void _menu_item_selected(void *data, Evas_Object *o, const char *emission, const char *source) { void (*selected_cb)(void *data); void *cb_data; selected_cb = evas_object_data_get(o, "item_cb"); cb_data = evas_object_data_get(o, "item_data"); if (selected_cb) selected_cb(cb_data); }
static menu_screen_error_e _insert_page_at(Evas_Object *scroller, Evas_Object *page, int index) { unsigned int nr_of_pages; Evas_Object *mapbuf; Evas_Object *box; retv_if(NULL == page, MENU_SCREEN_ERROR_FAIL); if (index < 0) { _D("Out of range"); index = 0; } box = evas_object_data_get(scroller, "box"); retv_if(NULL == box, MENU_SCREEN_ERROR_FAIL); nr_of_pages = page_scroller_count_page(scroller); if (index >= nr_of_pages) { _D("Out of range. index : %d, total : %d", index, nr_of_pages); mapbuf = evas_object_data_get(page, "mapbuf"); if (mapbuf) { elm_box_pack_end(box, mapbuf); } else { elm_box_pack_end(box, page); } } else { Evas_Object *current; Evas_Object *current_mapbuf; const Eina_List *page_list; page_list = elm_box_children_get(box); retv_if(NULL == page_list, MENU_SCREEN_ERROR_FAIL); current = eina_list_nth(page_list, index); retv_if(NULL == current, MENU_SCREEN_ERROR_FAIL); current_mapbuf = mapbuf_get_mapbuf(current); mapbuf = mapbuf_get_mapbuf(page); if (current_mapbuf && mapbuf) { elm_box_pack_before(box, mapbuf, current_mapbuf); } else if (!current_mapbuf && !mapbuf) { elm_box_pack_before(box, page, current); } else { _D("Page has mapbuf, invalid"); } } page_mark_dirty(page); return MENU_SCREEN_ERROR_OK; }
static menu_screen_error_e _animated_pack_item(Evas_Object *item, Evas_Object *scroller, Evas_Object *page, int from) { Evas_Object *item_out_page = NULL; char buf[32]; int to; int page_no; retv_if(NULL == item, MENU_SCREEN_ERROR_INVALID_PARAMETER); retv_if(NULL == scroller, MENU_SCREEN_ERROR_INVALID_PARAMETER); retv_if(NULL == page, MENU_SCREEN_ERROR_INVALID_PARAMETER); page_no = page_scroller_get_page_no(scroller, page); do { to = page_find_empty_near(page, from); if (to < 0) { int page_max_app; page_max_app = (int) evas_object_data_get(page, "page_max_app"); to = page_max_app - 1; item_out_page = page_unpack_item_at(page, to); } for (to --; to >= from; to --) { Evas_Object *item_in_page; item_in_page = page_unpack_item_at(page, to); page_pack_item(page, to + 1, item_in_page); snprintf(buf, 32, "menu%d", to + 1); edje_object_signal_emit(_EDJ(page), STR_MOVE_PREV, buf); edje_object_signal_emit(_EDJ(page), STR_ANI_RETURN, buf); } page_pack_item(page, from, item); if (!item_out_page) break; page_no ++; page = page_scroller_get_page_at(scroller, page_no); if (!page) { int rotate; rotate = (int) evas_object_data_get(scroller, "rotate"); page = page_create(scroller, page_no, rotate); retv_if(NULL == page, MENU_SCREEN_ERROR_FAIL); mapbuf_enable(page, 0); } from = 0; item = item_out_page; item_out_page = NULL; } while (page && item); return MENU_SCREEN_ERROR_OK; }
static void init_glview(Evas_Object *obj) { LOGI_ENTRY; appdata_s *ad = static_cast<appdata_s *>(evas_object_data_get(obj, "ad")); SampleView *sv = static_cast<SampleView *>(evas_object_data_get(obj, "sv")); elm_glview_size_get(obj, &ad->glview_w, &ad->glview_h); LOGI("w,h[%d,%d]",ad->glview_w, ad->glview_h); if (sv == nullptr) { LOGE("[sv] has null ptr!"); return; } sv->Initialize(ad->glview_w, ad->glview_h); LOGI_EXIT; }
static void _dialog_delete_ok_clicked_cb(void *data, Evas_Object *btn, void *ev) { Enna_Localfiles_Priv *priv = data; Enna_File *file = evas_object_data_get(priv->dialog, "file"); if (priv->file_dialog) enna_file_free(priv->file_dialog); priv->file_dialog = enna_file_ref(file); if (file->type == ENNA_FILE_DIRECTORY) { eio_dir_unlink(file->mrl, _dir_filter_cb, _dir_progress_cb, _delete_done_cb, _error_cb, priv); } else if (file->type == ENNA_FILE_FILE) { eio_file_unlink(file->mrl, _delete_done_cb, _error_cb, priv); } evas_object_del(priv->dialog); }
void enna_photo_slideshow_image_add(Evas_Object *obj, const char *file, const char *group) { Elm_Object_Item *it; Smart_Data *sd = evas_object_data_get(obj, "sd"); it = elm_slideshow_item_add(sd->slideshow, &itc, file); sd->items = eina_list_append(sd->items, it); }
static void init_shaders(Evas_Object *obj) { appdata_s *ad = evas_object_data_get(obj, "ad"); const char *p; p = vertex_shader; ad->vtx_shader = glCreateShader(GL_VERTEX_SHADER); glShaderSource(ad->vtx_shader, 1, &p, NULL); glCompileShader(ad->vtx_shader); p = fragment_shader; ad->fgmt_shader = glCreateShader(GL_FRAGMENT_SHADER); glShaderSource(ad->fgmt_shader, 1, &p, NULL); glCompileShader(ad->fgmt_shader); ad->program = glCreateProgram(); glAttachShader(ad->program, ad->vtx_shader); glAttachShader(ad->program, ad->fgmt_shader); glLinkProgram(ad->program); ad->idx_position = glGetAttribLocation(ad->program, "a_position"); ad->idx_color = glGetAttribLocation(ad->program, "a_color"); ad->idx_mvp = glGetUniformLocation(ad->program, "u_mvpMatrix"); glUseProgram(ad->program); }
void entrybox_ok(Evas *e, Evas_Object *obj) { entry_info_struct *infostruct=(entry_info_struct *) evas_object_data_get(obj,"entry_info"); evas_object_focus_set(infostruct->parent,1); fini_entrybox(e,obj); (infostruct->handler)(e,obj,infostruct->entry); }
void fini_entrybox(Evas *e, Evas_Object *obj) { entry_info_struct *infostruct =(entry_info_struct *) evas_object_data_get(obj,"entry_info"); //free(infostruct->entry); evas_object_del(obj); }
void enna_panel_infos_set_cover(Evas_Object *obj, Enna_Metadata *m) { Evas_Object *cover; char *file = NULL; int from_vfs = 1; const char *cv; Smart_Data *sd = evas_object_data_get(obj, "sd"); if (!sd) return; if (!m) { file = strdup(VIDEO_DEFAULT_COVER); from_vfs = 0; } cv = enna_metadata_meta_get(m, "cover", 1); if (!file && cv) { char dst[1024] = { 0 }; snprintf(dst, sizeof(dst), "%s/covers/%s", enna_util_data_home_get(), cv); if (ecore_file_exists(dst)) file = strdup(dst); } if (!file) { file = strdup(VIDEO_DEFAULT_COVER); from_vfs = 0; } if (from_vfs) { cover = elm_icon_add(sd->o_edje); elm_image_file_set(cover, file, NULL); } else { cover = edje_object_add(evas_object_evas_get(sd->o_edje)); edje_object_file_set(cover, enna_config_theme_get(), file); } ENNA_OBJECT_DEL(sd->o_cover); sd->o_cover = cover; edje_object_part_swallow(sd->o_edje, "panel.cover.swallow", sd->o_cover); /* hide underlying shadows with default movie poster cover */ edje_object_signal_emit(sd->o_edje, (!strcmp(file, VIDEO_DEFAULT_COVER)) ? "shadow,hide" : "shadow,show", "enna"); eina_stringshare_del(cv); eina_stringshare_del(file); }
/* local subsystem functions */ static E_Layout_Item * _e_layout_smart_adopt(E_Smart_Data *sd, Evas_Object *obj) { E_Layout_Item *li; li = evas_object_data_get(obj, "e_layout_data"); if (li) e_layout_unpack(obj); li = calloc(1, sizeof(E_Layout_Item)); if (!li) return NULL; li->sd = sd; li->obj = obj; /* defaults */ li->x = 0; li->y = 0; li->w = 0; li->h = 0; evas_object_clip_set(obj, sd->clip); evas_object_smart_member_add(obj, li->sd->obj); evas_object_data_set(obj, "e_layout_data", li); evas_object_event_callback_add(obj, EVAS_CALLBACK_FREE, _e_layout_smart_item_del_hook, NULL); if ((!evas_object_visible_get(sd->clip)) && (evas_object_visible_get(sd->obj))) evas_object_show(sd->clip); return li; }
static void _hide_finished_cb(void *data, Evas_Object *obj, void *event_info) { view_manager_view_type_t top_view_id = (view_manager_view_type_t)evas_object_data_get(obj, SCREEN_TYPE_ID_KEY); if (data == elm_naviframe_top_item_get(obj)) { /* We are now in main view */ evas_object_data_set(obj, SCREEN_TYPE_ID_KEY, (void *)VIEW_MANAGER_VIEW_TYPE_MAIN); top_view_id = VIEW_MANAGER_VIEW_TYPE_MAIN; } INFO_LOG(UG_NAME_NORMAL, "top view id = %d", top_view_id); switch(top_view_id) { case VIEW_MANAGER_VIEW_TYPE_MAIN: /* Lets enable the scan updates */ wlan_manager_enable_scan_result_update(); break; case VIEW_MANAGER_VIEW_TYPE_DETAIL: case VIEW_MANAGER_VIEW_TYPE_EAP: default: /* Lets disable the scan updates so that the UI is not refreshed un-necessarily */ wlan_manager_disable_scan_result_update(); break; } }
static void __common_utils_entry_del(void *data, Evas_Object *obj) { Evas_Object *layout = (Evas_Object *)data; char *dfalt_entry_txt = evas_object_data_get(layout, COMMON_UTILS_DEFAULT_ENTRY_TEXT_KEY); g_free(dfalt_entry_txt); evas_object_unref(layout); }
static void _del_gl(Evas_Object *obj) { GLData *gld = evas_object_data_get(obj, "gld"); if (!gld) { printf("Unable to get GLData. \n"); return; } Evas_GL_API *gl = gld->glapi; gl->glDeleteShader(gld->vtx_shader); gl->glDeleteShader(gld->fgmt_shader); gl->glDeleteProgram(gld->program); gl->glDeleteBuffers(1, &gld->gear1->vbo); gl->glDeleteBuffers(1, &gld->gear2->vbo); gl->glDeleteBuffers(1, &gld->gear3->vbo); free_gear(gld->gear1); free_gear(gld->gear2); free_gear(gld->gear3); evas_object_data_del((Evas_Object*)obj, "..gld"); free(gld); }
static void _init_gl(Evas_Object *obj) { GLData *gld = evas_object_data_get(obj, "gld"); gears_init(gld); }
void enna_panel_infos_set_rating(Evas_Object *obj, Enna_Metadata *m) { Evas_Object *rating = NULL; const char *rt; Smart_Data *sd = evas_object_data_get(obj, "sd"); if (!sd) return; rt = enna_metadata_meta_get(m, "rating", 1); if (rt) { char rate[16]; int r; r = MMAX(atoi(rt), 0); r = MMIN(r, 5); memset(rate, '\0', sizeof(rate)); snprintf(rate, sizeof(rate), "rating/%d", r); rating = edje_object_add(evas_object_evas_get(sd->o_edje)); edje_object_file_set(rating, enna_config_theme_get(), rate); } ENNA_OBJECT_DEL(sd->o_rating); sd->o_rating = rating; edje_object_part_swallow(sd->o_edje, "panel.rating.swallow", sd->o_rating); eina_stringshare_del(rt); }
static void _uninstall_up_cb(void *item, Evas_Object *obj, const char* emission, const char* source) { Evas_Object *win; ret_if(mouse_is_scrolling()); win = menu_screen_get_win(); ret_if(NULL == win); _D("Uninstall button is up"); obj = evas_object_data_get(obj, "evas_object"); ret_if(NULL == obj); ret_if(NULL == evas_object_data_get(obj, "removing")); evas_object_data_del(obj, "removing"); }
// draw callback is where all the main GL rendering happens static void _draw_gl(Evas_Object *obj) { Evas_GL_API *gl = elm_glview_gl_api_get(obj); GLData *gld = evas_object_data_get(obj, "gld"); if (!gld) return; int w, h; elm_glview_size_get(obj, &w, &h); gl->glViewport(0, 0, w, h); gl->glClearColor(red, 0.8, 0.3, 1); gl->glClear(GL_COLOR_BUFFER_BIT); // Draw a Triangle gl->glEnable(GL_BLEND); gl->glUseProgram(gld->program); gl->glBindBuffer(GL_ARRAY_BUFFER, gld->vbo); gl->glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0); gl->glEnableVertexAttribArray(0); gl->glDrawArrays(GL_TRIANGLES, 0, 3); // Optional - Flush the GL pipeline gl->glFinish(); red -= 0.1; if (0.0 > red) red = 1.0; }
static void _ecore_evas_buffer_free(Ecore_Evas *ee) { Ecore_Evas_Engine_Buffer_Data *bdata = ee->engine.data; if (!bdata) return; if (bdata->image) { Ecore_Evas *ee2; ee2 = evas_object_data_get(bdata->image, "Ecore_Evas_Parent"); evas_object_del(bdata->image); if (ee2) ee2->sub_ecore_evas = eina_list_remove(ee2->sub_ecore_evas, ee); } else { bdata->free_func(bdata->data, bdata->pixels); } free(bdata); ee->engine.data = NULL; ecore_event_evas_shutdown(); }
static Eina_Bool _land_indicator_connect_cb(void *data) { const char *indicator_serv_name; ELM_CONFORMANT_DATA_GET(data, sd); int rot; if (!sd) return ECORE_CALLBACK_CANCEL; if (sd->indmode != ELM_WIN_INDICATOR_SHOW) { sd->land_indi_timer = NULL; return ECORE_CALLBACK_CANCEL; } rot = (intptr_t) evas_object_data_get(sd->landscape_indicator, CONFORMANT_KEY); indicator_serv_name = elm_config_indicator_service_get(rot); if (!indicator_serv_name) { DBG("Conformant cannot find indicator service name: Rotation=%d\n",rot); sd->land_indi_timer = NULL; return ECORE_CALLBACK_CANCEL; } if (strchr(indicator_serv_name, '/')) { sd->port_indi_timer = NULL; return ECORE_CALLBACK_CANCEL; } if (elm_plug_connect(sd->landscape_indicator, indicator_serv_name, 0, EINA_FALSE)) { DBG("Conformant connect to server[%s]\n", indicator_serv_name); sd->land_indi_timer = NULL; return ECORE_CALLBACK_CANCEL; } return ECORE_CALLBACK_RENEW; }
static void _drag_stop_cb(void *data, Evas_Object *scroller, void *event_info) { Evas_Coord x, y, w, h; int previous_x; _D("Invoked"); elm_scroller_region_get(scroller, &x, &y, &w, &h); previous_x = (int) evas_object_data_get(scroller, "previous_x"); if (x == previous_x) { _D("[33mHold scroller (previous) %d (current) %d[0m", previous_x, x); } /* page_scroller_focus & index_bring_in in _drag_stop_cb & _anim_stop_cb */ do { if (x % w) return; int cur_idx = page_scroller_get_current_page_no(scroller); int idx = 0; if (w) idx = x / w; if (cur_idx == idx) return; page_scroller_bring_in(scroller, idx); page_scroller_focus(scroller); } while (0); }
//testing ui reflection on prefs data changes static Eina_Bool _elm_prefs_data_change(void *data) { Evas_Object *notify = data; Elm_Prefs_Data *prefs_data; Elm_Prefs_Item_Type type; Eina_Value value; prefs_data = evas_object_data_get(notify, "prefs_data"); if (elm_prefs_data_value_get(prefs_data, "main:universe", &type, &value)) { eina_value_set(&value, 42); elm_prefs_data_value_set(prefs_data, "main:universe", type, &value); } if (elm_prefs_data_value_get(prefs_data, "main:text", &type, &value)) { eina_value_set(&value, "This is a text field (:"); elm_prefs_data_value_set(prefs_data, "main:text", type, &value); } evas_object_show(notify); return ECORE_CALLBACK_RENEW; }
static Eina_Bool viewer_manager_scan_button_set(Eina_Bool show_state) { __COMMON_FUNC_ENTER__; if(NULL == manager_object) { __COMMON_FUNC_EXIT__; return EINA_FALSE; } if(show_state == EINA_TRUE) { Evas_Object* navi_frame = viewer_manager_get_naviframe(); view_manager_view_type_t top_view_id = (view_manager_view_type_t)evas_object_data_get(navi_frame, SCREEN_TYPE_ID_KEY); if(VIEW_MANAGER_VIEW_TYPE_MAIN == top_view_id) { INFO_LOG(UG_NAME_NORMAL,"Show directly"); elm_object_item_disabled_set((Elm_Object_Item *)manager_object->scan_button, EINA_FALSE); } else { INFO_LOG(UG_NAME_NORMAL,"Show reserve"); } } else if (show_state == EINA_FALSE) { elm_object_item_disabled_set((Elm_Object_Item *)manager_object->scan_button, EINA_TRUE); } __COMMON_FUNC_EXIT__; return EINA_TRUE; }