From 5ba8a21b51462811c49d2da90ffe022a05746ef3 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 5 Mar 2019 17:00:37 -0500 Subject: [PATCH] elm_web: remove all legacy usage from eo files this takes the current generated output from eolian for legacy code in efl and adds it to the tree, then removes legacy references from the corresponding eo files. in the case where the entire eo file was for a legacy object, that eo file has been removed from the tree ref T7724 Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D8208 --- src/Makefile_Efl_Mono.am | 2 +- src/Makefile_Elementary.am | 14 +- src/lib/elementary/elm_web.eo | 450 ------------- src/lib/elementary/elm_web2.c | 2 +- src/lib/elementary/elm_web_eo.c | 293 +++++++++ src/lib/elementary/elm_web_eo.h | 603 +++++++++++++++++- src/lib/elementary/elm_web_eo.legacy.c | 246 +++++++ src/lib/elementary/elm_web_eo.legacy.h | 594 +++++++++++++++++ src/lib/elementary/elm_web_legacy.h | 2 +- src/lib/elementary/meson.build | 3 +- .../elementary/web/none/elm_web_none.c | 4 +- .../elementary/web/none/elm_web_none.eo | 42 -- .../elementary/web/none/elm_web_none_eo.c | 211 ++++++ .../elementary/web/none/elm_web_none_eo.h | 24 + src/modules/elementary/web/none/meson.build | 22 +- 15 files changed, 1985 insertions(+), 527 deletions(-) delete mode 100644 src/lib/elementary/elm_web.eo create mode 100644 src/lib/elementary/elm_web_eo.c create mode 100644 src/lib/elementary/elm_web_eo.legacy.c create mode 100644 src/lib/elementary/elm_web_eo.legacy.h delete mode 100644 src/modules/elementary/web/none/elm_web_none.eo create mode 100644 src/modules/elementary/web/none/elm_web_none_eo.c create mode 100644 src/modules/elementary/web/none/elm_web_none_eo.h diff --git a/src/Makefile_Efl_Mono.am b/src/Makefile_Efl_Mono.am index 1f09ba1ccd..e6d330cb1c 100644 --- a/src/Makefile_Efl_Mono.am +++ b/src/Makefile_Efl_Mono.am @@ -169,7 +169,7 @@ eo_eolian_blacklisted_files = \ lib/eo/efl_object_override.eo.cs elementary_eolian_blacklisted_files = \ -lib/elementary/elm_web.eo.cs \ +lib/elementary/elm_web_eo.cs \ lib/elementary/elm_map_eo.cs \ lib/elementary/elm_combobox.eo.cs \ lib/elementary/elm_list_eo.cs \ diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am index 13566cb093..6a0385a77d 100644 --- a/src/Makefile_Elementary.am +++ b/src/Makefile_Elementary.am @@ -146,7 +146,6 @@ elm_public_eolian_files += \ lib/elementary/elm_atspi_bridge.eo \ lib/elementary/elm_atspi_app_object.eo \ lib/elementary/efl_ui_image_zoomable_pan.eo \ - lib/elementary/elm_web.eo \ lib/elementary/elm_widget_item.eo \ lib/elementary/elm_widget_item_container.eo \ $(NULL) @@ -394,6 +393,8 @@ lib/elementary/elm_toolbar_item_eo.c \ lib/elementary/elm_toolbar_item_eo.legacy.c \ lib/elementary/elm_view_form_eo.c \ lib/elementary/elm_view_list_eo.c \ +lib/elementary/elm_web_eo.c \ +lib/elementary/elm_web_eo.legacy.c \ $(NULL) elm_legacy_eo_headers = \ @@ -605,6 +606,8 @@ lib/elementary/elm_view_form_eo.h \ lib/elementary/elm_view_form_eo.legacy.h \ lib/elementary/elm_view_list_eo.h \ lib/elementary/elm_view_list_eo.legacy.h \ +lib/elementary/elm_web_eo.h \ +lib/elementary/elm_web_eo.legacy.h \ $(NULL) @@ -1686,13 +1689,10 @@ moduleweb_nonepkg_LTLIBRARIES = modules/elementary/web/none/module.la install_moduleweb_nonepkgLTLIBRARIES = install-moduleweb_nonepkgLTLIBRARIES $(install_moduleweb_nonepkgLTLIBRARIES): install-libLTLIBRARIES -elm_web_none_eolian_files = modules/elementary/web/none/elm_web_none.eo -elm_web_none_eolian_c = $(elm_web_none_eolian_files:%.eo=%.eo.c) -elm_web_none_eolian_h = $(elm_web_none_eolian_files:%.eo=%.eo.h) - -EXTRA_DIST2 += $(elm_web_none_eolian_files) -BUILT_SOURCES += $(elm_web_none_eolian_c) $(elm_web_none_eolian_h) +EXTRA_DIST2 += \ +modules/elementary/web/none/elm_web_none_eo.c \ +modules/elementary/web/none/elm_web_none_eo.h modules_elementary_web_none_module_la_SOURCES = \ modules/elementary/web/none/elm_web_none.c diff --git a/src/lib/elementary/elm_web.eo b/src/lib/elementary/elm_web.eo deleted file mode 100644 index 00cdc729d6..0000000000 --- a/src/lib/elementary/elm_web.eo +++ /dev/null @@ -1,450 +0,0 @@ -type Elm_Web_Console_Message: __undefined_type; [[Elementary web console message type]] -type Elm_Web_Window_Open: __undefined_type; [[Elementary web window open type]] -type Elm_Web_Dialog_File_Selector: __undefined_type; [[Elementary web dialog file selector type]] -type Elm_Web_Dialog_Confirm: __undefined_type; [[Elementary web dialog confirm type]] -type Elm_Web_Dialog_Prompt: __undefined_type; [[Elementary web dialog prompt type]] -type Elm_Web_Dialog_Alert: __undefined_type; [[Elementary web dialog alert type]] - -abstract Elm.Web extends Efl.Ui.Widget implements Efl.Ui.Legacy, Efl.Ui.Zoom -{ - [[Elementary web view class]] - legacy_prefix: elm_web; - eo_prefix: elm_obj_web; - event_prefix: elm_web; - methods { - @property text_matches_highlight @pure_virtual { - set { - [[Sets whether to highlight the matched marks. - - If enabled, marks set with @.text_matches_mark will be - highlighted. - ]] - return: bool; [[$true on success, $false otherwise]] - } - get { - [[Get whether highlighting marks is enabled.]] - } - values { - highlight: bool; [[Whether to highlight the marks or not.]] - } - } - @property useragent @pure_virtual { - set { - [[Change useragent of a elm_web object.]] - } - get { - [[Return current useragent of elm_web object.]] - } - values { - user_agent: string; [[String for useragent.]] - } - } - @property url @pure_virtual { - set { - [[Sets the URL for the web object. - - It must be a full URL, with resource included, in the form - http://www.enlightenment.org or file:///tmp/something.html - ]] - return: bool; [[$true on success, $false otherwise]] - } - get { - [[Get the current URL for the object. - - The returned string must not be freed and is guaranteed to be - stringshared. - ]] - } - values { - url: string; [[The URL to set.]] - } - } - @property bg_color @pure_virtual { - set { - [[Sets the background color to be used by the web object. - - This is the color that will be used by default when the - loaded page does not set it's own. Color values are - pre-multiplied. - ]] - } - get { - [[Get the background color to be used by the web object. - - This is the color that will be used by default when the - loaded page does not set it's own. Color values are - pre-multiplied. - ]] - } - values { - r: int; [[Red component.]] - g: int; [[Green component.]] - b: int; [[Blue component.]] - a: int; [[Alpha component.]] - } - } - @property inwin_mode @pure_virtual { - set { - [[Sets the default dialogs to use an Inwin instead of a - normal window. - - If set, then the default implementation for the JavaScript - dialogs and file selector will be opened in an Inwin. - Otherwise they will use a normal separated window. - ]] - } - get { - [[Get whether Inwin mode is set for the current object.]] - } - values { - value: bool; [[$true if dialog will be opened as Inwin, $false otherwise]] - } - } - @property tab_propagate @pure_virtual { - set { - [[Sets whether to use tab propagation. - - If tab propagation is enabled, whenever the user presses the - Tab key, Elementary will handle it and switch focus to the - next widget. The default value is disabled, where WebKit - will handle the Tab key to cycle focus though its internal - objects, jumping to the next widget only when that cycle ends. - ]] - } - get { - [[Get the status of the tab propagation.]] - } - values { - propagate: bool; [[Whether to propagate Tab keys to Elementary or not.]] - } - } - @property history_enabled @pure_virtual { - set { - [[Enables or disables the browsing history.]] - } - get { - [[Get whether browsing history is enabled for the given object.]] - } - values { - enable: bool; [[Whether to enable or disable the browsing history.]] - } - } - @property console_message_hook { - set @pure_virtual { - [[Sets the function to call when a console message is emitted - from JS. - - This hook will be called when a console message is emitted - from JavaScript. There is no default implementation for - this feature. - ]] - } - values { - func: Elm_Web_Console_Message; [[The callback function to be used.]] - data: void_ptr; [[User data.]] - } - } - @property window_create_hook { - set @pure_virtual { - [[Sets the function to call when a new window is requested. - - This hook will be called when a request to create a new - window is issued from the web page loaded. - There is no default implementation for this feature, so - leaving this unset or passing $null in $func will prevent - new windows from opening. - ]] - } - values { - func: Elm_Web_Window_Open @nullable; [[The hook function to be called when a window is requested.]] - data: void_ptr @optional; [[User data.]] - } - } - @property dialog_file_selector_hook { - set @pure_virtual { - [[Sets the function to call when an file selector dialog. - - This hook will be called when a JavaScript file selector - dialog is requested. - If no function is set or $null is passed in $func, the default - implementation will take place. - ]] - } - values { - func: Elm_Web_Dialog_File_Selector @nullable; [[The callback function to be used.]] - data: void_ptr @optional; [[User data.]] - } - } - @property dialog_confirm_hook { - set @pure_virtual { - [[Sets the function to call when an confirm dialog. - - This hook will be called when a JavaScript confirm dialog is - requested. If no function is set or $null is passed in $func, - the default implementation will take place. - ]] - } - values { - func: Elm_Web_Dialog_Confirm @nullable; [[The callback function to be used.]] - data: void_ptr @optional; [[User data.]] - } - } - @property popup_selected { - set @pure_virtual { - [[Tells the web object which index in the currently open popup - was selected. - - When the user handles the popup creation from the - "popup,created" signal, it needs to tell the web object - which item was selected by calling this function with - the index corresponding to the item. - ]] - } - values { - idx: int; [[The index selected.]] - } - } - @property dialog_prompt_hook { - set @pure_virtual { - [[Sets the function to call when an prompt dialog. - - This hook will be called when a JavaScript prompt dialog is - requested. If no function is set or $null is passed in $func, - the default implementation will take place. - ]] - } - values { - func: Elm_Web_Dialog_Prompt @nullable; [[The callback function to be used.]] - data: void_ptr @optional; [[User data.]] - } - } - @property dialog_alert_hook { - set @pure_virtual { - [[Sets the function to call when an alert dialog. - - This hook will be called when a JavaScript alert dialog is - requested. If no function is set or $null is passed in $func, - the default implementation will take place. - ]] - } - values { - func: Elm_Web_Dialog_Alert @nullable; [[Callback function to be used.]] - data: void_ptr @optional; [[User data.]] - } - } - @property forward_possible { - get @pure_virtual { - [[Queries whether it's possible to go forward in history.]] - return: bool; [[$true if it is possible to go forward, $false otherwise]] - } - } - @property webkit_view { - get @pure_virtual { - [[Get internal ewk_view object from web object. - - Elementary may not provide some low level features of EWebKit, - instead of cluttering the API with proxy methods we opted to - return the internal reference. Be careful using it as it may - interfere with elm_web behavior. - ]] - return: Efl.Canvas.Object; [[The internal ewk_view object or $null - if it does not exist. (Failure to - create or Elementary compiled - without ewebkit)]] - } - } - @property back_possible { - get @pure_virtual { - [[Queries whether it's possible to go back in history.]] - return: bool; [[$true if it is possible to go back, $false otherwise]] - } - } - @property load_progress { - get @pure_virtual { - [[Get the overall loading progress of the page. - - Returns the estimated loading progress of the page, with a - value between 0.0 and 1.0. This is an estimated progress - accounting for all the frames included in the page. - ]] - return: double; [[A value between 0.0 and 1.0 indicating the - progress, or -1.0 on failure.]] - } - } - @property selection { - get @pure_virtual { - [[Get a copy of the currently selected text. - - The string returned must be freed by the user when it's done - with it. - ]] - return: mstring @owned @warn_unused; [[A newly allocated string, or - $null if nothing is selected - or an error occurred.]] - } - } - @property title { - get @pure_virtual { - [[Get the current title. - - The returned string must not be freed and is guaranteed to be - stringshared. - ]] - return: stringshare @owned @warn_unused; [[ - A stringshared internal string with the current title, or $null on - failure. - ]] - } - } - navigate @pure_virtual { - [[Jumps the given number of steps in the browsing history. - - The $steps value can be a negative integer to back in history, - or a positive to move forward. - ]] - return: bool; [[$true on success, $false on error or if not enough - history exists to jump the given number of steps]] - params { - @in steps: int; [[The number of steps to jump.]] - } - } - back @pure_virtual { - [[Goes back one step in the browsing history. - - This is equivalent to calling elm_web_object_navigate(obj, -1); - ]] - return: bool; [[$true on success, $false otherwise]] - } - html_string_load @pure_virtual { - [[Loads the specified $html string as the content of the web - object. - - External objects such as stylesheets or images referenced in - the HTML document are located relative to $base_url. - - If an $unreachable_url is passed it is used as the url for the - loaded content. This is typically used to display error pages - for a failed load. - - @since 1.9 - ]] - return: bool; [[$true on success, $false otherwise]] - params { - @in html: string; [[HTML data to load.]] - @in base_url: string @optional; [[Base URL used for relative paths to external objects (optional).]] - @in unreachable_url: string @optional; [[URL that could not be reached (optional).]] - } - } - text_search @const @pure_virtual { - [[Searches the given string in a document.]] - return: bool; [[$true if the given string was found, $false if not - or failure.]] - params { - @in string: string; [[String to search.]] - @in case_sensitive: bool; [[If search should be case sensitive or not.]] - @in forward: bool; [[If search is from cursor and on or backwards.]] - @in wrap: bool; [[If search should wrap at the end.]] - } - } - popup_destroy @pure_virtual { - [[Dismisses an open dropdown popup - - When the popup from a dropdown widget is to be dismissed, either - after selecting an option or to cancel it, this function must be - called, which will later emit an "popup,willdelete" signal to - notify the user that any memory and objects related to this - popup can be freed. - ]] - return: bool; [[$true if the menu was successfully destroyed, or - $false if there was no menu to destroy.]] - } - region_show @pure_virtual { - [[Shows the given region in the web object.]] - params { - @in x: int; [[The x coordinate of the region to show.]] - @in y: int; [[The y coordinate of the region to show.]] - @in w: int; [[The width of the region to show.]] - @in h: int; [[The height of the region to show.]] - } - } - forward @pure_virtual { - [[Goes forward one step in the browsing history. - - This is equivalent to calling elm_web_object_navigate(obj, 1); - - See also @.history_enabled.set, @.forward_possible.get, - @.back, @.navigate. - ]] - return: bool; [[$true on success, $false otherwise.]] - } - text_matches_mark @pure_virtual { - [[Marks matches of the given string in a document.]] - return: uint; [[Number of matched $string.]] - params { - @in string: string; [[String to match.]] - @in case_sensitive: bool; [[If match should be case sensitive or not.]] - @in highlight: bool; [[If matches should be highlighted.]] - @in limit: uint; [[Maximum amount of matches, or zero to unlimited.]] - } - } - region_bring_in @pure_virtual { - [[Brings in the region to the visible area. - - Like @.region_show, but it animates the scrolling of the object - to show the area. - ]] - params { - @in x: int; [[The x coordinate of the region to show.]] - @in y: int; [[The y coordinate of the region to show.]] - @in w: int; [[The width of the region to show.]] - @in h: int; [[The height of the region to show.]] - } - } - stop @pure_virtual { - [[Stops loading the current page. - - Cancels the loading of the current page in the web object. This - will cause a "load,error" signal to be emitted, with the - is_cancellation flag set to $true. - ]] - return: bool; [[$true if the cancel was successful, $false otherwise.]] - } - navigate_possible_get @pure_virtual { - [[Queries whether it's possible to jump the given number of steps. - - The $steps value can be a negative integer to back in history, - or positive to move forward. - ]] - return: bool; [[$true if enough history exists to perform the - given jump, $false otherwise.]] - params { - @in steps: int; [[The number of steps to check for.]] - } - } - reload_full @pure_virtual { - [[Requests a reload of the current document, avoiding any - existing caches. - ]] - return: bool; [[$true on success, $false otherwise.]] - } - text_matches_unmark_all @pure_virtual { - [[Clears all marked matches in the document.]] - return: bool; [[$true on success, $false otherwise.]] - } - reload @pure_virtual { - [[Requests a reload of the current document in the object.]] - return: bool; [[$true on success, $false otherwise.]] - } - } - implements { - class.constructor; - Efl.Object.constructor; - } - events { - /* FIXME: Nobody is emitting these - uri,changed; [[Called when URI changed]] - url,changed; [[Called when URL changed]] - windows,close,request; [[Called when window closed event was received]] - */ - } -} diff --git a/src/lib/elementary/elm_web2.c b/src/lib/elementary/elm_web2.c index 3c82d927f7..90e454ca01 100644 --- a/src/lib/elementary/elm_web2.c +++ b/src/lib/elementary/elm_web2.c @@ -281,4 +281,4 @@ _elm_web_init(const char *engine) #undef ELM_WEB_CLASS #define ELM_WEB_CLASS elm_web_class_get() -#include "elm_web.eo.c" +#include "elm_web_eo.c" diff --git a/src/lib/elementary/elm_web_eo.c b/src/lib/elementary/elm_web_eo.c new file mode 100644 index 0000000000..20d25eef52 --- /dev/null +++ b/src/lib/elementary/elm_web_eo.c @@ -0,0 +1,293 @@ + +static Eina_Error +__eolian_elm_web_text_matches_highlight_set_reflect(Eo *obj, Eina_Value val) +{ + Eina_Error r = 0; Eina_Bool cval; + if (!eina_value_bool_convert(&val, &cval)) + { + r = EINA_ERROR_VALUE_FAILED; + goto end; + } + elm_obj_web_text_matches_highlight_set(obj, cval); + end: + eina_value_flush(&val); + return r; +} + +EOAPI EFL_FUNC_BODYV(elm_obj_web_text_matches_highlight_set, Eina_Bool, 0, EFL_FUNC_CALL(highlight), Eina_Bool highlight); + +static Eina_Value +__eolian_elm_web_text_matches_highlight_get_reflect(Eo *obj) +{ + Eina_Bool val = elm_obj_web_text_matches_highlight_get(obj); + return eina_value_bool_init(val); +} + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_web_text_matches_highlight_get, Eina_Bool, 0); + +static Eina_Error +__eolian_elm_web_useragent_set_reflect(Eo *obj, Eina_Value val) +{ + Eina_Error r = 0; const char *cval; + if (!eina_value_string_convert(&val, &cval)) + { + r = EINA_ERROR_VALUE_FAILED; + goto end; + } + elm_obj_web_useragent_set(obj, cval); + end: + eina_value_flush(&val); + return r; +} + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_web_useragent_set, EFL_FUNC_CALL(user_agent), const char *user_agent); + +static Eina_Value +__eolian_elm_web_useragent_get_reflect(Eo *obj) +{ + const char *val = elm_obj_web_useragent_get(obj); + return eina_value_string_init(val); +} + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_web_useragent_get, const char *, NULL); + +static Eina_Error +__eolian_elm_web_url_set_reflect(Eo *obj, Eina_Value val) +{ + Eina_Error r = 0; const char *cval; + if (!eina_value_string_convert(&val, &cval)) + { + r = EINA_ERROR_VALUE_FAILED; + goto end; + } + elm_obj_web_url_set(obj, cval); + end: + eina_value_flush(&val); + return r; +} + +EOAPI EFL_FUNC_BODYV(elm_obj_web_url_set, Eina_Bool, 0, EFL_FUNC_CALL(url), const char *url); + +static Eina_Value +__eolian_elm_web_url_get_reflect(Eo *obj) +{ + const char *val = elm_obj_web_url_get(obj); + return eina_value_string_init(val); +} + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_web_url_get, const char *, NULL); +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_web_bg_color_set, EFL_FUNC_CALL(r, g, b, a), int r, int g, int b, int a); +EOAPI EFL_VOID_FUNC_BODYV_CONST(elm_obj_web_bg_color_get, EFL_FUNC_CALL(r, g, b, a), int *r, int *g, int *b, int *a); + +static Eina_Error +__eolian_elm_web_inwin_mode_set_reflect(Eo *obj, Eina_Value val) +{ + Eina_Error r = 0; Eina_Bool cval; + if (!eina_value_bool_convert(&val, &cval)) + { + r = EINA_ERROR_VALUE_FAILED; + goto end; + } + elm_obj_web_inwin_mode_set(obj, cval); + end: + eina_value_flush(&val); + return r; +} + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_web_inwin_mode_set, EFL_FUNC_CALL(value), Eina_Bool value); + +static Eina_Value +__eolian_elm_web_inwin_mode_get_reflect(Eo *obj) +{ + Eina_Bool val = elm_obj_web_inwin_mode_get(obj); + return eina_value_bool_init(val); +} + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_web_inwin_mode_get, Eina_Bool, 0); + +static Eina_Error +__eolian_elm_web_tab_propagate_set_reflect(Eo *obj, Eina_Value val) +{ + Eina_Error r = 0; Eina_Bool cval; + if (!eina_value_bool_convert(&val, &cval)) + { + r = EINA_ERROR_VALUE_FAILED; + goto end; + } + elm_obj_web_tab_propagate_set(obj, cval); + end: + eina_value_flush(&val); + return r; +} + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_web_tab_propagate_set, EFL_FUNC_CALL(propagate), Eina_Bool propagate); + +static Eina_Value +__eolian_elm_web_tab_propagate_get_reflect(Eo *obj) +{ + Eina_Bool val = elm_obj_web_tab_propagate_get(obj); + return eina_value_bool_init(val); +} + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_web_tab_propagate_get, Eina_Bool, 0); + +static Eina_Error +__eolian_elm_web_history_enabled_set_reflect(Eo *obj, Eina_Value val) +{ + Eina_Error r = 0; Eina_Bool cval; + if (!eina_value_bool_convert(&val, &cval)) + { + r = EINA_ERROR_VALUE_FAILED; + goto end; + } + elm_obj_web_history_enabled_set(obj, cval); + end: + eina_value_flush(&val); + return r; +} + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_web_history_enabled_set, EFL_FUNC_CALL(enable), Eina_Bool enable); + +static Eina_Value +__eolian_elm_web_history_enabled_get_reflect(Eo *obj) +{ + Eina_Bool val = elm_obj_web_history_enabled_get(obj); + return eina_value_bool_init(val); +} + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_web_history_enabled_get, Eina_Bool, 0); +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_web_console_message_hook_set, EFL_FUNC_CALL(func, data), Elm_Web_Console_Message func, void *data); +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_web_window_create_hook_set, EFL_FUNC_CALL(func, data), Elm_Web_Window_Open func, void *data); +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_web_dialog_file_selector_hook_set, EFL_FUNC_CALL(func, data), Elm_Web_Dialog_File_Selector func, void *data); +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_web_dialog_confirm_hook_set, EFL_FUNC_CALL(func, data), Elm_Web_Dialog_Confirm func, void *data); + +static Eina_Error +__eolian_elm_web_popup_selected_set_reflect(Eo *obj, Eina_Value val) +{ + Eina_Error r = 0; int cval; + if (!eina_value_int_convert(&val, &cval)) + { + r = EINA_ERROR_VALUE_FAILED; + goto end; + } + elm_obj_web_popup_selected_set(obj, cval); + end: + eina_value_flush(&val); + return r; +} + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_web_popup_selected_set, EFL_FUNC_CALL(idx), int idx); +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_web_dialog_prompt_hook_set, EFL_FUNC_CALL(func, data), Elm_Web_Dialog_Prompt func, void *data); +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_web_dialog_alert_hook_set, EFL_FUNC_CALL(func, data), Elm_Web_Dialog_Alert func, void *data); +EOAPI EFL_FUNC_BODY_CONST(elm_obj_web_forward_possible_get, Eina_Bool, 0); +EOAPI EFL_FUNC_BODY_CONST(elm_obj_web_webkit_view_get, Efl_Canvas_Object *, NULL); +EOAPI EFL_FUNC_BODY_CONST(elm_obj_web_back_possible_get, Eina_Bool, 0); +EOAPI EFL_FUNC_BODY_CONST(elm_obj_web_load_progress_get, double, 0); +EOAPI EFL_FUNC_BODY_CONST(elm_obj_web_selection_get, char *, NULL); +EOAPI EFL_FUNC_BODY_CONST(elm_obj_web_title_get, Eina_Stringshare *, NULL); +EOAPI EFL_FUNC_BODYV(elm_obj_web_navigate, Eina_Bool, 0, EFL_FUNC_CALL(steps), int steps); +EOAPI EFL_FUNC_BODY(elm_obj_web_back, Eina_Bool, 0); +EOAPI EFL_FUNC_BODYV(elm_obj_web_html_string_load, Eina_Bool, 0, EFL_FUNC_CALL(html, base_url, unreachable_url), const char *html, const char *base_url, const char *unreachable_url); +EOAPI EFL_FUNC_BODYV_CONST(elm_obj_web_text_search, Eina_Bool, 0, EFL_FUNC_CALL(string, case_sensitive, forward, wrap), const char *string, Eina_Bool case_sensitive, Eina_Bool forward, Eina_Bool wrap); +EOAPI EFL_FUNC_BODY(elm_obj_web_popup_destroy, Eina_Bool, 0); +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_web_region_show, EFL_FUNC_CALL(x, y, w, h), int x, int y, int w, int h); +EOAPI EFL_FUNC_BODY(elm_obj_web_forward, Eina_Bool, 0); +EOAPI EFL_FUNC_BODYV(elm_obj_web_text_matches_mark, unsigned int, 0, EFL_FUNC_CALL(string, case_sensitive, highlight, limit), const char *string, Eina_Bool case_sensitive, Eina_Bool highlight, unsigned int limit); +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_web_region_bring_in, EFL_FUNC_CALL(x, y, w, h), int x, int y, int w, int h); +EOAPI EFL_FUNC_BODY(elm_obj_web_stop, Eina_Bool, 0); +EOAPI EFL_FUNC_BODYV(elm_obj_web_navigate_possible_get, Eina_Bool, 0, EFL_FUNC_CALL(steps), int steps); +EOAPI EFL_FUNC_BODY(elm_obj_web_reload_full, Eina_Bool, 0); +EOAPI EFL_FUNC_BODY(elm_obj_web_text_matches_unmark_all, Eina_Bool, 0); +EOAPI EFL_FUNC_BODY(elm_obj_web_reload, Eina_Bool, 0); + +Efl_Object *_elm_web_efl_object_constructor(Eo *obj, Elm_Web_Data *pd); + + +static Eina_Bool +_elm_web_class_initializer(Efl_Class *klass) +{ + const Efl_Object_Ops *opsp = NULL; + + const Efl_Object_Property_Reflection_Ops *ropsp = NULL; + +#ifndef ELM_WEB_EXTRA_OPS +#define ELM_WEB_EXTRA_OPS +#endif + + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC(elm_obj_web_text_matches_highlight_set, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_text_matches_highlight_get, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_useragent_set, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_useragent_get, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_url_set, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_url_get, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_bg_color_set, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_bg_color_get, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_inwin_mode_set, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_inwin_mode_get, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_tab_propagate_set, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_tab_propagate_get, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_history_enabled_set, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_history_enabled_get, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_console_message_hook_set, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_window_create_hook_set, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_dialog_file_selector_hook_set, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_dialog_confirm_hook_set, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_popup_selected_set, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_dialog_prompt_hook_set, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_dialog_alert_hook_set, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_forward_possible_get, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_webkit_view_get, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_back_possible_get, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_load_progress_get, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_selection_get, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_title_get, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_navigate, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_back, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_html_string_load, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_text_search, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_popup_destroy, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_region_show, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_forward, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_text_matches_mark, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_region_bring_in, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_stop, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_navigate_possible_get, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_reload_full, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_text_matches_unmark_all, NULL), + EFL_OBJECT_OP_FUNC(elm_obj_web_reload, NULL), + EFL_OBJECT_OP_FUNC(efl_constructor, _elm_web_efl_object_constructor), + ELM_WEB_EXTRA_OPS + ); + opsp = &ops; + + static const Efl_Object_Property_Reflection refl_table[] = { + {"text_matches_highlight", __eolian_elm_web_text_matches_highlight_set_reflect, __eolian_elm_web_text_matches_highlight_get_reflect}, + {"useragent", __eolian_elm_web_useragent_set_reflect, __eolian_elm_web_useragent_get_reflect}, + {"url", __eolian_elm_web_url_set_reflect, __eolian_elm_web_url_get_reflect}, + {"inwin_mode", __eolian_elm_web_inwin_mode_set_reflect, __eolian_elm_web_inwin_mode_get_reflect}, + {"tab_propagate", __eolian_elm_web_tab_propagate_set_reflect, __eolian_elm_web_tab_propagate_get_reflect}, + {"history_enabled", __eolian_elm_web_history_enabled_set_reflect, __eolian_elm_web_history_enabled_get_reflect}, + {"popup_selected", __eolian_elm_web_popup_selected_set_reflect, NULL}, + }; + static const Efl_Object_Property_Reflection_Ops rops = { + refl_table, EINA_C_ARRAY_LENGTH(refl_table) + }; + ropsp = &rops; + + return efl_class_functions_set(klass, opsp, ropsp); +} + +static const Efl_Class_Description _elm_web_class_desc = { + EO_VERSION, + "Elm.Web", + EFL_CLASS_TYPE_REGULAR_NO_INSTANT, + sizeof(Elm_Web_Data), + _elm_web_class_initializer, + _elm_web_class_constructor, + NULL +}; + +EFL_DEFINE_CLASS(elm_web_class_get, &_elm_web_class_desc, EFL_UI_WIDGET_CLASS, EFL_UI_LEGACY_INTERFACE, EFL_UI_ZOOM_INTERFACE, NULL); + +#include "elm_web_eo.legacy.c" diff --git a/src/lib/elementary/elm_web_eo.h b/src/lib/elementary/elm_web_eo.h index 33b3f7ede2..0407b40188 100644 --- a/src/lib/elementary/elm_web_eo.h +++ b/src/lib/elementary/elm_web_eo.h @@ -1 +1,602 @@ -#include "elm_web.eo.h" \ No newline at end of file +#ifndef _ELM_WEB_EO_H_ +#define _ELM_WEB_EO_H_ + +#ifndef _ELM_WEB_EO_CLASS_TYPE +#define _ELM_WEB_EO_CLASS_TYPE + +typedef Eo Elm_Web; + +#endif + +#ifndef _ELM_WEB_EO_TYPES +#define _ELM_WEB_EO_TYPES + + +#endif +/** Elementary web view class + * + * @ingroup Elm_Web + */ +#define ELM_WEB_CLASS elm_web_class_get() + +EWAPI const Efl_Class *elm_web_class_get(void); + +/** + * @brief Sets whether to highlight the matched marks. + * + * If enabled, marks set with @ref elm_obj_web_text_matches_mark will be + * highlighted. + * + * @param[in] obj The object. + * @param[in] highlight Whether to highlight the marks or not. + * + * @return @c true on success, @c false otherwise + * + * @ingroup Elm_Web + */ +EOAPI Eina_Bool elm_obj_web_text_matches_highlight_set(Eo *obj, Eina_Bool highlight); + +/** + * @brief Get whether highlighting marks is enabled. + * + * @param[in] obj The object. + * + * @return Whether to highlight the marks or not. + * + * @ingroup Elm_Web + */ +EOAPI Eina_Bool elm_obj_web_text_matches_highlight_get(const Eo *obj); + +/** + * @brief Change useragent of a elm_web object. + * + * @param[in] obj The object. + * @param[in] user_agent String for useragent. + * + * @ingroup Elm_Web + */ +EOAPI void elm_obj_web_useragent_set(Eo *obj, const char *user_agent); + +/** + * @brief Return current useragent of elm_web object. + * + * @param[in] obj The object. + * + * @return String for useragent. + * + * @ingroup Elm_Web + */ +EOAPI const char *elm_obj_web_useragent_get(const Eo *obj); + +/** + * @brief Sets the URL for the web object. + * + * It must be a full URL, with resource included, in the form + * http://www.enlightenment.org or file:///tmp/something.html + * + * @param[in] obj The object. + * @param[in] url The URL to set. + * + * @return @c true on success, @c false otherwise + * + * @ingroup Elm_Web + */ +EOAPI Eina_Bool elm_obj_web_url_set(Eo *obj, const char *url); + +/** + * @brief Get the current URL for the object. + * + * The returned string must not be freed and is guaranteed to be stringshared. + * + * @param[in] obj The object. + * + * @return The URL to set. + * + * @ingroup Elm_Web + */ +EOAPI const char *elm_obj_web_url_get(const Eo *obj); + +/** + * @brief Sets the background color to be used by the web object. + * + * This is the color that will be used by default when the loaded page does not + * set it's own. Color values are pre-multiplied. + * + * @param[in] obj The object. + * @param[in] r Red component. + * @param[in] g Green component. + * @param[in] b Blue component. + * @param[in] a Alpha component. + * + * @ingroup Elm_Web + */ +EOAPI void elm_obj_web_bg_color_set(Eo *obj, int r, int g, int b, int a); + +/** + * @brief Get the background color to be used by the web object. + * + * This is the color that will be used by default when the loaded page does not + * set it's own. Color values are pre-multiplied. + * + * @param[in] obj The object. + * @param[out] r Red component. + * @param[out] g Green component. + * @param[out] b Blue component. + * @param[out] a Alpha component. + * + * @ingroup Elm_Web + */ +EOAPI void elm_obj_web_bg_color_get(const Eo *obj, int *r, int *g, int *b, int *a); + +/** + * @brief Sets the default dialogs to use an Inwin instead of a normal window. + * + * If set, then the default implementation for the JavaScript dialogs and file + * selector will be opened in an Inwin. Otherwise they will use a normal + * separated window. + * + * @param[in] obj The object. + * @param[in] value @c true if dialog will be opened as Inwin, @c false + * otherwise + * + * @ingroup Elm_Web + */ +EOAPI void elm_obj_web_inwin_mode_set(Eo *obj, Eina_Bool value); + +/** + * @brief Get whether Inwin mode is set for the current object. + * + * @param[in] obj The object. + * + * @return @c true if dialog will be opened as Inwin, @c false otherwise + * + * @ingroup Elm_Web + */ +EOAPI Eina_Bool elm_obj_web_inwin_mode_get(const Eo *obj); + +/** + * @brief Sets whether to use tab propagation. + * + * If tab propagation is enabled, whenever the user presses the Tab key, + * Elementary will handle it and switch focus to the next widget. The default + * value is disabled, where WebKit will handle the Tab key to cycle focus + * though its internal objects, jumping to the next widget only when that cycle + * ends. + * + * @param[in] obj The object. + * @param[in] propagate Whether to propagate Tab keys to Elementary or not. + * + * @ingroup Elm_Web + */ +EOAPI void elm_obj_web_tab_propagate_set(Eo *obj, Eina_Bool propagate); + +/** + * @brief Get the status of the tab propagation. + * + * @param[in] obj The object. + * + * @return Whether to propagate Tab keys to Elementary or not. + * + * @ingroup Elm_Web + */ +EOAPI Eina_Bool elm_obj_web_tab_propagate_get(const Eo *obj); + +/** + * @brief Enables or disables the browsing history. + * + * @param[in] obj The object. + * @param[in] enable Whether to enable or disable the browsing history. + * + * @ingroup Elm_Web + */ +EOAPI void elm_obj_web_history_enabled_set(Eo *obj, Eina_Bool enable); + +/** + * @brief Get whether browsing history is enabled for the given object. + * + * @param[in] obj The object. + * + * @return Whether to enable or disable the browsing history. + * + * @ingroup Elm_Web + */ +EOAPI Eina_Bool elm_obj_web_history_enabled_get(const Eo *obj); + +/** + * @brief Sets the function to call when a console message is emitted from JS. + * + * This hook will be called when a console message is emitted from JavaScript. + * There is no default implementation for this feature. + * + * @param[in] obj The object. + * @param[in] func The callback function to be used. + * @param[in] data User data. + * + * @ingroup Elm_Web + */ +EOAPI void elm_obj_web_console_message_hook_set(Eo *obj, Elm_Web_Console_Message func, void *data); + +/** + * @brief Sets the function to call when a new window is requested. + * + * This hook will be called when a request to create a new window is issued + * from the web page loaded. There is no default implementation for this + * feature, so leaving this unset or passing @c null in @c func will prevent + * new windows from opening. + * + * @param[in] obj The object. + * @param[in] func The hook function to be called when a window is requested. + * @param[in] data User data. + * + * @ingroup Elm_Web + */ +EOAPI void elm_obj_web_window_create_hook_set(Eo *obj, Elm_Web_Window_Open func, void *data); + +/** + * @brief Sets the function to call when an file selector dialog. + * + * This hook will be called when a JavaScript file selector dialog is + * requested. If no function is set or @c null is passed in @c func, the + * default implementation will take place. + * + * @param[in] obj The object. + * @param[in] func The callback function to be used. + * @param[in] data User data. + * + * @ingroup Elm_Web + */ +EOAPI void elm_obj_web_dialog_file_selector_hook_set(Eo *obj, Elm_Web_Dialog_File_Selector func, void *data); + +/** + * @brief Sets the function to call when an confirm dialog. + * + * This hook will be called when a JavaScript confirm dialog is requested. If + * no function is set or @c null is passed in @c func, the default + * implementation will take place. + * + * @param[in] obj The object. + * @param[in] func The callback function to be used. + * @param[in] data User data. + * + * @ingroup Elm_Web + */ +EOAPI void elm_obj_web_dialog_confirm_hook_set(Eo *obj, Elm_Web_Dialog_Confirm func, void *data); + +/** + * @brief Tells the web object which index in the currently open popup was + * selected. + * + * When the user handles the popup creation from the "popup,created" signal, it + * needs to tell the web object which item was selected by calling this + * function with the index corresponding to the item. + * + * @param[in] obj The object. + * @param[in] idx The index selected. + * + * @ingroup Elm_Web + */ +EOAPI void elm_obj_web_popup_selected_set(Eo *obj, int idx); + +/** + * @brief Sets the function to call when an prompt dialog. + * + * This hook will be called when a JavaScript prompt dialog is requested. If no + * function is set or @c null is passed in @c func, the default implementation + * will take place. + * + * @param[in] obj The object. + * @param[in] func The callback function to be used. + * @param[in] data User data. + * + * @ingroup Elm_Web + */ +EOAPI void elm_obj_web_dialog_prompt_hook_set(Eo *obj, Elm_Web_Dialog_Prompt func, void *data); + +/** + * @brief Sets the function to call when an alert dialog. + * + * This hook will be called when a JavaScript alert dialog is requested. If no + * function is set or @c null is passed in @c func, the default implementation + * will take place. + * + * @param[in] obj The object. + * @param[in] func Callback function to be used. + * @param[in] data User data. + * + * @ingroup Elm_Web + */ +EOAPI void elm_obj_web_dialog_alert_hook_set(Eo *obj, Elm_Web_Dialog_Alert func, void *data); + +/** + * @brief Queries whether it's possible to go forward in history. + * + * @param[in] obj The object. + * + * @return @c true if it is possible to go forward, @c false otherwise + * + * @ingroup Elm_Web + */ +EOAPI Eina_Bool elm_obj_web_forward_possible_get(const Eo *obj); + +/** + * @brief Get internal ewk_view object from web object. + * + * Elementary may not provide some low level features of EWebKit, instead of + * cluttering the API with proxy methods we opted to return the internal + * reference. Be careful using it as it may interfere with elm_web behavior. + * + * @param[in] obj The object. + * + * @return The internal ewk_view object or @c null if it does not exist. + * (Failure to create or Elementary compiled without ewebkit) + * + * @ingroup Elm_Web + */ +EOAPI Efl_Canvas_Object *elm_obj_web_webkit_view_get(const Eo *obj); + +/** + * @brief Queries whether it's possible to go back in history. + * + * @param[in] obj The object. + * + * @return @c true if it is possible to go back, @c false otherwise + * + * @ingroup Elm_Web + */ +EOAPI Eina_Bool elm_obj_web_back_possible_get(const Eo *obj); + +/** + * @brief Get the overall loading progress of the page. + * + * Returns the estimated loading progress of the page, with a value between 0.0 + * and 1.0. This is an estimated progress accounting for all the frames + * included in the page. + * + * @param[in] obj The object. + * + * @return A value between 0.0 and 1.0 indicating the progress, or -1.0 on + * failure. + * + * @ingroup Elm_Web + */ +EOAPI double elm_obj_web_load_progress_get(const Eo *obj); + +/** + * @brief Get a copy of the currently selected text. + * + * The string returned must be freed by the user when it's done with it. + * + * @param[in] obj The object. + * + * @return A newly allocated string, or @c null if nothing is selected or an + * error occurred. + * + * @ingroup Elm_Web + */ +EOAPI char *elm_obj_web_selection_get(const Eo *obj) EINA_WARN_UNUSED_RESULT; + +/** + * @brief Get the current title. + * + * The returned string must not be freed and is guaranteed to be stringshared. + * + * @param[in] obj The object. + * + * @return A stringshared internal string with the current title, or @c null on + * failure. + * + * @ingroup Elm_Web + */ +EOAPI Eina_Stringshare *elm_obj_web_title_get(const Eo *obj) EINA_WARN_UNUSED_RESULT; + +/** + * @brief Jumps the given number of steps in the browsing history. + * + * The @c steps value can be a negative integer to back in history, or a + * positive to move forward. + * + * @param[in] obj The object. + * @param[in] steps The number of steps to jump. + * + * @return @c true on success, @c false on error or if not enough history + * exists to jump the given number of steps + * + * @ingroup Elm_Web + */ +EOAPI Eina_Bool elm_obj_web_navigate(Eo *obj, int steps); + +/** + * @brief Goes back one step in the browsing history. + * + * This is equivalent to calling elm_web_object_navigate(obj, -1); + * + * @param[in] obj The object. + * + * @return @c true on success, @c false otherwise + * + * @ingroup Elm_Web + */ +EOAPI Eina_Bool elm_obj_web_back(Eo *obj); + +/** + * @brief Loads the specified @c html string as the content of the web object. + * + * External objects such as stylesheets or images referenced in the HTML + * document are located relative to @c base_url. + * + * If an @c unreachable_url is passed it is used as the url for the loaded + * content. This is typically used to display error pages for a failed load. + * + * @param[in] obj The object. + * @param[in] html HTML data to load. + * @param[in] base_url Base URL used for relative paths to external objects + * (optional). + * @param[in] unreachable_url URL that could not be reached (optional). + * + * @return @c true on success, @c false otherwise + * + * @since 1.9 + * + * @ingroup Elm_Web + */ +EOAPI Eina_Bool elm_obj_web_html_string_load(Eo *obj, const char *html, const char *base_url, const char *unreachable_url); + +/** + * @brief Searches the given string in a document. + * + * @param[in] obj The object. + * @param[in] string String to search. + * @param[in] case_sensitive If search should be case sensitive or not. + * @param[in] forward If search is from cursor and on or backwards. + * @param[in] wrap If search should wrap at the end. + * + * @return @c true if the given string was found, @c false if not or failure. + * + * @ingroup Elm_Web + */ +EOAPI Eina_Bool elm_obj_web_text_search(const Eo *obj, const char *string, Eina_Bool case_sensitive, Eina_Bool forward, Eina_Bool wrap); + +/** + * @brief Dismisses an open dropdown popup + * + * When the popup from a dropdown widget is to be dismissed, either after + * selecting an option or to cancel it, this function must be called, which + * will later emit an "popup,willdelete" signal to notify the user that any + * memory and objects related to this popup can be freed. + * + * @param[in] obj The object. + * + * @return @c true if the menu was successfully destroyed, or @c false if there + * was no menu to destroy. + * + * @ingroup Elm_Web + */ +EOAPI Eina_Bool elm_obj_web_popup_destroy(Eo *obj); + +/** + * @brief Shows the given region in the web object. + * + * @param[in] obj The object. + * @param[in] x The x coordinate of the region to show. + * @param[in] y The y coordinate of the region to show. + * @param[in] w The width of the region to show. + * @param[in] h The height of the region to show. + * + * @ingroup Elm_Web + */ +EOAPI void elm_obj_web_region_show(Eo *obj, int x, int y, int w, int h); + +/** + * @brief Goes forward one step in the browsing history. + * + * This is equivalent to calling elm_web_object_navigate(obj, 1); + * + * See also @ref elm_obj_web_history_enabled_set, + * @ref elm_obj_web_forward_possible_get, @ref elm_obj_web_back, + * @ref elm_obj_web_navigate. + * + * @param[in] obj The object. + * + * @return @c true on success, @c false otherwise. + * + * @ingroup Elm_Web + */ +EOAPI Eina_Bool elm_obj_web_forward(Eo *obj); + +/** + * @brief Marks matches of the given string in a document. + * + * @param[in] obj The object. + * @param[in] string String to match. + * @param[in] case_sensitive If match should be case sensitive or not. + * @param[in] highlight If matches should be highlighted. + * @param[in] limit Maximum amount of matches, or zero to unlimited. + * + * @return Number of matched @c string. + * + * @ingroup Elm_Web + */ +EOAPI unsigned int elm_obj_web_text_matches_mark(Eo *obj, const char *string, Eina_Bool case_sensitive, Eina_Bool highlight, unsigned int limit); + +/** + * @brief Brings in the region to the visible area. + * + * Like @ref elm_obj_web_region_show, but it animates the scrolling of the + * object to show the area. + * + * @param[in] obj The object. + * @param[in] x The x coordinate of the region to show. + * @param[in] y The y coordinate of the region to show. + * @param[in] w The width of the region to show. + * @param[in] h The height of the region to show. + * + * @ingroup Elm_Web + */ +EOAPI void elm_obj_web_region_bring_in(Eo *obj, int x, int y, int w, int h); + +/** + * @brief Stops loading the current page. + * + * Cancels the loading of the current page in the web object. This will cause a + * "load,error" signal to be emitted, with the is_cancellation flag set to + * @c true. + * + * @param[in] obj The object. + * + * @return @c true if the cancel was successful, @c false otherwise. + * + * @ingroup Elm_Web + */ +EOAPI Eina_Bool elm_obj_web_stop(Eo *obj); + +/** + * @brief Queries whether it's possible to jump the given number of steps. + * + * The @c steps value can be a negative integer to back in history, or positive + * to move forward. + * + * @param[in] obj The object. + * @param[in] steps The number of steps to check for. + * + * @return @c true if enough history exists to perform the given jump, @c false + * otherwise. + * + * @ingroup Elm_Web + */ +EOAPI Eina_Bool elm_obj_web_navigate_possible_get(Eo *obj, int steps); + +/** + * @brief Requests a reload of the current document, avoiding any existing + * caches. + * + * @param[in] obj The object. + * + * @return @c true on success, @c false otherwise. + * + * @ingroup Elm_Web + */ +EOAPI Eina_Bool elm_obj_web_reload_full(Eo *obj); + +/** + * @brief Clears all marked matches in the document. + * + * @param[in] obj The object. + * + * @return @c true on success, @c false otherwise. + * + * @ingroup Elm_Web + */ +EOAPI Eina_Bool elm_obj_web_text_matches_unmark_all(Eo *obj); + +/** + * @brief Requests a reload of the current document in the object. + * + * @param[in] obj The object. + * + * @return @c true on success, @c false otherwise. + * + * @ingroup Elm_Web + */ +EOAPI Eina_Bool elm_obj_web_reload(Eo *obj); + +#endif diff --git a/src/lib/elementary/elm_web_eo.legacy.c b/src/lib/elementary/elm_web_eo.legacy.c new file mode 100644 index 0000000000..a589988825 --- /dev/null +++ b/src/lib/elementary/elm_web_eo.legacy.c @@ -0,0 +1,246 @@ + +EAPI Eina_Bool +elm_web_text_matches_highlight_set(Elm_Web *obj, Eina_Bool highlight) +{ + return elm_obj_web_text_matches_highlight_set(obj, highlight); +} + +EAPI Eina_Bool +elm_web_text_matches_highlight_get(const Elm_Web *obj) +{ + return elm_obj_web_text_matches_highlight_get(obj); +} + +EAPI void +elm_web_useragent_set(Elm_Web *obj, const char *user_agent) +{ + elm_obj_web_useragent_set(obj, user_agent); +} + +EAPI const char * +elm_web_useragent_get(const Elm_Web *obj) +{ + return elm_obj_web_useragent_get(obj); +} + +EAPI Eina_Bool +elm_web_url_set(Elm_Web *obj, const char *url) +{ + return elm_obj_web_url_set(obj, url); +} + +EAPI const char * +elm_web_url_get(const Elm_Web *obj) +{ + return elm_obj_web_url_get(obj); +} + +EAPI void +elm_web_bg_color_set(Elm_Web *obj, int r, int g, int b, int a) +{ + elm_obj_web_bg_color_set(obj, r, g, b, a); +} + +EAPI void +elm_web_bg_color_get(const Elm_Web *obj, int *r, int *g, int *b, int *a) +{ + elm_obj_web_bg_color_get(obj, r, g, b, a); +} + +EAPI void +elm_web_inwin_mode_set(Elm_Web *obj, Eina_Bool value) +{ + elm_obj_web_inwin_mode_set(obj, value); +} + +EAPI Eina_Bool +elm_web_inwin_mode_get(const Elm_Web *obj) +{ + return elm_obj_web_inwin_mode_get(obj); +} + +EAPI void +elm_web_tab_propagate_set(Elm_Web *obj, Eina_Bool propagate) +{ + elm_obj_web_tab_propagate_set(obj, propagate); +} + +EAPI Eina_Bool +elm_web_tab_propagate_get(const Elm_Web *obj) +{ + return elm_obj_web_tab_propagate_get(obj); +} + +EAPI void +elm_web_history_enabled_set(Elm_Web *obj, Eina_Bool enable) +{ + elm_obj_web_history_enabled_set(obj, enable); +} + +EAPI Eina_Bool +elm_web_history_enabled_get(const Elm_Web *obj) +{ + return elm_obj_web_history_enabled_get(obj); +} + +EAPI void +elm_web_console_message_hook_set(Elm_Web *obj, Elm_Web_Console_Message func, void *data) +{ + elm_obj_web_console_message_hook_set(obj, func, data); +} + +EAPI void +elm_web_window_create_hook_set(Elm_Web *obj, Elm_Web_Window_Open func, void *data) +{ + elm_obj_web_window_create_hook_set(obj, func, data); +} + +EAPI void +elm_web_dialog_file_selector_hook_set(Elm_Web *obj, Elm_Web_Dialog_File_Selector func, void *data) +{ + elm_obj_web_dialog_file_selector_hook_set(obj, func, data); +} + +EAPI void +elm_web_dialog_confirm_hook_set(Elm_Web *obj, Elm_Web_Dialog_Confirm func, void *data) +{ + elm_obj_web_dialog_confirm_hook_set(obj, func, data); +} + +EAPI void +elm_web_popup_selected_set(Elm_Web *obj, int idx) +{ + elm_obj_web_popup_selected_set(obj, idx); +} + +EAPI void +elm_web_dialog_prompt_hook_set(Elm_Web *obj, Elm_Web_Dialog_Prompt func, void *data) +{ + elm_obj_web_dialog_prompt_hook_set(obj, func, data); +} + +EAPI void +elm_web_dialog_alert_hook_set(Elm_Web *obj, Elm_Web_Dialog_Alert func, void *data) +{ + elm_obj_web_dialog_alert_hook_set(obj, func, data); +} + +EAPI Eina_Bool +elm_web_forward_possible_get(const Elm_Web *obj) +{ + return elm_obj_web_forward_possible_get(obj); +} + +EAPI Efl_Canvas_Object * +elm_web_webkit_view_get(const Elm_Web *obj) +{ + return elm_obj_web_webkit_view_get(obj); +} + +EAPI Eina_Bool +elm_web_back_possible_get(const Elm_Web *obj) +{ + return elm_obj_web_back_possible_get(obj); +} + +EAPI double +elm_web_load_progress_get(const Elm_Web *obj) +{ + return elm_obj_web_load_progress_get(obj); +} + +EAPI char * +elm_web_selection_get(const Elm_Web *obj) +{ + return elm_obj_web_selection_get(obj); +} + +EAPI Eina_Stringshare * +elm_web_title_get(const Elm_Web *obj) +{ + return elm_obj_web_title_get(obj); +} + +EAPI Eina_Bool +elm_web_navigate(Elm_Web *obj, int steps) +{ + return elm_obj_web_navigate(obj, steps); +} + +EAPI Eina_Bool +elm_web_back(Elm_Web *obj) +{ + return elm_obj_web_back(obj); +} + +EAPI Eina_Bool +elm_web_html_string_load(Elm_Web *obj, const char *html, const char *base_url, const char *unreachable_url) +{ + return elm_obj_web_html_string_load(obj, html, base_url, unreachable_url); +} + +EAPI Eina_Bool +elm_web_text_search(const Elm_Web *obj, const char *string, Eina_Bool case_sensitive, Eina_Bool forward, Eina_Bool wrap) +{ + return elm_obj_web_text_search(obj, string, case_sensitive, forward, wrap); +} + +EAPI Eina_Bool +elm_web_popup_destroy(Elm_Web *obj) +{ + return elm_obj_web_popup_destroy(obj); +} + +EAPI void +elm_web_region_show(Elm_Web *obj, int x, int y, int w, int h) +{ + elm_obj_web_region_show(obj, x, y, w, h); +} + +EAPI Eina_Bool +elm_web_forward(Elm_Web *obj) +{ + return elm_obj_web_forward(obj); +} + +EAPI unsigned int +elm_web_text_matches_mark(Elm_Web *obj, const char *string, Eina_Bool case_sensitive, Eina_Bool highlight, unsigned int limit) +{ + return elm_obj_web_text_matches_mark(obj, string, case_sensitive, highlight, limit); +} + +EAPI void +elm_web_region_bring_in(Elm_Web *obj, int x, int y, int w, int h) +{ + elm_obj_web_region_bring_in(obj, x, y, w, h); +} + +EAPI Eina_Bool +elm_web_stop(Elm_Web *obj) +{ + return elm_obj_web_stop(obj); +} + +EAPI Eina_Bool +elm_web_navigate_possible_get(Elm_Web *obj, int steps) +{ + return elm_obj_web_navigate_possible_get(obj, steps); +} + +EAPI Eina_Bool +elm_web_reload_full(Elm_Web *obj) +{ + return elm_obj_web_reload_full(obj); +} + +EAPI Eina_Bool +elm_web_text_matches_unmark_all(Elm_Web *obj) +{ + return elm_obj_web_text_matches_unmark_all(obj); +} + +EAPI Eina_Bool +elm_web_reload(Elm_Web *obj) +{ + return elm_obj_web_reload(obj); +} diff --git a/src/lib/elementary/elm_web_eo.legacy.h b/src/lib/elementary/elm_web_eo.legacy.h new file mode 100644 index 0000000000..a872707400 --- /dev/null +++ b/src/lib/elementary/elm_web_eo.legacy.h @@ -0,0 +1,594 @@ +#ifndef _ELM_WEB_EO_LEGACY_H_ +#define _ELM_WEB_EO_LEGACY_H_ + +#ifndef _ELM_WEB_EO_CLASS_TYPE +#define _ELM_WEB_EO_CLASS_TYPE + +typedef Eo Elm_Web; + +#endif + +#ifndef _ELM_WEB_EO_TYPES +#define _ELM_WEB_EO_TYPES + + +#endif + +/** + * @brief Sets whether to highlight the matched marks. + * + * If enabled, marks set with @ref elm_web_text_matches_mark will be + * highlighted. + * + * @param[in] obj The object. + * @param[in] highlight Whether to highlight the marks or not. + * + * @return @c true on success, @c false otherwise + * + * @ingroup Elm_Web_Group + */ +EAPI Eina_Bool elm_web_text_matches_highlight_set(Elm_Web *obj, Eina_Bool highlight); + +/** + * @brief Get whether highlighting marks is enabled. + * + * @param[in] obj The object. + * + * @return Whether to highlight the marks or not. + * + * @ingroup Elm_Web_Group + */ +EAPI Eina_Bool elm_web_text_matches_highlight_get(const Elm_Web *obj); + +/** + * @brief Change useragent of a elm_web object. + * + * @param[in] obj The object. + * @param[in] user_agent String for useragent. + * + * @ingroup Elm_Web_Group + */ +EAPI void elm_web_useragent_set(Elm_Web *obj, const char *user_agent); + +/** + * @brief Return current useragent of elm_web object. + * + * @param[in] obj The object. + * + * @return String for useragent. + * + * @ingroup Elm_Web_Group + */ +EAPI const char *elm_web_useragent_get(const Elm_Web *obj); + +/** + * @brief Sets the URL for the web object. + * + * It must be a full URL, with resource included, in the form + * http://www.enlightenment.org or file:///tmp/something.html + * + * @param[in] obj The object. + * @param[in] url The URL to set. + * + * @return @c true on success, @c false otherwise + * + * @ingroup Elm_Web_Group + */ +EAPI Eina_Bool elm_web_url_set(Elm_Web *obj, const char *url); + +/** + * @brief Get the current URL for the object. + * + * The returned string must not be freed and is guaranteed to be stringshared. + * + * @param[in] obj The object. + * + * @return The URL to set. + * + * @ingroup Elm_Web_Group + */ +EAPI const char *elm_web_url_get(const Elm_Web *obj); + +/** + * @brief Sets the background color to be used by the web object. + * + * This is the color that will be used by default when the loaded page does not + * set it's own. Color values are pre-multiplied. + * + * @param[in] obj The object. + * @param[in] r Red component. + * @param[in] g Green component. + * @param[in] b Blue component. + * @param[in] a Alpha component. + * + * @ingroup Elm_Web_Group + */ +EAPI void elm_web_bg_color_set(Elm_Web *obj, int r, int g, int b, int a); + +/** + * @brief Get the background color to be used by the web object. + * + * This is the color that will be used by default when the loaded page does not + * set it's own. Color values are pre-multiplied. + * + * @param[in] obj The object. + * @param[out] r Red component. + * @param[out] g Green component. + * @param[out] b Blue component. + * @param[out] a Alpha component. + * + * @ingroup Elm_Web_Group + */ +EAPI void elm_web_bg_color_get(const Elm_Web *obj, int *r, int *g, int *b, int *a); + +/** + * @brief Sets the default dialogs to use an Inwin instead of a normal window. + * + * If set, then the default implementation for the JavaScript dialogs and file + * selector will be opened in an Inwin. Otherwise they will use a normal + * separated window. + * + * @param[in] obj The object. + * @param[in] value @c true if dialog will be opened as Inwin, @c false + * otherwise + * + * @ingroup Elm_Web_Group + */ +EAPI void elm_web_inwin_mode_set(Elm_Web *obj, Eina_Bool value); + +/** + * @brief Get whether Inwin mode is set for the current object. + * + * @param[in] obj The object. + * + * @return @c true if dialog will be opened as Inwin, @c false otherwise + * + * @ingroup Elm_Web_Group + */ +EAPI Eina_Bool elm_web_inwin_mode_get(const Elm_Web *obj); + +/** + * @brief Sets whether to use tab propagation. + * + * If tab propagation is enabled, whenever the user presses the Tab key, + * Elementary will handle it and switch focus to the next widget. The default + * value is disabled, where WebKit will handle the Tab key to cycle focus + * though its internal objects, jumping to the next widget only when that cycle + * ends. + * + * @param[in] obj The object. + * @param[in] propagate Whether to propagate Tab keys to Elementary or not. + * + * @ingroup Elm_Web_Group + */ +EAPI void elm_web_tab_propagate_set(Elm_Web *obj, Eina_Bool propagate); + +/** + * @brief Get the status of the tab propagation. + * + * @param[in] obj The object. + * + * @return Whether to propagate Tab keys to Elementary or not. + * + * @ingroup Elm_Web_Group + */ +EAPI Eina_Bool elm_web_tab_propagate_get(const Elm_Web *obj); + +/** + * @brief Enables or disables the browsing history. + * + * @param[in] obj The object. + * @param[in] enable Whether to enable or disable the browsing history. + * + * @ingroup Elm_Web_Group + */ +EAPI void elm_web_history_enabled_set(Elm_Web *obj, Eina_Bool enable); + +/** + * @brief Get whether browsing history is enabled for the given object. + * + * @param[in] obj The object. + * + * @return Whether to enable or disable the browsing history. + * + * @ingroup Elm_Web_Group + */ +EAPI Eina_Bool elm_web_history_enabled_get(const Elm_Web *obj); + +/** + * @brief Sets the function to call when a console message is emitted from JS. + * + * This hook will be called when a console message is emitted from JavaScript. + * There is no default implementation for this feature. + * + * @param[in] obj The object. + * @param[in] func The callback function to be used. + * @param[in] data User data. + * + * @ingroup Elm_Web_Group + */ +EAPI void elm_web_console_message_hook_set(Elm_Web *obj, Elm_Web_Console_Message func, void *data); + +/** + * @brief Sets the function to call when a new window is requested. + * + * This hook will be called when a request to create a new window is issued + * from the web page loaded. There is no default implementation for this + * feature, so leaving this unset or passing @c null in @c func will prevent + * new windows from opening. + * + * @param[in] obj The object. + * @param[in] func The hook function to be called when a window is requested. + * @param[in] data User data. + * + * @ingroup Elm_Web_Group + */ +EAPI void elm_web_window_create_hook_set(Elm_Web *obj, Elm_Web_Window_Open func, void *data); + +/** + * @brief Sets the function to call when an file selector dialog. + * + * This hook will be called when a JavaScript file selector dialog is + * requested. If no function is set or @c null is passed in @c func, the + * default implementation will take place. + * + * @param[in] obj The object. + * @param[in] func The callback function to be used. + * @param[in] data User data. + * + * @ingroup Elm_Web_Group + */ +EAPI void elm_web_dialog_file_selector_hook_set(Elm_Web *obj, Elm_Web_Dialog_File_Selector func, void *data); + +/** + * @brief Sets the function to call when an confirm dialog. + * + * This hook will be called when a JavaScript confirm dialog is requested. If + * no function is set or @c null is passed in @c func, the default + * implementation will take place. + * + * @param[in] obj The object. + * @param[in] func The callback function to be used. + * @param[in] data User data. + * + * @ingroup Elm_Web_Group + */ +EAPI void elm_web_dialog_confirm_hook_set(Elm_Web *obj, Elm_Web_Dialog_Confirm func, void *data); + +/** + * @brief Tells the web object which index in the currently open popup was + * selected. + * + * When the user handles the popup creation from the "popup,created" signal, it + * needs to tell the web object which item was selected by calling this + * function with the index corresponding to the item. + * + * @param[in] obj The object. + * @param[in] idx The index selected. + * + * @ingroup Elm_Web_Group + */ +EAPI void elm_web_popup_selected_set(Elm_Web *obj, int idx); + +/** + * @brief Sets the function to call when an prompt dialog. + * + * This hook will be called when a JavaScript prompt dialog is requested. If no + * function is set or @c null is passed in @c func, the default implementation + * will take place. + * + * @param[in] obj The object. + * @param[in] func The callback function to be used. + * @param[in] data User data. + * + * @ingroup Elm_Web_Group + */ +EAPI void elm_web_dialog_prompt_hook_set(Elm_Web *obj, Elm_Web_Dialog_Prompt func, void *data); + +/** + * @brief Sets the function to call when an alert dialog. + * + * This hook will be called when a JavaScript alert dialog is requested. If no + * function is set or @c null is passed in @c func, the default implementation + * will take place. + * + * @param[in] obj The object. + * @param[in] func Callback function to be used. + * @param[in] data User data. + * + * @ingroup Elm_Web_Group + */ +EAPI void elm_web_dialog_alert_hook_set(Elm_Web *obj, Elm_Web_Dialog_Alert func, void *data); + +/** + * @brief Queries whether it's possible to go forward in history. + * + * @param[in] obj The object. + * + * @return @c true if it is possible to go forward, @c false otherwise + * + * @ingroup Elm_Web_Group + */ +EAPI Eina_Bool elm_web_forward_possible_get(const Elm_Web *obj); + +/** + * @brief Get internal ewk_view object from web object. + * + * Elementary may not provide some low level features of EWebKit, instead of + * cluttering the API with proxy methods we opted to return the internal + * reference. Be careful using it as it may interfere with elm_web behavior. + * + * @param[in] obj The object. + * + * @return The internal ewk_view object or @c null if it does not exist. + * (Failure to create or Elementary compiled without ewebkit) + * + * @ingroup Elm_Web_Group + */ +EAPI Efl_Canvas_Object *elm_web_webkit_view_get(const Elm_Web *obj); + +/** + * @brief Queries whether it's possible to go back in history. + * + * @param[in] obj The object. + * + * @return @c true if it is possible to go back, @c false otherwise + * + * @ingroup Elm_Web_Group + */ +EAPI Eina_Bool elm_web_back_possible_get(const Elm_Web *obj); + +/** + * @brief Get the overall loading progress of the page. + * + * Returns the estimated loading progress of the page, with a value between 0.0 + * and 1.0. This is an estimated progress accounting for all the frames + * included in the page. + * + * @param[in] obj The object. + * + * @return A value between 0.0 and 1.0 indicating the progress, or -1.0 on + * failure. + * + * @ingroup Elm_Web_Group + */ +EAPI double elm_web_load_progress_get(const Elm_Web *obj); + +/** + * @brief Get a copy of the currently selected text. + * + * The string returned must be freed by the user when it's done with it. + * + * @param[in] obj The object. + * + * @return A newly allocated string, or @c null if nothing is selected or an + * error occurred. + * + * @ingroup Elm_Web_Group + */ +EAPI char *elm_web_selection_get(const Elm_Web *obj) EINA_WARN_UNUSED_RESULT; + +/** + * @brief Get the current title. + * + * The returned string must not be freed and is guaranteed to be stringshared. + * + * @param[in] obj The object. + * + * @return A stringshared internal string with the current title, or @c null on + * failure. + * + * @ingroup Elm_Web_Group + */ +EAPI Eina_Stringshare *elm_web_title_get(const Elm_Web *obj) EINA_WARN_UNUSED_RESULT; + +/** + * @brief Jumps the given number of steps in the browsing history. + * + * The @c steps value can be a negative integer to back in history, or a + * positive to move forward. + * + * @param[in] obj The object. + * @param[in] steps The number of steps to jump. + * + * @return @c true on success, @c false on error or if not enough history + * exists to jump the given number of steps + * + * @ingroup Elm_Web_Group + */ +EAPI Eina_Bool elm_web_navigate(Elm_Web *obj, int steps); + +/** + * @brief Goes back one step in the browsing history. + * + * This is equivalent to calling elm_web_object_navigate(obj, -1); + * + * @param[in] obj The object. + * + * @return @c true on success, @c false otherwise + * + * @ingroup Elm_Web_Group + */ +EAPI Eina_Bool elm_web_back(Elm_Web *obj); + +/** + * @brief Loads the specified @c html string as the content of the web object. + * + * External objects such as stylesheets or images referenced in the HTML + * document are located relative to @c base_url. + * + * If an @c unreachable_url is passed it is used as the url for the loaded + * content. This is typically used to display error pages for a failed load. + * + * @param[in] obj The object. + * @param[in] html HTML data to load. + * @param[in] base_url Base URL used for relative paths to external objects + * (optional). + * @param[in] unreachable_url URL that could not be reached (optional). + * + * @return @c true on success, @c false otherwise + * + * @since 1.9 + * + * @ingroup Elm_Web_Group + */ +EAPI Eina_Bool elm_web_html_string_load(Elm_Web *obj, const char *html, const char *base_url, const char *unreachable_url); + +/** + * @brief Searches the given string in a document. + * + * @param[in] obj The object. + * @param[in] string String to search. + * @param[in] case_sensitive If search should be case sensitive or not. + * @param[in] forward If search is from cursor and on or backwards. + * @param[in] wrap If search should wrap at the end. + * + * @return @c true if the given string was found, @c false if not or failure. + * + * @ingroup Elm_Web_Group + */ +EAPI Eina_Bool elm_web_text_search(const Elm_Web *obj, const char *string, Eina_Bool case_sensitive, Eina_Bool forward, Eina_Bool wrap); + +/** + * @brief Dismisses an open dropdown popup + * + * When the popup from a dropdown widget is to be dismissed, either after + * selecting an option or to cancel it, this function must be called, which + * will later emit an "popup,willdelete" signal to notify the user that any + * memory and objects related to this popup can be freed. + * + * @param[in] obj The object. + * + * @return @c true if the menu was successfully destroyed, or @c false if there + * was no menu to destroy. + * + * @ingroup Elm_Web_Group + */ +EAPI Eina_Bool elm_web_popup_destroy(Elm_Web *obj); + +/** + * @brief Shows the given region in the web object. + * + * @param[in] obj The object. + * @param[in] x The x coordinate of the region to show. + * @param[in] y The y coordinate of the region to show. + * @param[in] w The width of the region to show. + * @param[in] h The height of the region to show. + * + * @ingroup Elm_Web_Group + */ +EAPI void elm_web_region_show(Elm_Web *obj, int x, int y, int w, int h); + +/** + * @brief Goes forward one step in the browsing history. + * + * This is equivalent to calling elm_web_object_navigate(obj, 1); + * + * See also @ref elm_web_history_enabled_set, + * @ref elm_web_forward_possible_get, @ref elm_web_back, @ref elm_web_navigate. + * + * @param[in] obj The object. + * + * @return @c true on success, @c false otherwise. + * + * @ingroup Elm_Web_Group + */ +EAPI Eina_Bool elm_web_forward(Elm_Web *obj); + +/** + * @brief Marks matches of the given string in a document. + * + * @param[in] obj The object. + * @param[in] string String to match. + * @param[in] case_sensitive If match should be case sensitive or not. + * @param[in] highlight If matches should be highlighted. + * @param[in] limit Maximum amount of matches, or zero to unlimited. + * + * @return Number of matched @c string. + * + * @ingroup Elm_Web_Group + */ +EAPI unsigned int elm_web_text_matches_mark(Elm_Web *obj, const char *string, Eina_Bool case_sensitive, Eina_Bool highlight, unsigned int limit); + +/** + * @brief Brings in the region to the visible area. + * + * Like @ref elm_web_region_show, but it animates the scrolling of the object + * to show the area. + * + * @param[in] obj The object. + * @param[in] x The x coordinate of the region to show. + * @param[in] y The y coordinate of the region to show. + * @param[in] w The width of the region to show. + * @param[in] h The height of the region to show. + * + * @ingroup Elm_Web_Group + */ +EAPI void elm_web_region_bring_in(Elm_Web *obj, int x, int y, int w, int h); + +/** + * @brief Stops loading the current page. + * + * Cancels the loading of the current page in the web object. This will cause a + * "load,error" signal to be emitted, with the is_cancellation flag set to + * @c true. + * + * @param[in] obj The object. + * + * @return @c true if the cancel was successful, @c false otherwise. + * + * @ingroup Elm_Web_Group + */ +EAPI Eina_Bool elm_web_stop(Elm_Web *obj); + +/** + * @brief Queries whether it's possible to jump the given number of steps. + * + * The @c steps value can be a negative integer to back in history, or positive + * to move forward. + * + * @param[in] obj The object. + * @param[in] steps The number of steps to check for. + * + * @return @c true if enough history exists to perform the given jump, @c false + * otherwise. + * + * @ingroup Elm_Web_Group + */ +EAPI Eina_Bool elm_web_navigate_possible_get(Elm_Web *obj, int steps); + +/** + * @brief Requests a reload of the current document, avoiding any existing + * caches. + * + * @param[in] obj The object. + * + * @return @c true on success, @c false otherwise. + * + * @ingroup Elm_Web_Group + */ +EAPI Eina_Bool elm_web_reload_full(Elm_Web *obj); + +/** + * @brief Clears all marked matches in the document. + * + * @param[in] obj The object. + * + * @return @c true on success, @c false otherwise. + * + * @ingroup Elm_Web_Group + */ +EAPI Eina_Bool elm_web_text_matches_unmark_all(Elm_Web *obj); + +/** + * @brief Requests a reload of the current document in the object. + * + * @param[in] obj The object. + * + * @return @c true on success, @c false otherwise. + * + * @ingroup Elm_Web_Group + */ +EAPI Eina_Bool elm_web_reload(Elm_Web *obj); + +#endif diff --git a/src/lib/elementary/elm_web_legacy.h b/src/lib/elementary/elm_web_legacy.h index 29588eded5..ea6f18c36d 100644 --- a/src/lib/elementary/elm_web_legacy.h +++ b/src/lib/elementary/elm_web_legacy.h @@ -126,4 +126,4 @@ EAPI void elm_web_zoom_set(Evas_Object *obj, double zoom); * @ingroup Elm_Web */ EAPI double elm_web_zoom_get(const Evas_Object *obj); -#include "elm_web.eo.legacy.h" +#include "elm_web_eo.legacy.h" diff --git a/src/lib/elementary/meson.build b/src/lib/elementary/meson.build index ebd8a6cd71..88583b3ea7 100644 --- a/src/lib/elementary/meson.build +++ b/src/lib/elementary/meson.build @@ -176,7 +176,6 @@ pub_eo_files = [ 'elm_atspi_bridge.eo', 'elm_atspi_app_object.eo', 'efl_ui_image_zoomable_pan.eo', - 'elm_web.eo', 'elm_widget_item.eo', 'efl_ui_text_part.eo', 'efl_ui_caching_factory.eo', @@ -806,6 +805,8 @@ elementary_pub_headers = [ 'elm_view_form_eo.legacy.h', 'elm_view_list_eo.h', 'elm_view_list_eo.legacy.h', + 'elm_web_eo.h', + 'elm_web_eo.legacy.h', ] elementary_header_src = [ diff --git a/src/modules/elementary/web/none/elm_web_none.c b/src/modules/elementary/web/none/elm_web_none.c index 93b1d79021..6ac26507ed 100644 --- a/src/modules/elementary/web/none/elm_web_none.c +++ b/src/modules/elementary/web/none/elm_web_none.c @@ -12,7 +12,7 @@ #define ELEMENTARY_BUILD #undef ELM_MODULE_HELPER_H #include "elm_module_helper.h" -#include "elm_web_none.eo.h" +#include "elm_web_none_eo.h" #define MY_CLASS ELM_WEB_CLASS @@ -365,4 +365,4 @@ ewm_class_get(void) #define ELM_WEB_NONE_EXTRA_OPS \ EFL_CANVAS_GROUP_ADD_OPS(elm_web_none) -#include "elm_web_none.eo.c" +#include "elm_web_none_eo.c" diff --git a/src/modules/elementary/web/none/elm_web_none.eo b/src/modules/elementary/web/none/elm_web_none.eo deleted file mode 100644 index d00d2d68a0..0000000000 --- a/src/modules/elementary/web/none/elm_web_none.eo +++ /dev/null @@ -1,42 +0,0 @@ -class Elm.Web.None extends Elm.Web implements Efl.Ui.Legacy -{ - [[Elementary web module class]] - implements { - Elm.Web.tab_propagate { get; set; } - Elm.Web.webkit_view { get; } - Elm.Web.window_create_hook { set; } - Elm.Web.dialog_alert_hook { set; } - Elm.Web.dialog_confirm_hook { set; } - Elm.Web.dialog_prompt_hook { set; } - Elm.Web.dialog_file_selector_hook { set; } - Elm.Web.console_message_hook { set; } - Elm.Web.useragent { get; set; } - Elm.Web.url { get; set; } - Elm.Web.html_string_load; - Elm.Web.title { get; } - Elm.Web.bg_color { get; set; } - Elm.Web.selection { get; } - Elm.Web.popup_selected { set; } - Elm.Web.popup_destroy; - Elm.Web.text_search; - Elm.Web.text_matches_mark; - Elm.Web.text_matches_unmark_all; - Elm.Web.text_matches_highlight { get; set; } - Elm.Web.load_progress { get; } - Elm.Web.stop; - Elm.Web.reload; - Elm.Web.reload_full; - Elm.Web.back; - Elm.Web.forward; - Elm.Web.navigate; - Elm.Web.back_possible { get; } - Elm.Web.forward_possible { get; } - Elm.Web.navigate_possible_get; - Elm.Web.history_enabled { get; set; } - Efl.Ui.Zoom.zoom_level { get; set; } - Efl.Ui.Zoom.zoom_mode { get; set; } - Elm.Web.region_show; - Elm.Web.region_bring_in; - Elm.Web.inwin_mode { get; set; } - } -} diff --git a/src/modules/elementary/web/none/elm_web_none_eo.c b/src/modules/elementary/web/none/elm_web_none_eo.c new file mode 100644 index 0000000000..8fd029ecfd --- /dev/null +++ b/src/modules/elementary/web/none/elm_web_none_eo.c @@ -0,0 +1,211 @@ + +void _elm_web_none_elm_web_tab_propagate_set(Eo *obj, Elm_Web_None_Data *pd, Eina_Bool propagate); + + +Eina_Bool _elm_web_none_elm_web_tab_propagate_get(const Eo *obj, Elm_Web_None_Data *pd); + + +Efl_Canvas_Object *_elm_web_none_elm_web_webkit_view_get(const Eo *obj, Elm_Web_None_Data *pd); + + +void _elm_web_none_elm_web_window_create_hook_set(Eo *obj, Elm_Web_None_Data *pd, Elm_Web_Window_Open func, void *data); + + +void _elm_web_none_elm_web_dialog_alert_hook_set(Eo *obj, Elm_Web_None_Data *pd, Elm_Web_Dialog_Alert func, void *data); + + +void _elm_web_none_elm_web_dialog_confirm_hook_set(Eo *obj, Elm_Web_None_Data *pd, Elm_Web_Dialog_Confirm func, void *data); + + +void _elm_web_none_elm_web_dialog_prompt_hook_set(Eo *obj, Elm_Web_None_Data *pd, Elm_Web_Dialog_Prompt func, void *data); + + +void _elm_web_none_elm_web_dialog_file_selector_hook_set(Eo *obj, Elm_Web_None_Data *pd, Elm_Web_Dialog_File_Selector func, void *data); + + +void _elm_web_none_elm_web_console_message_hook_set(Eo *obj, Elm_Web_None_Data *pd, Elm_Web_Console_Message func, void *data); + + +void _elm_web_none_elm_web_useragent_set(Eo *obj, Elm_Web_None_Data *pd, const char *user_agent); + + +const char *_elm_web_none_elm_web_useragent_get(const Eo *obj, Elm_Web_None_Data *pd); + + +Eina_Bool _elm_web_none_elm_web_url_set(Eo *obj, Elm_Web_None_Data *pd, const char *url); + + +const char *_elm_web_none_elm_web_url_get(const Eo *obj, Elm_Web_None_Data *pd); + + +Eina_Bool _elm_web_none_elm_web_html_string_load(Eo *obj, Elm_Web_None_Data *pd, const char *html, const char *base_url, const char *unreachable_url); + + +Eina_Stringshare *_elm_web_none_elm_web_title_get(const Eo *obj, Elm_Web_None_Data *pd); + + +void _elm_web_none_elm_web_bg_color_set(Eo *obj, Elm_Web_None_Data *pd, int r, int g, int b, int a); + + +void _elm_web_none_elm_web_bg_color_get(const Eo *obj, Elm_Web_None_Data *pd, int *r, int *g, int *b, int *a); + + +char *_elm_web_none_elm_web_selection_get(const Eo *obj, Elm_Web_None_Data *pd); + + +void _elm_web_none_elm_web_popup_selected_set(Eo *obj, Elm_Web_None_Data *pd, int idx); + + +Eina_Bool _elm_web_none_elm_web_popup_destroy(Eo *obj, Elm_Web_None_Data *pd); + + +Eina_Bool _elm_web_none_elm_web_text_search(const Eo *obj, Elm_Web_None_Data *pd, const char *string, Eina_Bool case_sensitive, Eina_Bool forward, Eina_Bool wrap); + + +unsigned int _elm_web_none_elm_web_text_matches_mark(Eo *obj, Elm_Web_None_Data *pd, const char *string, Eina_Bool case_sensitive, Eina_Bool highlight, unsigned int limit); + + +Eina_Bool _elm_web_none_elm_web_text_matches_unmark_all(Eo *obj, Elm_Web_None_Data *pd); + + +Eina_Bool _elm_web_none_elm_web_text_matches_highlight_set(Eo *obj, Elm_Web_None_Data *pd, Eina_Bool highlight); + + +Eina_Bool _elm_web_none_elm_web_text_matches_highlight_get(const Eo *obj, Elm_Web_None_Data *pd); + + +double _elm_web_none_elm_web_load_progress_get(const Eo *obj, Elm_Web_None_Data *pd); + + +Eina_Bool _elm_web_none_elm_web_stop(Eo *obj, Elm_Web_None_Data *pd); + + +Eina_Bool _elm_web_none_elm_web_reload(Eo *obj, Elm_Web_None_Data *pd); + + +Eina_Bool _elm_web_none_elm_web_reload_full(Eo *obj, Elm_Web_None_Data *pd); + + +Eina_Bool _elm_web_none_elm_web_back(Eo *obj, Elm_Web_None_Data *pd); + + +Eina_Bool _elm_web_none_elm_web_forward(Eo *obj, Elm_Web_None_Data *pd); + + +Eina_Bool _elm_web_none_elm_web_navigate(Eo *obj, Elm_Web_None_Data *pd, int steps); + + +Eina_Bool _elm_web_none_elm_web_back_possible_get(const Eo *obj, Elm_Web_None_Data *pd); + + +Eina_Bool _elm_web_none_elm_web_forward_possible_get(const Eo *obj, Elm_Web_None_Data *pd); + + +Eina_Bool _elm_web_none_elm_web_navigate_possible_get(Eo *obj, Elm_Web_None_Data *pd, int steps); + + +void _elm_web_none_elm_web_history_enabled_set(Eo *obj, Elm_Web_None_Data *pd, Eina_Bool enable); + + +Eina_Bool _elm_web_none_elm_web_history_enabled_get(const Eo *obj, Elm_Web_None_Data *pd); + + +void _elm_web_none_efl_ui_zoom_zoom_level_set(Eo *obj, Elm_Web_None_Data *pd, double zoom); + + +double _elm_web_none_efl_ui_zoom_zoom_level_get(const Eo *obj, Elm_Web_None_Data *pd); + + +void _elm_web_none_efl_ui_zoom_zoom_mode_set(Eo *obj, Elm_Web_None_Data *pd, Efl_Ui_Zoom_Mode mode); + + +Efl_Ui_Zoom_Mode _elm_web_none_efl_ui_zoom_zoom_mode_get(const Eo *obj, Elm_Web_None_Data *pd); + + +void _elm_web_none_elm_web_region_show(Eo *obj, Elm_Web_None_Data *pd, int x, int y, int w, int h); + + +void _elm_web_none_elm_web_region_bring_in(Eo *obj, Elm_Web_None_Data *pd, int x, int y, int w, int h); + + +void _elm_web_none_elm_web_inwin_mode_set(Eo *obj, Elm_Web_None_Data *pd, Eina_Bool value); + + +Eina_Bool _elm_web_none_elm_web_inwin_mode_get(const Eo *obj, Elm_Web_None_Data *pd); + + +static Eina_Bool +_elm_web_none_class_initializer(Efl_Class *klass) +{ + const Efl_Object_Ops *opsp = NULL; + + const Efl_Object_Property_Reflection_Ops *ropsp = NULL; + +#ifndef ELM_WEB_NONE_EXTRA_OPS +#define ELM_WEB_NONE_EXTRA_OPS +#endif + + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC(elm_obj_web_tab_propagate_set, _elm_web_none_elm_web_tab_propagate_set), + EFL_OBJECT_OP_FUNC(elm_obj_web_tab_propagate_get, _elm_web_none_elm_web_tab_propagate_get), + EFL_OBJECT_OP_FUNC(elm_obj_web_webkit_view_get, _elm_web_none_elm_web_webkit_view_get), + EFL_OBJECT_OP_FUNC(elm_obj_web_window_create_hook_set, _elm_web_none_elm_web_window_create_hook_set), + EFL_OBJECT_OP_FUNC(elm_obj_web_dialog_alert_hook_set, _elm_web_none_elm_web_dialog_alert_hook_set), + EFL_OBJECT_OP_FUNC(elm_obj_web_dialog_confirm_hook_set, _elm_web_none_elm_web_dialog_confirm_hook_set), + EFL_OBJECT_OP_FUNC(elm_obj_web_dialog_prompt_hook_set, _elm_web_none_elm_web_dialog_prompt_hook_set), + EFL_OBJECT_OP_FUNC(elm_obj_web_dialog_file_selector_hook_set, _elm_web_none_elm_web_dialog_file_selector_hook_set), + EFL_OBJECT_OP_FUNC(elm_obj_web_console_message_hook_set, _elm_web_none_elm_web_console_message_hook_set), + EFL_OBJECT_OP_FUNC(elm_obj_web_useragent_set, _elm_web_none_elm_web_useragent_set), + EFL_OBJECT_OP_FUNC(elm_obj_web_useragent_get, _elm_web_none_elm_web_useragent_get), + EFL_OBJECT_OP_FUNC(elm_obj_web_url_set, _elm_web_none_elm_web_url_set), + EFL_OBJECT_OP_FUNC(elm_obj_web_url_get, _elm_web_none_elm_web_url_get), + EFL_OBJECT_OP_FUNC(elm_obj_web_html_string_load, _elm_web_none_elm_web_html_string_load), + EFL_OBJECT_OP_FUNC(elm_obj_web_title_get, _elm_web_none_elm_web_title_get), + EFL_OBJECT_OP_FUNC(elm_obj_web_bg_color_set, _elm_web_none_elm_web_bg_color_set), + EFL_OBJECT_OP_FUNC(elm_obj_web_bg_color_get, _elm_web_none_elm_web_bg_color_get), + EFL_OBJECT_OP_FUNC(elm_obj_web_selection_get, _elm_web_none_elm_web_selection_get), + EFL_OBJECT_OP_FUNC(elm_obj_web_popup_selected_set, _elm_web_none_elm_web_popup_selected_set), + EFL_OBJECT_OP_FUNC(elm_obj_web_popup_destroy, _elm_web_none_elm_web_popup_destroy), + EFL_OBJECT_OP_FUNC(elm_obj_web_text_search, _elm_web_none_elm_web_text_search), + EFL_OBJECT_OP_FUNC(elm_obj_web_text_matches_mark, _elm_web_none_elm_web_text_matches_mark), + EFL_OBJECT_OP_FUNC(elm_obj_web_text_matches_unmark_all, _elm_web_none_elm_web_text_matches_unmark_all), + EFL_OBJECT_OP_FUNC(elm_obj_web_text_matches_highlight_set, _elm_web_none_elm_web_text_matches_highlight_set), + EFL_OBJECT_OP_FUNC(elm_obj_web_text_matches_highlight_get, _elm_web_none_elm_web_text_matches_highlight_get), + EFL_OBJECT_OP_FUNC(elm_obj_web_load_progress_get, _elm_web_none_elm_web_load_progress_get), + EFL_OBJECT_OP_FUNC(elm_obj_web_stop, _elm_web_none_elm_web_stop), + EFL_OBJECT_OP_FUNC(elm_obj_web_reload, _elm_web_none_elm_web_reload), + EFL_OBJECT_OP_FUNC(elm_obj_web_reload_full, _elm_web_none_elm_web_reload_full), + EFL_OBJECT_OP_FUNC(elm_obj_web_back, _elm_web_none_elm_web_back), + EFL_OBJECT_OP_FUNC(elm_obj_web_forward, _elm_web_none_elm_web_forward), + EFL_OBJECT_OP_FUNC(elm_obj_web_navigate, _elm_web_none_elm_web_navigate), + EFL_OBJECT_OP_FUNC(elm_obj_web_back_possible_get, _elm_web_none_elm_web_back_possible_get), + EFL_OBJECT_OP_FUNC(elm_obj_web_forward_possible_get, _elm_web_none_elm_web_forward_possible_get), + EFL_OBJECT_OP_FUNC(elm_obj_web_navigate_possible_get, _elm_web_none_elm_web_navigate_possible_get), + EFL_OBJECT_OP_FUNC(elm_obj_web_history_enabled_set, _elm_web_none_elm_web_history_enabled_set), + EFL_OBJECT_OP_FUNC(elm_obj_web_history_enabled_get, _elm_web_none_elm_web_history_enabled_get), + EFL_OBJECT_OP_FUNC(efl_ui_zoom_level_set, _elm_web_none_efl_ui_zoom_zoom_level_set), + EFL_OBJECT_OP_FUNC(efl_ui_zoom_level_get, _elm_web_none_efl_ui_zoom_zoom_level_get), + EFL_OBJECT_OP_FUNC(efl_ui_zoom_mode_set, _elm_web_none_efl_ui_zoom_zoom_mode_set), + EFL_OBJECT_OP_FUNC(efl_ui_zoom_mode_get, _elm_web_none_efl_ui_zoom_zoom_mode_get), + EFL_OBJECT_OP_FUNC(elm_obj_web_region_show, _elm_web_none_elm_web_region_show), + EFL_OBJECT_OP_FUNC(elm_obj_web_region_bring_in, _elm_web_none_elm_web_region_bring_in), + EFL_OBJECT_OP_FUNC(elm_obj_web_inwin_mode_set, _elm_web_none_elm_web_inwin_mode_set), + EFL_OBJECT_OP_FUNC(elm_obj_web_inwin_mode_get, _elm_web_none_elm_web_inwin_mode_get), + ELM_WEB_NONE_EXTRA_OPS + ); + opsp = &ops; + + return efl_class_functions_set(klass, opsp, ropsp); +} + +static const Efl_Class_Description _elm_web_none_class_desc = { + EO_VERSION, + "Elm.Web.None", + EFL_CLASS_TYPE_REGULAR, + sizeof(Elm_Web_None_Data), + _elm_web_none_class_initializer, + NULL, + NULL +}; + +EFL_DEFINE_CLASS(elm_web_none_class_get, &_elm_web_none_class_desc, ELM_WEB_CLASS, EFL_UI_LEGACY_INTERFACE, NULL); diff --git a/src/modules/elementary/web/none/elm_web_none_eo.h b/src/modules/elementary/web/none/elm_web_none_eo.h new file mode 100644 index 0000000000..8bf39b1461 --- /dev/null +++ b/src/modules/elementary/web/none/elm_web_none_eo.h @@ -0,0 +1,24 @@ +#ifndef _ELM_WEB_NONE_EO_H_ +#define _ELM_WEB_NONE_EO_H_ + +#ifndef _ELM_WEB_NONE_EO_CLASS_TYPE +#define _ELM_WEB_NONE_EO_CLASS_TYPE + +typedef Eo Elm_Web_None; + +#endif + +#ifndef _ELM_WEB_NONE_EO_TYPES +#define _ELM_WEB_NONE_EO_TYPES + + +#endif +/** Elementary web module class + * + * @ingroup Elm_Web_None + */ +#define ELM_WEB_NONE_CLASS elm_web_none_class_get() + +EWAPI const Efl_Class *elm_web_none_class_get(void); + +#endif diff --git a/src/modules/elementary/web/none/meson.build b/src/modules/elementary/web/none/meson.build index e71a16837d..632bca3bc4 100644 --- a/src/modules/elementary/web/none/meson.build +++ b/src/modules/elementary/web/none/meson.build @@ -1,26 +1,6 @@ -pub_eo_files = [ - 'elm_web_none.eo' -] - - -foreach eo_file : pub_eo_files - pub_eo_file_target += custom_target('eolian_gen_' + eo_file, - input : eo_file, - output : [eo_file + '.h'], - depfile : eo_file + '.d', - install : true, - install_dir : dir_package_include, - command : eolian_gen + [ '-I', meson.current_source_dir(), eolian_include_directories, - '-o', 'h:' + join_paths(meson.current_build_dir(), eo_file + '.h'), - '-o', 'c:' + join_paths(meson.current_build_dir(), eo_file + '.c'), - '-o', 'd:' + join_paths(meson.current_build_dir(), eo_file + '.d'), - '-gchd', '@INPUT@']) -endforeach - - src = files([ 'elm_web_none.c' -]) + pub_eo_file_target +]) shared_module('none', src,