1 /**
2  * @addtogroup Elm_Web
3  *
4  * @{
5  */
6 
7 /**
8  * Structure used to report load errors.
9  *
10  * Load errors are reported as signal by elm_web. All the strings are
11  * temporary references and should @b not be used after the signal
12  * callback returns. If it's required, make copies with strdup() or
13  * eina_stringshare_add() (they are not even guaranteed to be
14  * stringshared, so must use eina_stringshare_add() and not
15  * eina_stringshare_ref()).
16  */
17 typedef struct _Elm_Web_Frame_Load_Error Elm_Web_Frame_Load_Error;
18 
19 /**
20  * Structure used to report load errors.
21  *
22  * Load errors are reported as signal by elm_web. All the strings are
23  * temporary references and should @b not be used after the signal
24  * callback returns. If it's required, make copies with strdup() or
25  * eina_stringshare_add() (they are not even guaranteed to be
26  * stringshared, so must use eina_stringshare_add() and not
27  * eina_stringshare_ref()).
28  */
29 struct _Elm_Web_Frame_Load_Error
30 {
31    int          code; /**< Numeric error code */
32    Eina_Bool    is_cancellation; /**< Error produced by canceling a request */
33    const char  *domain; /**< Error domain name */
34    const char  *description; /**< Error description (already localized) */
35    const char  *failing_url; /**< The URL that failed to load */
36    Evas_Object *frame; /**< Frame object that produced the error */
37 };
38 
39 /**
40  * The possibles types that the items in a menu can be
41  */
42 typedef enum
43 {
44    ELM_WEB_MENU_SEPARATOR,
45    ELM_WEB_MENU_GROUP,
46    ELM_WEB_MENU_OPTION
47 } Elm_Web_Menu_Item_Type;
48 
49 /**
50  * Structure describing the items in a menu
51  */
52 typedef struct _Elm_Web_Menu_Item Elm_Web_Menu_Item;
53 
54 /**
55  * Structure describing the items in a menu
56  */
57 struct _Elm_Web_Menu_Item
58 {
59    const char            *text; /**< The text for the item */
60    Elm_Web_Menu_Item_Type type; /**< The type of the item */
61 };
62 
63 /**
64  * Structure describing the menu of a popup
65  *
66  * This structure will be passed as the @p event_info for the "popup,create"
67  * signal, which is emitted when a dropdown menu is opened. Users wanting
68  * to handle these popups by themselves should listen to this signal and
69  * set the @c handled property of the struct to @c EINA_TRUE. Leaving this
70  * property as @c EINA_FALSE means that the user will not handle the popup
71  * and the default implementation will be used.
72  *
73  * When the popup is ready to be dismissed, a "popup,willdelete" signal
74  * will be emitted to notify the user that it can destroy any objects and
75  * free all data related to it.
76  *
77  * @see elm_web_popup_selected_set()
78  * @see elm_web_popup_destroy()
79  */
80 typedef struct _Elm_Web_Menu Elm_Web_Menu;
81 
82 /**
83  * Structure describing the menu of a popup
84  *
85  * This structure will be passed as the @p event_info for the "popup,create"
86  * signal, which is emitted when a dropdown menu is opened. Users wanting
87  * to handle these popups by themselves should listen to this signal and
88  * set the @c handled property of the struct to @c EINA_TRUE. Leaving this
89  * property as @c EINA_FALSE means that the user will not handle the popup
90  * and the default implementation will be used.
91  *
92  * When the popup is ready to be dismissed, a "popup,willdelete" signal
93  * will be emitted to notify the user that it can destroy any objects and
94  * free all data related to it.
95  *
96  * @see elm_web_popup_selected_set()
97  * @see elm_web_popup_destroy()
98  */
99 struct _Elm_Web_Menu
100 {
101    Eina_List *items; /**< List of #Elm_Web_Menu_Item */
102    int        x; /**< The X position of the popup, relative to the elm_web object */
103    int        y; /**< The Y position of the popup, relative to the elm_web object */
104    int        width; /**< Width of the popup menu */
105    int        height; /**< Height of the popup menu */
106 
107    Eina_Bool  handled : 1; /**< Set to @c EINA_TRUE by the user to indicate that the popup has been handled and the default implementation should be ignored. Leave as @c EINA_FALSE otherwise. */
108 };
109 
110 typedef struct _Elm_Web_Download Elm_Web_Download;
111 struct _Elm_Web_Download
112 {
113    const char *url;
114 };
115 
116 
117 /**
118  * Opaque handler containing the features (such as statusbar, menubar, etc)
119  * that are to be set on a newly requested window.
120  */
121 typedef struct _Elm_Web_Window_Features Elm_Web_Window_Features;
122 
123 /**
124  * Definitions of web window features.
125  *
126  */
127 typedef enum
128 {
129    ELM_WEB_WINDOW_FEATURE_TOOLBAR,
130    ELM_WEB_WINDOW_FEATURE_STATUSBAR,
131    ELM_WEB_WINDOW_FEATURE_SCROLLBARS,
132    ELM_WEB_WINDOW_FEATURE_MENUBAR,
133    ELM_WEB_WINDOW_FEATURE_LOCATIONBAR,
134    ELM_WEB_WINDOW_FEATURE_FULLSCREEN
135 } Elm_Web_Window_Feature_Flag;
136 
137 /**
138  * Callback type for the create_window hook.
139  *
140  * @param data User data pointer set when setting the hook function.
141  * @param obj The elm_web object requesting the new window.
142  * @param js Set to @c EINA_TRUE if the request was originated from
143  * JavaScript. @c EINA_FALSE otherwise.
144  * @param window_features A pointer of #Elm_Web_Window_Features indicating
145  * the features requested for the new window.
146  *
147  * @return The @c elm_web widget where the request will be loaded. That is,
148  * if a new window or tab is created, the elm_web widget in it should be
149  * returned, and @b NOT the window object. Returning @c NULL should cancel
150  * the request.
151  *
152  * @see elm_web_window_create_hook_set()
153  */
154 typedef Evas_Object *(*Elm_Web_Window_Open)(void *data, Evas_Object *obj, Eina_Bool js, const Elm_Web_Window_Features *window_features);
155 
156 /**
157  * Callback type for the JS alert hook.
158  *
159  * @param data User data pointer set when setting the hook function.
160  * @param obj The elm_web object requesting the new window.
161  * @param message The message to show in the alert dialog.
162  *
163  * @return The object representing the alert dialog.
164  * Elm_Web will run a second main loop to handle the dialog and normal
165  * flow of the application will be restored when the object is deleted, so
166  * the user should handle the popup properly in order to delete the object
167  * when the action is finished.
168  * If the function returns @c NULL the popup will be ignored.
169  *
170  * @see elm_web_dialog_alert_hook_set()
171  */
172 typedef Evas_Object *(*Elm_Web_Dialog_Alert)(void *data, Evas_Object *obj, const char *message);
173 
174 /**
175  * Callback type for the JS confirm hook.
176  *
177  * @param data User data pointer set when setting the hook function.
178  * @param obj The elm_web object requesting the new window.
179  * @param message The message to show in the confirm dialog.
180  * @param ret Pointer to store the user selection. @c EINA_TRUE if
181  * the user selected @c Ok, @c EINA_FALSE otherwise.
182  *
183  * @return The object representing the confirm dialog.
184  * Elm_Web will run a second main loop to handle the dialog and normal
185  * flow of the application will be restored when the object is deleted, so
186  * the user should handle the popup properly in order to delete the object
187  * when the action is finished.
188  * If the function returns @c NULL the popup will be ignored.
189  *
190  * @see elm_web_dialog_confirm_hook_set()
191  */
192 typedef Evas_Object *(*Elm_Web_Dialog_Confirm)(void *data, Evas_Object *obj, const char *message, Eina_Bool *ret);
193 
194 /**
195  * Callback type for the JS prompt hook.
196  *
197  * @param data User data pointer set when setting the hook function.
198  * @param obj The elm_web object requesting the new window.
199  * @param message The message to show in the prompt dialog.
200  * @param def_value The default value to present the user in the entry
201  * @param value Pointer to store the value given by the user. Must
202  * be a malloc'ed string or @c NULL if the user canceled the popup.
203  * @param ret Pointer to store the user selection. @c EINA_TRUE if
204  * the user selected @c Ok, @c EINA_FALSE otherwise.
205  *
206  * @return The object representing the prompt dialog.
207  * Elm_Web will run a second main loop to handle the dialog and normal
208  * flow of the application will be restored when the object is deleted, so
209  * the user should handle the popup properly in order to delete the object
210  * when the action is finished.
211  * If the function returns @c NULL the popup will be ignored.
212  *
213  * @see elm_web_dialog_prompt_hook_set()
214  */
215 typedef Evas_Object *(*Elm_Web_Dialog_Prompt)(void *data, Evas_Object *obj, const char *message, const char *def_value, const char **value, Eina_Bool *ret);
216 
217 /**
218  * Callback type for the JS file selector hook.
219  *
220  * @param data User data pointer set when setting the hook function.
221  * @param obj The elm_web object requesting the new window.
222  * @param allows_multiple @c EINA_TRUE if multiple files can be selected.
223  * @param accept_types Mime types accepted.
224  * @param selected Pointer to store the list of malloc'ed strings
225  * containing the path to each file selected. Must be @c NULL if the file
226  * dialog is canceled.
227  * @param ret Pointer to store the user selection. @c EINA_TRUE if
228  * the user selected @c Ok, @c EINA_FALSE otherwise.
229  *
230  * @return The object representing the file selector dialog.
231  * Elm_Web will run a second main loop to handle the dialog and normal
232  * flow of the application will be restored when the object is deleted, so
233  * the user should handle the popup properly in order to delete the object
234  * when the action is finished.
235  * If the function returns @c NULL the popup will be ignored.
236  *
237  * @see elm_web_dialog_file selector_hook_set()
238  */
239 typedef Evas_Object *(*Elm_Web_Dialog_File_Selector)(void *data, Evas_Object *obj, Eina_Bool allows_multiple, Eina_List *accept_types, Eina_List **selected, Eina_Bool *ret);
240 
241 /**
242  * Callback type for the JS console message hook.
243  *
244  * When a console message is added from JavaScript, any set function to the
245  * console message hook will be called for the user to handle. There is no
246  * default implementation of this hook.
247  *
248  * @param data User data pointer set when setting the hook function.
249  * @param obj The elm_web object that originated the message.
250  * @param message The message sent.
251  * @param line_number The line number.
252  * @param source_id Source id.
253  *
254  * @see elm_web_console_message_hook_set()
255  */
256 typedef void (*Elm_Web_Console_Message)(void *data, Evas_Object *obj, const char *message, unsigned int line_number, const char *source_id);
257 
258 /**
259  * Get boolean properties from Elm_Web_Window_Features
260  * (such as statusbar, menubar, etc) that are on a window.
261  *
262  * @param wf The web window features object
263  * @param flag The web window feature flag whose value is required.
264  *
265  * @return @c EINA_TRUE if the flag is set, @c EINA_FALSE otherwise
266  */
267 EAPI Eina_Bool              elm_web_window_features_property_get(const Elm_Web_Window_Features *wf, Elm_Web_Window_Feature_Flag flag);
268 
269 /**
270  *
271  * TODO : Add documentation.
272  *
273  * @param wf The web window features object
274  * @param x, y, w, h - the co-ordinates of the web view window.
275  */
276 EAPI void              elm_web_window_features_region_get(const Elm_Web_Window_Features *wf, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
277 
278 EAPI void              elm_web_window_features_ref(Elm_Web_Window_Features *wf);
279 EAPI void              elm_web_window_features_unref(Elm_Web_Window_Features *wf);
280 
281 /**
282  * @}
283  */
284