static void _init_photo(Evas_Object *win) { Evas_Object *bg, *bx, *photo; const char * const filename = "./data/th-whiterabbit01.jpg"; 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); bx = elm_box_add(win); elm_box_horizontal_set(bx, EINA_TRUE); evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_box_homogeneous_set(bx, EINA_TRUE); elm_win_resize_object_add(win, bx); photo = elm_photo_add(win); g_assert(elm_photo_file_set(photo, filename)); elm_photo_size_set(photo, 100); elm_photo_aspect_fixed_set(photo, EINA_FALSE); evas_object_smart_callback_add(photo, "clicked", _on_photo_clicked, NULL); evas_object_size_hint_weight_set(photo, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_photo_fill_inside_set(photo, EINA_TRUE); evas_object_size_hint_align_set(photo, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_box_pack_end(bx, photo); evas_object_show(photo); evas_object_show(bx); }
EAPI_MAIN int elm_main(int argc, char **argv) { Evas_Object *win = NULL; Evas_Object *bg = NULL; win = elm_win_add(NULL, "Background sample", ELM_WIN_BASIC); elm_win_autodel_set(win, EINA_TRUE); elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); bg = elm_bg_add(win); elm_bg_option_set(bg, ELM_BG_OPTION_CENTER); elm_bg_color_set(bg, 255, 0, 255); evas_object_show(bg); evas_object_smart_callback_add(win, "focus,in", _register_cb, bg); register_request_listener(EVENT_HIDE, hide, bg); register_request_listener(EVENT_SHOW, show, bg); elm_win_resize_object_add(win, bg); evas_object_resize(win, 240, 200); evas_object_show(win); elm_run(); elm_shutdown(); return 0; }
static void _cb_color_changed(void *data, Evas_Object *obj, void *event) { Evas_Object *o_bg = data; double val = 0.0; val = elm_spinner_value_get(obj); if (val == 1.0) elm_bg_color_set(o_bg, 255, 255, 255); else if (val == 2.0) elm_bg_color_set(o_bg, 255, 0, 0); else if (val == 3.0) elm_bg_color_set(o_bg, 0, 0, 255); else if (val == 4.0) elm_bg_color_set(o_bg, 0, 255, 0); }
// Create Window static void Build_Window () { // Create window named Main_Win Window *Main_Win = malloc(sizeof(Window)) ; //Create window printf("Create window\n") ; Main_Win->win = elm_win_add(NULL, "main_window", ELM_WIN_BASIC); evas_object_smart_callback_add(Main_Win->win, "delete,request", win_del, Main_Win); elm_win_title_set(Main_Win->win, "MyTest") ; evas_object_resize(Main_Win->win, 500, 500) ; evas_object_show(Main_Win->win); //Create background printf("Create background\n") ; Main_Win->bg = elm_bg_add(Main_Win->win); elm_win_resize_object_add(Main_Win->win, Main_Win->bg) ; elm_bg_color_set(Main_Win->bg, 10, 90, 200) ; evas_object_size_hint_weight_set(Main_Win->bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND) ; evas_object_show(Main_Win->bg); //Create Buttons printf("Create Button\n") ; Main_Win->btn_con = elm_button_add(Main_Win->win) ; evas_object_move(Main_Win->btn_con, 10, 10) ; evas_object_resize(Main_Win->btn_con, 100, 30) ; elm_object_text_set(Main_Win->btn_con, "Connect") ; evas_object_show(Main_Win->btn_con) ; Main_Win->btn_disc = elm_button_add(Main_Win->win) ; evas_object_move(Main_Win->btn_disc, 10, 50) ; evas_object_resize(Main_Win->btn_disc, 100, 30) ; elm_object_text_set(Main_Win->btn_disc, "Disconnect") ; evas_object_show(Main_Win->btn_disc) ; elm_object_disabled_set(Main_Win->btn_disc, EINA_TRUE) ; //Create Entrys printf("Create entry\n") ; Main_Win->ip = elm_entry_add(Main_Win->win) ; evas_object_move(Main_Win->ip, 120, 120) ; evas_object_resize(Main_Win->ip, 100, 30) ; elm_object_text_set (Main_Win->ip, "127.0.0.1") ; elm_entry_scrollable_set(Main_Win->ip, EINA_TRUE) ; elm_object_tooltip_text_set(Main_Win->ip, "Coucou") ; evas_object_show(Main_Win->ip) ; // Link Buttons Functions evas_object_smart_callback_add(Main_Win->btn_con, "clicked", btn_connect, Main_Win) ; evas_object_smart_callback_add(Main_Win->btn_disc, "clicked", btn_disconnect, Main_Win) ; }
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_size_hint_min_set(bg, 800, 160); evas_object_size_hint_max_set(bg, 800, 640); evas_object_resize(win, 800, 320); evas_object_show(win); elm_run(); elm_shutdown(); return 0; }
static Evas_Object * _genlist_content_get(void *data, Evas_Object *obj, const char *part) { int i = (int) (uintptr_t) data; if (strcmp(part, "elm.swallow.icon") == 0) { Evas_Object *bg = elm_bg_add(obj); elm_bg_color_set(bg, 255 * cos(i / (double) 10), 0, i % 255); return bg; } else if (strcmp(part, "elm.swallow.end") == 0) { Evas_Object *bg = elm_bg_add(obj); elm_bg_color_set(bg, 0, 255 * sin(i / (double) 10), i % 255); return bg; } else return NULL; }
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; }
int elm_main(int argc, char **argv) { Evas_Object *win, *bg, *image; char buf[PATH_MAX]; elm_app_info_set(elm_main, "elementary", "images/plant_01.jpg"); win = elm_win_add(NULL, "image", ELM_WIN_BASIC); elm_win_title_set(win, "Image"); 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); snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get()); image = elm_image_add(win); if (!elm_image_file_set(image, buf, NULL)) { printf("error: could not load image \"%s\"\n", buf); return -1; } elm_image_no_scale_set(image, EINA_TRUE); elm_image_resizable_set(image, EINA_FALSE, EINA_TRUE); elm_image_smooth_set(image, EINA_FALSE); elm_image_orient_set(image, ELM_IMAGE_FLIP_HORIZONTAL); elm_image_aspect_fixed_set(image, EINA_TRUE); elm_image_fill_outside_set(image, EINA_TRUE); elm_image_editable_set(image, EINA_TRUE); evas_object_size_hint_weight_set(image, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, image); evas_object_show(image); evas_object_size_hint_min_set(bg, 160, 160); evas_object_size_hint_max_set(bg, 640, 640); evas_object_resize(win, 320, 320); evas_object_show(win); elm_run(); elm_shutdown(); return 0; }
EAPI_MAIN int elm_main(int argc, char **argv) { Evas_Object *win, *bg, *icon; const char *path, *group, *name; 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); icon = elm_icon_add(win); elm_icon_order_lookup_set(icon, ELM_ICON_LOOKUP_THEME_FDO); elm_icon_standard_set(icon, "home"); path = NULL; group = NULL; name = NULL; elm_icon_file_get(icon, &path, &group); name = elm_icon_standard_get(icon); printf("path = %s, group = %s, name = %s\n", path, group, name); elm_icon_no_scale_set(icon, EINA_TRUE); elm_icon_resizable_set(icon, EINA_FALSE, EINA_TRUE); elm_icon_smooth_set(icon, EINA_FALSE); elm_icon_fill_outside_set(icon, EINA_TRUE); evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, icon); evas_object_show(icon); evas_object_size_hint_min_set(bg, 160, 160); evas_object_size_hint_max_set(bg, 640, 640); evas_object_resize(win, 320, 320); evas_object_show(win); elm_run(); elm_shutdown(); return 0; }
EAPI_MAIN int elm_main(int argc, char **argv) { Evas_Object *win, *bg, *layout, *icon; struct _App app; app.current = 0; win = elm_win_add(NULL, "layout", ELM_WIN_BASIC); elm_win_title_set(win, "Layout"); 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 and filling it with widgets 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); elm_layout_theme_set( layout, "layout", "application", "content-back-next"); evas_object_show(layout); icon = elm_icon_add(win); elm_icon_standard_set(icon, images[app.current]); evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_object_part_content_set(layout, "elm.swallow.content", icon); elm_object_signal_callback_add(layout, "elm,action,back", "", _signal_cb, &app); elm_object_signal_callback_add(layout, "elm,action,next", "", _signal_cb, &app); evas_object_resize(win, 320, 320); evas_object_show(win); elm_run(); elm_shutdown(); return 0; }
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(); }
int elm_main(int argc, char **argv) { Evas_Object *win, *bg, *slider, *box; //Load our custom edj file with our slider style elm_theme_extension_add(NULL, "./slider.edj"); //Window win = elm_win_add(NULL, "volume-slider", ELM_WIN_BASIC); elm_win_title_set(win, "Volume Know style Example"); elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); elm_win_autodel_set(win, EINA_TRUE); evas_object_resize(win, 400, 400); evas_object_show(win); //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); evas_object_size_hint_min_set(bg, 200, 200); elm_bg_color_set(bg, 10, 10, 10); //Box box = elm_box_add(win); evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, box); evas_object_show(box); //The slider slider = elm_slider_add(win); elm_object_style_set(slider, "knob_volume"); evas_object_size_hint_weight_set(slider, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_box_pack_end(box, slider); evas_object_show(slider); elm_run(); return 0; }
Evas_Object* add_customer_inquire_seat_view(Evas_Object *parent){ Evas_Object *scroller, *grid, *bg, *layout, *label, *seat_layout, *map; train_seat_s *seat_s = calloc(1,sizeof(train_seat_s)); int i; strcpy(seat_s->train_number,"A0001"); seat_s->section_number = 'A'; seat_s->seat_number = 40; for(i = 0 ; i < seat_s->seat_number; i++){ seat_s->seat_empty[i] = true; } scroller = elm_scroller_add(parent); elm_scroller_bounce_set(scroller, EINA_FALSE, EINA_TRUE); elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); grid = elm_grid_add(scroller); evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(grid, EVAS_HINT_FILL, EVAS_HINT_FILL); bg = elm_bg_add(grid); elm_win_resize_object_add(grid, bg); elm_object_content_set(grid, bg); elm_grid_pack(grid, bg, 0, 0, 100, 100); elm_bg_color_set(bg, 38, 116, 212); evas_object_show(bg); bg = elm_bg_add(grid); elm_object_content_set(grid, bg); elm_grid_pack(grid, bg, 5, 5, 10, 10); elm_bg_color_set(bg, 255, 255, 255); evas_object_show(bg); label = elm_label_add(grid); elm_object_text_set(label,seat_s->train_number); evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(label); elm_grid_pack(grid, label, 5, 5, 10, 10); // map = elm_map_add(grid); // elm_map_zoom_mode_set(map,ELM_MAP_ZOOM_MODE_MANUAL); // elm_map_zoom_set(map,12); // elm_map_region_bring_in(map,37.2,127.8); // elm_grid_pack(grid,map,5,5,90,90); // evas_object_show(map); // // table = elm_table_add(grid); // elm_table_padding_set(table,12,5); elm_object_content_set(scroller, grid); return scroller; }
EAPI_MAIN int elm_main(int argc, char **argv) { Evas_Object *win, *bg, *obj, *icon, *box, *vbox, *btn, *dummy; Eina_List *objs = NULL; char buf[PATH_MAX]; int i; elm_app_info_set(elm_main, "elementary", "images/icon_07.png"); /* add a window */ win = elm_win_add(NULL, "transit", ELM_WIN_BASIC); elm_win_title_set(win, "Transit Example"); evas_object_smart_callback_add(win, "delete,request", on_done, NULL); elm_win_autodel_set(win, EINA_TRUE); /* add a scalable white background to this window */ 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); evas_object_size_hint_min_set(bg, 640, 640); evas_object_size_hint_max_set(bg, 640, 640); 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_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_win_resize_object_add(win, box); evas_object_show(box); dummy = elm_bg_add(win); evas_object_size_hint_weight_set(dummy, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_box_pack_end(box, dummy); evas_object_show(dummy); /* add an object that we are going to play with */ obj = elm_button_add(win); elm_object_text_set(obj, "Transformed object!"); icon = elm_icon_add(win); snprintf(buf, sizeof(buf), "%s/images/icon_07.png", elm_app_data_dir_get()); elm_icon_file_set(icon, buf, NULL); elm_object_part_content_set(obj, "icon", icon); evas_object_move(obj, 160, 60); evas_object_resize(obj, 250, 100); evas_object_show(obj); objs = eina_list_append(objs, obj); /* add another object that we are going to play with */ obj = elm_button_add(win); elm_object_text_set(obj, "Another object!"); icon = elm_icon_add(win); snprintf(buf, sizeof(buf), "%s/images/icon_08.png", elm_app_data_dir_get()); elm_icon_file_set(icon, buf, NULL); elm_object_part_content_set(obj, "icon", icon); evas_object_move(obj, 160, 60); evas_object_resize(obj, 250, 100); objs = eina_list_append(objs, obj); btn = elm_button_add(win); evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_object_text_set(btn, "Transit!"); elm_box_pack_end(box, btn); evas_object_show(btn); evas_object_smart_callback_add(btn, "clicked", _transit_start, objs); vbox = elm_box_add(win); evas_object_size_hint_weight_set(vbox, EVAS_HINT_EXPAND, EVAS_HINT_FILL); evas_object_size_hint_align_set(vbox, EVAS_HINT_FILL, 0.0); for (i = 0; _transitions[i].label; i++) _checkbox_transition_add(vbox, _transitions[i].label, &_transitions[i].checked); elm_box_pack_end(box, vbox); evas_object_show(vbox); evas_object_show(win); elm_run(); elm_shutdown(); return 0; }
minicontrol* mini_control_view_create(playback_service *p_ps, application *p_app) { minicontrol *mc = calloc(1, sizeof(*mc)); mc->p_ps = p_ps; mc->p_app = p_app; ps = p_ps; const Evas_Coord width = 720; const Evas_Coord height = 120; /* main widget */ mc->win = minicontrol_create_window("quickpanel", MINICONTROL_TARGET_VIEWER_QUICK_PANEL, mini_control_event_cb); evas_object_resize(mc->win, width, height); evas_object_hide(mc->win); /* Create layout and set the theme */ Evas_Object *wlayout = elm_layout_add(mc->win); evas_object_resize(wlayout, width, height); //elm_win_resize_object_add(mc->win, layout); elm_layout_theme_set(wlayout, "layout", "application", "default"); evas_object_show(wlayout); /* Create the background */ Evas_Object *bg = elm_bg_add(wlayout); elm_bg_color_set(bg, 255, 255, 255); evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(bg, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(bg); /* Set the background to the theme */ elm_object_part_content_set(wlayout, "elm.swallow.bg", bg); /* */ Evas_Object *layout = mc->layout = elm_layout_add(mc->win); elm_object_part_content_set(wlayout, "elm.swallow.content", layout); /* */ elm_layout_file_set(layout, QUICKPANELCONTROLS_EDJ, "quick_panel_controls"); evas_object_show(layout); mc->play_button = create_icon(layout, "ic_play_circle_normal_o.png"); mc->next_button = create_icon(layout, "ic_widget_next_normal.png"); mc->prev_button = create_icon(layout, "ic_widget_previous_normal.png"); mc->cover = create_icon(layout, "background_cone.png"); elm_object_part_content_set(layout, "swallow.play", mc->play_button); elm_object_part_content_set(layout, "swallow.cover", mc->cover); elm_object_part_content_set(layout, "swallow.previous", mc->prev_button); elm_object_part_content_set(layout, "swallow.next", mc->next_button); evas_object_event_callback_add(mc->play_button, EVAS_CALLBACK_MOUSE_UP, mini_control_action_cb, mc); evas_object_event_callback_add(mc->next_button, EVAS_CALLBACK_MOUSE_UP, mini_control_action_cb, mc); evas_object_event_callback_add(mc->prev_button, EVAS_CALLBACK_MOUSE_UP, mini_control_action_cb, mc); Evas_Object *edje = elm_layout_edje_get(layout); edje_object_signal_callback_add(edje, "mouse,clicked,1", "hub_background", mini_control_background_action_cb, mc); /* */ Evas_Object *progress = mc->progress = elm_slider_add(layout); elm_slider_horizontal_set(progress, EINA_TRUE); elm_object_disabled_set(progress, EINA_TRUE); elm_object_part_content_set(layout, "swallow.progress", progress); return mc; }
interface * intf_create(application *app) { interface *intf = calloc(1, sizeof(*intf)); intf->p_app = app; intf->current_view = -1; #ifdef __arm__ /* no opengl for emulator */ elm_config_accel_preference_set("opengl"); #endif /* Add and set the main Window */ intf->win = elm_win_util_standard_add(PACKAGE, PACKAGE); elm_win_autodel_set(intf->win, EINA_TRUE); /* Change colors */ // 2.3.1 EDJE_COLOR_CLASS_SET_VLC_ORANGE("B011"); // Base class EDJE_COLOR_CLASS_SET_VLC_ORANGE("B0511"); // Naviframe base EDJE_COLOR_CLASS_SET_VLC_ORANGE("B0514"); // Naviframe tab bar EDJE_COLOR_CLASS_SET_VLC_ORANGE("B0514S"); // Naviframe tab bar EDJE_COLOR_CLASS_SET_VLC_ORANGE("B0514P"); // Naviframe tab bar EDJE_COLOR_CLASS_SET_VLC_ORANGE("B0517"); // Naviframe second EDJE_COLOR_CLASS_SET_VLC_COLOR("F043P", VLC_GREY_400_TRANSPARENT); // Naviframe selection // 2.4 EDJE_COLOR_CLASS_SET_VLC_ORANGE("B001"); // Base class EDJE_COLOR_CLASS_SET_VLC_ORANGE("B071"); // Scrollbars EDJE_COLOR_CLASS_SET_VLC_COLOR("B018", VLC_ORANGE_500_TRANSPARENT_100); // End of list effect /* Progress Bar Colors */ EDJE_COLOR_CLASS_SET_VLC_COLOR("W062L1", VLC_GREY_400_TRANSPARENT); // slider background EDJE_COLOR_CLASS_SET_VLC_COLOR("W062L2", VLC_ORANGE_500_TRANSPARENT); // slider foreground EDJE_COLOR_CLASS_SET_VLC_COLOR("W0641P", VLC_ORANGE_500_TRANSPARENT); // slider thumb pressed EDJE_COLOR_CLASS_SET_VLC_COLOR("W0641D", VLC_ORANGE_500_TRANSPARENT); // slider thumb disabled EDJE_COLOR_CLASS_SET_VLC_ORANGE("W0641"); // slider thumb // Extend theme elm_theme_extension_add(NULL, THEME_EDJ); /* Handle rotations */ if (elm_win_wm_rotation_supported_get(intf->win)) { int rots[4] = { 0, 90, 180, 270 }; elm_win_wm_rotation_available_rotations_set(intf->win, (const int *)(&rots), 4); } /* Handle back buttons and delete callbacks */ evas_object_smart_callback_add(intf->win, "delete,request", win_delete_request_cb, NULL); eext_object_event_callback_add(intf->win, EEXT_CALLBACK_BACK, win_back_key_cb, intf); eext_object_event_callback_add(intf->win, EEXT_CALLBACK_MORE, right_panel_button_clicked_cb, intf); /* Add and set a conformant in the main Window */ Evas_Object *conform = elm_conformant_add(intf->win); elm_win_conformant_set(intf->win, EINA_TRUE); evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); /* */ elm_win_indicator_mode_set(intf->win, ELM_WIN_INDICATOR_SHOW); elm_win_indicator_opacity_set(intf->win, ELM_WIN_INDICATOR_OPAQUE); elm_win_resize_object_add(intf->win, conform); evas_object_show(conform); /* Add and set a bg in the conformant */ Evas_Object *bg = elm_bg_add(conform); elm_bg_color_set(bg, 255, 136, 0); /* Add the bg in the conformant */ elm_object_part_content_set(conform, "elm.swallow.indicator_bg", bg); evas_object_show(bg); view_e view_type = preferences_get_index(PREF_CURRENT_VIEW, VIEW_VIDEO); /* Create the main view in the conformant */ create_main_layout(intf, conform, view_type); /* Create the default view in the content naviframe */ intf_show_view(intf, view_type); ps_register_on_emotion_restart_cb(application_get_playback_service(intf->p_app), intf_on_emotion_restart_cb, intf); media_library* p_ml = (media_library*)application_get_media_library(intf->p_app); media_library_register_progress_cb( p_ml, &intf_scan_progress_set_cb, intf ); /* */ evas_object_show(intf->win); return intf; }
static void winmain() { const char* name = "Hapti_UI_TEST"; int w,h; Evas_Object* win; Evas_Object* bg; Evas_Object* main_layout; Evas_Object* btns_box; Evas_Object* btn_vibe; Evas_Object* btn_stop; Evas* evas; win = elm_win_add(NULL, name, ELM_WIN_BASIC); if(!win) return; elm_win_title_set(win, name); elm_win_borderless_set(win, EINA_TRUE); elm_win_autodel_set(win, EINA_TRUE); evas_object_smart_callback_add(win, "delete,request", _quit_cb, NULL); ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h); evas_object_resize(win, w, h); evas_object_show(win); evas = evas_object_evas_get(win); // set background bg = elm_bg_add(win); elm_bg_color_set(bg, 0xff, 0xff, 0xff); evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, bg); evas_object_show(bg); // Base Layout main_layout = elm_layout_add(win); elm_layout_theme_set(main_layout, "layout", "application", "default"); evas_object_size_hint_weight_set(main_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, main_layout); evas_object_show(main_layout); // Indicator elm_win_indicator_mode_set(win, ELM_WIN_INDICATOR_SHOW); // add box btns_box = elm_box_add(win); elm_box_horizontal_set(btns_box, EINA_TRUE); elm_win_resize_object_add(win, btns_box); elm_box_padding_set(btns_box, 10, 0); evas_object_show(btns_box); // add Button btn_vibe = elm_button_add(main_layout); btn_stop = elm_button_add(main_layout); elm_object_text_set(btn_vibe, "Vibe"); elm_object_text_set(btn_stop, "Stop"); evas_object_smart_callback_add(btn_vibe, "clicked", _vibe_clicked_cb, NULL); evas_object_smart_callback_add(btn_stop, "clicked", _stop_clicked_cb, NULL); elm_box_pack_end(btns_box, btn_vibe); elm_box_pack_end(btns_box, btn_stop); evas_object_show(btn_vibe); evas_object_show(btn_stop); }
EAPI_MAIN int elm_main(int argc, char **argv) { Evas_Object *win, *bg, *icon, *icon2, *bt, *bt2, *layout; Evas_Object *clk; Evas_Object *item; 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 and filling it with widgets 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/mylayout"); evas_object_show(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); } // Add icon, clock and button to the table icon = elm_icon_add(win); elm_icon_standard_set(icon, "home"); evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(icon, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_layout_table_pack(layout, TABLE, icon, 0, 0, 1, 1); evas_object_show(icon); icon2 = elm_icon_add(win); elm_icon_standard_set(icon2, "close"); evas_object_size_hint_weight_set(icon2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(icon2, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_layout_table_pack(layout, TABLE, icon2, 1, 0, 1, 1); evas_object_show(icon2); clk = elm_clock_add(win); evas_object_size_hint_weight_set(clk, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(clk, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_layout_table_pack(layout, TABLE, clk, 2, 0, 1, 1); evas_object_show(clk); bt = elm_button_add(win); elm_object_text_set(bt, "Click me!"); 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_layout_table_pack(layout, TABLE, bt, 0, 1, 3, 1); evas_object_smart_callback_add(bt, "clicked", _tbl_btn_cb, layout); evas_object_show(bt); item = elm_button_add(win); elm_object_text_set(item, "Position 0"); evas_object_size_hint_weight_set(item, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(item, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_layout_box_insert_at(layout, BOX, item, 0); evas_object_smart_callback_add(item, "clicked", _box_btn_cb, layout); evas_object_show(item); item = elm_button_add(win); elm_object_text_set(item, "Prepended"); evas_object_size_hint_weight_set(item, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(item, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_layout_box_prepend(layout, BOX, item); evas_object_smart_callback_add(item, "clicked", _box_btn_cb, layout); evas_object_show(item); bt2 = elm_button_add(win); elm_object_text_set(bt2, "Delete All"); elm_object_part_content_set(layout, SWALLOW, bt2); evas_object_smart_callback_add(bt2, "clicked", _swallow_btn_cb, layout); evas_object_resize(win, 320, 320); evas_object_show(win); elm_run(); elm_shutdown(); return 0; }
ApplicationMain::ApplicationMain(int argc, char **argv) { cInfo() << "Calaos Home, starting..."; if (system("killall -9 eskiss 2> /dev/null") == -1) cCritical() << "Error forking !"; //init random generator srand(time(NULL)); //Init SSL and CURL SSL_load_error_strings(); SSL_library_init(); curl_global_init(CURL_GLOBAL_ALL); char *themefile = argvOptionParam(argv, argv + argc, "--theme"); if (themefile) { ApplicationMain::theme = themefile; cInfo() << "Using specified theme file: " << ApplicationMain::getTheme(); } else { ApplicationMain::theme = Prefix::Instance().dataDirectoryGet() + "/default.edj"; if (ecore_file_exists(ApplicationMain::theme.c_str())) cInfo() << "Using theme file " << theme; else cError() << theme << " Not found!"; } //Init efl core if (!eina_init()) throw (runtime_error("Unable to init Eina")); if (!ecore_init()) throw (runtime_error("Unable to init Ecore")); if (!ecore_con_init()) throw (runtime_error("Unable to init Ecore-Con")); if (!ecore_con_url_init()) throw (runtime_error("Unable to init Ecore-Con-Url")); if (!evas_init()) throw (runtime_error("Unable to init Evas")); if (!ecore_evas_init()) throw (runtime_error("Unable to init Ecore-Evas")); if (!edje_init()) throw (runtime_error("Unable to init Edje")); edje_frametime_set(1.0 / 60.0); edje_scale_set(1.0); if (!elm_init(argc, argv)) throw (runtime_error("Unable to init Elementary")); //Load Calaos specific ELM extensions elm_theme_extension_add(NULL, ApplicationMain::getTheme()); //Create the main window window = elm_win_add(NULL, "calaos-home", ELM_WIN_BASIC); elm_win_title_set(window, "Calaos Home"); elm_win_borderless_set(window, true); bool bFullscreen = argvOptionCheck(argv, argv + argc, "--fullscreen"); elm_win_fullscreen_set(window, bFullscreen); //Automatically quit main loop when the window is closed elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); elm_win_autodel_set(window, true); if (argvOptionCheck(argv, argv + argc, "--set-elm-config")) { //force setting the correct elementary options for touchscreen elm_config_finger_size_set(10); elm_config_scroll_bounce_enabled_set(true); elm_config_scroll_thumbscroll_enabled_set(true); elm_config_scroll_thumbscroll_threshold_set(24); elm_config_scroll_thumbscroll_momentum_threshold_set(100.0); elm_config_scroll_bounce_friction_set(0.5); elm_config_scroll_page_scroll_friction_set(0.5); elm_config_scroll_bring_in_scroll_friction_set(0.5); elm_config_scroll_zoom_friction_set(0.5); elm_config_scroll_thumbscroll_friction_set(1.0); elm_config_scroll_thumbscroll_border_friction_set(0.5); elm_config_scroll_thumbscroll_sensitivity_friction_set(0.25); } evas_object_event_callback_add(window, EVAS_CALLBACK_RESIZE, _window_resize_cb, this); evas = evas_object_evas_get(window); Evas_Object *bg = elm_bg_add(window); evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(window, bg); evas_object_show(bg); evas_object_size_hint_min_set(bg, 200, 200); elm_bg_color_set(bg, 0, 0, 0); layout = elm_layout_add(window); if (!elm_layout_file_set(layout, ApplicationMain::getTheme(), EDJE_GROUP_MAIN_LAYOUT)) { string e = "Unable to find group \""; e += EDJE_GROUP_MAIN_LAYOUT; e += "\" in theme \""; e += ApplicationMain::getTheme(); e += "\""; throw (runtime_error(e)); } //create the screen suspend object and put it on the canvas ScreenSuspendView *screen_suspend = new ScreenSuspendView(evas, window); screen_suspend->Show(); screen_suspend->setAutoDelete(true); evas_object_size_hint_weight_set(layout, 1.0, 1.0); evas_object_show(layout); evas_object_resize(window, 1024, 768); evas_object_show(window); ecore_evas_focus_set(ecore_evas_ecore_evas_get(evas_object_evas_get(window)), true); Resize(); try { controller = new ApplicationController(evas, layout); } catch(exception const& e) { cCritical() << "Can't create ApplicationController"; throw; } }
EAPI_MAIN int elm_main(int argc, char **argv) { Evas_Object *win, *bg, *box, *fbox; Evas_Object *list; Evas_Object *bt_bring_in, *bt_show; Evas_Object *bt_middle_in, *bt_middle_show; Evas_Object *bt_top_in, *bt_top_show; int i; 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); 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 = "default"; _itc->func.text_get = _item_label_get; _itc->func.content_get = _item_content_get; _itc->func.state_get = NULL; _itc->func.del = NULL; } if (!_itc_group) { _itc_group = elm_genlist_item_class_new(); _itc_group->item_style = "group_index"; _itc_group->func.text_get = _group_label_get; _itc_group->func.content_get = _group_content_get; _itc_group->func.state_get = NULL; _itc_group->func.del = NULL; } list = elm_genlist_add(win); evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_box_pack_end(box, list); evas_object_show(list); fbox = elm_box_add(win); elm_box_layout_set(fbox, evas_object_box_layout_flow_horizontal, NULL, NULL); evas_object_size_hint_weight_set(fbox, EVAS_HINT_EXPAND, 0); evas_object_size_hint_align_set(fbox, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_box_pack_end(box, fbox); evas_object_show(fbox); _button_add(list, fbox, "prepend", _prepend_cb); _button_add(list, fbox, "append", _append_cb); _button_add(list, fbox, "insert before", _insert_before_cb); _button_add(list, fbox, "insert after", _insert_after_cb); _button_add(list, fbox, "prev", _prev_cb); _button_add(list, fbox, "next", _next_cb); _button_add(list, fbox, "realize", _realize_cb); bt_bring_in = _button_add(list, fbox, "bring #50", NULL); bt_show = _button_add(list, fbox, "show #50", NULL); bt_middle_in = _button_add(list, fbox, "bring to middle #200", NULL); bt_middle_show = _button_add(list, fbox, "show in middle #200", NULL); bt_top_in = _button_add(list, fbox, "bring to top #250", NULL); bt_top_show = _button_add(list, fbox, "show in top #250", NULL); for (i = 0; i < N_ITEMS; i++) { Elm_Object_Item *gli, *glg; if (i % 7 == 0) { glg = gli = elm_genlist_item_append(list, _itc_group, (void *)(long)nitems++, NULL, ELM_GENLIST_ITEM_GROUP, _item_sel_cb, NULL); elm_genlist_item_select_mode_set(gli, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); } else { gli = elm_genlist_item_append(list, _itc, (void *)(long)nitems++, glg, ELM_GENLIST_ITEM_NONE, _item_sel_cb, NULL); } switch (i) { case 3: elm_object_item_disabled_set(gli, EINA_TRUE); break; case 50: evas_object_smart_callback_add( bt_bring_in, "clicked", _bring_in_cb, gli); evas_object_smart_callback_add( bt_show, "clicked", _show_cb, gli); break; case 200: evas_object_smart_callback_add( bt_middle_in, "clicked", _middle_in_cb, gli); evas_object_smart_callback_add( bt_middle_show, "clicked", _middle_show_cb, gli); break; case 250: evas_object_smart_callback_add( bt_top_in, "clicked", _top_in_cb, gli); evas_object_smart_callback_add( bt_top_show, "clicked", _top_show_cb, gli); } } evas_object_size_hint_min_set(bg, 160, 160); evas_object_size_hint_max_set(bg, 640, 640); evas_object_resize(win, 420, 320); evas_object_show(win); elm_run(); elm_shutdown(); return 0; }