static void _smart_resize (Evas_Object *obj, Evas_Coord w, Evas_Coord h) { Smart_Dvi *sp; sp = evas_object_smart_data_get (obj); if (!sp) return; evas_object_image_fill_set (sp->obj, 0, 0, w, h); evas_object_resize (sp->obj, w, h); }
static void _init_naviframe(Evas_Object *win) { Evas_Object *nf; nf = elm_naviframe_add(win); evas_object_size_hint_weight_set(nf, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, nf); evas_object_show(nf); evas_object_resize(win, 800, 600); }
int download_func(void *data, const char *file, long int dltotal, long int dlnow, long int ultotal, long int ulnow){ is_downloading = true; if(dltotal!=0){ char perc[10]; sprintf(perc,"%ld %%", dlnow*100/dltotal); override_text(&download_perc, "d_perc_text", perc); evas_object_resize(down, Bar_X_Val*dlnow/dltotal, Bar_Y_Val); evas_object_show(down); } return ECORE_FILE_PROGRESS_CONTINUE; }
int main(int argc, char **argv) { Evas_Object *win; if (!elm_init(argc, argv)) return -1; win = elm_win_util_standard_add("Genlist", "Genlist Basic Tutorial"); elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); elm_win_autodel_set(win, EINA_TRUE); //win 400x400 px evas_object_resize(win, 400, 400); //GENLIST here Evas_Object *list; list = elm_genlist_add(win); Elm_Genlist_Item_Class *_itc = elm_genlist_item_class_new(); _itc->item_style = "default"; _itc->func.text_get = _genlist_text_get; _itc->func.content_get = _genlist_content_get; _itc->func.state_get = NULL; _itc->func.del = NULL; Elm_Genlist_Item_Class *_itc2 = elm_genlist_item_class_new(); _itc2->item_style = "group_index"; _itc2->func.text_get = _genlist_text_get; _itc2->func.content_get = _genlist_content_get; _itc2->func.state_get = NULL; _itc2->func.del = NULL; int i=0; for (i=0; i<20; i++) { elm_genlist_item_append( list, _itc, (void *)(uintptr_t) i, // Item data NULL, // Parent item for trees, NULL if none ELM_GENLIST_ITEM_NONE, // Item type; this is the common one _genlist_selected_cb, // Callback on selection of the item _itc2 // Data for that callback function ); } evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, list); evas_object_show(list); evas_object_show(win); elm_run(); elm_shutdown(); return 0; }
static Cube * _cube_new(Evas_Coord w, Evas_Coord h, Evas_Coord d) { Cube *c; int i; w -= (w / 2); h -= (h / 2); d -= (d / 2); c = calloc(1, sizeof(Cube)); for (i = 0; i < 6; i++) { Evas_Object *o; char buf[256]; o = evas_object_image_add(evas); c->side[i].o = o; snprintf(buf, sizeof(buf), "cube%i.png", i + 1); evas_object_image_file_set(o, build_path(buf), NULL); evas_object_image_fill_set(o, 0, 0, 256, 256); evas_object_resize(o, 256, 256); evas_object_show(o); } POINT(0, 0, -w, -h, -d, 0, 0); POINT(0, 1, w, -h, -d, 256, 0); POINT(0, 2, w, h, -d, 256, 256); POINT(0, 3, -w, h, -d, 0, 256); POINT(1, 0, w, -h, -d, 0, 0); POINT(1, 1, w, -h, d, 256, 0); POINT(1, 2, w, h, d, 256, 256); POINT(1, 3, w, h, -d, 0, 256); POINT(2, 0, w, -h, d, 0, 0); POINT(2, 1, -w, -h, d, 256, 0); POINT(2, 2, -w, h, d, 256, 256); POINT(2, 3, w, h, d, 0, 256); POINT(3, 0, -w, -h, d, 0, 0); POINT(3, 1, -w, -h, -d, 256, 0); POINT(3, 2, -w, h, -d, 256, 256); POINT(3, 3, -w, h, d, 0, 256); POINT(4, 0, -w, -h, d, 0, 0); POINT(4, 1, w, -h, d, 256, 0); POINT(4, 2, w, -h, -d, 256, 256); POINT(4, 3, -w, -h, -d, 0, 256); POINT(5, 0, -w, h, -d, 0, 0); POINT(5, 1, w, h, -d, 256, 0); POINT(5, 2, w, h, d, 256, 256); POINT(5, 3, -w, h, d, 0, 256); return c; }
static void _sizing_eval(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); Evas_Coord x,y,w,h; if (!wd) return; if (!wd->parent) return; evas_object_geometry_get(wd->parent, &x, &y, &w, &h); evas_object_move(obj, x, y); evas_object_resize(obj, w, h); }
static void winchoosefile(char *prompt, char *buf, int len, int filter, Eina_Bool is_save) { Evas *evas = NULL; if ( frame != NULL ){ //simulate a modal dialog by disabling all events to the main window ecore_evas_get( frame ); disable_idlers(); evas_event_freeze(evas); } /*TODO: implement file name filtering */ Evas_Object *win, *fs, *bg, *vbox, *hbox, *bt; win = elm_win_add(NULL, "fileselector", ELM_WIN_BASIC); elm_win_title_set(win, prompt); bg = elm_bg_add(win); elm_win_resize_object_add(win, bg); evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(bg); vbox = elm_box_add(win); elm_win_resize_object_add(win, vbox); evas_object_size_hint_weight_set(vbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(vbox); fs = elm_fileselector_add(win); elm_fileselector_is_save_set(fs, is_save); elm_fileselector_expandable_set(fs, EINA_FALSE); evas_object_size_hint_weight_set(fs, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(fs, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_box_pack_end(vbox, fs); evas_object_show(fs); evas_object_smart_callback_add(fs, "done", my_fileselector_done, win); if (strlen(buf)) elm_fileselector_selected_set( fs, buf ); if (fileselect) elm_fileselector_path_set( fs, filepath ); else if (getenv("HOME")) elm_fileselector_path_set( fs, getenv("HOME") ); evas_object_resize(win, 400, 350); evas_object_show(win); evas_object_data_set(fs, "buffer", buf); elm_run(); if ( evas != NULL ){ //enable events to the main window enable_idlers(); evas_event_thaw(evas); } }
static void _generate_thumb(Ethumb *e) { Epdf_Document *document; Epdf_Page *page; Evas_Object *o; const char *src_path; int w, h, ww, hh; int fx, fy, fw, fh; unsigned int npages, pagenum; ethumb_file_get(e, &src_path, NULL); document = epdf_document_new(src_path); if (!document) { fprintf(stderr, "ERROR: could not read document: %s\n", src_path); ethumb_finished_callback_call(e, 0); return; } page = epdf_page_new(document); if (!page) { fprintf(stderr, "ERROR: could not read document: %s\n", src_path); epdf_document_delete(document); ethumb_finished_callback_call(e, 0); return; } npages = epdf_document_page_count_get(document); pagenum = ethumb_document_page_get(e); if (pagenum < npages) epdf_page_page_set(page, pagenum); epdf_page_size_get(page, &w, &h); ethumb_calculate_aspect(e, w, h, &ww, &hh); ethumb_plugin_image_resize(e, ww, hh); o = evas_object_image_add(ethumb_evas_get(e)); epdf_page_render(page, o); evas_object_resize(o, ww, hh); evas_object_move(o, 0, 0); ethumb_calculate_fill(e, w, h, &fx, &fy, &fw, &fh); evas_object_image_fill_set(o, fx, fy, fw, fh); evas_object_show(o); ethumb_image_save(e); evas_object_del(o); epdf_page_delete(page); epdf_document_delete(document); ethumb_finished_callback_call(e, 1); }
static void resize_cb(Ecore_Evas *ee) { app_t *app; Evas_Coord w, h; app = ecore_evas_data_get(ee, "app"); evas_output_viewport_get(app->evas, NULL, NULL, &w, &h); evas_object_resize(app->edje_main, w, h); setup_gui_list(app); }
static Evas_Object * rect_create(void) { Evas_Object *r; r = evas_object_rectangle_add(e); evas_object_color_set(r, 255, 0, 0, 255); evas_object_resize(r, 36, 36); evas_object_move(r, 25, (450 / 2) - (36 / 2)); evas_object_show(r); return r; }
EAPI_MAIN int elm_main(int argc, char *argv[]) { // Initialize ewebkit. ewk_init(); Evas_Object* win; win = elm_win_add(NULL, "sample", ELM_WIN_BASIC); elm_win_title_set(win, "sample"); evas_object_smart_callback_add(win, "delete,request", on_done, NULL); elm_win_autodel_set(win, EINA_TRUE); Evas_Object* bg = elm_bg_add(win); evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_bg_color_set(bg, 0, 0, 255); elm_win_resize_object_add(win, bg); evas_object_show(bg); // create very simple ewk_view. Evas_Object* ewk = ewk_view_add(evas_object_evas_get(win)); // register callback. evas_object_smart_callback_add(ewk, "load,progress", progress_cb, NULL); // load specific url. ewk_view_url_set(ewk, "http://bunhere.tistory.com"); // locate ewk_view at (0,0,400,400) evas_object_resize(ewk, 400, 400); evas_object_move(ewk, 0, 0); evas_object_show(ewk); evas_object_resize(win, 400, 400); evas_object_show(win); // execute main loop, ewk_view will do a lot of operation for loading url. elm_run(); // Before terminated process, please deinitialize ewebkit. ewk_shutdown(); }
/* local subsystem globals */ static void _smart_reconfigure(Smart_Data * sd) { Evas_Coord x, y, w, h; x = sd->x; y = sd->y; w = sd->w; h = sd->h; evas_object_move(sd->o_edje, x, y); evas_object_resize(sd->o_edje, w, h); }
void eps_page_render (const Eps_Page *page, Evas_Object *o) { unsigned char *data; unsigned char *d; unsigned int *m = NULL; double hscale; double vscale; SpectreStatus status; int width; int height; int stride; int yy; if (!page || !o) return; spectre_page_render (page->page, page->rc, &data, &stride); status = spectre_page_status (page->page); if (status != SPECTRE_STATUS_SUCCESS) { printf ("[eps] %s\n", spectre_status_to_string (status)); return; } eps_page_scale_get (page, &hscale, &vscale); eps_page_size_get (page, &width, &height); width *= hscale; height *= vscale; evas_object_image_size_set (o, width, height); evas_object_image_fill_set (o, 0, 0, width, height); m = (unsigned int *)evas_object_image_data_get (o, 1); if (!m) { free (data); return; } if (stride == 4 * width) memcpy(m, data, height * stride); else { d = data; for (yy = 0; yy < height; d += stride, m += width, ++yy) { memcpy (m, d, width * 4); } } evas_object_image_data_update_add (o, 0, 0, width, height); evas_object_resize (o, width, height); free (data); }
EAPI_MAIN int elm_main(int argc, char **argv) { Evas_Object *win, *prefs, *notify, *label; Elm_Prefs_Data *prefs_data; win = elm_win_util_standard_add("prefs", "Prefs Example 01"); elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); elm_win_autodel_set(win, EINA_TRUE); prefs = elm_prefs_add(win); evas_object_size_hint_weight_set(prefs, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, prefs); evas_object_show(prefs); evas_object_smart_callback_add(prefs, "page,saved", _page_saved_cb, NULL); evas_object_smart_callback_add(prefs, "page,loaded", _page_loaded_cb, NULL); evas_object_smart_callback_add(prefs, "item,changed", _item_changed_cb, win); elm_prefs_autosave_set(prefs, EINA_TRUE); prefs_data = elm_prefs_data_new("./prefs_example_01.cfg", NULL, EET_FILE_MODE_READ_WRITE); elm_prefs_file_set(prefs, "prefs_example_01.epb", NULL); elm_prefs_data_set(prefs, prefs_data); label = elm_label_add(win); elm_object_text_set(label, "Setting Values Programmatically"); evas_object_size_hint_align_set(label, 0.5, 0.5); notify = elm_notify_add(win); elm_notify_align_set(notify, 0.5, 1); elm_notify_timeout_set(notify, 2); elm_object_content_set(notify, label); evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(notify); evas_object_data_set(notify, "prefs_data", prefs_data); evas_object_resize(win, 320, 320); evas_object_show(win); ecore_timer_add(5.0, _elm_prefs_data_change, notify); elm_run(); elm_prefs_data_unref(prefs_data); elm_shutdown(); return 0; }
EAPI_MAIN int elm_main(int argc, char **argv) { Evas_Object *win, *prefs, *notify, *label; Elm_Prefs_Data *prefs_data; win = elm_win_util_standard_add("prefs", "Prefs Example 02"); elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); elm_win_autodel_set(win, EINA_TRUE); prefs = elm_prefs_add(win); evas_object_size_hint_weight_set(prefs, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, prefs); evas_object_show(prefs); elm_prefs_autosave_set(prefs, EINA_TRUE); prefs_data = elm_prefs_data_new("./prefs_example_02.cfg", NULL, EET_FILE_MODE_READ_WRITE); elm_prefs_file_set(prefs, "prefs_example_02.epb", NULL); elm_prefs_data_set(prefs, prefs_data); label = elm_label_add(win); elm_object_text_set(label, "Editable, Visible and Disable! Just Saying..."); evas_object_size_hint_weight_set(label, 0.0, 0.0); evas_object_size_hint_align_set(label, 0.5, 0.5); notify = elm_notify_add(win); elm_notify_align_set(notify, 0.5, 1); elm_notify_timeout_set(notify, 2); elm_object_content_set(notify, label); evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(notify); evas_object_data_set(notify, "prefs", prefs); evas_object_data_set(notify, "prefs_data", prefs_data); evas_object_smart_callback_add(prefs, "action", _action_cb, notify); evas_object_resize(win, 320, 320); evas_object_show(win); ecore_timer_add(5.0, _elm_prefs_items_change, notify); elm_run(); elm_prefs_data_unref(prefs_data); elm_shutdown(); return 0; }
EAPI_MAIN int elm_main(int argc, char **argv) { Evas_Object *win, *bx, *tb, *bt, *menu; Elm_Object_Item *tb_it; elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); win = elm_win_util_standard_add("toolbar", "Toolbar Example"); elm_win_autodel_set(win, EINA_TRUE); bx = elm_box_add(win); evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, bx); evas_object_show(bx); bt = elm_button_add(win); evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_object_text_set(bt, "Button"); evas_object_show(bt); tb = elm_toolbar_add(win); evas_object_size_hint_weight_set(tb, 0.0, 0.0); evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, 0.0); evas_object_show(tb); elm_toolbar_item_append(tb, "document-print", "Print", NULL, NULL); elm_toolbar_item_append(tb, "folder-new", "Folder", NULL, NULL); elm_toolbar_item_append(tb, "clock", "Clock", NULL, NULL); elm_toolbar_item_append(tb, "refresh", "Update", NULL, NULL); elm_toolbar_menu_parent_set(tb, win); tb_it = elm_toolbar_item_append(tb, "mail-send", "Send Mail", NULL, NULL); elm_toolbar_item_menu_set(tb_it, EINA_TRUE); menu = elm_toolbar_item_menu_get(tb_it); elm_menu_item_add(menu, NULL, "emptytrash", "Empty Trash", NULL, NULL); elm_menu_item_add(menu, NULL, "trashcan_full", "Full Trash", NULL, NULL); elm_toolbar_item_priority_set(tb_it, 10); elm_box_pack_end(bx, tb); elm_box_pack_end(bx, bt); evas_object_resize(win, 230, 200); evas_object_show(win); elm_run(); return 0; }
static void _sizing_eval(Evas_Object *obj) { Evas_Coord x, y, w, h; ELM_NOTIFY_DATA_GET(obj, sd); if (!sd->parent) return; evas_object_geometry_get(sd->parent, &x, &y, &w, &h); evas_object_move(obj, x, y); evas_object_resize(obj, w, h); }
static void resizeInspectorWindow(Ecore_Evas* inspectorWindow) { Evas_Object* inspectorView = evas_object_name_find(ecore_evas_get(inspectorWindow), "inspector"); if (!inspectorView) return; int width, height; ecore_evas_geometry_get(inspectorWindow, 0, 0, &width, &height); evas_object_move(inspectorView, 0, 0); evas_object_resize(inspectorView, width, height); }
EAPI_MAIN int elm_main(int argc, char **argv) { Evas_Object *win, *bg, *box; Evas_Object *list; win = elm_win_add(NULL, "icon", ELM_WIN_BASIC); elm_win_title_set(win, "Icon"); elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); elm_win_autodel_set(win, EINA_TRUE); bg = elm_bg_add(win); elm_bg_color_set(bg, 255,255 ,255); evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, bg); evas_object_show(bg); box = elm_box_add(win); elm_box_horizontal_set(box, EINA_TRUE); evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_win_resize_object_add(win, box); evas_object_show(box); if (!_itc) { _itc = elm_genlist_item_class_new(); _itc->item_style = "double_label"; _itc->func.text_get = _item_label_get; _itc->func.content_get = _item_content_get; _itc->func.state_get = NULL; _itc->func.del = NULL; } list = _genlist_add(box); _genlist_fill(list); list = _genlist_add(box); elm_genlist_mode_set(list, ELM_LIST_LIMIT); _genlist_fill(list); list = _genlist_add(box); elm_genlist_mode_set(list, ELM_LIST_COMPRESS); _genlist_fill(list); evas_object_resize(win, 800, 320); evas_object_show(win); elm_run(); elm_shutdown(); return 0; }
EAPI_MAIN int elm_main ( int argc, char **argv) { Evas_Object *win, *bg, *box, *logout, *ulist, *login; #if !GLIB_CHECK_VERSION (2, 36, 0) g_type_init (); #endif win = elm_win_add(NULL, "tlmui", ELM_WIN_BASIC); elm_win_title_set(win, "Demo tlm-ui"); elm_win_autodel_set(win, EINA_TRUE); elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); evas_object_resize(win, 500, 400); evas_object_show(win); main_window = g_malloc0 (sizeof(MainWindow)); main_window->win = win; main_window->use_nfc_tag = FALSE; main_window->user_label = NULL; //background bg = elm_bg_add(win); evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, bg); evas_object_show(bg); box = elm_box_add (win); evas_object_size_hint_weight_set (box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show (box); elm_win_resize_object_add (win, box); login = _add_login_box (win); elm_box_pack_end (box, login); ulist = _add_user_list (win); elm_box_pack_end (box, ulist); logout = _add_logout_box (win); elm_box_pack_end (box, logout); _set_loggedin_username (); // run the mainloop and process events and callbacks elm_run(); elm_shutdown(); g_free (main_window); return 0; }
static void resize(Elation_Module *em) { Elation_Module_Private *pr; Evas_Coord w, h; pr = em->data; evas_output_viewport_get(em->info->evas, NULL, NULL, &w, &h); evas_object_move(pr->overlay, 0, 0); evas_object_resize(pr->overlay, w, h); }
static void display_help(Evas *e) { Evas_Textblock_Style *style; int h_win, w_win; evas_output_viewport_get(e, NULL, NULL, &w_win, &h_win); help_background = evas_object_rectangle_add(e); help_text_cmd = evas_object_textblock_add(e); help_text_desc = evas_object_textblock_add(e); style = evas_textblock_style_new(); evas_font_path_append(e,PACKAGE_DATA_DIR"/viewer"); evas_textblock_style_set(style,"DEFAULT='font=DejaVuSans-Bold font_size=20 align=left color=#000000 wrap=word style=soft_outline outline_color=#3779cb'" "NewLine= '+\n'"); evas_object_resize(help_text_cmd, w_win,h_win); evas_object_move(help_text_cmd,200,140); evas_object_show(help_text_cmd); evas_object_textblock_style_set(help_text_cmd,style); evas_object_textblock_text_markup_set(help_text_cmd,help_msg_cmd); evas_object_resize(help_text_desc, w_win,h_win); evas_object_move(help_text_desc,450,140); evas_object_show(help_text_desc); evas_object_textblock_style_set(help_text_desc,style); evas_object_textblock_text_markup_set(help_text_desc,help_msg_desc); evas_object_show(help_background); evas_object_color_set(help_background, 0, 0, 0, 200); evas_object_resize(help_background, w_win,h_win); evas_object_move(help_background,0,0); is_help = 1; }
void window_resize(Ecore_Evas *ee) { Evas_Coord pw; int ex, ey, ew, eh; evas_output_size_get(evas, &win_w, &win_h); evas_object_resize(o_bg, win_w, win_h); evas_object_image_fill_set(o_bg, 0, 0, win_w, win_h); evas_object_geometry_get(o_panel, NULL, NULL, &pw, NULL); evas_object_resize(o_panel, pw, win_h); evas_object_image_fill_set(o_panel, 0, 0, pw, win_h); ey = win_h / 2; ew = win_w - pw - 20; eh = ey - 10; ex = pw + 10; ey += 10; evas_object_move(e_msg, ex, 10); evas_object_resize(e_msg, ew, eh); evas_object_move(o_bg_etox, ex, ey); evas_object_resize(o_bg_etox, ew, eh); evas_object_move(clip_test, ex, ey); evas_object_resize(clip_test, ew, eh); evas_object_move(e_test, ex, ey); evas_object_resize(e_test, ew, eh); return; ee = NULL; }
static Evas_Object * engage_element_icon_new(Evas * evas, const char *file, const char *group) { int iw, ih; Evas_Object *result = NULL; /* edje */ if (group) { if (file && file[0] == '/') { result = edje_object_add(evas); if (edje_object_file_set(result, file, group) > 0) { evas_object_move(result, -9999, -9999); evas_object_resize(result, 4, 4); } } else { evas_object_del(result); result = NULL; } } /* image */ else { if (file && file[0] == '/') { result = evas_object_image_add(evas); evas_object_image_file_set(result, file, NULL); switch (evas_object_image_load_error_get(result)) { case EVAS_LOAD_ERROR_NONE: evas_object_move(result, -9999, -9999); evas_object_resize(result, 4, 4); break; default: evas_object_del(result); result = NULL; } } else { evas_object_del(result); result = NULL; } } return (result); }
EAPI_MAIN int elm_main(int argc, char **argv) { Evas_Object *win, *cs, *rect, *bx, *fr; elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); win = elm_win_util_standard_add("color selector", "Color selector"); elm_win_autodel_set(win, EINA_TRUE); bx = elm_box_add(win); evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, bx); evas_object_show(bx); fr = elm_frame_add(win); evas_object_size_hint_weight_set(fr, 1.0, 0.5); evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_object_text_set(fr, "Color View"); elm_box_pack_end(bx, fr); evas_object_show(fr); rect = evas_object_rectangle_add(evas_object_evas_get(win)); elm_object_content_set(fr, rect); evas_object_color_set(rect, 255, 90, 18, 255); evas_object_show(rect); fr = elm_frame_add(win); evas_object_size_hint_weight_set(fr, 1.0, 0.5); evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_object_text_set(fr, "Color Selector"); elm_box_pack_end(bx, fr); evas_object_show(fr); cs = elm_colorselector_add(win); elm_colorselector_palette_name_set(cs, "painting"); evas_object_size_hint_weight_set(cs, EVAS_HINT_EXPAND, 0.0); evas_object_size_hint_align_set(cs, EVAS_HINT_FILL, 0.0); elm_colorselector_color_set(cs, 255, 90, 18, 255); evas_object_show(cs); evas_object_smart_callback_add(cs, "changed", _change_color, rect); evas_object_smart_callback_add(cs, "color,item,selected", _colorpalette_clicked_cb, rect); evas_object_smart_callback_add(cs, "color,item,longpressed", _colorpalette_longpressed_cb, rect); elm_object_content_set(fr, cs); evas_object_resize(win, 320, 480); evas_object_show(win); elm_run(); return 0; }
void eps_page_render_slice (const Eps_Page *page, Evas_Object *o, int x, int y, int width, int height) { unsigned char *data; unsigned char *d; unsigned int *m = NULL; double hscale; double vscale; SpectreStatus status; int stride; int yy; if (!page || !o || (width <= 0) || (height <= 0)) return; spectre_page_render_slice (page->page, page->rc, x, y, width, height, &data, &stride); status = spectre_page_status (page->page); if (status != SPECTRE_STATUS_SUCCESS) { printf ("aie !!%d %d %d %d %d\n", status, x, y, width, height); printf ("[eps] %s\n", spectre_status_to_string (status)); return; } eps_page_scale_get (page, &hscale, &vscale); width *= hscale; height *= vscale; evas_object_image_size_set (o, width, height); evas_object_image_fill_set (o, 0, 0, width, height); m = (unsigned int *)evas_object_image_data_get (o, 1); if (!m) { free (data); return; } d = data + y * stride + x; for (yy = 0; yy < height; d += stride, m += width, ++yy) { memcpy (m, d, width * 4); } evas_object_image_data_update_add (o, 0, 0, width, height); evas_object_resize (o, width, height); free (data); }
EAPI_MAIN int elm_main(int argc, char **argv) { Evas_Object *win, *bg, *btn, *layout; char buf[PATH_MAX]; elm_app_info_set(elm_main, "elementary", "examples/layout_example.edj"); win = elm_win_add(NULL, "layout", ELM_WIN_BASIC); elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); elm_win_autodel_set(win, EINA_TRUE); bg = elm_bg_add(win); elm_bg_color_set(bg, 255,255 ,255); evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, bg); evas_object_show(bg); // Adding layout layout = elm_layout_add(win); evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, layout); snprintf(buf, sizeof(buf), "%s/examples/layout_example.edj", elm_app_data_dir_get()); elm_layout_file_set(layout, buf, "example/mylayout3"); evas_object_show(layout); elm_object_signal_callback_add(layout, "size,changed", "", _size_changed_cb, layout); // Setting title const char *title = elm_layout_data_get(layout, "title"); if (title) { elm_win_title_set(win, title); elm_object_part_text_set(layout, TITLE, title); } btn = elm_button_add(win); elm_object_text_set(btn, "Enlarge me!"); evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_object_part_content_set(layout, SWALLOW, btn); evas_object_smart_callback_add(btn, "clicked", _swallow_btn_cb, layout); evas_object_size_hint_min_set(bg, 160, 160); evas_object_size_hint_max_set(bg, 640, 640); evas_object_resize(win, 160, 160); evas_object_show(win); elm_run(); elm_shutdown(); return 0; }
/* to inform current window's size */ static void _canvas_resize_cb(Ecore_Evas *ee_) { int w, h; char buf[1024]; ecore_evas_geometry_get(ee_, NULL, NULL, &w, &h); snprintf(buf, sizeof(buf), "%d x %d", w, h); evas_object_text_text_set(text, buf); evas_object_move(text, (w - 150) / 2, (h - 50) / 2); evas_object_resize(bg, w, h); }
static void _smart_slider_smart_calculate(Evas_Object *o) { smart_slider_t *priv = evas_object_smart_data_get(o); Evas_Coord x, y, w, h; evas_object_geometry_get(o, &x, &y, &w, &h); evas_object_resize(priv->theme, w, h); evas_object_move(priv->theme, x, y); _smart_slider_value_flush(o); }
void _elm_precondition(void) { elm_init(0, NULL); main_win = elm_win_add(NULL, "main", ELM_WIN_BASIC); elm_win_title_set(main_win, "Elementary Unit Test Suite"); evas_object_smart_callback_add(main_win, "delete,request", _win_del, NULL); main_bg = elm_bg_add(main_win); evas_object_size_hint_weight_set(main_bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_resize(main_win, 320, 480); evas_object_show(main_win); }