static void _tb_item_del_cb(void *data, Evas_Object *obj, void *event_info) { Tab_Data *td = data; if (!td->app->exiting && !elm_toolbar_selected_item_get(obj)) { td->app->current_tab = NULL; elm_entry_icon_visible_set(td->app->url, EINA_FALSE); if (td->app->search_box) evas_object_del(td->app->search_box); } td->tab = NULL; }
static void tab_current_set(Tab_Data *td) { const char *uri; if (td == td->app->current_tab) return; td->app->current_tab = td; uri = elm_web_uri_get(td->web); elm_object_text_set(td->app->url, uri); nav_button_update(td->app); elm_entry_icon_visible_set(td->app->url, EINA_TRUE); elm_naviframe_item_simple_promote(td->app->naviframe, td->web); }
EINA_DEPRECATED EAPI void elm_scrolled_entry_icon_visible_set(Evas_Object *obj, Eina_Bool setting) {elm_entry_icon_visible_set(obj, setting);}
EAPI_MAIN int elm_main(int argc, char *argv[]) { Evas_Object *win, *bg, *box, *box2, *btn, *ic, *url, *naviframe, *tabs, *web; Evas *e; Evas_Modifier_Mask ctrl_mask; App_Data *ad; if (!elm_need_web()) return -1; ad = calloc(1, sizeof(App_Data)); if (!ad) return -1; elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); win = elm_win_add(NULL, "example-web", ELM_WIN_BASIC); elm_win_autodel_set(win, EINA_TRUE); e = evas_object_evas_get(win); ctrl_mask = evas_key_modifier_mask_get(e, "Control"); if (!evas_object_key_grab(win, "f", ctrl_mask, 0, EINA_TRUE)) fprintf(stderr, "Could not grab trigger for search dialog\n"); evas_object_smart_callback_add(win, "delete,request", _win_del_request_cb, ad); evas_object_event_callback_add(win, EVAS_CALLBACK_KEY_DOWN, _win_search_trigger_cb, ad); evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _win_free_cb, ad); 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); elm_win_resize_object_add(win, box); evas_object_show(box); url = elm_entry_add(win); elm_entry_single_line_set(url, EINA_TRUE); elm_entry_scrollable_set(url, EINA_TRUE); evas_object_size_hint_weight_set(url, EVAS_HINT_EXPAND, 0.0); evas_object_size_hint_align_set(url, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_box_pack_end(box, url); evas_object_show(url); evas_object_smart_callback_add(url, "activated", _url_activated_cb, ad); box2 = elm_box_add(win); elm_box_horizontal_set(box2, EINA_TRUE); elm_object_part_content_set(url, "icon", box2); elm_entry_icon_visible_set(url, EINA_FALSE); btn = elm_button_add(win); elm_box_pack_end(box2, btn); evas_object_show(btn); ad->nav.back = btn; ic = elm_icon_add(win); elm_icon_standard_set(ic, "arrow_left"); elm_object_part_content_set(btn, "icon", ic); evas_object_smart_callback_add(btn, "clicked", _nav_back_cb, ad); btn = elm_button_add(win); elm_box_pack_end(box2, btn); evas_object_show(btn); ad->nav.refresh = btn; ic = elm_icon_add(win); elm_icon_standard_set(ic, "refresh"); elm_object_part_content_set(btn, "icon", ic); evas_object_smart_callback_add(btn, "clicked", _nav_refresh_cb, ad); btn = elm_button_add(win); elm_box_pack_end(box2, btn); evas_object_show(btn); ad->nav.fwd = btn; ic = elm_icon_add(win); elm_icon_standard_set(ic, "arrow_right"); elm_object_part_content_set(btn, "icon", ic); evas_object_smart_callback_add(btn, "clicked", _nav_fwd_cb, ad); box2 = elm_box_add(win); elm_box_horizontal_set(box2, EINA_TRUE); evas_object_size_hint_weight_set(box2, EVAS_HINT_EXPAND, 0.0); evas_object_size_hint_align_set(box2, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_box_pack_end(box, box2); evas_object_show(box2); btn = elm_button_add(win); elm_box_pack_end(box2, btn); evas_object_show(btn); ic = elm_icon_add(win); elm_icon_standard_set(ic, "file"); elm_object_part_content_set(btn, "icon", ic); evas_object_smart_callback_add(btn, "clicked", _add_tab_cb, ad); tabs = elm_toolbar_add(win); elm_toolbar_align_set(tabs, 0.0); elm_toolbar_select_mode_set(tabs, ELM_OBJECT_SELECT_MODE_ALWAYS); elm_toolbar_homogeneous_set(tabs, EINA_FALSE); elm_toolbar_shrink_mode_set(tabs, ELM_TOOLBAR_SHRINK_MENU); evas_object_size_hint_weight_set(tabs, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(tabs, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_box_pack_end(box2, tabs); evas_object_show(tabs); btn = elm_button_add(win); elm_box_pack_end(box2, btn); evas_object_show(btn); evas_object_smart_callback_add(btn, "clicked", _close_tab_cb, ad); ic = elm_icon_add(win); elm_icon_standard_set(ic, "close"); elm_object_part_content_set(btn, "icon", ic); naviframe = elm_naviframe_add(win); evas_object_size_hint_weight_set(naviframe, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(naviframe, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_box_pack_end(box, naviframe); evas_object_show(naviframe); elm_toolbar_menu_parent_set(tabs, naviframe); web = elm_web_add(win); elm_web_window_create_hook_set(web, _web_create_window_cb, ad); elm_web_history_enabled_set(web, EINA_FALSE); evas_object_size_hint_weight_set(web, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(web, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_naviframe_item_simple_push(naviframe, web); default_content_set(web); ad->win = win; ad->main_box = box; ad->naviframe = naviframe; ad->url = url; ad->default_web = web; ad->tabs = tabs; ad->close_tab = btn; evas_object_resize(win, 480, 640); evas_object_show(win); elm_run(); elm_shutdown(); return 0; }