X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/467d261e9dd430101119c76eb35aea43a31e7def..ab67e8874db324fab5223cc8d5dff8a8de3e2b77:/include/wx/webview.h diff --git a/include/wx/webview.h b/include/wx/webview.h index 59dc17de98..050c31953e 100644 --- a/include/wx/webview.h +++ b/include/wx/webview.h @@ -10,7 +10,7 @@ #ifndef _WX_WEB_VIEW_H_ #define _WX_WEB_VIEW_H_ -#include "wx/setup.h" +#include "wx/defs.h" #if wxUSE_WEBVIEW @@ -20,9 +20,15 @@ #include "wx/sharedptr.h" #include "wx/vector.h" -#include "wx/osx/webviewhistoryitem_webkit.h" -#include "wx/gtk/webviewhistoryitem_webkit.h" -#include "wx/msw/webviewhistoryitem_ie.h" +#if defined(__WXOSX__) + #include "wx/osx/webviewhistoryitem_webkit.h" +#elif defined(__WXGTK__) + #include "wx/gtk/webviewhistoryitem_webkit.h" +#elif defined(__WXMSW__) + #include "wx/msw/webviewhistoryitem_ie.h" +#else + #error "wxWebView not implemented on this platform." +#endif class wxFSFile; class wxFileSystem; @@ -59,7 +65,17 @@ enum wxWebViewReloadFlags { //Default, may access cache wxWEB_VIEW_RELOAD_DEFAULT, - wxWEB_VIEW_RELOAD_NO_CACHE + wxWEB_VIEW_RELOAD_NO_CACHE +}; + +enum wxWebViewFindFlags +{ + wxWEB_VIEW_FIND_WRAP = 0x0001, + wxWEB_VIEW_FIND_ENTIRE_WORD = 0x0002, + wxWEB_VIEW_FIND_MATCH_CASE = 0x0004, + wxWEB_VIEW_FIND_HIGHLIGHT_RESULT = 0x0008, + wxWEB_VIEW_FIND_BACKWARDS = 0x0010, + wxWEB_VIEW_FIND_DEFAULT = 0 }; enum wxWebViewBackend @@ -74,6 +90,7 @@ class WXDLLIMPEXP_WEBVIEW wxWebViewHandler { public: wxWebViewHandler(const wxString& scheme) : m_scheme(scheme) {} + virtual ~wxWebViewHandler() {} virtual wxString GetName() const { return m_scheme; } virtual wxFSFile* GetFile(const wxString &uri) = 0; private: @@ -86,14 +103,15 @@ extern WXDLLIMPEXP_DATA_WEBVIEW(const char) wxWebViewDefaultURLStr[]; class WXDLLIMPEXP_WEBVIEW wxWebView : public wxControl { public: + virtual ~wxWebView() {} virtual bool Create(wxWindow* parent, wxWindowID id, - const wxString& url, - const wxPoint& pos, - const wxSize& size, - long style, - const wxString& name) = 0; + const wxString& url = wxWebViewDefaultURLStr, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxWebViewNameStr) = 0; static wxWebView* New(wxWebViewBackend backend = wxWEB_VIEW_BACKEND_DEFAULT); static wxWebView* New(wxWindow* parent, @@ -119,12 +137,15 @@ public: virtual void Reload(wxWebViewReloadFlags flags = wxWEB_VIEW_RELOAD_DEFAULT) = 0; virtual void RunScript(const wxString& javascript) = 0; virtual void SetEditable(bool enable = true) = 0; - virtual void SetPage(const wxString& html, const wxString& baseUrl) = 0; - virtual void SetPage(wxInputStream& html, wxString baseUrl) + void SetPage(const wxString& html, const wxString& baseUrl) + { + DoSetPage(html, baseUrl); + } + void SetPage(wxInputStream& html, wxString baseUrl) { wxStringOutputStream stream; stream.Write(html); - SetPage(stream.GetString(), baseUrl); + DoSetPage(stream.GetString(), baseUrl); } virtual void Stop() = 0; @@ -168,6 +189,14 @@ public: virtual void Undo() = 0; virtual void Redo() = 0; + //Get the pointer to the underlying native engine. + virtual void* GetNativeBackend() const = 0; + //Find function + virtual long Find(const wxString& text, int flags = wxWEB_VIEW_FIND_DEFAULT) = 0; + +protected: + virtual void DoSetPage(const wxString& html, const wxString& baseUrl) = 0; + wxDECLARE_ABSTRACT_CLASS(wxWebView); }; @@ -217,7 +246,7 @@ typedef void (wxEvtHandler::*wxWebViewEventFunction) wx__DECLARE_EVT1(wxEVT_COMMAND_WEB_VIEW_LOADED, id, \ wxWebViewEventHandler(fn)) -#define EVT_WEB_VIEW_ERRROR(id, fn) \ +#define EVT_WEB_VIEW_ERROR(id, fn) \ wx__DECLARE_EVT1(wxEVT_COMMAND_WEB_VIEW_ERROR, id, \ wxWebViewEventHandler(fn))