1 /* 2 Copyright (C) 2009-2010 ProFUSION embedded systems 3 Copyright (C) 2009-2010 Samsung Electronics 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 21 #ifndef ewk_frame_h 22 #define ewk_frame_h 23 24 #include "ewk_eapi.h" 25 #include <Evas.h> 26 27 #ifdef __cplusplus 28 extern "C" { 29 #endif 30 31 /** 32 * @file 33 * 34 * WebKit frame smart object. 35 * 36 * This object is the low level access to WebKit-EFL browser 37 * component. It represents both the main and internal frames that 38 * HTML pages contain. 39 * 40 * Every ewk_view has at least one frame, called "main frame" and 41 * retrieved with ewk_view_frame_main_get(). One can retrieve frame's 42 * owner view with ewk_frame_view_get(). Parent frame can be retrieved 43 * with standard smart object's evas_object_smart_parent_get(). 44 * Children can be accessed with ewk_frame_children_iterator_new() or 45 * ewk_frame_child_find(). 46 * 47 * The following signals (see evas_object_smart_callback_add()) are emitted: 48 * 49 * - "title,changed", const char*: title of the main frame changed. 50 * - "uri,changed", const char*: uri of the main frame changed. 51 * - "load,document,finished", void: loading of a document has 52 * finished on this frame. 53 * - "load,nonemptylayout,finished", void: frame finished first 54 * non-empty layout. 55 * - "load,started", void: frame started loading. 56 * - "load,progress", double*: load progress changed (overall value 57 * from 0.0 to 1.0, connect to individual frames for fine grained). 58 * - "load,finished", const Ewk_Frame_Load_Error*: reports load 59 * finished and as argument @c NULL if successfully or pointer to 60 * structure defining the error. 61 * - "load,provisional", void: frame started provisional load. 62 * - "load,firstlayout,finished", void: frame finished first layout. 63 * - "load,error", const Ewk_Frame_Load_Error*: reports load failed 64 * and as argument a pointer to structure defining the error. 65 * - "contents,size,changed", Evas_Coord[2]: reports contents size 66 * changed due new layout, script actions or any other events. 67 * - "navigation,first", void: first navigation occurred. 68 * - "resource,request,new", Ewk_Frame_Resource_Request*: reports that 69 * there's a new resource request. 70 * - "resource,request,willsend", Ewk_Frame_Resource_Request*: a resource will 71 * be requested. 72 * - "state,save", void: frame's state will be saved as a history item. 73 */ 74 75 76 /** 77 * Structure used to report load errors. 78 * 79 * Load errors are reported as signal by ewk_view. All the strings are 80 * temporary references and should @b not be used after the signal 81 * callback returns. If required, make copies with strdup() or 82 * eina_stringshare_add() (they are not even guaranteed to be 83 * stringshared, so must use eina_stringshare_add() and not 84 * eina_stringshare_ref()). 85 */ 86 typedef struct _Ewk_Frame_Load_Error Ewk_Frame_Load_Error; 87 struct _Ewk_Frame_Load_Error { 88 int code; /**< numeric error code */ 89 Eina_Bool is_cancellation; /**< if load failed because it was canceled */ 90 const char *domain; /**< error domain name */ 91 const char *description; /**< error description already localized */ 92 const char *failing_url; /**< the url that failed to load */ 93 Evas_Object *frame; /**< frame where the failure happened */ 94 }; 95 96 /** 97 * Structure used to report resource requests 98 * 99 * Details given before a resource is loaded on a given frame. It's used by 100 * ewk_frame_request_will_send() to inform the details of a to-be-loaded 101 * resource, allowing them to be overridden. 102 */ 103 typedef struct _Ewk_Frame_Resource_Request Ewk_Frame_Resource_Request; 104 struct _Ewk_Frame_Resource_Request { 105 const char *url; /**< url of this resource */ 106 const unsigned long identifier; /**< resource's identifier. Can not be changed */ 107 }; 108 109 /** 110 * Structure used to report hit test results. 111 */ 112 typedef struct _Ewk_Hit_Test Ewk_Hit_Test; 113 struct _Ewk_Hit_Test { 114 int x, y; 115 struct { 116 int x, y, w, h; 117 } bounding_box; 118 const char *title; 119 const char *alternate_text; /**< for image, area, input and applet */ 120 Evas_Object *frame; 121 struct { 122 const char *text; 123 const char *url; 124 const char *title; 125 Evas_Object *target_frame; 126 } link; 127 struct { 128 Eina_Bool editable:1; 129 Eina_Bool selected:1; 130 } flags; 131 }; 132 133 typedef enum { 134 EWK_TOUCH_START, 135 EWK_TOUCH_END, 136 EWK_TOUCH_MOVE, 137 EWK_TOUCH_CANCEL 138 } Ewk_Touch_Event_Type; 139 140 typedef enum { 141 EWK_TOUCH_POINT_PRESSED, 142 EWK_TOUCH_POINT_RELEASED, 143 EWK_TOUCH_POINT_MOVED, 144 EWK_TOUCH_POINT_CANCELLED 145 } Ewk_Touch_Point_Type; 146 147 typedef struct _Ewk_Touch_Point Ewk_Touch_Point; 148 struct _Ewk_Touch_Point { 149 unsigned int id; 150 int x, y; 151 Ewk_Touch_Point_Type state; 152 }; 153 154 EAPI Evas_Object *ewk_frame_view_get(const Evas_Object *o); 155 EAPI void ewk_frame_theme_set(Evas_Object *o, const char *path); 156 EAPI const char *ewk_frame_theme_get(Evas_Object *o); 157 158 EAPI Eina_Iterator *ewk_frame_children_iterator_new(Evas_Object *o); 159 EAPI Evas_Object *ewk_frame_child_find(Evas_Object *o, const char *name); 160 161 EAPI Eina_Bool ewk_frame_uri_set(Evas_Object *o, const char *uri); 162 EAPI const char *ewk_frame_uri_get(const Evas_Object *o); 163 EAPI const char *ewk_frame_title_get(const Evas_Object *o); 164 EAPI const char *ewk_frame_name_get(const Evas_Object *o); 165 EAPI Eina_Bool ewk_frame_contents_size_get(const Evas_Object *o, Evas_Coord *w, Evas_Coord *h); 166 167 EAPI Eina_Bool ewk_frame_contents_set(Evas_Object *o, const char *contents, size_t contents_size, const char *mime_type, const char *encoding, const char *base_uri); 168 EAPI Eina_Bool ewk_frame_contents_alternate_set(Evas_Object *o, const char *contents, size_t contents_size, const char *mime_type, const char *encoding, const char *base_uri, const char *unreachable_uri); 169 170 EAPI Eina_Bool ewk_frame_script_execute(Evas_Object *o, const char *script); 171 172 EAPI Eina_Bool ewk_frame_editable_get(const Evas_Object *o); 173 EAPI Eina_Bool ewk_frame_editable_set(Evas_Object *o, Eina_Bool editable); 174 175 EAPI char *ewk_frame_selection_get(const Evas_Object *o); 176 177 EAPI Eina_Bool ewk_frame_text_search(const Evas_Object *o, const char *string, Eina_Bool case_sensitive, Eina_Bool forward, Eina_Bool wrap); 178 179 EAPI unsigned int ewk_frame_text_matches_mark(Evas_Object *o, const char *string, Eina_Bool case_sensitive, Eina_Bool highlight, unsigned int limit); 180 EAPI Eina_Bool ewk_frame_text_matches_unmark_all(Evas_Object *o); 181 EAPI Eina_Bool ewk_frame_text_matches_highlight_set(Evas_Object *o, Eina_Bool highlight); 182 EAPI Eina_Bool ewk_frame_text_matches_highlight_get(const Evas_Object *o); 183 EAPI Eina_Bool ewk_frame_text_matches_nth_pos_get(Evas_Object *o, size_t n, int *x, int *y); 184 185 EAPI Eina_Bool ewk_frame_stop(Evas_Object *o); 186 EAPI Eina_Bool ewk_frame_reload(Evas_Object *o); 187 EAPI Eina_Bool ewk_frame_reload_full(Evas_Object *o); 188 189 EAPI Eina_Bool ewk_frame_back(Evas_Object *o); 190 EAPI Eina_Bool ewk_frame_forward(Evas_Object *o); 191 EAPI Eina_Bool ewk_frame_navigate(Evas_Object *o, int steps); 192 193 EAPI Eina_Bool ewk_frame_back_possible(Evas_Object *o); 194 EAPI Eina_Bool ewk_frame_forward_possible(Evas_Object *o); 195 EAPI Eina_Bool ewk_frame_navigate_possible(Evas_Object *o, int steps); 196 197 EAPI float ewk_frame_zoom_get(const Evas_Object *o); 198 EAPI Eina_Bool ewk_frame_zoom_set(Evas_Object *o, float zoom); 199 EAPI Eina_Bool ewk_frame_zoom_text_only_get(const Evas_Object *o); 200 EAPI Eina_Bool ewk_frame_zoom_text_only_set(Evas_Object *o, Eina_Bool setting); 201 202 EAPI void ewk_frame_hit_test_free(Ewk_Hit_Test *hit_test); 203 EAPI Ewk_Hit_Test *ewk_frame_hit_test_new(const Evas_Object *o, int x, int y); 204 205 EAPI Eina_Bool ewk_frame_scroll_add(Evas_Object *o, int dx, int dy); 206 EAPI Eina_Bool ewk_frame_scroll_set(Evas_Object *o, int x, int y); 207 208 EAPI Eina_Bool ewk_frame_scroll_size_get(const Evas_Object *o, int *w, int *h); 209 EAPI Eina_Bool ewk_frame_scroll_pos_get(const Evas_Object *o, int *x, int *y); 210 211 EAPI Eina_Bool ewk_frame_visible_content_geometry_get(const Evas_Object *o, Eina_Bool include_scrollbars, int *x, int *y, int *w, int *h); 212 213 EAPI Eina_Bool ewk_frame_paint_full_get(const Evas_Object *o); 214 EAPI void ewk_frame_paint_full_set(Evas_Object *o, Eina_Bool flag); 215 216 EAPI Eina_Bool ewk_frame_feed_focus_in(Evas_Object *o); 217 EAPI Eina_Bool ewk_frame_feed_focus_out(Evas_Object *o); 218 219 EAPI Eina_Bool ewk_frame_feed_mouse_wheel(Evas_Object *o, const Evas_Event_Mouse_Wheel *ev); 220 EAPI Eina_Bool ewk_frame_feed_mouse_down(Evas_Object *o, const Evas_Event_Mouse_Down *ev); 221 EAPI Eina_Bool ewk_frame_feed_mouse_up(Evas_Object *o, const Evas_Event_Mouse_Up *ev); 222 EAPI Eina_Bool ewk_frame_feed_mouse_move(Evas_Object *o, const Evas_Event_Mouse_Move *ev); 223 EAPI Eina_Bool ewk_frame_feed_touch_event(Evas_Object* o, Ewk_Touch_Event_Type action, Eina_List* points, int metaState); 224 EAPI Eina_Bool ewk_frame_feed_key_down(Evas_Object *o, const Evas_Event_Key_Down *ev); 225 EAPI Eina_Bool ewk_frame_feed_key_up(Evas_Object *o, const Evas_Event_Key_Up *ev); 226 227 228 #ifdef __cplusplus 229 } 230 #endif 231 #endif // ewk_frame_h 232