Tab_Data * tab_add(App_Data *ad) { Tab_Data *td; td = calloc(1, sizeof(Tab_Data)); if (!td) return NULL; td->web = elm_web_add(ad->win); elm_web_window_create_hook_set(td->web, _web_create_window_cb, ad); elm_web_inwin_mode_set(td->web, EINA_TRUE); evas_object_size_hint_weight_set(td->web, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(td->web, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_naviframe_item_simple_push(ad->naviframe, td->web); td->app = ad; td->tab = elm_toolbar_item_append(td->app->tabs, NULL, "New tab", _tab_clicked_cb, td); elm_object_item_del_cb_set(td->tab, _tb_item_del_cb); evas_object_data_set(td->web, "tab_data", td); evas_object_smart_callback_add(td->web, "title,changed", _title_changed_cb, td); evas_object_smart_callback_add(td->web, "uri,changed", _uri_changed_cb, td); evas_object_event_callback_add(td->web, EVAS_CALLBACK_FREE, _web_free_cb, td); elm_toolbar_item_selected_set(td->tab, EINA_TRUE); return td; }
ActivityWebView::ActivityWebView(Evas *_e, Evas_Object *_parent): ActivityView(_e, _parent, "calaos/page/web") { setPartText("header.label", _("Web browser")); keyboard = new KeyboardView(evas, parent); Swallow(keyboard, "keyboard"); if (elm_need_web()) { web = elm_web_add(parent); Swallow(web, "webkit"); evas_object_show(web); elm_object_focus_set(web, true); elm_web_useragent_set(web, USER_AGENT); elm_web_inwin_mode_set(web, true); evas_object_smart_callback_add(web, "load,started", _web_load_started, this); evas_object_smart_callback_add(web, "load,progress", _web_load_progress, this); evas_object_smart_callback_add(web, "load,finished", _web_load_finished, this); evas_object_smart_callback_add(web, "load,error", _web_load_finished, this); evas_object_smart_callback_add(web, "title,changed", _web_title_changed, this); evas_object_smart_callback_add(web, "inputmethod,changed", _web_inputmethod_changed, this); #ifdef HAVE_EWEBKIT Evas_Object *eview = elm_web_webkit_view_get(web); ewk_view_setting_enable_auto_resize_window_set(eview, false); #endif goToCallback(DEFAULT_BROWSER_URL); } Evas_Object *btn = edje_object_part_external_object_get(edje, "button.back"); elm_object_text_set(btn, _("Back to menu")); btn = edje_object_part_external_object_get(edje, "button.reload"); elm_object_text_set(btn, _("Reload")); btn = edje_object_part_external_object_get(edje, "button.stop"); elm_object_text_set(btn, _("Stop")); btn = edje_object_part_external_object_get(edje, "button.home"); elm_object_text_set(btn, _("Home page")); btn = edje_object_part_external_object_get(edje, "button.go"); elm_object_text_set(btn, _("Go to...")); btn = edje_object_part_external_object_get(edje, "button.bookmark"); elm_object_text_set(btn, _("Add to favorites")); addCallback("button.*", "pressed", sigc::mem_fun(*this, &ActivityWebView::buttonCallback)); }