Add wxWebView::SetZoomFactor(float) and GetZoomFactor()

The new method allows to set the zoom level more precisely than the
existing SetZoom(wxWebViewZoom).

Also improve the webview sample by using radio menu items instead of
check items and manually resetting them.

Closes https://github.com/wxWidgets/wxWidgets/pull/1894

Closes #18769.
This commit is contained in:
Hertatijanto Hartono
2020-06-13 22:50:55 +07:00
committed by Vadim Zeitlin
parent dc9040cc89
commit 895424ecc0
12 changed files with 227 additions and 59 deletions

View File

@@ -882,11 +882,20 @@ public:
virtual bool CanSetZoomType(wxWebViewZoomType type) const = 0;
/**
Get the zoom factor of the page.
Get the zoom level of the page.
See GetZoomFactor() to get more precise zoom scale value other than
as provided by @c wxWebViewZoom.
@return The current level of zoom.
*/
virtual wxWebViewZoom GetZoom() const = 0;
/**
Get the zoom factor of the page.
@return The current factor of zoom.
@since 3.1.4
*/
virtual float GetZoomFactor() const = 0;
/**
Get how the zoom factor is currently interpreted.
@return How the zoom factor is currently interpreted by the HTML engine.
@@ -894,12 +903,24 @@ public:
virtual wxWebViewZoomType GetZoomType() const = 0;
/**
Set the zoom factor of the page.
Set the zoom level of the page.
See SetZoomFactor() for more precise scaling other than the measured
steps provided by @c wxWebViewZoom.
@param zoom How much to zoom (scale) the HTML document.
*/
virtual void SetZoom(wxWebViewZoom zoom) = 0;
/**
Set the zoom factor of the page.
@param zoom How much to zoom (scale) the HTML document in arbitrary
number.
@note zoom scale in IE will be converted into @c wxWebViewZoom levels
for @c wxWebViewZoomType of @c wxWEBVIEW_ZOOM_TYPE_TEXT.
@since 3.1.4
*/
virtual void SetZoomFactor(float zoom) = 0;
/**
Set how to interpret the zoom factor.
@param zoomType How the zoom factor should be interpreted by the
HTML engine.