static void _mesh_setup(Scene_Data *data) { /* Setup material. */ data->material = efl_add(EVAS_CANVAS3D_MATERIAL_CLASS, evas); evas_canvas3d_material_enable_set(data->material, EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, EINA_TRUE); evas_canvas3d_material_enable_set(data->material, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, EINA_TRUE); evas_canvas3d_material_enable_set(data->material, EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, EINA_TRUE); evas_canvas3d_material_color_set(data->material, EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, 0.2, 0.2, 0.2, 1.0); evas_canvas3d_material_color_set(data->material, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, 0.8, 0.8, 0.8, 1.0); evas_canvas3d_material_color_set(data->material, EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, 1.0, 1.0, 1.0, 1.0); evas_canvas3d_material_shininess_set(data->material, 100.0); /* Setup mesh. */ data->mesh = efl_add(EVAS_CANVAS3D_MESH_CLASS, evas); evas_canvas3d_mesh_vertex_count_set(data->mesh, 24); evas_canvas3d_mesh_frame_add(data->mesh, 0); evas_canvas3d_mesh_frame_vertex_data_set(data->mesh, 0, EVAS_CANVAS3D_VERTEX_ATTRIB_POSITION, 12 * sizeof(float), &cube_vertices[ 0]); evas_canvas3d_mesh_frame_vertex_data_set(data->mesh, 0, EVAS_CANVAS3D_VERTEX_ATTRIB_NORMAL, 12 * sizeof(float), &cube_vertices[ 3]); evas_canvas3d_mesh_frame_vertex_data_set(data->mesh, 0, EVAS_CANVAS3D_VERTEX_ATTRIB_COLOR, 12 * sizeof(float), &cube_vertices[ 6]); evas_canvas3d_mesh_frame_vertex_data_set(data->mesh, 0, EVAS_CANVAS3D_VERTEX_ATTRIB_TEXCOORD, 12 * sizeof(float), &cube_vertices[10]); evas_canvas3d_mesh_index_data_set(data->mesh, EVAS_CANVAS3D_INDEX_FORMAT_UNSIGNED_SHORT, 36, &cube_indices[0]); evas_canvas3d_mesh_vertex_assembly_set(data->mesh, EVAS_CANVAS3D_VERTEX_ASSEMBLY_TRIANGLES); evas_canvas3d_mesh_shader_mode_set(data->mesh, EVAS_CANVAS3D_SHADER_MODE_PHONG); evas_canvas3d_mesh_frame_material_set(data->mesh, 0, data->material); data->mesh_node = efl_add(EVAS_CANVAS3D_NODE_CLASS, evas, evas_canvas3d_node_type_set(efl_added, EVAS_CANVAS3D_NODE_TYPE_MESH)); evas_canvas3d_node_member_add(data->root_node, data->mesh_node); evas_canvas3d_node_mesh_add(data->mesh_node, data->mesh); }
EOLIAN static Eo * _efl_ui_pager_efl_object_constructor(Eo *obj, Efl_Ui_Pager_Data *pd) { ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL); if (!elm_widget_theme_klass_get(obj)) elm_widget_theme_klass_set(obj, "pager"); obj = efl_constructor(efl_super(obj, MY_CLASS)); if (elm_widget_theme_object_set(obj, wd->resize_obj, elm_widget_theme_klass_get(obj), elm_widget_theme_element_get(obj), elm_widget_theme_style_get(obj)) == EFL_UI_THEME_APPLY_ERROR_GENERIC) CRI("Failed to set layout!"); pd->cnt = 0; pd->loop = EFL_UI_PAGER_LOOP_DISABLED; pd->curr.page = -1; pd->curr.pos = 0.0; pd->transition = NULL; pd->indicator = NULL; pd->fill_width = EINA_TRUE; pd->fill_height = EINA_TRUE; pd->page_spec.sz.w = -1; pd->page_spec.sz.h = -1; elm_widget_can_focus_set(obj, EINA_TRUE); pd->page_root = efl_add(EFL_CANVAS_GROUP_CLASS, evas_object_evas_get(obj)); efl_content_set(efl_part(obj, "efl.page_root"), pd->page_root); efl_event_callback_add(pd->page_root, EFL_GFX_ENTITY_EVENT_SIZE_CHANGED, _resize_cb, pd); efl_event_callback_add(pd->page_root, EFL_GFX_ENTITY_EVENT_POSITION_CHANGED, _move_cb, pd); pd->page_box = efl_add(EFL_UI_BOX_CLASS, obj); efl_ui_widget_internal_set(pd->page_box, EINA_TRUE); efl_canvas_group_member_add(pd->page_root, pd->page_box); pd->foreclip = efl_add(EFL_CANVAS_RECTANGLE_CLASS, evas_object_evas_get(obj)); efl_canvas_group_member_add(pd->page_root, pd->foreclip); evas_object_static_clip_set(pd->foreclip, EINA_TRUE); efl_canvas_object_clipper_set(pd->page_box, pd->foreclip); pd->backclip = efl_add(EFL_CANVAS_RECTANGLE_CLASS, evas_object_evas_get(obj)); efl_canvas_group_member_add(pd->page_root, pd->backclip); evas_object_static_clip_set(pd->backclip, EINA_TRUE); efl_gfx_entity_visible_set(pd->backclip, EINA_FALSE); return obj; }
static void _camera_setup(Scene_Data *data) { data->camera = efl_add(EVAS_CANVAS3D_CAMERA_CLASS, evas); evas_canvas3d_camera_projection_perspective_set(data->camera, 60.0, 1.0, 2.0, 50.0); data->camera_node = efl_add(EVAS_CANVAS3D_NODE_CLASS, evas, evas_canvas3d_node_type_set(efl_added, EVAS_CANVAS3D_NODE_TYPE_CAMERA)); evas_canvas3d_node_camera_set(data->camera_node, data->camera); evas_canvas3d_node_position_set(data->camera_node, 0.0, 0.0, 10.0); evas_canvas3d_node_look_at_set(data->camera_node, EVAS_CANVAS3D_SPACE_PARENT, 0.0, 0.0, 0.0, EVAS_CANVAS3D_SPACE_PARENT, 0.0, 1.0, 0.0); evas_canvas3d_node_member_add(data->root_node, data->camera_node); }
static Eo *page_add(Page_Type p, Eo *parent) { Eo *page; char buf[PATH_MAX]; int i; switch (p) { case LAYOUT: snprintf(buf, sizeof(buf), "%s/objects/test_pager.edj", elm_app_data_dir_get()); page = efl_add(EFL_UI_LAYOUT_CLASS, parent, efl_file_set(efl_added, buf), efl_file_key_set(efl_added, "page"), efl_file_load(efl_added), efl_text_set(efl_part(efl_added, "text"), "Layout Page")); efl_gfx_hint_fill_set(page, EINA_TRUE, EINA_TRUE); break; case LIST: page = elm_list_add(parent); elm_list_select_mode_set(page, ELM_OBJECT_SELECT_MODE_ALWAYS); evas_object_show(page); for (i = 0; i < 20; i++) { snprintf(buf, sizeof(buf), "List Page - Item #%d", i); elm_list_item_append(page, buf, NULL, NULL, NULL, NULL); } evas_object_size_hint_weight_set(page, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(page, EVAS_HINT_FILL, EVAS_HINT_FILL); break; case BUTTON: page = efl_add(EFL_UI_BUTTON_CLASS, parent, efl_text_set(efl_added, "Button Page")); efl_gfx_hint_fill_set(page, EINA_TRUE, EINA_TRUE); break; default: snprintf(buf, sizeof(buf), "%s/objects/test_pager.edj", elm_app_data_dir_get()); page = efl_add(EFL_UI_LAYOUT_CLASS, parent, efl_file_set(efl_added, buf), efl_file_key_set(efl_added, "page"), efl_file_load(efl_added), efl_text_set(efl_part(efl_added, "text"), "Layout Page")); efl_gfx_hint_fill_set(page, EINA_TRUE, EINA_TRUE); break; } return page; }
static void _light_setup(Scene_Data *data) { data->light = efl_add(EVAS_CANVAS3D_LIGHT_CLASS, evas); evas_canvas3d_light_ambient_set(data->light, 0.2, 0.2, 0.2, 1.0); evas_canvas3d_light_diffuse_set(data->light, 1.0, 1.0, 1.0, 1.0); evas_canvas3d_light_specular_set(data->light, 1.0, 1.0, 1.0, 1.0); data->light_node = efl_add(EVAS_CANVAS3D_NODE_CLASS, evas, evas_canvas3d_node_type_set(efl_added, EVAS_CANVAS3D_NODE_TYPE_LIGHT)); evas_canvas3d_node_light_set(data->light_node, data->light); evas_canvas3d_node_position_set(data->light_node, 0.0, 0.0, 10.0); evas_canvas3d_node_look_at_set(data->light_node, EVAS_CANVAS3D_SPACE_PARENT, 0.0, 0.0, 0.0, EVAS_CANVAS3D_SPACE_PARENT, 0.0, 1.0, 0.0); evas_canvas3d_node_member_add(data->root_node, data->light_node); }
EOLIAN static Efl_Object * _efl_net_dialer_simple_efl_object_finalize(Eo *o, Efl_Net_Dialer_Simple_Data *pd) { if (efl_io_buffered_stream_inner_io_get(o)) goto end; if (!pd->inner_class) { ERR("no valid dialer was set with efl_io_buffered_stream_inner_io_set() and no class set with efl_net_dialer_simple_inner_class_set()!"); return NULL; } else { Eo *dialer = efl_add(pd->inner_class, o); EINA_SAFETY_ON_NULL_RETURN_VAL(dialer, NULL); if (!efl_isa(dialer, EFL_NET_DIALER_INTERFACE)) { ERR("class %s=%p doesn't implement Efl.Net.Dialer interface!", efl_class_name_get(pd->inner_class), pd->inner_class); efl_del(dialer); return NULL; } DBG("created new inner dialer %p (%s)", dialer, efl_class_name_get(efl_class_get(dialer))); efl_io_buffered_stream_inner_io_set(o, dialer); } end: return efl_finalize(efl_super(o, MY_CLASS)); }
EAPI Evas_Object * evas_object_polygon_add(Evas *e) { e = evas_find(e); EINA_SAFETY_ON_FALSE_RETURN_VAL(efl_isa(e, EVAS_CANVAS_CLASS), NULL); return efl_add(MY_CLASS, e, efl_canvas_object_legacy_ctor(efl_added)); }
EOLIAN static Efl_Input_Event * _efl_input_pointer_efl_duplicate_duplicate(const Eo *obj, Efl_Input_Pointer_Data *pd) { Efl_Input_Pointer_Data *ev; Efl_Input_Focus *evt; if (efl_invalidated_get(obj)) { ERR("Object %s has already been invalidated and can't be duplicated.", efl_debug_name_get(obj)); return NULL; } if (!efl_parent_get(obj)) { ERR("Object %s has not parent during duplicate.", efl_debug_name_get(obj)); return NULL; } evt = efl_add(MY_CLASS, efl_parent_get(obj), efl_allow_parent_unref_set(efl_added, EINA_TRUE)); ev = efl_data_scope_get(evt, MY_CLASS); if (!ev) return NULL; memcpy(ev, pd, sizeof(*ev)); ev->eo = evt; ev->legacy = NULL; ev->evas_done = 0; ev->win_fed = 0; ev->fake = 1; ev->device = efl_ref(pd->device); return evt; }
static void _scene_setup(Scene_Data *data) { data->scene = efl_add(EVAS_CANVAS3D_SCENE_CLASS, evas); evas_canvas3d_scene_size_set(data->scene, WIDTH - d_w, HEIGHT - d_h); evas_canvas3d_scene_background_color_set(data->scene, 0.0, 0.0, 0.0, 0.0); data->root_node = efl_add(EVAS_CANVAS3D_NODE_CLASS, evas, evas_canvas3d_node_type_set(efl_added, EVAS_CANVAS3D_NODE_TYPE_NODE)); _camera_setup(data); _light_setup(data); _mesh_setup(data); evas_canvas3d_scene_root_node_set(data->scene, data->root_node); evas_canvas3d_scene_camera_node_set(data->scene, data->camera_node); }
static inline Eo * _image_create(Eo *win, const char *path) { return efl_add(EFL_UI_IMAGE_CLASS, win, efl_file_set(efl_added, path), efl_file_load(efl_added), efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(20, 20))); }
EAPI Evas_Canvas3D_Primitive * evas_canvas3d_primitive_add(Evas *e) { MAGIC_CHECK(e, Evas, MAGIC_EVAS); return NULL; MAGIC_CHECK_END(); return efl_add(MY_CLASS, e); }
EAPI Evas_Object * //Evas_Object * jk_spinner_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); Evas_Object *obj = efl_add(MY_CLASS, parent); printf("jk_spinner_add ::::::::::::::::::::: :obj : %p \n", obj); return obj; }
int main(int argc, char *argv[]) { (void) argc; (void) argv; efl_object_init(); Eo *obj = efl_add(SIMPLE_CLASS, NULL); simple_a_set(obj, 1); simple_b_set(obj, 2); int a = 0, b = 0, sum = 0; a = simple_a_get(obj); b = simple_b_get(obj); sum = mixin_ab_sum_get(obj); fail_if(sum != a + b + 2); /* 2 for the two mixins... */ sum = mixin_ab_sum_get(obj); sum = mixin_ab_sum_get(obj); Mixin2_Public_Data *pd2 = efl_data_scope_get(obj, MIXIN2_CLASS); fail_if(pd2->count != 6); Mixin3_Public_Data *pd3 = efl_data_scope_get(obj, MIXIN3_CLASS); fail_if(pd3->count != 9); efl_unref(obj); obj = efl_add(INHERIT_CLASS, NULL); simple_a_set(obj, 5); a = simple_a_get(obj); printf("%d\n", a); fail_if(a != 5); efl_unref(obj); efl_object_shutdown(); return 0; }
static Eo * _create_label(Eo *win, Eo *bx) { Eo *en; en = efl_add(EFL_UI_TEXT_CLASS, win); printf("Added Efl.Ui.Text object\n"); efl_ui_text_interactive_editable_set(en, EINA_FALSE); efl_canvas_text_style_set(en, NULL, "DEFAULT='align=center font=Sans font_size=10 color=#fff wrap=word'"); evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(en); elm_box_pack_end(bx, en); return en; }
//FIXME sub_object_parent_add? destruction static void _event_handler_create(Eo *obj, Efl_Ui_Pager_Data *pd) { pd->event = efl_add(EFL_CANVAS_RECTANGLE_CLASS, evas_object_evas_get(obj)); evas_object_color_set(pd->event, 0, 0, 0, 0); evas_object_repeat_events_set(pd->event, EINA_TRUE); efl_content_set(efl_part(obj, "efl.event"), pd->event); efl_event_callback_add(pd->event, EFL_EVENT_POINTER_DOWN, _mouse_down_cb, obj); efl_event_callback_add(pd->event, EFL_EVENT_POINTER_UP, _mouse_up_cb, obj); efl_event_callback_add(pd->event, EFL_EVENT_POINTER_MOVE, _mouse_move_cb, obj); }
static void _set_material_to_mesh_from_eet_file(Evas_Canvas3D_Mesh *mesh, Evas_Canvas3D_Mesh_Eet *eet_mesh) { Evas_Canvas3D_Object_Data *pd = efl_data_scope_get(mesh, EVAS_CANVAS3D_OBJECT_CLASS); Eo *material = NULL; material = efl_add(EVAS_CANVAS3D_MATERIAL_CLASS, pd->evas); evas_canvas3d_material_enable_set(material, EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, !!(eet_mesh->materials->colors[0].a > 0)); evas_canvas3d_material_enable_set(material, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, !!(eet_mesh->materials->colors[1].a > 0)); evas_canvas3d_material_enable_set(material, EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, !!(eet_mesh->materials->colors[2].a > 0)); evas_canvas3d_material_enable_set(material, EVAS_CANVAS3D_MATERIAL_ATTRIB_NORMAL, EINA_TRUE); evas_canvas3d_material_color_set(material, EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, eet_mesh->materials->colors[0].r, eet_mesh->materials->colors[0].g, eet_mesh->materials->colors[0].b, eet_mesh->materials->colors[0].a); evas_canvas3d_material_color_set(material, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, eet_mesh->materials->colors[1].r, eet_mesh->materials->colors[1].g, eet_mesh->materials->colors[1].b, eet_mesh->materials->colors[1].a); evas_canvas3d_material_color_set(material, EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, eet_mesh->materials->colors[2].r, eet_mesh->materials->colors[2].g, eet_mesh->materials->colors[2].b, eet_mesh->materials->colors[2].a); evas_canvas3d_material_shininess_set(material, eet_mesh->materials->shininess); evas_canvas3d_mesh_frame_material_set(mesh, 0, material); }
static Eina_Bool _ecore_con_local_win32_client_add(void *data, Ecore_Win32_Handler *wh) { Ecore_Con_Server *obj = data; Efl_Network_Server_Data *svr = efl_data_scope_get(obj, EFL_NETWORK_SERVER_CLASS); Ecore_Win32_Handler *handler_read; Ecore_Win32_Handler *handler_peek; if (!svr->pipe) return ECORE_CALLBACK_CANCEL; if (svr->delete_me) return ECORE_CALLBACK_CANCEL; if ((svr->client_limit >= 0) && (!svr->reject_excess_clients) && (svr->client_count >= (unsigned int)svr->client_limit)) return ECORE_CALLBACK_CANCEL; Ecore_Con_Client *cl_obj = efl_add(EFL_NETWORK_CLIENT_CLASS, efl_main_loop_get()); Efl_Network_Client_Data *cl = efl_data_scope_get(obj, EFL_NETWORK_CLIENT_CLASS); if (!cl) { ERR("allocation failed"); return ECORE_CALLBACK_CANCEL; } cl->host_server = obj; svr->event_read = CreateEvent(NULL, TRUE, FALSE, NULL); if (!svr->event_read) { ERR("Can not create event read"); goto free_cl; } handler_read = ecore_main_win32_handler_add(svr->event_read, _ecore_con_local_win32_server_read_client_handler, obj); if (!handler_read) { ERR("Can not create handler read"); goto close_event_read; } svr->event_peek = CreateEvent(NULL, TRUE, FALSE, NULL); if (!svr->event_peek) { ERR("Can not create event peek"); goto del_handler_read; } handler_peek = ecore_main_win32_handler_add(svr->event_peek, _ecore_con_local_win32_server_peek_client_handler, obj); if (!handler_peek) { ERR("Can not create handler peek"); goto close_event_peek; } svr->read_stopped = EINA_TRUE; svr->thread_read = (HANDLE)_beginthreadex(NULL, 0, _ecore_con_local_win32_server_read_client_thread, cl, CREATE_SUSPENDED, NULL); if (!svr->thread_read) { ERR("Can not launch thread"); goto del_handler_peek; } svr->clients = eina_list_append(svr->clients, obj); svr->client_count++; if (!cl->delete_me) ecore_con_event_client_add(obj); ecore_main_win32_handler_del(wh); ResumeThread(svr->thread_read); return ECORE_CALLBACK_DONE; del_handler_peek: ecore_main_win32_handler_del(handler_peek); close_event_peek: CloseHandle(svr->event_peek); del_handler_read: ecore_main_win32_handler_del(handler_read); close_event_read: CloseHandle(svr->event_read); free_cl: efl_del(cl_obj); return ECORE_CALLBACK_CANCEL; }
EAPI int eio_init(void) { if (++_eio_init_count != 1) return _eio_init_count; if (!eina_init()) { fprintf(stderr, "Eio can not initialize Eina\n"); return --_eio_init_count; } _eio_log_dom_global = eina_log_domain_register("eio", EIO_DEFAULT_LOG_COLOR); if (_eio_log_dom_global < 0) { EINA_LOG_ERR("Eio can not create a general log domain."); goto shutdown_eina; } if (!ecore_init()) { ERR("Can not initialize Ecore\n"); goto unregister_log_domain; } memset(&progress_pool, 0, sizeof(progress_pool)); memset(&direct_info_pool, 0, sizeof(direct_info_pool)); memset(&char_pool, 0, sizeof(char_pool)); memset(&associate_pool, 0, sizeof(associate_pool)); eina_lock_new(&(progress_pool.lock)); progress_pool.mem_size = sizeof (Eio_Progress); eina_lock_new(&(direct_info_pool.lock)); direct_info_pool.mem_size = sizeof (Eio_File_Direct_Info); eina_lock_new(&(char_pool.lock)); char_pool.mem_size = sizeof (Eio_File_Char); eina_lock_new(&(associate_pool.lock)); associate_pool.mem_size = sizeof (Eio_File_Associate); eina_spinlock_new(&(memory_pool_lock)); eina_lock_new(&(memory_pool_mutex)); eina_condition_new(&(memory_pool_cond), &(memory_pool_mutex)); eio_monitor_init(); efreet_mime_init(); io_manager = efl_add(EFL_IO_MANAGER_CLASS, ecore_main_loop_get()); efl_loop_register(ecore_main_loop_get(), EFL_IO_MANAGER_CLASS, io_manager); eina_log_timing(_eio_log_dom_global, EINA_LOG_STATE_STOP, EINA_LOG_STATE_INIT); return _eio_init_count; unregister_log_domain: eina_log_domain_unregister(_eio_log_dom_global); _eio_log_dom_global = -1; shutdown_eina: eina_shutdown(); return --_eio_init_count; }