2 Copyright (C) 2011 Samsung Electronics
3 Copyright (C) 2012 Intel Corporation. All rights reserved.
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
23 * @brief WebKit main smart object.
25 * This object provides view related APIs of WebKit2 to EFL object.
31 #include "ewk_context.h"
33 #include "ewk_frame.h"
34 #include "ewk_setting.h"
37 #include <WebKit2/WKGeometry.h>
40 #include "ewk_history.h"
42 //#if ENABLE(TIZEN_WEBKIT2_HIT_TEST)
43 #include "ewk_hit_test.h"
46 //#if ENABLE(TIZEN_WEBKIT2_POPUP)
47 #include "ewk_enums.h"
54 typedef struct _Ewk_View_Smart_Data Ewk_View_Smart_Data;
55 typedef struct _Ewk_View_Smart_Class Ewk_View_Smart_Class;
58 /// Creates a type name for _Ewk_Event_Gesture.
59 typedef struct _Ewk_Event_Gesture Ewk_Event_Gesture;
61 /// Represents a gesture event.
62 struct _Ewk_Event_Gesture {
63 Ewk_Gesture_Type type; /**< type of the gesture event */
64 Evas_Coord_Point position; /**< position of the gesture event */
65 Evas_Point velocity; /**< velocity of the gesture event. The unit is pixel per second. */
66 double scale; /**< scale of the gesture event */
67 int count; /**< count of the gesture */
68 unsigned int timestamp; /**< timestamp of the gesture */
71 /// Represents types of touch event.
77 } Ewk_Touch_Event_Type;
79 /// Creates a type name for _Ewk_Touch_Point.
80 typedef struct _Ewk_Touch_Point Ewk_Touch_Point;
82 /// Represents a touch point.
83 struct _Ewk_Touch_Point {
84 int id; /**< identifier of the touch event */
85 int x; /**< the horizontal position of the touch event */
86 int y; /**< the vertical position of the touch event */
87 Evas_Touch_Point_State state; /**< state of the touch event */
90 // #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
92 * \enum Ewk_Input_Type
93 * @brief Provides type of focused input element
95 enum _Ewk_Input_Type {
97 EWK_INPUT_TYPE_TELEPHONE,
98 EWK_INPUT_TYPE_NUMBER,
101 EWK_INPUT_TYPE_PASSWORD,
102 EWK_INPUT_TYPE_COLOR,
104 EWK_INPUT_TYPE_DATETIME,
105 EWK_INPUT_TYPE_DATETIMELOCAL,
106 EWK_INPUT_TYPE_MONTH,
110 typedef enum _Ewk_Input_Type Ewk_Input_Type;
111 // #endif // ENABLE(TIZEN_INPUT_TAG_EXTENSION)
112 // #endif // #if OS(TIZEN)
114 /// Ewk view's class, to be overridden by sub-classes.
115 struct _Ewk_View_Smart_Class {
116 Evas_Smart_Class sc; /**< all but 'data' is free to be changed. */
117 unsigned long version;
119 //#if ENABLE(TIZEN_WEBKIT2_POPUP)
120 Eina_Bool (*popup_menu_show)(Ewk_View_Smart_Data *sd, Eina_Rectangle rect, Ewk_Text_Direction text_direction, double page_scale_factor, Eina_List* items, int selected_index);
121 Eina_Bool (*popup_menu_hide)(Ewk_View_Smart_Data *sd);
124 // #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
125 Eina_Bool (*text_selection_down)(Ewk_View_Smart_Data *sd, int x, int y);
126 Eina_Bool (*text_selection_move)(Ewk_View_Smart_Data *sd, int x, int y);
127 Eina_Bool (*text_selection_up)(Ewk_View_Smart_Data *sd, int x, int y);
130 //#if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
131 Eina_Bool (*input_picker_show)(Ewk_View_Smart_Data *sd, Ewk_Input_Type inputType, const char* inputValue);
134 //#if ENABLE(TIZEN_DATALIST_ELEMENT)
135 Eina_Bool (*data_list_show)(Ewk_View_Smart_Data *sd, Ewk_Input_Type inputType, Eina_List *optionList);
136 Eina_Bool (*data_list_hide)(Ewk_View_Smart_Data *sd, Ewk_Input_Type inputType);
139 // #if ENABLE(SCREEN_ORIENTATION_SUPPORT) && ENABLE(TIZEN_SCREEN_ORIENTATION_SUPPORT)
140 Eina_Bool (*orientation_lock)(Ewk_View_Smart_Data *sd, int orientations);
141 void (*orientation_unlock)(Ewk_View_Smart_Data *sd);
145 // - returns true if handled
146 // - if overridden, have to call parent method if desired
147 Eina_Bool (*focus_in)(Ewk_View_Smart_Data *sd);
148 Eina_Bool (*focus_out)(Ewk_View_Smart_Data *sd);
149 Eina_Bool (*mouse_wheel)(Ewk_View_Smart_Data *sd, const Evas_Event_Mouse_Wheel *ev);
150 Eina_Bool (*mouse_down)(Ewk_View_Smart_Data *sd, const Evas_Event_Mouse_Down *ev);
151 Eina_Bool (*mouse_up)(Ewk_View_Smart_Data *sd, const Evas_Event_Mouse_Up *ev);
152 Eina_Bool (*mouse_move)(Ewk_View_Smart_Data *sd, const Evas_Event_Mouse_Move *ev);
153 Eina_Bool (*key_down)(Ewk_View_Smart_Data *sd, const Evas_Event_Key_Down *ev);
154 Eina_Bool (*key_up)(Ewk_View_Smart_Data *sd, const Evas_Event_Key_Up *ev);
156 Eina_Bool (*initialize)(Ewk_View_Smart_Data *sd, Ewk_Context *context);
157 Eina_Bool (*multi_down)(Ewk_View_Smart_Data *sd, const Evas_Event_Multi_Down *ev);
158 Eina_Bool (*multi_up)(Ewk_View_Smart_Data *sd, const Evas_Event_Multi_Up *ev);
159 Eina_Bool (*multi_move)(Ewk_View_Smart_Data *sd, const Evas_Event_Multi_Move *ev);
160 Eina_Bool (*gesture_start)(Ewk_View_Smart_Data *sd, const Ewk_Event_Gesture *ev);
161 Eina_Bool (*gesture_end)(Ewk_View_Smart_Data *sd, const Ewk_Event_Gesture *ev);
162 Eina_Bool (*gesture_move)(Ewk_View_Smart_Data *sd, const Ewk_Event_Gesture *ev);
168 * Callback for ewk_view_web_app_capable_get
170 * @param capable web application capable
171 * @param user_data user_data will be passsed when ewk_view_web_app_capable_get is called
173 typedef void (*Ewk_Web_App_Capable_Get_Callback)(Eina_Bool capable, void* user_data);
176 * Callback for ewk_view_web_app_icon_get
178 * @param icon_url web application icon
179 * @param user_data user_data will be passsed when ewk_view_web_app_icon_get is called
181 typedef void (*Ewk_Web_App_Icon_URL_Get_Callback)(const char* icon_url, void* user_data);
185 * The version you have to put into the version field
186 * in the @a Ewk_View_Smart_Class structure.
188 #define EWK_VIEW_SMART_CLASS_VERSION 1UL
191 * Initializer for whole Ewk_View_Smart_Class structure.
193 * @param smart_class_init initializer to use for the "base" field
194 * (Evas_Smart_Class).
196 * @see EWK_VIEW_SMART_CLASS_INIT_NULL
197 * @see EWK_VIEW_SMART_CLASS_INIT_VERSION
198 * @see EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION
200 #define EWK_VIEW_SMART_CLASS_INIT(smart_class_init) {smart_class_init, EWK_VIEW_SMART_CLASS_VERSION, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
203 * Initializer to zero a whole Ewk_View_Smart_Class structure.
205 * @see EWK_VIEW_SMART_CLASS_INIT_VERSION
206 * @see EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION
207 * @see EWK_VIEW_SMART_CLASS_INIT
209 #define EWK_VIEW_SMART_CLASS_INIT_NULL EWK_VIEW_SMART_CLASS_INIT(EVAS_SMART_CLASS_INIT_NULL)
212 * Initializer to zero a whole Ewk_View_Smart_Class structure and set
215 * Similar to EWK_VIEW_SMART_CLASS_INIT_NULL, but will set version field of
216 * Evas_Smart_Class (base field) to latest EVAS_SMART_CLASS_VERSION and name
217 * to the specific value.
219 * It will keep a reference to name field as a "const char *", that is,
220 * name must be available while the structure is used (hint: static or global!)
221 * and will not be modified.
223 * @see EWK_VIEW_SMART_CLASS_INIT_NULL
224 * @see EWK_VIEW_SMART_CLASS_INIT_VERSION
225 * @see EWK_VIEW_SMART_CLASS_INIT
227 #define EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION(name) EWK_VIEW_SMART_CLASS_INIT(EVAS_SMART_CLASS_INIT_NAME_VERSION(name))
229 typedef struct _Ewk_View_Private_Data Ewk_View_Private_Data;
231 //#if ENABLE(TIZEN_WEBKIT2_POPUP)
233 * Structure do contain data of each menu item
235 typedef struct _Ewk_Popup_Menu_Item Ewk_Popup_Menu_Item;
236 /// Contains data of each menu item.
237 struct _Ewk_Popup_Menu_Item {
238 const char *text; /**< Text of the item. */
239 Ewk_Popup_Menu_Item_Type type; /** Type of the item. */
244 // #if ENABLE(TIZEN_MM_PLAYER)
245 typedef struct _Ewk_View_Html5_Video_Data Ewk_View_Html5_Video_Data;
247 // #endif // #if OS(TIZEN)
250 * @brief Contains an internal View data.
252 * It is to be considered private by users, but may be extended or
253 * changed by sub-classes (that's why it's in public header file).
255 struct _Ewk_View_Smart_Data {
256 Evas_Object_Smart_Clipped_Data base;
257 const Ewk_View_Smart_Class* api; /**< reference to casted class instance */
258 Evas_Object* self; /**< reference to owner object */
259 Evas_Object* image; /**< reference to evas_object_image for drawing web contents */
261 Evas_Object* bg_rect; /**< rectangle for webview's background */
262 Evas_Object* events_rect; /**< rectangle that should receive mouse events */
264 Ewk_View_Private_Data* priv; /**< should never be accessed, c++ stuff */
266 Evas_Coord x, y, w, h; /**< last used viewport */
268 struct { /**< what changed since last smart_calculate */
271 Eina_Bool position:1;
277 * Sets the smart class APIs, enabling view to be inherited.
279 * @param api class definition to set, all members with the
280 * exception of @a Evas_Smart_Class->data may be overridden, must
283 * @note @a Evas_Smart_Class->data is used to implement type checking and
284 * is not supposed to be changed/overridden. If you need extra
285 * data for your smart class to work, just extend
286 * Ewk_View_Smart_Class instead.
288 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure (probably
291 EAPI Eina_Bool ewk_view_smart_class_set(Ewk_View_Smart_Class *api);
295 * Creates a new EFL WebKit view object.
297 * @param e canvas object where to create the view object
299 * @return view object on success or @c 0 on failure
301 EAPI Evas_Object* ewk_view_add(Evas* canvas);
304 * Creates a new EFL WebKit view object based on specific Ewk_Context.
306 * @param e canvas object where to create the view object
307 * @param context Ewk_Context object to declare process model
309 * @return view object on success or @c 0 on failure
311 EAPI Evas_Object *ewk_view_add_with_context(Evas *e, Ewk_Context *context);
314 * Asks the object to load the given URI.
316 * @param o view object to load @a URI
317 * @param uri uniform resource identifier to load
319 * @return @c EINA_TRUE is returned if @a o is valid, irrespective of load.
321 EAPI Eina_Bool ewk_view_uri_set(Evas_Object *o, const char *uri);
324 * Returns the current URI string of view object.
326 * It returns an internal string and should not
327 * be modified. The string is guaranteed to be stringshared.
329 * @param o view object to get current URI
331 * @return current URI on success or @c 0 on failure
333 EAPI const char *ewk_view_uri_get(const Evas_Object *o);
336 * Asks the main frame to reload the current document.
338 * @param o view object to reload current document
340 * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
342 * @see ewk_view_reload_full()
344 EAPI Eina_Bool ewk_view_reload(Evas_Object *o);
347 * Reloads the current page's document without cache.
349 * @param o view object to reload current document
351 * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
353 EAPI Eina_Bool ewk_view_reload_bypass_cache(Evas_Object *o);
356 * Asks the main frame to stop loading.
358 * @param o view object to stop loading
360 * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise.
362 EAPI Eina_Bool ewk_view_stop(Evas_Object* o);
365 EINA_DEPRECATED EAPI WKPageRef ewk_view_WKPage_get(Evas_Object* o);
367 enum _Ewk_Page_Visibility_State {
368 EWK_PAGE_VISIBILITY_STATE_VISIBLE,
369 EWK_PAGE_VISIBILITY_STATE_HIDDEN,
370 EWK_PAGE_VISIBILITY_STATE_PRERENDER
372 typedef enum _Ewk_Page_Visibility_State Ewk_Page_Visibility_State;
374 enum _Ewk_Http_Method {
376 EWK_HTTP_METHOD_HEAD,
377 EWK_HTTP_METHOD_POST,
379 EWK_HTTP_METHOD_DELETE,
381 typedef enum _Ewk_Http_Method Ewk_Http_Method;
384 * Callback for ewk_view_rss_items_get
386 * @param o view object to get RSS items
387 * @param items RSS items on success, or NULL on failure
388 * @param user_data user data
390 typedef void (*Ewk_View_Rss_Items_Get_Callback)(Evas_Object* o, const Eina_List* items, void* user_data);
393 * \enum EwkFindOptions
394 * @brief Provides option to find word
395 * @info Keep this in sync with WKFindOptions.h
398 EWK_FIND_OPTIONS_CASE_INSENSITIVE = 1 << 0,
399 EWK_FIND_OPTIONS_AT_WORD_STARTS = 1 << 1,
400 EWK_FIND_OPTIONS_TREAT_MEDIAL_CAPITAL_AS_WORD_START = 1 << 2,
401 EWK_FIND_OPTIONS_BACKWARDS = 1 << 3,
402 EWK_FIND_OPTIONS_WRAP_AROUND = 1 << 4,
403 EWK_FIND_OPTIONS_SHOW_OVERLAY = 1 << 5,
404 EWK_FIND_OPTIONS_SHOW_FIND_INDICATOR = 1 << 6,
405 EWK_FIND_OPTIONS_SHOW_HIGHLIGHT = 1 << 7
407 typedef uint32_t EwkFindOptions;
410 * @brief ewk_view_find_string callback.
412 * @param o view object to get reader article
413 * @param string string to find.
414 * @param match_count count to match
415 * @param user_data user data
417 typedef void (*Ewk_View_String_Find_Callback)(Evas_Object* o, const char* string, int match_count, void* user_data);
420 * Callback for ewk_view_script_execute
422 * @param o the view object
423 * @param result_value value returned by script
424 * @param user_data user data
426 typedef void (*Ewk_View_Script_Execute_Callback)(Evas_Object* o, const char* result_value, void* user_data);
429 * Callback for ewk_view_plain_text_get
431 * @param o the view object
432 * @param plain_text the contents of the given frame converted to plain text
433 * @param user_data user data
435 typedef void (*Ewk_View_Plain_Text_Get_Callback)(Evas_Object* o, const char* plain_text, void* user_data);
439 * Sets whether the ewk_view supports the mouse events or not.
441 * The ewk_view will support the mouse events if EINA_TRUE or not support the
442 * mouse events otherwise. The default value is EINA_TRUE.
444 * @param o view object to enable/disable the mouse events
445 * @param enabled a state to set
447 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
449 EAPI Eina_Bool ewk_view_mouse_events_enabled_set(Evas_Object *o, Eina_Bool enabled);
452 * Queries if the ewk_view supports the mouse events.
454 * @param o view object to query if the mouse events are enabled
456 * @return @c EINA_TRUE if the mouse events are enabled or @c EINA_FALSE otherwise
458 EAPI Eina_Bool ewk_view_mouse_events_enabled_get(const Evas_Object *o);
461 * Feeds the touch event to the view.
463 * @param o view object to feed touch event
464 * @param type the type of touch event
465 * @param points a list of points (Ewk_Touch_Point) to process
466 * @param modifiers modifiers state of touch event. Users are expected to pass
467 * ORed values of the ECORE_EVENT_MODIFIER macros in Ecore_Input.h such
468 * as ECORE_EVENT_MODIFIER_ALT or ECORE_EVENT_MODIFIER_SHIFT
470 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
472 EAPI Eina_Bool ewk_view_feed_touch_event(Evas_Object *o, Ewk_Touch_Event_Type type, Eina_List *points, const Evas_Modifier *modifiers);
473 // #endif // #if OS(TIZEN)
476 * Creates a new EFL WebKit View object with Ewk_Context.
478 * @param e canvas object where to create the view object
479 * @param context context object
481 * @return view object on success or @c 0 on failure
483 EAPI Evas_Object* ewk_view_add_with_context(Evas* canvas, Ewk_Context* context);
486 * Gets the Ewk_Context of this view.
488 * @param o the view object to get the WKPageRef
490 * @return the Ewk_Context of this view
492 EAPI Ewk_Context* ewk_view_context_get(const Evas_Object* o);
495 * Gets the reference object for frame that represents the main frame.
497 * @param o view object to get main frame
499 * @return frame reference of frame object on success, or NULL on failure
501 EAPI Ewk_Frame_Ref ewk_view_main_frame_get(Evas_Object* o);
504 * Gets the reference obect for the currently focused frame.
506 * @param o view object to get main frame
508 * @return frame reference of frame object on success, or NULL on failure
510 EAPI Ewk_Frame_Ref ewk_view_focused_frame_get(Evas_Object* o);
513 * Gets the Ewk_Setting of this view.
515 * @param o the view object to get Ewk_Setting
517 * @return the Ewk_Setting of this view
519 EAPI Ewk_Setting* ewk_view_setting_get(Evas_Object* o);
521 EAPI Eina_Bool ewk_view_horizontal_panning_hold_get(Evas_Object* o);
522 EAPI void ewk_view_horizontal_panning_hold_set(Evas_Object* o, Eina_Bool hold);
523 EAPI Eina_Bool ewk_view_vertical_panning_hold_get(Evas_Object* o);
524 EAPI void ewk_view_vertical_panning_hold_set(Evas_Object* o, Eina_Bool hold);
525 EAPI void ewk_view_top_of_contents_go(Evas_Object* ewkView);
526 EINA_DEPRECATED EAPI Eina_Bool ewk_view_enable_specified_plugin_set(Evas_Object* ewkView, Eina_Bool enable, const char* mimeType);
529 * Gets the current scale factor.
531 * @param o view object to get the scale factor
533 * @return current scale factor on success or @c -1.0 on failure
535 EAPI double ewk_view_scale_get(Evas_Object* o);
538 * Scales the current page, centered at the given point.
540 * @param o view object to set the scale factor
541 * @param scale_factor a new level to set
542 * @param cx x of center coordinate
543 * @param cy y of center coordinate
545 * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
547 EAPI Eina_Bool ewk_view_scale_set(Evas_Object* o, double scale_factor, Evas_Coord cx, Evas_Coord cy);
550 * Gets the minimum and maximum value of the scale range or -1 on failure
552 * @param o view object to get the minimum and maximum value of the scale range
553 * @param min_scale Pointer to an double in which to store the minimum scale factor of the object.
554 * @param max_scale Pointer to an double in which to store the maximum scale factor of the object.
556 * @note Use @c NULL pointers on the scale components you're not
557 * interested in: they'll be ignored by the function.
559 EAPI void ewk_view_scale_range_get(Evas_Object* o, double* min_scale, double* max_scale);
562 * Gets the current text zoom level.
564 * @param o view object to get the zoom level
566 * @return current zoom level in use on success or @c -1.0 on failure
568 EAPI double ewk_view_text_zoom_get(const Evas_Object* o);
571 * Sets the current text zoom level.
573 * @param o view object to set the zoom level
574 * @param textZoomFactor a new level to set
576 * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
578 EAPI Eina_Bool ewk_view_text_zoom_set(Evas_Object* o, double text_zoom_factor);
580 EAPI void ewk_view_suspend(Evas_Object* o);
581 EAPI void ewk_view_resume(Evas_Object* o);
583 typedef Eina_Bool (*Ewk_View_JavaScript_Alert_Callback)(Evas_Object* o, const char* alert_text, void* user_data);
584 EAPI void ewk_view_javascript_alert_callback_set(Evas_Object* o, Ewk_View_JavaScript_Alert_Callback callback, void* user_data);
585 EAPI void ewk_view_javascript_alert_reply(Evas_Object* o);
587 typedef Eina_Bool (*Ewk_View_JavaScript_Confirm_Callback)(Evas_Object* o, const char* message, void* user_data);
588 EAPI void ewk_view_javascript_confirm_callback_set(Evas_Object* o, Ewk_View_JavaScript_Confirm_Callback callback, void* user_data);
589 EAPI void ewk_view_javascript_confirm_reply(Evas_Object* o, Eina_Bool result);
591 typedef Eina_Bool (*Ewk_View_JavaScript_Prompt_Callback)(Evas_Object* o, const char* message, const char* default_value, void* user_data);
592 EAPI void ewk_view_javascript_prompt_callback_set(Evas_Object* o, Ewk_View_JavaScript_Prompt_Callback callback, void* user_data);
593 EAPI void ewk_view_javascript_prompt_reply(Evas_Object* o, const char* result);
595 typedef Eina_Bool (*Ewk_View_Open_Panel_Callback)(Evas_Object* o, Eina_Bool allow_multiple_files, Eina_List* accepted_mime_types, const char* capture, void* user_data);
596 EAPI void ewk_view_open_panel_callback_set(Evas_Object* o, Ewk_View_Open_Panel_Callback callback, void* user_data);
597 EAPI void ewk_view_open_panel_reply(Evas_Object* o, Eina_List* file_url, Eina_Bool result);
600 * Asks the main frame to navigate back in the history.
602 * @param o view object to navigate back
604 * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
606 * @see ewk_frame_back()
608 EAPI Eina_Bool ewk_view_back(Evas_Object *o);
611 * Asks the main frame to navigate forward in the history.
613 * @param o view object to navigate forward
615 * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
617 * @see ewk_frame_forward()
619 EAPI Eina_Bool ewk_view_forward(Evas_Object *o);
622 * Queries if it is possible to navigate backwards one item in the history.
624 * @param o view object to query if backward navigation is possible
626 * @return @c EINA_TRUE if it is possible to navigate backwards in the history, @c EINA_FALSE otherwise
628 EAPI Eina_Bool ewk_view_back_possible(Evas_Object *o);
631 * Queries if it is possible to navigate forwards one item in the history.
633 * @param o view object to query if forward navigation is possible
635 * @return @c EINA_TRUE if it is possible to navigate forwards in the history, @c EINA_FALSE otherwise
637 EAPI Eina_Bool ewk_view_forward_possible(Evas_Object *o);
640 * Requests loading of the given request data.
642 * @param o view object to load
643 * @param url uniform resource identifier to load
644 * @param method http method
645 * @param headers http headers
646 * @param body http body data
648 * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
650 EAPI Eina_Bool ewk_view_url_request_set(Evas_Object* o, const char* url, Ewk_Http_Method method, Eina_Hash* headers, const char* body);
653 * Requests the specified plain text string into the view object
655 * @note The mime type of document will be "text/plain".
657 * @param o view object to load
658 * @param plain_text the plain text to load
660 * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
662 EAPI Eina_Bool ewk_view_plain_text_set(Evas_Object* o, const char* plain_text);
665 * Requests loading the given contents by mime type into the view object.
667 * @param o view object to load
668 * @param contents what to load
669 * @param contents_size size of @a contents (in bytes),
670 * @param mime_type type of @a contents data, if @c 0 is given "text/html" is assumed
671 * @param encoding encoding for @a contents data, if @c 0 is given "UTF-8" is assumed
672 * @param base_uri base uri to use for relative resources, may be @c 0,
673 * if provided @b must be an absolute uri
675 * @return @c EINA_TRUE on successful request, @c EINA_FALSE on errors
677 EAPI Eina_Bool ewk_view_contents_set(Evas_Object* o, const char* contents, size_t contents_size, char* mime_type, char* encoding, char* base_uri);
680 * Returns the current title string of page.
682 * @param o view object to get current title
684 * @return current title string on success or @c 0 on failure
686 EAPI const char* ewk_view_title_get(const Evas_Object* o);
689 * Gets the current load progress of page.
691 * The progress estimates from 0.0 to 1.0.
693 * @param o view object to get the current progress
695 * @return the load progres of page, value from 0.0 to 1.0 on success
698 EAPI double ewk_view_load_progress_get(const Evas_Object* o);
701 * Requests loading the given contents.
703 * @param o view object to load document
704 * @param html what to load
705 * @param base_uri base uri to use for relative resources, may be @c 0,
706 * if provided @b must be an absolute uri
708 * @return @c EINA_TRUE on successful request, @c EINA_FALSE on errors
710 EAPI Eina_Bool ewk_view_html_contents_set(Evas_Object* o, const char* html, const char* base_uri);
713 * Requests for setting page visibility state.
715 * @param o view object to set the page visibility
716 * @param page_visibility_state visible state of the page to set
717 * @param initial_state @c EINA_TRUE if this function is called at page initialization time,
718 * @c EINA_FALSE otherwise
720 * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
722 EAPI Eina_Bool ewk_view_page_visibility_state_set(Evas_Object* o, Ewk_Page_Visibility_State page_visibility_state, Eina_Bool initial_state);
725 * Request to set the user agent string.
727 * @param o view object to set the user agent string
729 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
731 EAPI Eina_Bool ewk_view_user_agent_set(Evas_Object* o, const char* user_agent);
734 * Returns user agent string.
736 * @param o view object to get the user agent string
738 * @return @c user agent string
740 EAPI const char* ewk_view_user_agent_get(const Evas_Object* o);
741 //#if ENABLE(TIZEN_CUSTOM_HEADERS)
745 * @param o view object to add custom header
747 * @param name custom header name to add the custom header
749 * @param value custom header value to add the custom header
751 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
753 EAPI Eina_Bool ewk_view_custom_header_add(const Evas_Object* o, const char* name, const char* value);
756 // #if ENABLE(TIZEN_MM_PLAYER)
758 * Returns url of video data.
760 * @param video_data video data to get the url
762 * @return @c url of video data or empty string on failure
764 EAPI const char* ewk_view_video_data_url_get(const Ewk_View_Html5_Video_Data* video_data);
767 * Returns cookie of video data.
769 * @param video_data video data to get the cookie
771 * @return @c cookie of video data or empty string on failure
773 EAPI const char* ewk_view_video_data_cookie_get(const Ewk_View_Html5_Video_Data* video_data);
774 // #endif // #if ENABLE(TIZEN_MM_PLAYER)
777 * Request to find string
779 * @param o view object to find string
780 * @param string text to find
781 * @param options options to find
782 * @param max_match_count max count to find
783 * @param result_cb result callback
784 * @param user_data user data
786 * @return @c EINA_TRUE on successful request, @c EINA_FALSE on errors
788 EAPI Eina_Bool ewk_view_string_find(Evas_Object* o, const char* string, EwkFindOptions options, unsigned max_match_count, Ewk_View_String_Find_Callback callback, void* user_data);
790 //#if ENABLE(TIZEN_WEBKIT2_VIEW_VISIBILITY)
792 * Request to set the current page's visibility.
794 * @param o view object to set the visibility.
795 * @param enable EINA_TRUE to set on the visibility of the page, EINA_FALSE otherwise.
797 * @return @c EINA_TRUE on successful request, @c EINA_FALSE on errors
799 EAPI Eina_Bool ewk_view_visibility_set(Evas_Object* o, Eina_Bool enable);
803 * Returns the evas image object of the specified viewArea of page
805 * The returned evas image object @b should be freed after use.
807 * @param o view object to get specified rectangle of cairo surface.
808 * @param viewArea rectangle of cairo surface.
809 * @param scaleFactor scale factor of cairo surface.
810 * @param canvas canvas for creating evas image.
812 * @return newly allocated evas image object on sucess or @c 0 on failure.
814 EAPI Evas_Object* ewk_view_screenshot_contents_get(const Evas_Object* o, Eina_Rectangle viewArea, float scaleFactor, Evas* canvas);
816 // #if ENABLE(TIZEN_WEBKIT2_REMOTE_WEB_INSPECTOR)
818 * Start a server for inspecting web pages
819 * This server will be used by Remote Web Browser to transfer messages over network
821 * @param [o] view object to debug
822 * @param [in] port It is a port number for the server. A free port on system will be allocated if port is 0
824 * @return @c assigned port number on success or @c 0 on failure
826 EAPI unsigned int ewk_view_inspector_server_start(Evas_Object* o, unsigned int port);
829 * Stop a server for inspecting web pages
831 * @param [o] view object to debug
833 * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
835 EAPI Eina_Bool ewk_view_inspector_server_stop(Evas_Object* o);
839 * Scrolls webpage of view by dx and dy.
841 * @param o view object to scroll
842 * @param dx horizontal offset to scroll
843 * @param dy vertical offset to scroll
845 EAPI void ewk_view_scroll_by(Evas_Object* o, int dx, int dy);
848 * Gets the current scroll position of given view.
850 * @param o view object to get the current scroll position
851 * @param x the pointer to store the horizontal position, may be @c 0
852 * @param y the pointer to store the vertical position, may be @c 0
854 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise and
857 EAPI Eina_Bool ewk_view_scroll_pos_get(Evas_Object* o, int* x, int* y);
860 * Sets an absolute scroll of the given view.
862 * Both values are from zero to the contents size minus the viewport
865 * @param o view object to scroll
866 * @param x horizontal position to scroll
867 * @param y vertical position to scroll
869 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise
871 EAPI Eina_Bool ewk_view_scroll_set(Evas_Object* o, int x, int y);
874 * Gets the possible scroll size of the given view.
876 * Possible scroll size is contents size minus the viewport size.
878 * @param o view object to get scroll size
879 * @param w the pointer to store the horizontal size that is possible to scroll,
881 * @param h the pointer to store the vertical size that is possible to scroll,
884 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise and
887 EAPI Eina_Bool ewk_view_scroll_size_get(const Evas_Object* o, int* w, int* h);
892 * @param o view object to get rss items.
893 * @param callback result callback
894 * @param user_data user data
896 * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
898 EAPI Eina_Bool ewk_view_rss_items_get(Evas_Object* o, Ewk_View_Rss_Items_Get_Callback callback, void* user_data);
901 * Requests for getting web application capable.
903 * @param callback result callback to get web database quota
904 * @param user_data user_data will be passed when result_callback is called
905 * -I.e., user data will be kept until callback is called
907 * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
909 EAPI Eina_Bool ewk_view_web_application_capable_get(Evas_Object* o, Ewk_Web_App_Capable_Get_Callback callback, void* user_data);
912 * Requests for getting web application icon string.
914 * @param callback result callback to get web database quota
915 * @param user_data user_data will be passed when result_callback is called
916 * -I.e., user data will be kept until callback is called
918 * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
920 EAPI Eina_Bool ewk_view_web_application_icon_url_get(Evas_Object* o, Ewk_Web_App_Icon_URL_Get_Callback callback, void* user_data);
923 * Executes editor command.
925 * @param o view object to execute command
926 * @param command editor command to execute
927 * @param value the value to be passed into command
929 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
931 EAPI Eina_Bool ewk_view_command_execute(Evas_Object* o, const char* command, const char* value);
934 * Gets last known contents size.
936 * @param o view object to get contents size
937 * @param width pointer to store contents size width, may be @c 0
938 * @param height pointer to store contents size height, may be @c 0
940 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure and
941 * @a width and @a height will be zeroed
943 EAPI Eina_Bool ewk_view_contents_size_get(Evas_Object* o, Evas_Coord* width, Evas_Coord* height);
946 * Create PDF file of page contents
948 * @param o view object to get page contents.
949 * @param fileName the file name for creating PDF file.
951 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
953 EAPI Eina_Bool ewk_view_contents_pdf_get(Evas_Object* ewkView, const char* fileName);
955 // #if ENABLE(TIZEN_WEB_STORAGE)
957 * Callback for ewk_view_web_storage_quota_get
959 * @param quota web storage quota
960 * @param user_data user_data will be passed when ewk_view_web_storage_quota_get is called
962 typedef void (*Ewk_Web_Storage_Quota_Get_Callback)(uint32_t quota, void* user_data);
965 * Requests for getting web storage quota.
967 * @param o view object to get web storage quota
968 * @param result_cb callback to get web database origins
969 * @param user_data user_data will be passed when result_cb is called
970 * -I.e., user data will be kept until callback is called
972 * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
974 EAPI Eina_Bool ewk_view_web_storage_quota_get(const Evas_Object* o, Ewk_Web_Storage_Quota_Get_Callback result_callback, void* user_data);
977 * Requests for setting web storage quota.
979 * @param o view object to set web storage quota
980 * @param quota quota to store web storage db.
982 * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
984 EAPI Eina_Bool ewk_view_web_storage_quota_set(Evas_Object* o, uint32_t quota);
985 // #endif // #if ENABLE(TIZEN_WEB_STORAGE)
988 * Requests execution of the given script.
990 * @note This allows to use NULL for the callback parameter.
991 * So, if the result data from the script is not required, NULL might be used for the callback parameter.
993 * @param o view object to execute script
994 * @param script Java Script to execute
995 * @param callback result callback
996 * @param user_data user data
998 * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
1000 EAPI Eina_Bool ewk_view_script_execute(Evas_Object* o, const char* script, Ewk_View_Script_Execute_Callback callback, void* user_data);
1003 * Retrieve the contents in plain text.
1005 * @param o view object whose contents to retrieve.
1006 * @param callback result callback
1007 * @param user_data user data
1009 * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
1011 EAPI Eina_Bool ewk_view_plain_text_get(Evas_Object* o, Ewk_View_Plain_Text_Get_Callback callback, void* user_data);
1013 // #if ENABLE(TIZEN_WEBKIT2_HIT_TEST)
1015 * Creates a new hit test for the given veiw object and point.
1017 * The returned object should be freed by ewk_hit_test_free().
1019 * @param o view object to do hit test on
1020 * @param x the horizontal position to query
1021 * @param y the vertical position to query
1022 * @param hit_test_mode the Ewk_Hit_Test_Mode enum value to query
1024 * @return a newly allocated hit test on success, @c 0 otherwise
1026 EAPI Ewk_Hit_Test* ewk_view_hit_test_new(Evas_Object* o, int x, int y, int hit_test_mode);
1027 // #endif // #if ENABLE(TIZEN_WEBKIT2_HIT_TEST)
1030 * Get the whole history(whole back & forward list) associated with this view.
1032 * @param o view object to get the history(whole back & forward list)
1034 * @return a newly allocated history of @b newly allocated item
1035 * instance. This memory of each item must be released with
1036 * ewk_history_free() after use.
1038 * @see ewk_history_free()
1040 EAPI Ewk_History* ewk_view_history_get(Evas_Object* o);
1043 * Requests to set recording surface.
1045 * @param o view object to set recording surface
1046 * @param enable @c EINA_TRUE to enable recording surface
1047 * @c EINA_FALSE to disable
1049 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
1051 EINA_DEPRECATED EAPI Eina_Bool ewk_view_recording_surface_enable_set(Evas_Object* o, Eina_Bool enable);
1054 * Notify that notification is closed.
1056 * @param notification_list list of Ewk_Notification pointer
1057 * notification_list is freed in this function.
1059 * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
1061 EAPI Eina_Bool ewk_view_notification_closed(Evas_Object* o, Eina_List* notification_list);
1064 * Sends the orientation of the device to send orientationchanged javascript event.
1066 * @param o view object to receive orientation event.
1067 * @param orientation the new orientation of the device. (degree)
1069 * orientation will be 0 degrees when the device is oriented to natural position,
1070 * 90 degrees when it's left side is at the top,
1071 * -90 degrees when it's right side is at the top,
1072 * 180 degrees when it is upside down.
1074 EAPI void ewk_view_orientation_send(Evas_Object *o, int orientation);
1077 * Sets the theme path that will be used by this view.
1079 * This also sets the theme on the main frame. As frames inherit theme
1080 * from their parent, this will have all frames with unset theme to
1083 * @param o view object to change theme
1084 * @param path theme path, may be @c 0 to reset to the default theme
1086 EAPI void ewk_view_theme_set(Evas_Object *o, const char *path);
1089 * Gets the theme set on this view.
1091 * This returns the value set by ewk_view_theme_set().
1093 * @param o view object to get theme path
1095 * @return the theme path, may be @c 0 if not set
1097 EAPI const char *ewk_view_theme_get(const Evas_Object *o);
1100 * Gets the current encoding.
1102 * @param o view object to get the current encoding
1104 * @return @c current encoding, or @c 0 if it's not setted
1106 EAPI const char* ewk_view_encoding_custom_get(const Evas_Object* o);
1109 * Sets the encoding and reloads the page.
1111 * @param o view to set the encoding
1112 * @param encoding the new encoding to set or @c 0 to restore the default one
1114 EAPI void ewk_view_encoding_custom_set(Evas_Object* o, const char* encoding);
1116 // #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
1117 EAPI Eina_Bool ewk_view_text_selection_enable_set(Evas_Object* o, Eina_Bool enable);
1118 EAPI Eina_Bool ewk_view_text_selection_range_get(Evas_Object* o, Eina_Rectangle* left_rect, Eina_Rectangle* right_rect);
1119 EAPI const char* ewk_view_text_selection_text_get(Evas_Object* o);
1120 // #endif // #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
1122 // #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
1124 * Sets the focused input element value
1126 * @param o view object to send the value
1127 * @param value the string value to be set
1129 EAPI void ewk_view_focused_input_element_value_set(Evas_Object* o, const char* value);
1130 // #endif // ENABLE(TIZEN_INPUT_TAG_EXTENSION)
1132 // #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
1134 * Gets the focused input element's value
1136 * @param o view object to get the value
1138 * @return focused input element's value on success or NULL on failure.
1140 EAPI const char* ewk_view_focused_input_element_value_get(Evas_Object* o);
1141 // #endif // ENABLE(TIZEN_INPUT_TAG_EXTENSION)
1144 // #if ENABLE(TIZEN_INPUT_COLOR_PICKER)
1146 * Sets the color value of color chooser
1148 * @param o view object contains color chooser
1149 * @param color the color value to be set (ex: #000000)
1151 EAPI void ewk_view_color_chooser_color_set(Evas_Object* o, const char* color);
1154 * Closes color chooser
1156 * @param o view object contains color chooser
1158 EAPI void ewk_view_color_chooser_close(Evas_Object* o);
1159 // #endif // ENABLE(TIZEN_INPUT_COLOR_PICKER)
1161 // #if ENABLE(TIZEN_DATALIST_ELEMENT)
1163 * Closes data list picker
1165 * @param o view object contains data list element
1166 * @param value value to be set to the input element
1168 void ewk_view_data_list_close(Evas_Object *o, const char *value);
1169 //#endif // ENABLE(TIZEN_DATALIST_ELEMENT)
1171 // #endif // #if OS(TIZEN)
1174 * Queries the ratio between the CSS units and device pixels when the content is unscaled.
1176 * When designing touch-friendly contents, knowing the approximated target size on a device
1177 * is important for contents providers in order to get the intented layout and element
1180 * As most first generation touch devices had a PPI of approximately 160, this became a
1181 * de-facto value, when used in conjunction with the viewport meta tag.
1183 * Devices with a higher PPI learning towards 240 or 320, applies a pre-scaling on all
1184 * content, of either 1.5 or 2.0, not affecting the CSS scale or pinch zooming.
1186 * This value can be set using this property and it is exposed to CSS media queries using
1187 * the -webkit-device-pixel-ratio query.
1189 * For instance, if you want to load an image without having it upscaled on a web view
1190 * using a device pixel ratio of 2.0 it can be done by loading an image of say 100x100
1191 * pixels but showing it at half the size.
1193 * @media (-webkit-min-device-pixel-ratio: 1.5) {
1197 * url: "/images/icon@2x.png"; // This is actually a 100x100 image
1201 * If the above is used on a device with device pixel ratio of 1.5, it will be scaled
1202 * down but still provide a better looking image.
1204 * @param o view object to get device pixel ratio
1206 * @return the ratio between the CSS units and device pixels.
1208 EAPI float ewk_view_device_pixel_ratio_get(const Evas_Object *o);
1211 * Sets the ratio between the CSS units and device pixels when the content is unscaled.
1213 * @param o view object to set device pixel ratio
1215 * @return @c EINA_TRUE if the device pixel ratio was set, @c EINA_FALSE otherwise
1217 * @see ewk_view_device_pixel_ratio_get()
1219 EAPI Eina_Bool ewk_view_device_pixel_ratio_set(Evas_Object *o, float ratio);
1222 * Selects index of current popup menu.
1224 * @param o view object contains popup menu.
1225 * @param index index of item to select
1227 * @return @c EINA_TRUE on success, @c EINA_FALSE on failure (probably
1228 * popup menu is not selected or index is out of range)
1230 EAPI Eina_Bool ewk_view_popup_menu_select(Evas_Object *o, unsigned int index);
1233 * Closes current popup menu.
1235 * @param o view object contains popup menu.
1237 * @return @c EINA_TRUE on success, @c EINA_FALSE on failure (probably
1238 * popup menu is not selected)
1240 EAPI Eina_Bool ewk_view_popup_menu_close(Evas_Object *o);
1242 typedef Eina_Bool (*Ewk_Orientation_Lock_Cb)(Evas_Object* o, Eina_Bool need_lock, int orientation, void* user_data);
1245 * Sets callback of orientation lock function
1247 * func will be called when screen lock is called or unlock is called.
1248 * When screen.lockOrientation is called, need_lock will be true and orientation
1249 * will be the flags which should be locked.
1250 * For example, when contents called 'screen.lockOrientation("portrait"), orientation
1251 * will be EWK_SCREEN_ORIENTATION_PORTRAIT_PRIMARY | EWK_SCREEN_ORIENTATION_PORTRAIT_SECONDARY
1252 * When screen.unlockOrientation is called, need_lock will be false.
1254 * @param o view object to set the callback of orientation
1255 * @param func callback function to be called when screen orientation is locked or unlocked.
1256 * @param use_data user_data will be passsed when ewk_view_web_app_icon_get is called
1258 * @return current URI on success or @c 0 on failure
1260 EINA_DEPRECATED EAPI void ewk_view_orientation_lock_callback_set(Evas_Object *o, Ewk_Orientation_Lock_Cb func, void* user_data);
1265 #endif // ewk_view_h