int main(int argc, char **argv) { Evas_Object *edje; elm_init(argc, argv); win = elm_win_add(NULL, "tuto", ELM_WIN_BASIC); elm_win_title_set(win, "Edje Tutorial"); evas_object_smart_callback_add(win, "delete,request", _win_del, NULL); layout = elm_layout_add(win); elm_layout_file_set(layout, "tut22.edj", "interface"); evas_object_show(layout); elm_win_resize_object_add(win, layout); table = elm_layout_add(layout); elm_layout_file_set(table, "tut22.edj", "table"); evas_object_show(table); evas_object_size_hint_weight_set(layout, 1, 1); elm_object_part_content_set(layout, "table_swallow", table); edje = elm_layout_edje_get(table); edje_object_signal_callback_add(edje, "*", "*", _edje_signal_cb, NULL); evas_object_resize(win, 800, 480); evas_object_show(win); elm_run(); elm_shutdown(); }
/** * @brief Positive test case of elm_nocontents_custom_set() */ static void utc_UIFW_elm_nocontents_custom_set_func_01(void) { Evas_Object *no_contents = NULL; Evas_Object *custom_area,*btn , *icon; Evas_Object *custom; char buf[255] = {0,}; no_contents = elm_nocontents_add(main_win); evas_object_show(no_contents); custom_area = elm_layout_add (main_win); elm_layout_file_set (custom_area, NULL, "winset-test/nocontents/search_google"); elm_nocontents_custom_set(no_contents,custom_area); btn = elm_button_add (main_win); icon = elm_icon_add (main_win); snprintf (buf, sizeof(buf), "%s/30_SmartSearch_google_icon.png", PKG_DATA_DIR); elm_icon_file_set (icon, buf, NULL); elm_icon_scale_set (icon, 1, 1); elm_button_icon_set (btn, icon); elm_layout_content_set (custom_area, "buttons", btn); custom = elm_nocontents_custom_get(no_contents); if (!custom) { tet_infoline("elm_nocontents_custom_set() failed in positive test case"); tet_result(TET_FAIL); return; } tet_result(TET_PASS); }
static Evas_Object* create_labels(Evas_Object *parent) { Evas_Object *layout, *label, *label2, *label3, *label4, *label5; layout = elm_layout_add(parent); elm_layout_file_set(layout, ELM_DEMO_EDJ, "label_layout"); evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); label = elm_label_add(layout); elm_object_part_content_set(layout, "label1", label); elm_object_text_set(label, _("<align=left>left aligned label</align>")); label2 = elm_label_add(layout); elm_object_part_content_set(layout, "label2", label2); elm_object_text_set(label2, _("<align=center>center aligned label<align>")); label3 = elm_label_add(layout); elm_object_part_content_set(layout, "label3", label3); elm_label_wrap_width_set(label3, 100); elm_object_text_set(label3, _("<align=right>right aligned label</align>")); label4 = elm_label_add(layout); elm_object_part_content_set(layout, "label4", label4); elm_label_wrap_width_set(label4, 100); elm_object_text_set(label4, _("<align=left>left aligned label</align>")); label5 = elm_label_add(layout); elm_object_part_content_set(layout, "label5", label5); elm_label_line_wrap_set(label5, EINA_TRUE); elm_label_wrap_width_set(label5, 100); elm_object_text_set(label5, _("<align=left>label changes line automatically if label wrap width is set and the text length is bigger than the width of the label</align>")); return layout; }
void show_graphic_popup(appdata_s *ad, char *text, int timeout){ Evas_Object *popup, *layout, *progressbar; ad->popup = elm_popup_add(ad->win); elm_object_style_set(ad->popup, "circle"); layout = elm_layout_add(ad->popup); elm_layout_file_set(layout, ELM_DEMO_EDJ, "popup_progressbar"); elm_object_content_set(ad->popup, layout); elm_object_part_text_set(layout,"elm.text", text); evas_object_show(layout); progressbar = elm_progressbar_add(layout); elm_object_style_set(progressbar, "process/popup/small"); evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, 0.5); evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_progressbar_pulse(progressbar, EINA_TRUE); elm_object_part_content_set(layout, "elm.swallow.content", progressbar); evas_object_show(progressbar); evas_object_show(ad->popup); if(timeout>0){ elm_popup_timeout_set(ad->popup, timeout); evas_object_smart_callback_add(ad->popup, "timeout", destroy_popup, ad); }else{ evas_object_smart_callback_del(ad->popup, "timeout", destroy_popup); } }
static void _edje_signal_cb(void *data, Evas_Object *obj, const char *emission, const char *source) { //printf("Emission : %s - Source : %s\n", emission, source); if (!strcmp(emission, "info,clicked")) { Evas_Object *textblock; Evas_Object *edje; printf("info clicked \n"); textblock = elm_layout_add(win); elm_layout_file_set(textblock, "tut22.edj", "infos_panel"); evas_object_show(textblock); evas_object_size_hint_weight_set(textblock, 1, 1); elm_object_part_content_set(layout, "panel_swallow", textblock); evas_object_show(textblock); elm_object_part_text_set(textblock, "textblock", "<h1>What is Enlightenment?</h1><br>" "<tab><h4>Enlightenment is not just a window manager for <hilight>Linux/X11</hilight> and others, but also a whole suite of libraries to help you create beautiful user interfaces with much less work than doing it the old fashioned way and fighting with traditional toolkits, not to mention a traditional window manager. It covers uses from small mobile devices like phones all the way to powerful multi-core desktops (which are the primary development environment). </h4><br>" "<br><h1>Enlightenment Foundation Libraries (EFL)</h1> <br>" "<tab>These provide both a semi-traditional toolkit set in <rhinoceros>Elementary</rhinoceros> as well as the object canvas <h2>(Evas)</h2> and powerful abstracted objects (Edje) that you can combine, mix and match, even layer on top of each other with alpha channels and events in-tact. It has <link><a href=\"evas_map\">3D transformations</a></link> for all objects and more. )"); edje = elm_layout_edje_get(textblock); edje_object_signal_callback_add(edje, "*", "*", _edje_signal_textblock_cb, NULL); edje = elm_layout_edje_get(layout); edje_object_signal_emit(edje, "hide,table,anim", "tuto"); } }
static void _test_layout() { Evas_Object *win, *box, *ly, *bt; char buf[PATH_MAX]; win = eailu_create_test_window_with_glib_init(_on_done, _on_focus_in); 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); ly = elm_layout_add(win); if (!elm_layout_theme_set( ly, "layout", "application", "titlebar")) fprintf(stderr, "Failed to set layout"); elm_object_part_text_set(ly, "elm.text", "Some title"); evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_box_pack_end(box, ly); evas_object_show(ly); bt = elm_icon_add(win); elm_icon_standard_set(bt, "chat"); evas_object_size_hint_min_set(bt, 20, 20); elm_layout_icon_set(ly, bt); bt = elm_icon_add(win); elm_icon_standard_set(bt, "close"); evas_object_size_hint_min_set(bt, 20, 20); elm_layout_end_set(ly, bt); ly = elm_layout_add(win); snprintf(buf, sizeof(buf), "%s/test.edj","./data/"); elm_layout_file_set(ly, buf, "layout"); evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_box_pack_end(box, ly); //elm_win_resize_object_add(win, ly); evas_object_show(ly); bt = elm_button_add(win); elm_object_text_set(bt, "Button 1"); elm_object_part_content_set(ly, "element1", bt); evas_object_show(bt); bt = elm_button_add(win); elm_object_text_set(bt, "Button 2"); elm_object_part_content_set(ly, "element2", bt); evas_object_show(bt); bt = elm_button_add(win); elm_object_text_set(bt, "Button 3"); elm_object_part_content_set(ly, "element3", bt); evas_object_show(bt); evas_object_show(win); }
static void _init_network_page() { Evas_Object *win = ui_utils_view_window_get(VIEW_PTR(view)); view.layout2 = elm_layout_add(win); elm_win_resize_object_add(win, view.layout2); evas_object_size_hint_weight_set(view.layout2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_layout_file_set(view.layout2, phoneui_theme, "phoneui/settings/quick-settings/network"); evas_object_show(view.layout2); view.gprs_slide = elm_check_add(win); elm_object_style_set(view.gprs_slide, "toggle"); elm_object_part_content_set(view.layout2, "network-frame-auto-frame-gprs-slide", view.gprs_slide); evas_object_smart_callback_add(view.gprs_slide, "changed", _gprs_slide_changed_cb, NULL); elm_object_part_text_set(view.gprs_slide, "on", D_("Connected")); elm_object_part_text_set(view.gprs_slide, "off", D_("Disconnected")); evas_object_show(view.gprs_slide); view.sharing_slide = elm_check_add(win); elm_object_style_set(view.sharing_slide, "toggle"); elm_object_part_content_set(view.layout2, "network-frame-auto-frame-sharing-slide", view.sharing_slide); evas_object_smart_callback_add(view.sharing_slide, "changed", _sharing_slide_changed_cb, NULL); elm_object_part_text_set(view.sharing_slide, "on", D_("Sharing")); elm_object_part_text_set(view.sharing_slide, "off", D_("Not sharing")); evas_object_show(view.sharing_slide); // FIXME: until we implement it elm_object_disabled_set(view.sharing_slide, 1); elm_naviframe_item_simple_push(view.pager, view.layout2); phoneui_info_register_and_request_pdp_context_status(_pdp_context_status_signal_cb, NULL); }
static void view_main_create_empty_layout(void) { __COMMON_FUNC_ENTER__; Evas_Object *box = NULL; Evas_Object *layout = NULL; Evas_Object *prev_box = NULL; prev_box = elm_object_content_get(devpkr_app_state->popup); if (prev_box != NULL) { evas_object_del(prev_box); list = NULL; grouptitle = NULL; } box = elm_box_add(devpkr_app_state->popup); 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); layout = elm_layout_add(devpkr_app_state->popup); elm_layout_file_set(layout, WIFI_DEVPKR_EDJ, WIFI_SYSPOPUP_EMPTY_GRP); evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_object_domain_translatable_part_text_set(layout, "text", PACKAGE, sc(PACKAGE, I18N_TYPE_No_Wi_Fi_AP_Found)); elm_box_pack_end(box, layout); evas_object_show(layout); evas_object_show(box); elm_object_content_set(devpkr_app_state->popup, box); __COMMON_FUNC_EXIT__; }
EAPI int elm_main(int argc, char **argv) { Evas_Object *win=NULL, *bg=NULL, *pattern=NULL, *edje=NULL, *object=NULL, *item=NULL; Ecore_X_Window xwin, rootxwin; char theme[PATH_MAX]; setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); win = elm_win_add(NULL, "e_pattern_lock", ELM_WIN_BASIC); elm_win_autodel_set(win, EINA_TRUE); elm_win_maximized_set(win, EINA_TRUE); // change to full screen and above everything for lockscreen effect evas_object_size_hint_min_set(win, 480, 480); evas_object_size_hint_max_set(win, 640, 640); elm_win_fullscreen_set(win, EINA_TRUE); elm_win_sticky_set(win, EINA_TRUE); elm_win_keyboard_mode_set(win, ELM_WIN_KEYBOARD_OFF); elm_win_layer_set(win, INT_MAX); xwin = elm_win_xwindow_get(win); rootxwin = ecore_x_window_root_get(xwin); ecore_x_pointer_grab(xwin); ecore_x_keyboard_grab(rootxwin); bg = elm_bg_add(win); evas_object_size_hint_weight_set(bg, 1.0, 1.0); elm_win_resize_object_add(win, bg); evas_object_show(bg); snprintf(theme, sizeof(theme), "%s/themes/default.edj", PKGDATADIR); elm_theme_extension_add(NULL, theme); elm_theme_overlay_add(NULL, theme); pattern = elm_layout_add(win); elm_layout_file_set(pattern, theme, "e_lock/table/default"); evas_object_size_hint_weight_set(pattern, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(pattern, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_win_resize_object_add(win, pattern); edje = elm_layout_edje_get(pattern); set_event_cbs(0, 0, "top_left"); set_event_cbs(1, 0, "top"); set_event_cbs(2, 0, "top_right"); set_event_cbs(0, 1, "left"); set_event_cbs(1, 1, "center"); set_event_cbs(2, 1, "right"); set_event_cbs(0, 2, "bottom_left"); set_event_cbs(1, 2, "bottom"); set_event_cbs(2, 2, "bottom_right"); evas_object_show(pattern); evas_object_show(win); elm_run(); elm_shutdown(); return(0); }
static void _init_content_page(struct MessageNewViewData *view) { Evas_Object *win, *btn; win = ui_utils_view_window_get(VIEW_PTR(*view)); view->layout_content = elm_layout_add(win); elm_win_resize_object_add(win, view->layout_content); evas_object_size_hint_weight_set(view->layout_content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_layout_file_set(view->layout_content, phoneui_theme, "phoneui/messages/new/content"); evas_object_show(view->layout_content); edje_object_part_text_set(elm_layout_edje_get(view->layout_content), "content_title", D_("Enter your message")); view->content_entry = elm_entry_add(win); elm_entry_scrollable_set(view->content_entry, EINA_TRUE); evas_object_smart_callback_add(view->content_entry, "changed", _content_changed, view); if (view->content != NULL) { elm_entry_entry_set(view->content_entry, elm_entry_utf8_to_markup(view->content)); } evas_object_show(view->content_entry); elm_object_part_content_set(view->layout_content, "content_entry", view->content_entry); elm_object_focus_set(view->content_entry, EINA_TRUE); btn = elm_button_add(win); elm_object_text_set(btn, D_("Insert")); evas_object_smart_callback_add(btn, "clicked", _content_button_insert_clicked, view); elm_object_part_content_set(view->layout_content, "content_button_insert", btn); evas_object_show(btn); btn = elm_button_add(win); elm_object_text_set(btn, D_("Close")); evas_object_smart_callback_add(btn, "clicked", _content_button_close_clicked, view); elm_object_part_content_set(view->layout_content, "content_button_close", btn); evas_object_show(btn); btn = elm_button_add(win); elm_object_text_set(btn, D_("Continue")); evas_object_smart_callback_add(btn, "clicked", _content_button_continue_clicked, view); elm_object_part_content_set(view->layout_content, "content_button_continue", btn); evas_object_show(btn); elm_naviframe_item_simple_push(view->pager, view->layout_content); }
static Evas_Object * _date_add(Evas_Object *parent) { sd->obj = elm_layout_add(parent); elm_layout_file_set(sd->obj, enna_config_theme_get(), "gadget/date"); evas_object_show(sd->obj); elm_layout_content_set(parent, "enna.swallow.date", sd->obj); return NULL; }
static Evas_Object * _elsa_gui_theme_get (Evas_Object *win, const char *group, const char *theme) { Evas_Object *edje = NULL; edje = elm_layout_add(win); if (theme) { char buf[PATH_MAX]; snprintf(buf, sizeof(buf), PACKAGE_DATA_DIR"/themes/%s.edj", theme); if (!elm_layout_file_set(edje, buf, group)) { fprintf(stderr, PACKAGE": can't load %s theme fallback to default\n", theme); elm_layout_file_set(edje, PACKAGE_DATA_DIR"/themes/default.edj", group); } } else elm_layout_file_set(edje, PACKAGE_DATA_DIR"/themes/default.edj", group); return edje; }
EAPI_MAIN int elm_main(int argc, char **argv) { Evas_Object *win, *bg, *prefs, *layout; Elm_Prefs_Data *prefs_data; win = elm_win_add(NULL, "Prefs", ELM_WIN_BASIC); elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); elm_win_title_set(win, "Prefs Example 03"); elm_win_autodel_set(win, EINA_TRUE); bg = elm_bg_add(win); elm_win_resize_object_add(win, bg); evas_object_size_hint_min_set(bg, WIDTH, HEIGHT); evas_object_size_hint_max_set(bg, WIDTH, HEIGHT); evas_object_show(bg); layout = elm_layout_add(win); elm_layout_file_set(layout, "prefs_example_03.edj", "prefs_edje"); prefs = elm_prefs_add(win); evas_object_size_hint_weight_set(prefs, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_resize(prefs, WIDTH, HEIGHT); evas_object_show(prefs); evas_object_smart_callback_add(prefs, "page,loaded", _page_loaded_cb, layout); evas_object_smart_callback_add(prefs, "item,changed", _item_changed_cb, layout); elm_prefs_autosave_set(prefs, EINA_TRUE); prefs_data = elm_prefs_data_new("./prefs_example_03.cfg", NULL, EET_FILE_MODE_READ_WRITE); elm_prefs_file_set(prefs, "prefs_example_03.epb", NULL); elm_prefs_data_set(prefs, prefs_data); elm_prefs_item_swallow(prefs, "main:swal", layout); _update_animation_time(prefs, layout); _update_animation(prefs, layout); evas_object_resize(win, WIDTH, HEIGHT); evas_object_show(win); elm_run(); elm_prefs_data_unref(prefs_data); elm_shutdown(); return 0; }
static void _init_number_page(struct MessageNewViewData *view) { Evas_Object *win, *btn, *ico; win = ui_utils_view_window_get(VIEW_PTR(*view)); view->number[0] = '\0'; view->number_length = 0; view->layout_number = elm_layout_add(view->pager); elm_win_resize_object_add(win, view->layout_number); elm_layout_file_set(view->layout_number, phoneui_theme, "phoneui/messages/new/number"); evas_object_show(view->layout_number); edje_object_part_text_set(elm_layout_edje_get(view->layout_number), "number_title", D_("Add Number")); btn = elm_button_add(win); elm_object_text_set(btn, D_("Back")); evas_object_smart_callback_add(btn, "clicked", _number_button_back_clicked, view); elm_object_part_content_set(view->layout_number, "number_button_back", btn); evas_object_show(btn); btn = elm_button_add(win); elm_object_text_set(btn, D_("Add")); evas_object_smart_callback_add(btn, "clicked", _number_button_add_clicked, view); elm_object_part_content_set(view->layout_number, "number_button_add", btn); evas_object_show(btn); ico = elm_icon_add(win); evas_object_size_hint_aspect_set(ico, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); elm_image_file_set(ico, phoneui_theme, "icon/edit-undo"); evas_object_show(ico); btn = elm_button_add(win); elm_object_content_set(btn, ico); elm_object_part_content_set(view->layout_number, "number_button_delete", btn); evas_object_smart_callback_add(btn, "clicked", _number_button_delete_clicked, view); evas_object_show(btn); view->number_keypad = (Evas_Object *) elm_keypad_add(win); evas_object_smart_callback_add(view->number_keypad, "clicked", _number_keypad_clicked, view); elm_object_part_content_set(view->layout_number, "number_keypad", view->number_keypad); evas_object_show(view->number_keypad); elm_naviframe_item_simple_push(view->pager, view->layout_number); }
static void bs_service_set_bg (const char *bg) { if (bg) { Evas_Object *old; old = mod->service_bg; mod->service_bg = elm_layout_add(mod->o_layout); elm_layout_file_set(mod->service_bg, enna_config_theme_get(), bg); elm_layout_content_set(mod->o_layout, "service.bg.swallow", mod->service_bg); evas_object_show(mod->service_bg); evas_object_del(old); } else { evas_object_hide(mod->service_bg); elm_layout_file_set(mod->o_layout, "service.bg.swallow", 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; }
Evas_Object * enna_video_flags_add(Evas_Object *parent) { Smart_Data *sd; sd = calloc(1, sizeof(Smart_Data)); sd->o_edje = elm_layout_add(parent); elm_layout_file_set(sd->o_edje, enna_config_theme_get(), EDJE_GROUP); evas_object_show(sd->o_edje); evas_object_data_set(sd->o_edje, "sd", sd); evas_object_event_callback_add(sd->o_edje, EVAS_CALLBACK_DEL, video_flags_del, sd); return sd->o_edje; }
HAPI Evas_Object* layout_load_edj(Evas_Object *parent, const char *edjname, const char *grpname) { Evas_Object *eo; retv_if(NULL == parent, NULL); eo = elm_layout_add(parent); retv_if(NULL == eo, NULL); retv_if(EINA_FALSE == elm_layout_file_set(eo, edjname, grpname), NULL); evas_object_data_set(_EDJ(eo), "evas_object", eo); evas_object_show(eo); return eo; }
void Widget::init_widget_elm_edje_file(Widget *widget, const char *filename,const char *groupe, int x, int y, int width, int heigh){ // Conformant widget->_conform = elm_conformant_add(CM::I()->window()); evas_object_size_hint_weight_set(widget->_conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(CM::I()->window(), widget->_conform); evas_object_show(widget->_conform); widget->_obj = elm_layout_add(widget->_conform); elm_layout_file_set(widget->_obj, filename, groupe); evas_object_move(widget->_obj,x,y); evas_object_resize(widget->_obj, width,heigh); evas_object_show(widget->_obj); }
void label_linebreak_modes_cb(void *data, Evas_Object *obj, void *event_info) { Evas_Object *scroller, *layout_inner, *layout; Evas_Object *nf = data; scroller = create_scroller(nf); layout = elm_layout_add(scroller); evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_layout_file_set(layout, ELM_DEMO_EDJ, "white_bg_layout"); layout_inner = create_labels(nf); elm_object_part_content_set(layout, "elm.swallow.content", layout_inner); elm_object_content_set(scroller, layout); elm_naviframe_item_push(nf, "Linebreakmodes", NULL, NULL, scroller, NULL); }
Evas_Object* appcore_load_edj(Evas_Object *parent, const char *file, const char *group) { Evas_Object *eo; int r; eo = elm_layout_add(parent); if (eo) { r = elm_layout_file_set(eo, file, group); if (!r) { evas_object_del(eo); return NULL; } evas_object_size_hint_weight_set(eo, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); } return eo; }
static Evas_Object * create_button(datetimedata_s *dd, Evas_Object *parent, char *text, char *format) { Evas_Object *layout, *button; layout = elm_layout_add(parent); elm_layout_file_set(layout, ELM_DEMO_EDJ, "button_layout_1"); button = elm_button_add(layout); elm_object_text_set(button, text); evas_object_show(button); evas_object_data_set(button, "format", format); evas_object_smart_callback_add(button, "clicked", launch_popup_cb, dd); elm_object_part_content_set(layout, "elm.swallow.content", button); evas_object_show(layout); elm_box_pack_end(parent, layout); return button; }
static Evas_Object * _content_get(eo_ui_t *eoui) { UI *ui = (void *)eoui - offsetof(UI, eoui); ui->theme = elm_layout_add(eoui->win); elm_layout_file_set(ui->theme, ui->theme_path, CHIMAERA_SIMULATOR_UI_URI"/theme"); evas_object_event_callback_add(ui->theme, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down, ui); evas_object_event_callback_add(ui->theme, EVAS_CALLBACK_MOUSE_UP, _mouse_up, ui); evas_object_event_callback_add(ui->theme, EVAS_CALLBACK_MOUSE_MOVE, _mouse_move, ui); evas_object_event_callback_add(ui->theme, EVAS_CALLBACK_MOUSE_IN, _mouse_in, ui); evas_object_event_callback_add(ui->theme, EVAS_CALLBACK_MOUSE_OUT, _mouse_out, ui); evas_object_pointer_mode_set(ui->theme, EVAS_OBJECT_POINTER_MODE_NOGRAB); return ui->theme; }
static void frame_content_show(struct MessageNewViewData *data) { struct Window *win = data->win; elm_layout_file_set(win->layout, MESSAGE_FILE, "content_edit"); data->bt1 = elm_button_add(window_evas_object_get(win)); elm_button_label_set(data->bt1, D_("Close")); evas_object_smart_callback_add(data->bt1, "clicked", frame_content_close_clicked, data); window_swallow(win, "button_close", data->bt1); evas_object_show(data->bt1); data->bt2 = elm_button_add(window_evas_object_get(win)); elm_button_label_set(data->bt2, D_("Continue")); evas_object_smart_callback_add(data->bt2, "clicked", frame_content_continue_clicked, data); window_swallow(win, "button_continue", data->bt2); evas_object_show(data->bt2); data->sc = elm_scroller_add(window_evas_object_get(win)); elm_scroller_policy_set(data->sc, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_ON); data->entry = elm_entry_add(window_evas_object_get(win)); evas_object_size_hint_weight_set(data->entry, 1.0, 1.0); evas_object_size_hint_align_set(data->entry, -1.0, -1.0); evas_object_smart_callback_add(data->entry, "changed", frame_content_content_changed, data); if (data->content != NULL) { elm_entry_entry_set(data->entry, data->content); } elm_scroller_content_set(data->sc, data->entry); evas_object_show(data->entry); window_swallow(win, "entry", data->sc); evas_object_show(data->sc); elm_object_focus(data->entry); }
static Evas_Object* create_about_section(view_sys *p_sys) { /* Create layout and set the theme */ Evas_Object *layout = elm_layout_add(p_sys->nf_toolbar); /* */ elm_layout_file_set(layout, ABOUT_EDJ, "about"); /* Cone */ Evas_Object *cone = elm_image_add(layout); evas_object_size_hint_align_set(cone, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_weight_set(cone, EVAS_HINT_FILL, EVAS_HINT_EXPAND); elm_image_file_set(cone, ICON_DIR"cone.png", NULL); elm_object_part_content_set(layout, "cone", cone); evas_object_show(cone); /* Description */ Evas_Object *lbl_description = elm_label_add(layout); evas_object_size_hint_align_set(lbl_description, EVAS_HINT_FILL, 0); evas_object_size_hint_weight_set(lbl_description, EVAS_HINT_FILL, EVAS_HINT_EXPAND); elm_label_line_wrap_set(lbl_description, ELM_WRAP_MIXED); elm_object_text_set(lbl_description, "<font-size=22><align=center>VLC for Tizen™ is a port of VLC media player, the popular open-source media player."); elm_object_part_content_set(layout, "description", lbl_description); evas_object_show(lbl_description); /* Revision number */ elm_object_part_text_set(layout, "revision", REVISION); /* Handle cone animation */ p_sys->p_anim->initial_y = -1; // Initial position unknown p_sys->p_anim->obj = cone; p_sys->p_anim->container = layout; evas_object_smart_callback_add(cone, "clicked", cone_clicked_cb, p_sys); /* */ evas_object_show(layout); return layout; }
static void _class_show(void) { /* create the activity content once for all */ if (!mod->o_layout) { mod->o_layout = elm_layout_add(enna->layout); elm_layout_file_set(mod->o_layout, enna_config_theme_get(), "activity/bookstore"); mod->edje = elm_layout_edje_get(mod->o_layout); enna_content_append(ENNA_MODULE_NAME, mod->o_layout); } /* create the menu, once for all */ if (!mod->menu) bs_menu_create(); /* show module */ enna_content_select(ENNA_MODULE_NAME); edje_object_signal_emit(mod->edje, "module,show", "enna"); edje_object_signal_emit(mod->edje, "menu,show", "enna"); }
void datetime_cb(void *data, Evas_Object *obj, void *event_info) { appdata_s *ad = data; Elm_Object_Item *it; Evas_Object *box, *layout; datetimedata_s *dd = calloc(1, sizeof(datetimedata_s)); dd->nf = ad->nf; time_t local_time = time(NULL); char buff[200] = {0}; struct tm *time_info = localtime(&local_time); dd->saved_time = *time_info; layout = elm_layout_add(ad->nf); evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_layout_file_set(layout, ELM_DEMO_EDJ, "white_bg_layout"); box = elm_box_add(layout); 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_box_padding_set(box, 0, ELM_SCALE_SIZE(70)); elm_object_part_content_set(layout, "elm.swallow.content", box); strftime(buff, 200, DATE_FORMAT, &dd->saved_time); dd->button1 = create_button(dd, box, buff, DATE_FORMAT); strftime(buff, 200, TIME_12_FORMAT, &dd->saved_time); dd->button2 = create_button(dd, box, buff, TIME_12_FORMAT); strftime(buff, 200, TIME_24_FORMAT, &dd->saved_time); dd->button3 = create_button(dd, box, buff, TIME_24_FORMAT); it = elm_naviframe_item_push(ad->nf, "DateTime", NULL, NULL, layout, NULL); elm_naviframe_item_pop_cb_set(it, naviframe_pop_cb, dd); }
static void _init_contacts_page(struct MessageNewViewData *view) { Evas_Object *win, *btn; win = ui_utils_view_window_get(VIEW_PTR(*view)); view->layout_contacts = elm_layout_add(view->pager); elm_win_resize_object_add(win, view->layout_contacts); elm_layout_file_set(view->layout_contacts, phoneui_theme, "phoneui/messages/new/contacts"); evas_object_show(view->layout_contacts); edje_object_part_text_set(elm_layout_edje_get(view->layout_contacts), "contacts_title", D_("Add Contact")); view->contact_list_data.layout = view->layout_contacts; contact_list_add(&view->contact_list_data); btn = elm_button_add(win); elm_object_text_set(btn, D_("Back")); evas_object_smart_callback_add(btn, "clicked", _contacts_button_back_clicked, view); elm_object_part_content_set(view->layout_contacts, "contacts_button_back", btn); evas_object_show(btn); btn = elm_button_add(win); elm_object_text_set(btn, D_("Add")); evas_object_smart_callback_add(btn, "clicked", _contacts_button_add_clicked, view); elm_object_part_content_set(view->layout_contacts, "contacts_button_add", btn); evas_object_show(btn); contact_list_fill(&view->contact_list_data); elm_naviframe_item_simple_push(view->pager, view->layout_contacts); }
void game_init(GameData *data, int argc, char** argv) { ecore_event_init(); ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, _game_key_down_cb, data); ecore_event_handler_add(ECORE_EVENT_KEY_UP, _game_key_up_cb, data); elm_init(argc, argv); data->win = elm_win_util_standard_add(PROJ_NAME, PROJ_NAME); evas_object_smart_callback_add(data->win, "delete,request", _on_exit, NULL); elm_win_autodel_set(data->win, EINA_TRUE); evas_object_resize(data->win, SCREEN_WIDTH, SCREEN_HEIGHT); evas_object_show(data->win); data->layout = elm_layout_add(data->win); elm_layout_file_set(data->layout, LAYOUT_EDJ, GAME_MAIN_GROUP); evas_object_size_hint_weight_set(data->layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(data->win, data->layout); evas_object_show(data->layout); evas_object_event_callback_add(data->layout, EVAS_CALLBACK_RESIZE, _on_resize, data); data->food = calloc(1, sizeof(Snake_Food)); snake_food_generate_random(data->food, data->layout); snake_food_draw(data->food); }
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; }