ewebkit2  1.11.0
Web engine based on WebKit2 for EFL
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ewk_view.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2011 Samsung Electronics
3  Copyright (C) 2012 Intel Corporation. All rights reserved.
4 
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.
9 
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.
14 
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.
19 */
20 
74 #ifndef ewk_view_h
75 #define ewk_view_h
76 
77 #include "ewk_back_forward_list.h"
78 #include "ewk_color_picker.h"
79 #include "ewk_context.h"
80 #include "ewk_context_menu.h"
81 #include "ewk_download_job.h"
82 #include "ewk_error.h"
83 #include "ewk_page_group.h"
84 #include "ewk_popup_menu.h"
85 #include "ewk_security_origin.h"
86 #include "ewk_touch.h"
87 #include "ewk_url_request.h"
88 #include "ewk_url_response.h"
89 #include "ewk_window_features.h"
90 #include <Evas.h>
91 
92 #ifdef __cplusplus
93 extern "C" {
94 #endif
95 
97 typedef enum {
98  EWK_TEXT_DIRECTION_RIGHT_TO_LEFT,
99  EWK_TEXT_DIRECTION_LEFT_TO_RIGHT
101 
103 typedef enum {
104  EWK_PAGE_CONTENTS_TYPE_MHTML,
105  EWK_PAGE_CONTENTS_TYPE_STRING
107 
110 
113  Evas_Smart_Class sc;
114  unsigned long version;
115 
116  Eina_Bool (*custom_item_selected)(Ewk_View_Smart_Data *sd, Ewk_Context_Menu_Item *item);
117  Eina_Bool (*context_menu_show)(Ewk_View_Smart_Data *sd, Evas_Coord x, Evas_Coord y, Ewk_Context_Menu *menu);
118  Eina_Bool (*context_menu_hide)(Ewk_View_Smart_Data *sd);
119 
131  Eina_Bool (*popup_menu_show)(Ewk_View_Smart_Data *sd, Eina_Rectangle rect, Ewk_Text_Direction text_direction, double page_scale_factor, Ewk_Popup_Menu *menu);
140 
141  // event handling:
142  // - returns true if handled
143  // - if overridden, have to call parent method if desired
144  Eina_Bool (*focus_in)(Ewk_View_Smart_Data *sd);
145  Eina_Bool (*focus_out)(Ewk_View_Smart_Data *sd);
146  Eina_Bool (*fullscreen_enter)(Ewk_View_Smart_Data *sd, Ewk_Security_Origin *origin);
147  Eina_Bool (*fullscreen_exit)(Ewk_View_Smart_Data *sd);
148  Eina_Bool (*mouse_wheel)(Ewk_View_Smart_Data *sd, const Evas_Event_Mouse_Wheel *ev);
149  Eina_Bool (*mouse_down)(Ewk_View_Smart_Data *sd, const Evas_Event_Mouse_Down *ev);
150  Eina_Bool (*mouse_up)(Ewk_View_Smart_Data *sd, const Evas_Event_Mouse_Up *ev);
151  Eina_Bool (*mouse_move)(Ewk_View_Smart_Data *sd, const Evas_Event_Mouse_Move *ev);
152  Eina_Bool (*key_down)(Ewk_View_Smart_Data *sd, const Evas_Event_Key_Down *ev);
153  Eina_Bool (*key_up)(Ewk_View_Smart_Data *sd, const Evas_Event_Key_Up *ev);
154  Eina_Bool (*window_geometry_set)(Ewk_View_Smart_Data *sd, Evas_Coord x, Evas_Coord y, Evas_Coord width, Evas_Coord height);
155  Eina_Bool (*window_geometry_get)(Ewk_View_Smart_Data *sd, Evas_Coord *x, Evas_Coord *y, Evas_Coord *width, Evas_Coord *height);
156 
157  // javascript popup:
158  // - All strings should be guaranteed to be stringshared.
159  void (*run_javascript_alert)(Ewk_View_Smart_Data *sd, const char *message);
160  Eina_Bool (*run_javascript_confirm)(Ewk_View_Smart_Data *sd, const char *message);
161  const char *(*run_javascript_prompt)(Ewk_View_Smart_Data *sd, const char *message, const char *default_value);
163  // color picker:
164  // - Shows and hides color picker.
165  Eina_Bool (*input_picker_color_request)(Ewk_View_Smart_Data *sd, Ewk_Color_Picker *color_picker);
166  Eina_Bool (*input_picker_color_dismiss)(Ewk_View_Smart_Data *sd);
167 
168  // storage:
169  // - Web database.
170  unsigned long long (*exceeded_database_quota)(Ewk_View_Smart_Data *sd, const char *databaseName, const char *displayName, unsigned long long currentQuota, unsigned long long currentOriginUsage, unsigned long long currentDatabaseUsage, unsigned long long expectedUsage);
171 
172  // window creation and closing:
173  // - Create a new window with specified features and close window.
174  Evas_Object *(*window_create)(Ewk_View_Smart_Data *sd, const Ewk_Window_Features *window_features);
175  void (*window_close)(Ewk_View_Smart_Data *sd);
176 };
177 
182 #define EWK_VIEW_SMART_CLASS_VERSION 8UL
183 
194 #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}
195 
203 #define EWK_VIEW_SMART_CLASS_INIT_NULL EWK_VIEW_SMART_CLASS_INIT(EVAS_SMART_CLASS_INIT_NULL)
204 
221 #define EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION(name) EWK_VIEW_SMART_CLASS_INIT(EVAS_SMART_CLASS_INIT_NAME_VERSION(name))
222 
223 typedef struct EwkView EwkView;
231  Evas_Object_Smart_Clipped_Data base;
233  Evas_Object* self;
234  Evas_Object* image;
235  EwkView* priv;
236  struct {
237  Evas_Coord x, y, w, h;
238  } view;
239  struct {
240  Eina_Bool any:1;
241  Eina_Bool size:1;
242  Eina_Bool position:1;
243  } changed;
244 };
245 
248 
255 };
256 
258 typedef struct Ewk_CSS_Size Ewk_CSS_Size;
259 
263 struct Ewk_CSS_Size {
264  Evas_Coord w;
265  Evas_Coord h;
266 };
267 
282 };
284 
288 typedef enum {
296 
300 typedef enum Ewk_Focus_Direction {
301  EWK_FOCUS_DIRECTION_FORWARD = 0,
302  EWK_FOCUS_DIRECTION_BACKWARD,
304 
309 typedef void (*Ewk_View_Script_Execute_Cb)(Evas_Object *o, const char *return_value, void *user_data);
310 
318 typedef void (*Ewk_Page_Contents_Cb)(Ewk_Page_Contents_Type type, const char *data, void *user_data);
319 
342 
357 EAPI Evas_Object *ewk_view_smart_add(Evas *e, Evas_Smart *smart, Ewk_Context *context, Ewk_Page_Group *pageGroup);
358 
366 EAPI Evas_Object *ewk_view_add(Evas *e);
367 
376 EAPI Evas_Object *ewk_view_add_with_context(Evas *e, Ewk_Context *context);
377 
385 EAPI Ewk_Context *ewk_view_context_get(const Evas_Object *o);
386 
394 EAPI Ewk_Page_Group *ewk_view_page_group_get(const Evas_Object *o);
395 
405 EAPI Eina_Bool ewk_view_url_set(Evas_Object *o, const char *url);
406 
417 EAPI const char *ewk_view_url_get(const Evas_Object *o);
418 
428 EAPI Eina_Bool ewk_view_reload(Evas_Object *o);
429 
437 EAPI Eina_Bool ewk_view_reload_bypass_cache(Evas_Object *o);
438 
446 EAPI Eina_Bool ewk_view_stop(Evas_Object *o);
447 
457 EAPI Eina_Bool ewk_view_back(Evas_Object *o);
458 
468 EAPI Eina_Bool ewk_view_forward(Evas_Object *o);
469 
477 EAPI Eina_Bool ewk_view_back_possible(Evas_Object *o);
478 
486 EAPI Eina_Bool ewk_view_forward_possible(Evas_Object *o);
487 
501 EAPI Ewk_Back_Forward_List *ewk_view_back_forward_list_get(const Evas_Object *o);
502 
511 EAPI Eina_Bool ewk_view_navigate_to(Evas_Object *o, const Ewk_Back_Forward_List_Item *item);
512 
523 EAPI const char *ewk_view_title_get(const Evas_Object *o);
524 
535 EAPI double ewk_view_load_progress_get(const Evas_Object *o);
536 
554 EAPI Eina_Bool ewk_view_html_string_load(Evas_Object *o, const char *html, const char *baseUrl, const char *unreachableUrl);
555 
566 EAPI Eina_Bool ewk_view_scale_set(Evas_Object *o, double scale_factor, int cx, int cy);
567 
578 EAPI double ewk_view_scale_get(const Evas_Object *o);
579 
588 EAPI Eina_Bool ewk_view_page_zoom_set(Evas_Object *o, double zoom_factor);
589 
600 EAPI double ewk_view_page_zoom_get(const Evas_Object *o);
601 
642 EAPI float ewk_view_device_pixel_ratio_get(const Evas_Object *o);
643 
653 EAPI Eina_Bool ewk_view_device_pixel_ratio_set(Evas_Object *o, float ratio);
654 
665 EAPI void ewk_view_theme_set(Evas_Object *o, const char *path);
666 
676 EAPI const char *ewk_view_theme_get(const Evas_Object *o);
677 
686 EAPI const char *ewk_view_custom_encoding_get(const Evas_Object *o);
687 
696 EAPI Eina_Bool ewk_view_custom_encoding_set(Evas_Object *o, const char *encoding);
697 
706 EAPI const char *ewk_view_user_agent_get(const Evas_Object *o);
707 
716 EAPI Eina_Bool ewk_view_user_agent_set(Evas_Object *o, const char *user_agent);
717 
728 EAPI Eina_Bool ewk_view_text_find(Evas_Object *o, const char *text, Ewk_Find_Options options, unsigned max_match_count);
729 
737 EAPI Eina_Bool ewk_view_text_find_highlight_clear(Evas_Object *o);
738 
760 EAPI Eina_Bool ewk_view_text_matches_count(Evas_Object *o, const char *text, Ewk_Find_Options options, unsigned max_match_count);
761 
773 EAPI Eina_Bool ewk_view_mouse_events_enabled_set(Evas_Object *o, Eina_Bool enabled);
774 
782 EAPI Eina_Bool ewk_view_mouse_events_enabled_get(const Evas_Object *o);
783 
797 EAPI Eina_Bool ewk_view_feed_touch_event(Evas_Object *o, Ewk_Touch_Event_Type type, const Eina_List *points, const Evas_Modifier *modifiers);
798 
810 EAPI Eina_Bool ewk_view_touch_events_enabled_set(Evas_Object *o, Eina_Bool enabled);
811 
819 EAPI Eina_Bool ewk_view_touch_events_enabled_get(const Evas_Object *o);
820 
830 EAPI Eina_Bool ewk_view_inspector_show(Evas_Object *o);
831 
839 EAPI Eina_Bool ewk_view_inspector_close(Evas_Object *o);
840 
849 EAPI Eina_Bool ewk_view_pagination_mode_set(Evas_Object *o, Ewk_Pagination_Mode mode);
850 
861 EAPI Ewk_Pagination_Mode ewk_view_pagination_mode_get(const Evas_Object *o);
862 
870 EAPI Eina_Bool ewk_view_fullscreen_exit(Evas_Object *o);
871 
882 EAPI Eina_Bool ewk_view_page_contents_get(const Evas_Object *o, Ewk_Page_Contents_Type type, Ewk_Page_Contents_Cb callback, void *user_data);
883 
896 EAPI Eina_Bool ewk_view_script_execute(Evas_Object *o, const char *script, Ewk_View_Script_Execute_Cb callback, void *user_data);
897 
909 EAPI Eina_Bool ewk_view_layout_fixed_set(Evas_Object *o, Eina_Bool enabled);
910 
919 EAPI Eina_Bool ewk_view_layout_fixed_get(const Evas_Object *o);
920 
930 EAPI void ewk_view_layout_fixed_size_set(const Evas_Object *o, Evas_Coord width, Evas_Coord height);
931 
940 EAPI void ewk_view_layout_fixed_size_get(const Evas_Object *o, Evas_Coord *width, Evas_Coord *height);
941 
951 EAPI void ewk_view_bg_color_set(Evas_Object *o, int r, int g, int b, int a);
952 
962 EAPI void ewk_view_bg_color_get(const Evas_Object *o, int *r, int *g, int *b, int *a);
963 
975 EAPI Eina_Bool ewk_view_contents_size_get(const Evas_Object *o, Evas_Coord *width, Evas_Coord *height);
976 
977 #ifdef __cplusplus
978 }
979 #endif
980 #endif // ewk_view_h