From e669ddde233a87d1e80ce2b102d0a18ce9daedfe Mon Sep 17 00:00:00 2001 From: Steve Lamerton Date: Wed, 17 Aug 2011 10:26:09 +0000 Subject: [PATCH] Const correct the wxWebView api. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/SOC2011_WEBVIEW@68755 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/gtk/webview_webkit.h | 36 +++++++++++++-------------- include/wx/msw/webview_ie.h | 42 +++++++++++++++---------------- include/wx/osx/webview_webkit.h | 42 +++++++++++++++---------------- include/wx/webview.h | 34 ++++++++++++------------- interface/wx/webview.h | 34 ++++++++++++------------- src/gtk/webview_webkit.cpp | 36 +++++++++++++-------------- src/msw/webview_ie.cpp | 44 ++++++++++++++++----------------- src/osx/webview_webkit.mm | 34 ++++++++++++------------- 8 files changed, 151 insertions(+), 151 deletions(-) diff --git a/include/wx/gtk/webview_webkit.h b/include/wx/gtk/webview_webkit.h index c5a8ea616b..1a8f3a825f 100644 --- a/include/wx/gtk/webview_webkit.h +++ b/include/wx/gtk/webview_webkit.h @@ -63,60 +63,60 @@ public: void ZoomIn(); void ZoomOut(); void SetWebkitZoom(float level); - float GetWebkitZoom(); + float GetWebkitZoom() const; virtual void Stop(); virtual void LoadUrl(const wxString& url); virtual void GoBack(); virtual void GoForward(); virtual void Reload(wxWebViewReloadFlags flags = wxWEB_VIEW_RELOAD_DEFAULT); - virtual bool CanGoBack(); - virtual bool CanGoForward(); + virtual bool CanGoBack() const; + virtual bool CanGoForward() const; virtual void ClearHistory(); virtual void EnableHistory(bool enable = true); virtual wxVector > GetBackwardHistory(); virtual wxVector > GetForwardHistory(); virtual void LoadHistoryItem(wxSharedPtr item); - virtual wxString GetCurrentURL(); - virtual wxString GetCurrentTitle(); - virtual wxString GetPageSource(); - virtual wxString GetPageText(); + virtual wxString GetCurrentURL() const; + virtual wxString GetCurrentTitle() const; + virtual wxString GetPageSource() const; + virtual wxString GetPageText() const; //We do not want to hide the other overloads using wxWebView::SetPage; virtual void SetPage(const wxString& html, const wxString& baseUrl); virtual void Print(); - virtual bool IsBusy(); + virtual bool IsBusy() const; void SetZoomType(wxWebViewZoomType); wxWebViewZoomType GetZoomType() const; bool CanSetZoomType(wxWebViewZoomType) const; - virtual wxWebViewZoom GetZoom(); + virtual wxWebViewZoom GetZoom() const; virtual void SetZoom(wxWebViewZoom); //Clipboard functions - virtual bool CanCut(); - virtual bool CanCopy(); - virtual bool CanPaste(); + virtual bool CanCut() const; + virtual bool CanCopy() const; + virtual bool CanPaste() const; virtual void Cut(); virtual void Copy(); virtual void Paste(); //Undo / redo functionality - virtual bool CanUndo(); - virtual bool CanRedo(); + virtual bool CanUndo() const; + virtual bool CanRedo() const; virtual void Undo(); virtual void Redo(); //Editing functions virtual void SetEditable(bool enable = true); - virtual bool IsEditable(); + virtual bool IsEditable() const; //Selection virtual void DeleteSelection(); - virtual bool HasSelection(); + virtual bool HasSelection() const; virtual void SelectAll(); - virtual wxString GetSelectedText(); - virtual wxString GetSelectedSource(); + virtual wxString GetSelectedText() const; + virtual wxString GetSelectedSource() const; virtual void ClearSelection(); virtual void RunScript(const wxString& javascript); diff --git a/include/wx/msw/webview_ie.h b/include/wx/msw/webview_ie.h index 0cec911b2f..d6cc296e49 100644 --- a/include/wx/msw/webview_ie.h +++ b/include/wx/msw/webview_ie.h @@ -54,8 +54,8 @@ public: virtual wxVector > GetBackwardHistory(); virtual wxVector > GetForwardHistory(); - virtual bool CanGoForward(); - virtual bool CanGoBack(); + virtual bool CanGoForward() const; + virtual bool CanGoBack() const; virtual void GoBack(); virtual void GoForward(); virtual void ClearHistory(); @@ -63,12 +63,12 @@ public: virtual void Stop(); virtual void Reload(wxWebViewReloadFlags flags = wxWEB_VIEW_RELOAD_DEFAULT); - virtual wxString GetPageSource(); - virtual wxString GetPageText(); + virtual wxString GetPageSource() const; + virtual wxString GetPageText() const; - virtual bool IsBusy(); - virtual wxString GetCurrentURL(); - virtual wxString GetCurrentTitle(); + virtual bool IsBusy() const; + virtual wxString GetCurrentURL() const; + virtual wxString GetCurrentTitle() const; virtual void SetZoomType(wxWebViewZoomType); virtual wxWebViewZoomType GetZoomType() const; @@ -78,33 +78,33 @@ public: virtual void SetPage(const wxString& html, const wxString& baseUrl); - virtual wxWebViewZoom GetZoom(); + virtual wxWebViewZoom GetZoom() const; virtual void SetZoom(wxWebViewZoom zoom); //Clipboard functions - virtual bool CanCut(); - virtual bool CanCopy(); - virtual bool CanPaste(); + virtual bool CanCut() const; + virtual bool CanCopy() const; + virtual bool CanPaste() const; virtual void Cut(); virtual void Copy(); virtual void Paste(); //Undo / redo functionality - virtual bool CanUndo(); - virtual bool CanRedo(); + virtual bool CanUndo() const; + virtual bool CanRedo() const; virtual void Undo(); virtual void Redo(); //Editing functions virtual void SetEditable(bool enable = true); - virtual bool IsEditable(); + virtual bool IsEditable() const; //Selection virtual void SelectAll(); - virtual bool HasSelection(); + virtual bool HasSelection() const; virtual void DeleteSelection(); - virtual wxString GetSelectedText(); - virtual wxString GetSelectedSource(); + virtual wxString GetSelectedText() const; + virtual wxString GetSelectedSource() const; virtual void ClearSelection(); virtual void RunScript(const wxString& javascript); @@ -118,10 +118,10 @@ public: bool IsOfflineMode(); void SetOfflineMode(bool offline); - wxWebViewZoom GetIETextZoom(); + wxWebViewZoom GetIETextZoom() const; void SetIETextZoom(wxWebViewZoom level); - wxWebViewZoom GetIEOpticalZoom(); + wxWebViewZoom GetIEOpticalZoom() const; void SetIEOpticalZoom(wxWebViewZoom level); void onActiveXEvent(wxActiveXEvent& evt); @@ -153,9 +153,9 @@ private: bool m_historyEnabled; //Generic helper functions for IHtmlDocument commands - bool CanExecCommand(wxString command); + bool CanExecCommand(wxString command) const; void ExecCommand(wxString command); - IHTMLDocument2* GetDocument(); + IHTMLDocument2* GetDocument() const; wxDECLARE_DYNAMIC_CLASS(wxWebViewIE); }; diff --git a/include/wx/osx/webview_webkit.h b/include/wx/osx/webview_webkit.h index ecdd7a808b..491d0d723c 100644 --- a/include/wx/osx/webview_webkit.h +++ b/include/wx/osx/webview_webkit.h @@ -51,14 +51,14 @@ public: const wxString& name = wxWebViewNameStr); virtual ~wxWebViewWebKit(); - virtual bool CanGoBack(); - virtual bool CanGoForward(); + virtual bool CanGoBack() const; + virtual bool CanGoForward() const; virtual void GoBack(); virtual void GoForward(); virtual void Reload(wxWebViewReloadFlags flags = wxWEB_VIEW_RELOAD_DEFAULT); virtual void Stop(); - virtual wxString GetPageSource(); - virtual wxString GetPageText(); + virtual wxString GetPageSource() const; + virtual wxString GetPageText() const; //We do not want to hide the other overloads using wxWebView::SetPage; @@ -67,16 +67,16 @@ public: virtual void Print(); virtual void LoadUrl(const wxString& url); - virtual wxString GetCurrentURL(); - virtual wxString GetCurrentTitle(); - virtual wxWebViewZoom GetZoom(); + virtual wxString GetCurrentURL() const; + virtual wxString GetCurrentTitle() const; + virtual wxWebViewZoom GetZoom() const; virtual void SetZoom(wxWebViewZoom zoom); virtual void SetZoomType(wxWebViewZoomType zoomType); virtual wxWebViewZoomType GetZoomType() const; virtual bool CanSetZoomType(wxWebViewZoomType type) const; - virtual bool IsBusy() { return m_busy; } + virtual bool IsBusy() const { return m_busy; } //History functions virtual void ClearHistory(); @@ -86,29 +86,29 @@ public: virtual void LoadHistoryItem(wxSharedPtr item); //Undo / redo functionality - virtual bool CanUndo(); - virtual bool CanRedo(); + virtual bool CanUndo() const; + virtual bool CanRedo() const; virtual void Undo(); virtual void Redo(); //Clipboard functions - virtual bool CanCut() { return false; } - virtual bool CanCopy() { return false; } - virtual bool CanPaste() { return false; } + virtual bool CanCut() const { return false; } + virtual bool CanCopy() const { return false; } + virtual bool CanPaste() const { return false; } virtual void Cut(); virtual void Copy(); virtual void Paste(); //Editing functions virtual void SetEditable(bool enable = true); - virtual bool IsEditable(); + virtual bool IsEditable() const; //Selection virtual void DeleteSelection(); - virtual bool HasSelection(); + virtual bool HasSelection() const; virtual void SelectAll(); - virtual wxString GetSelectedText(); - virtual wxString GetSelectedSource(); + virtual wxString GetSelectedText() const; + virtual wxString GetSelectedSource() const; virtual void ClearSelection(); void RunScript(const wxString& javascript); @@ -117,17 +117,17 @@ public: virtual void RegisterHandler(wxSharedPtr handler); // ---- methods not from the parent (common) interface - bool CanGetPageSource(); + bool CanGetPageSource() const; void SetScrollPos(int pos); int GetScrollPos(); - bool CanIncreaseTextSize(); + bool CanIncreaseTextSize() const; void IncreaseTextSize(); - bool CanDecreaseTextSize(); + bool CanDecreaseTextSize() const; void DecreaseTextSize(); - float GetWebkitZoom(); + float GetWebkitZoom() const; void SetWebkitZoom(float zoom); // don't hide base class virtuals diff --git a/include/wx/webview.h b/include/wx/webview.h index ec1a1f383f..e72b27461f 100644 --- a/include/wx/webview.h +++ b/include/wx/webview.h @@ -165,12 +165,12 @@ public: /** Get whether it is possible to navigate back in the history of * visited pages */ - virtual bool CanGoBack() = 0; + virtual bool CanGoBack() const = 0; /** Get whether it is possible to navigate forward in the history of * visited pages */ - virtual bool CanGoForward() = 0; + virtual bool CanGoForward() const = 0; /** Navigate back in the history of visited pages. * Only valid if CanGoBack() returned true. @@ -214,13 +214,13 @@ public: /** * Get the URL of the currently displayed document */ - virtual wxString GetCurrentURL() = 0; + virtual wxString GetCurrentURL() const = 0; /** * Get the title of the current web page, or its URL/path if title is not * available */ - virtual wxString GetCurrentTitle() = 0; + virtual wxString GetCurrentTitle() const = 0; // TODO: handle choosing a frame when calling GetPageSource()? /** @@ -228,14 +228,14 @@ public: * @return the HTML source code, or an empty string if no page is currently * shown */ - virtual wxString GetPageSource() = 0; - virtual wxString GetPageText() = 0; + virtual wxString GetPageSource() const = 0; + virtual wxString GetPageText() const = 0; /** * Get the zoom factor of the page * @return How much the HTML document is zoomed (scaleed) */ - virtual wxWebViewZoom GetZoom() = 0; + virtual wxWebViewZoom GetZoom() const = 0; /** * Set the zoom factor of the page @@ -290,13 +290,13 @@ public: } virtual void SetEditable(bool enable = true) = 0; - virtual bool IsEditable() = 0; + virtual bool IsEditable() const = 0; virtual void SelectAll() = 0; - virtual bool HasSelection() = 0; + virtual bool HasSelection() const = 0; virtual void DeleteSelection() = 0; - virtual wxString GetSelectedText() = 0; - virtual wxString GetSelectedSource() = 0; + virtual wxString GetSelectedText() const = 0; + virtual wxString GetSelectedSource() const = 0; virtual void ClearSelection() = 0; virtual void RunScript(const wxString& javascript) = 0; @@ -325,19 +325,19 @@ public: /** * Returns whether the web control is currently busy (e.g. loading a page) */ - virtual bool IsBusy() = 0; + virtual bool IsBusy() const = 0; //Clipboard functions - virtual bool CanCut() = 0; - virtual bool CanCopy() = 0; - virtual bool CanPaste() = 0; + virtual bool CanCut() const = 0; + virtual bool CanCopy() const = 0; + virtual bool CanPaste() const = 0; virtual void Cut() = 0; virtual void Copy() = 0; virtual void Paste() = 0; //Undo / redo functionality - virtual bool CanUndo() = 0; - virtual bool CanRedo() = 0; + virtual bool CanUndo() const = 0; + virtual bool CanRedo() const = 0; virtual void Undo() = 0; virtual void Redo() = 0; diff --git a/interface/wx/webview.h b/interface/wx/webview.h index 47f7abadb0..c44532af0b 100644 --- a/interface/wx/webview.h +++ b/interface/wx/webview.h @@ -295,34 +295,34 @@ public: Get the title of the current web page, or its URL/path if title is not available. */ - virtual wxString GetCurrentTitle() = 0; + virtual wxString GetCurrentTitle() const = 0; /** Get the URL of the currently displayed document. */ - virtual wxString GetCurrentURL() = 0; + virtual wxString GetCurrentURL() const = 0; /** Get the HTML source code of the currently displayed document. @return The HTML source code, or an empty string if no page is currently shown. */ - virtual wxString GetPageSource() = 0; + virtual wxString GetPageSource() const = 0; /** Get the text of the current page. */ - virtual wxString GetPageText() = 0; + virtual wxString GetPageText() const = 0; /** Returns whether the web control is currently busy (e.g. loading a page). */ - virtual bool IsBusy() = 0; + virtual bool IsBusy() const = 0; /** Returns whether the web control is currently editable */ - virtual bool IsEditable() = 0; + virtual bool IsEditable() const = 0; /** Load a web page from a URL @@ -395,21 +395,21 @@ public: @note This always returns @c false on the OSX WebKit backend. */ - virtual bool CanCopy() = 0; + virtual bool CanCopy() const = 0; /** Returns @true if the current selection can be cut. @note This always returns @c false on the OSX WebKit backend. */ - virtual bool CanCut() = 0; + virtual bool CanCut() const = 0; /** Returns @true if data can be pasted. @note This always returns @c false on the OSX WebKit backend. */ - virtual bool CanPaste() = 0; + virtual bool CanPaste() const = 0; /** Copies the current selection. @@ -434,13 +434,13 @@ public: Returns @true if it is possible to navigate backward in the history of visited pages. */ - virtual bool CanGoBack() = 0; + virtual bool CanGoBack() const = 0; /** Returns @true if it is possible to navigate forward in the history of visited pages. */ - virtual bool CanGoForward() = 0; + virtual bool CanGoForward() const = 0; /** Clear the history, this will also remove the visible page. @@ -501,17 +501,17 @@ public: /** Returns the currently selected source, if any. */ - virtual wxString GetSelectedSource() = 0; + virtual wxString GetSelectedSource() const = 0; /** Returns the currently selected text, if any. */ - virtual wxString GetSelectedText() = 0; + virtual wxString GetSelectedText() const = 0; /** Returns @true if there is a current selection. */ - virtual bool HasSelection() = 0; + virtual bool HasSelection() const = 0; /** Selects the entire page. @@ -525,12 +525,12 @@ public: /** Returns @true if there is an action to redo. */ - virtual bool CanRedo() = 0; + virtual bool CanRedo() const = 0; /** Returns @true if there is an action to undo. */ - virtual bool CanUndo() = 0; + virtual bool CanUndo() const = 0; /** Redos the last action. @@ -558,7 +558,7 @@ public: Get the zoom factor of the page. @return The current level of zoom. */ - virtual wxWebViewZoom GetZoom() = 0; + virtual wxWebViewZoom GetZoom() const = 0; /** Get how the zoom factor is currently interpreted. diff --git a/src/gtk/webview_webkit.cpp b/src/gtk/webview_webkit.cpp index 6a47d8ddcd..8fb93faada 100644 --- a/src/gtk/webview_webkit.cpp +++ b/src/gtk/webview_webkit.cpp @@ -475,7 +475,7 @@ void wxWebViewWebKit::SetWebkitZoom(float level) webkit_web_view_set_zoom_level (WEBKIT_WEB_VIEW(web_view), level); } -float wxWebViewWebKit::GetWebkitZoom() +float wxWebViewWebKit::GetWebkitZoom() const { return webkit_web_view_get_zoom_level (WEBKIT_WEB_VIEW(web_view)); } @@ -514,13 +514,13 @@ void wxWebViewWebKit::GoForward() } -bool wxWebViewWebKit::CanGoBack() +bool wxWebViewWebKit::CanGoBack() const { return webkit_web_view_can_go_back (WEBKIT_WEB_VIEW(web_view)); } -bool wxWebViewWebKit::CanGoForward() +bool wxWebViewWebKit::CanGoForward() const { return webkit_web_view_can_go_forward (WEBKIT_WEB_VIEW(web_view)); } @@ -599,17 +599,17 @@ void wxWebViewWebKit::LoadHistoryItem(wxSharedPtr item) } } -bool wxWebViewWebKit::CanCut() +bool wxWebViewWebKit::CanCut() const { return webkit_web_view_can_cut_clipboard(WEBKIT_WEB_VIEW(web_view)); } -bool wxWebViewWebKit::CanCopy() +bool wxWebViewWebKit::CanCopy() const { return webkit_web_view_can_copy_clipboard(WEBKIT_WEB_VIEW(web_view)); } -bool wxWebViewWebKit::CanPaste() +bool wxWebViewWebKit::CanPaste() const { return webkit_web_view_can_paste_clipboard(WEBKIT_WEB_VIEW(web_view)); } @@ -629,12 +629,12 @@ void wxWebViewWebKit::Paste() webkit_web_view_paste_clipboard(WEBKIT_WEB_VIEW(web_view)); } -bool wxWebViewWebKit::CanUndo() +bool wxWebViewWebKit::CanUndo() const { return webkit_web_view_can_undo(WEBKIT_WEB_VIEW(web_view)); } -bool wxWebViewWebKit::CanRedo() +bool wxWebViewWebKit::CanRedo() const { return webkit_web_view_can_redo(WEBKIT_WEB_VIEW(web_view)); } @@ -649,7 +649,7 @@ void wxWebViewWebKit::Redo() webkit_web_view_redo(WEBKIT_WEB_VIEW(web_view)); } -wxString wxWebViewWebKit::GetCurrentURL() +wxString wxWebViewWebKit::GetCurrentURL() const { // FIXME: check which encoding the web kit control uses instead of // assuming UTF8 (here and elsewhere too) @@ -658,14 +658,14 @@ wxString wxWebViewWebKit::GetCurrentURL() } -wxString wxWebViewWebKit::GetCurrentTitle() +wxString wxWebViewWebKit::GetCurrentTitle() const { return wxString::FromUTF8(webkit_web_view_get_title( WEBKIT_WEB_VIEW(web_view))); } -wxString wxWebViewWebKit::GetPageSource() +wxString wxWebViewWebKit::GetPageSource() const { WebKitWebFrame* frame = webkit_web_view_get_main_frame( WEBKIT_WEB_VIEW(web_view)); @@ -678,7 +678,7 @@ wxString wxWebViewWebKit::GetPageSource() } -wxWebViewZoom wxWebViewWebKit::GetZoom() +wxWebViewZoom wxWebViewWebKit::GetZoom() const { float zoom = GetWebkitZoom(); @@ -786,7 +786,7 @@ void wxWebViewWebKit::Print() } -bool wxWebViewWebKit::IsBusy() +bool wxWebViewWebKit::IsBusy() const { return m_busy; @@ -817,7 +817,7 @@ void wxWebViewWebKit::SetEditable(bool enable) webkit_web_view_set_editable(WEBKIT_WEB_VIEW(web_view), enable); } -bool wxWebViewWebKit::IsEditable() +bool wxWebViewWebKit::IsEditable() const { return webkit_web_view_get_editable(WEBKIT_WEB_VIEW(web_view)); } @@ -827,7 +827,7 @@ void wxWebViewWebKit::DeleteSelection() webkit_web_view_delete_selection(WEBKIT_WEB_VIEW(web_view)); } -bool wxWebViewWebKit::HasSelection() +bool wxWebViewWebKit::HasSelection() const { return webkit_web_view_has_selection(WEBKIT_WEB_VIEW(web_view)); } @@ -837,7 +837,7 @@ void wxWebViewWebKit::SelectAll() webkit_web_view_select_all(WEBKIT_WEB_VIEW(web_view)); } -wxString wxWebViewWebKit::GetSelectedText() +wxString wxWebViewWebKit::GetSelectedText() const { WebKitDOMDocument* doc; WebKitDOMDOMWindow* win; @@ -853,7 +853,7 @@ wxString wxWebViewWebKit::GetSelectedText() wxConvUTF8); } -wxString wxWebViewWebKit::GetSelectedSource() +wxString wxWebViewWebKit::GetSelectedSource() const { WebKitDOMDocument* doc; WebKitDOMDOMWindow* win; @@ -891,7 +891,7 @@ void wxWebViewWebKit::ClearSelection() } -wxString wxWebViewWebKit::GetPageText() +wxString wxWebViewWebKit::GetPageText() const { WebKitDOMDocument* doc; WebKitDOMHTMLElement* body; diff --git a/src/msw/webview_ie.cpp b/src/msw/webview_ie.cpp index 5d46b47916..06d57d9a05 100644 --- a/src/msw/webview_ie.cpp +++ b/src/msw/webview_ie.cpp @@ -126,7 +126,7 @@ void wxWebViewIE::SetPage(const wxString& html, const wxString& baseUrl) } -wxString wxWebViewIE::GetPageSource() +wxString wxWebViewIE::GetPageSource() const { IHTMLDocument2* document = GetDocument(); IHTMLElement *bodyTag = NULL; @@ -150,7 +150,7 @@ wxString wxWebViewIE::GetPageSource() return source; } -wxWebViewZoom wxWebViewIE::GetZoom() +wxWebViewZoom wxWebViewIE::GetZoom() const { if(m_zoomType == wxWEB_VIEW_ZOOM_TYPE_LAYOUT) return GetIEOpticalZoom(); @@ -190,7 +190,7 @@ void wxWebViewIE::SetIETextZoom(wxWebViewZoom level) wxASSERT(result == S_OK); } -wxWebViewZoom wxWebViewIE::GetIETextZoom() +wxWebViewZoom wxWebViewIE::GetIETextZoom() const { VARIANT zoomVariant; VariantInit (&zoomVariant); @@ -242,7 +242,7 @@ void wxWebViewIE::SetIEOpticalZoom(wxWebViewZoom level) wxASSERT(result == S_OK); } -wxWebViewZoom wxWebViewIE::GetIEOpticalZoom() +wxWebViewZoom wxWebViewIE::GetIEOpticalZoom() const { VARIANT zoomVariant; VariantInit (&zoomVariant); @@ -309,7 +309,7 @@ void wxWebViewIE::Print() OLECMDEXECOPT_DODEFAULT, NULL, NULL); } -bool wxWebViewIE::CanGoBack() +bool wxWebViewIE::CanGoBack() const { if(m_historyEnabled) return m_historyPosition > 0; @@ -317,7 +317,7 @@ bool wxWebViewIE::CanGoBack() return false; } -bool wxWebViewIE::CanGoForward() +bool wxWebViewIE::CanGoForward() const { if(m_historyEnabled) return m_historyPosition != static_cast(m_historyList.size()) - 1; @@ -433,8 +433,8 @@ void wxWebViewIE::SetOfflineMode(bool offline) wxASSERT(success); } -bool wxWebViewIE::IsBusy() -{ +bool wxWebViewIE::IsBusy() const +{ if (m_isBusy) return true; wxVariant out = m_ie.GetProperty("Busy"); @@ -444,7 +444,7 @@ bool wxWebViewIE::IsBusy() return out.GetBool(); } -wxString wxWebViewIE::GetCurrentURL() +wxString wxWebViewIE::GetCurrentURL() const { wxVariant out = m_ie.GetProperty("LocationURL"); @@ -452,7 +452,7 @@ wxString wxWebViewIE::GetCurrentURL() return out.GetString(); } -wxString wxWebViewIE::GetCurrentTitle() +wxString wxWebViewIE::GetCurrentTitle() const { IHTMLDocument2* document = GetDocument(); BSTR title; @@ -462,16 +462,16 @@ wxString wxWebViewIE::GetCurrentTitle() return wxString(title); } -bool wxWebViewIE::CanCut() +bool wxWebViewIE::CanCut() const { return CanExecCommand("Cut"); } -bool wxWebViewIE::CanCopy() +bool wxWebViewIE::CanCopy() const { return CanExecCommand("Copy"); } -bool wxWebViewIE::CanPaste() +bool wxWebViewIE::CanPaste() const { return CanExecCommand("Paste"); } @@ -491,11 +491,11 @@ void wxWebViewIE::Paste() ExecCommand("Paste"); } -bool wxWebViewIE::CanUndo() +bool wxWebViewIE::CanUndo() const { return CanExecCommand("Undo"); } -bool wxWebViewIE::CanRedo() +bool wxWebViewIE::CanRedo() const { return CanExecCommand("Redo"); } @@ -521,7 +521,7 @@ void wxWebViewIE::SetEditable(bool enable) document->Release(); } -bool wxWebViewIE::IsEditable() +bool wxWebViewIE::IsEditable() const { IHTMLDocument2* document = GetDocument(); BSTR mode; @@ -538,7 +538,7 @@ void wxWebViewIE::SelectAll() ExecCommand("SelectAll"); } -bool wxWebViewIE::HasSelection() +bool wxWebViewIE::HasSelection() const { IHTMLDocument2* document = GetDocument(); IHTMLSelectionObject* selection; @@ -560,7 +560,7 @@ void wxWebViewIE::DeleteSelection() ExecCommand("Delete"); } -wxString wxWebViewIE::GetSelectedText() +wxString wxWebViewIE::GetSelectedText() const { IHTMLDocument2* document = GetDocument(); IHTMLSelectionObject* selection; @@ -589,7 +589,7 @@ wxString wxWebViewIE::GetSelectedText() return selected; } -wxString wxWebViewIE::GetSelectedSource() +wxString wxWebViewIE::GetSelectedSource() const { IHTMLDocument2* document = GetDocument(); IHTMLSelectionObject* selection; @@ -632,7 +632,7 @@ void wxWebViewIE::ClearSelection() document->Release(); } -wxString wxWebViewIE::GetPageText() +wxString wxWebViewIE::GetPageText() const { IHTMLDocument2* document = GetDocument(); wxString text; @@ -681,7 +681,7 @@ void wxWebViewIE::RegisterHandler(wxSharedPtr handler) } } -bool wxWebViewIE::CanExecCommand(wxString command) +bool wxWebViewIE::CanExecCommand(wxString command) const { IHTMLDocument2* document = GetDocument(); VARIANT_BOOL enabled; @@ -699,7 +699,7 @@ void wxWebViewIE::ExecCommand(wxString command) document->Release(); } -IHTMLDocument2* wxWebViewIE::GetDocument() +IHTMLDocument2* wxWebViewIE::GetDocument() const { wxVariant variant = m_ie.GetProperty("Document"); IHTMLDocument2* document = (IHTMLDocument2*)variant.GetVoidPtr(); diff --git a/src/osx/webview_webkit.mm b/src/osx/webview_webkit.mm index ad3f20eeab..c513eaa1a9 100644 --- a/src/osx/webview_webkit.mm +++ b/src/osx/webview_webkit.mm @@ -411,7 +411,7 @@ wxWebViewWebKit::~wxWebViewWebKit() // public methods // ---------------------------------------------------------------------------- -bool wxWebViewWebKit::CanGoBack() +bool wxWebViewWebKit::CanGoBack() const { if ( !m_webView ) return false; @@ -419,7 +419,7 @@ bool wxWebViewWebKit::CanGoBack() return [m_webView canGoBack]; } -bool wxWebViewWebKit::CanGoForward() +bool wxWebViewWebKit::CanGoForward() const { if ( !m_webView ) return false; @@ -469,7 +469,7 @@ void wxWebViewWebKit::Stop() [[m_webView mainFrame] stopLoading]; } -bool wxWebViewWebKit::CanGetPageSource() +bool wxWebViewWebKit::CanGetPageSource() const { if ( !m_webView ) return false; @@ -478,7 +478,7 @@ bool wxWebViewWebKit::CanGetPageSource() return ( [[dataSource representation] canProvideDocumentSource] ); } -wxString wxWebViewWebKit::GetPageSource() +wxString wxWebViewWebKit::GetPageSource() const { if (CanGetPageSource()) @@ -501,7 +501,7 @@ wxString wxWebViewWebKit::GetPageSource() return wxEmptyString; } -bool wxWebViewWebKit::CanIncreaseTextSize() +bool wxWebViewWebKit::CanIncreaseTextSize() const { if ( !m_webView ) return false; @@ -521,7 +521,7 @@ void wxWebViewWebKit::IncreaseTextSize() [m_webView makeTextLarger:(WebView*)m_webView]; } -bool wxWebViewWebKit::CanDecreaseTextSize() +bool wxWebViewWebKit::CanDecreaseTextSize() const { if ( !m_webView ) return false; @@ -573,7 +573,7 @@ void wxWebViewWebKit::SetEditable(bool enable) [m_webView setEditable:enable ]; } -bool wxWebViewWebKit::IsEditable() +bool wxWebViewWebKit::IsEditable() const { if ( !m_webView ) return false; @@ -629,7 +629,7 @@ void wxWebViewWebKit::SetScrollPos(int pos) (NSString*)wxNSStringWithWxString( javascript )]; } -wxString wxWebViewWebKit::GetSelectedText() +wxString wxWebViewWebKit::GetSelectedText() const { NSString* selection = [[m_webView selectedDOMRange] markupString]; if (!selection) return wxEmptyString; @@ -741,17 +741,17 @@ void wxWebViewWebKit::LoadUrl(const wxString& url) [NSURL URLWithString:wxNSStringWithWxString(url)]]]; } -wxString wxWebViewWebKit::GetCurrentURL() +wxString wxWebViewWebKit::GetCurrentURL() const { return wxStringWithNSString([m_webView mainFrameURL]); } -wxString wxWebViewWebKit::GetCurrentTitle() +wxString wxWebViewWebKit::GetCurrentTitle() const { return wxStringWithNSString([m_webView mainFrameTitle]); } -float wxWebViewWebKit::GetWebkitZoom() +float wxWebViewWebKit::GetWebkitZoom() const { return [m_webView textSizeMultiplier]; } @@ -761,7 +761,7 @@ void wxWebViewWebKit::SetWebkitZoom(float zoom) [m_webView setTextSizeMultiplier:zoom]; } -wxWebViewZoom wxWebViewWebKit::GetZoom() +wxWebViewZoom wxWebViewWebKit::GetZoom() const { float zoom = GetWebkitZoom(); @@ -865,7 +865,7 @@ void wxWebViewWebKit::DeleteSelection() [(WebView*)m_webView deleteSelection]; } -bool wxWebViewWebKit::HasSelection() +bool wxWebViewWebKit::HasSelection() const { DOMRange* range = [m_webView selectedDOMRange]; if(!range) @@ -889,7 +889,7 @@ void wxWebViewWebKit::SelectAll() RunScript("window.getSelection().selectAllChildren(document.body);"); } -wxString wxWebViewWebKit::GetSelectedSource() +wxString wxWebViewWebKit::GetSelectedSource() const { wxString script = ("var range = window.getSelection().getRangeAt(0);" "var element = document.createElement('div');" @@ -900,7 +900,7 @@ wxString wxWebViewWebKit::GetSelectedSource() return wxStringWithNSString([result stringValue]); } -wxString wxWebViewWebKit::GetPageText() +wxString wxWebViewWebKit::GetPageText() const { id result = [[m_webView windowScriptObject] evaluateWebScript:@"document.body.textContent"]; @@ -962,12 +962,12 @@ void wxWebViewWebKit::LoadHistoryItem(wxSharedPtr item) [m_webView goToBackForwardItem:item->m_histItem]; } -bool wxWebViewWebKit::CanUndo() +bool wxWebViewWebKit::CanUndo() const { return [[m_webView undoManager] canUndo]; } -bool wxWebViewWebKit::CanRedo() +bool wxWebViewWebKit::CanRedo() const { return [[m_webView undoManager] canRedo]; } -- 2.45.2