elm_web: use Efl.Ui.Zoom

This commit is contained in:
Mike Blumenkrantz 2018-02-14 21:14:52 -05:00
parent 8530bbc57b
commit 0a5b034977
5 changed files with 113 additions and 71 deletions

View File

@ -5,16 +5,7 @@ type Elm_Web_Dialog_Confirm: __undefined_type; [[Elementary web dialog confirm t
type Elm_Web_Dialog_Prompt: __undefined_type; [[Elementary web dialog prompt type]]
type Elm_Web_Dialog_Alert: __undefined_type; [[Elementary web dialog alert type]]
enum Elm.Web.Zoom_Mode
{
[[Types of zoom available.]]
manual = 0, [[Zoom controlled normally by elm_web_zoom_set]]
auto_fit, [[Zoom until content fits in web object]]
auto_fill, [[Zoom until content fills web object]]
last [[Sentinel value to indicate last enum field during iteration]]
}
class Elm.Web (Efl.Ui.Widget, Efl.Ui.Legacy)
class Elm.Web (Efl.Ui.Widget, Efl.Ui.Legacy, Efl.Ui.Zoom)
{
[[Elementary web view class]]
legacy_prefix: elm_web;
@ -138,58 +129,6 @@ class Elm.Web (Efl.Ui.Widget, Efl.Ui.Legacy)
enable: bool; [[Whether to enable or disable the browsing history.]]
}
}
@property zoom_mode @pure_virtual {
set {
[[Sets the zoom mode to use.
The modes can be any of those defined in .Elm_Web_Zoom_Mode,
except .ELM_WEB_ZOOM_MODE_LAST. The default is
.ELM_WEB_ZOOM_MODE_MANUAL.
.ELM_WEB_ZOOM_MODE_MANUAL means the zoom level will be
controlled with the @.zoom.set function.
.ELM_WEB_ZOOM_MODE_AUTO_FIT will calculate the needed zoom
level to make sure the entirety of the web object's contents
are shown.
.ELM_WEB_ZOOM_MODE_AUTO_FILL will calculate the needed zoom
level to fit the contents in the web object's size, without
leaving any space unused.
]]
}
get {
[[Get the currently set zoom mode.]]
}
values {
mode: Elm.Web.Zoom_Mode; [[The mode to set.]]
}
}
@property zoom @pure_virtual {
set {
[[Sets the zoom level of the web object.
Zoom level matches the Webkit API, so 1.0 means normal zoom,
with higher values meaning zoom in and lower meaning zoom out.
This function will only affect the zoom level if the mode set
with @.zoom_mode.set is .ELM_WEB_ZOOM_MODE_MANUAL.
]]
}
get {
[[Get the current zoom level set on the web object
Note that this is the zoom level set on the web object and
not that of the underlying Webkit one. In the
.ELM_WEB_ZOOM_MODE_MANUAL mode, the two zoom levels should
match, but for the other two modes the Webkit zoom is
calculated internally to match the chosen mode without
changing the zoom level set for the web object.
]]
}
values {
zoom: double; [[The zoom level to set.]]
}
}
@property console_message_hook {
set @pure_virtual {
[[Sets the function to call when a console message is emitted

View File

@ -156,6 +156,30 @@ elm_web_window_features_region_get(const Elm_Web_Window_Features *wf,
ewm.window_features_region_get(wf, x, y, w, h);
}
EAPI void
elm_web_zoom_mode_set(Evas_Object *obj, Elm_Web_Zoom_Mode mode)
{
efl_ui_zoom_mode_set(obj, mode);
}
EAPI Elm_Web_Zoom_Mode
elm_web_zoom_mode_get(const Evas_Object *obj)
{
return efl_ui_zoom_mode_get(obj);
}
EAPI void
elm_web_zoom_set(Evas_Object *obj, double zoom)
{
efl_ui_zoom_level_set(obj, zoom);
}
EAPI double
elm_web_zoom_get(const Evas_Object *obj)
{
return efl_ui_zoom_level_get(obj);
}
static void
_elm_web_class_constructor(Efl_Class *klass)
{

View File

@ -1,3 +1,17 @@
/** Types of zoom available.
*
* @ingroup Elm_Web
*/
typedef enum
{
ELM_WEB_ZOOM_MODE_MANUAL = 0, /**< Zoom controlled normally by
* elm_web_zoom_set */
ELM_WEB_ZOOM_MODE_AUTO_FIT, /**< Zoom until content fits in web object */
ELM_WEB_ZOOM_MODE_AUTO_FILL, /**< Zoom until content fills web object */
ELM_WEB_ZOOM_MODE_LAST /**< Sentinel value to indicate last enum field during
* iteration */
} Elm_Web_Zoom_Mode;
/**
* Add a new web object to the parent.
*
@ -47,4 +61,69 @@ EINA_DEPRECATED EAPI Eina_Bool elm_web_uri_set(Evas_Object *obj, const c
*/
EINA_DEPRECATED EAPI const char *elm_web_uri_get(const Evas_Object *obj);
#include "elm_web.eo.legacy.h"
/**
* @brief Sets the zoom mode to use.
*
* The modes can be any of those defined in .Elm_Web_Zoom_Mode, except
* .ELM_WEB_ZOOM_MODE_LAST. The default is .ELM_WEB_ZOOM_MODE_MANUAL.
*
* .ELM_WEB_ZOOM_MODE_MANUAL means the zoom level will be controlled with the
* @ref elm_web_zoom_set function.
*
* .ELM_WEB_ZOOM_MODE_AUTO_FIT will calculate the needed zoom level to make
* sure the entirety of the web object's contents are shown.
*
* .ELM_WEB_ZOOM_MODE_AUTO_FILL will calculate the needed zoom level to fit the
* contents in the web object's size, without leaving any space unused.
*
* @param[in] obj The object.
* @param[in] mode The mode to set.
*
* @ingroup Elm_Web
*/
EAPI void elm_web_zoom_mode_set(Evas_Object *obj, Elm_Web_Zoom_Mode mode);
/**
* @brief Get the currently set zoom mode.
*
* @param[in] obj The object.
*
* @return The mode to set.
*
* @ingroup Elm_Web
*/
EAPI Elm_Web_Zoom_Mode elm_web_zoom_mode_get(const Evas_Object *obj);
/**
* @brief Sets the zoom level of the web object.
*
* Zoom level matches the Webkit API, so 1.0 means normal zoom, with higher
* values meaning zoom in and lower meaning zoom out. This function will only
* affect the zoom level if the mode set with @ref elm_web_zoom_mode_set is
* .ELM_WEB_ZOOM_MODE_MANUAL.
*
* @param[in] obj The object.
* @param[in] zoom The zoom level to set.
*
* @ingroup Elm_Web
*/
EAPI void elm_web_zoom_set(Evas_Object *obj, double zoom);
/**
* @brief Get the current zoom level set on the web object
*
* Note that this is the zoom level set on the web object and not that of the
* underlying Webkit one. In the .ELM_WEB_ZOOM_MODE_MANUAL mode, the two zoom
* levels should match, but for the other two modes the Webkit zoom is
* calculated internally to match the chosen mode without changing the zoom
* level set for the web object.
*
* @param[in] obj The object.
*
* @return The zoom level to set.
*
* @ingroup Elm_Web
*/
EAPI double elm_web_zoom_get(const Evas_Object *obj);
#include "elm_web.eo.legacy.h"

View File

@ -266,25 +266,25 @@ _elm_web_none_elm_web_history_enabled_set(Eo *obj EINA_UNUSED, Elm_Web_None_Data
}
EOLIAN static void
_elm_web_none_elm_web_zoom_set(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED, double zoom EINA_UNUSED)
_elm_web_none_efl_ui_zoom_zoom_level_set(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED, double zoom EINA_UNUSED)
{
}
EOLIAN static double
_elm_web_none_elm_web_zoom_get(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED)
_elm_web_none_efl_ui_zoom_zoom_level_get(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED)
{
return -1;
}
EOLIAN static void
_elm_web_none_elm_web_zoom_mode_set(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED, Elm_Web_Zoom_Mode mode EINA_UNUSED)
_elm_web_none_efl_ui_zoom_zoom_mode_set(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED, Efl_Ui_Zoom_Mode mode EINA_UNUSED)
{
}
EOLIAN static Elm_Web_Zoom_Mode
_elm_web_none_elm_web_zoom_mode_get(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED)
EOLIAN static Efl_Ui_Zoom_Mode
_elm_web_none_efl_ui_zoom_zoom_mode_get(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED)
{
return ELM_WEB_ZOOM_MODE_LAST;
return EFL_UI_ZOOM_MODE_LAST;
}
EOLIAN static void

View File

@ -33,8 +33,8 @@ class Elm.Web.None (Elm.Web)
Elm.Web.forward_possible { get; }
Elm.Web.navigate_possible_get;
Elm.Web.history_enabled { get; set; }
Elm.Web.zoom { get; set; }
Elm.Web.zoom_mode { 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; }