X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1d156af3247c862e51a7c62f569a3fd302052a42..9c34a216817028bc533e07873d047208a96b05a2:/include/wx/gtk/webview_webkit.h diff --git a/include/wx/gtk/webview_webkit.h b/include/wx/gtk/webview_webkit.h index 3add4d993a..24d30c89d9 100644 --- a/include/wx/gtk/webview_webkit.h +++ b/include/wx/gtk/webview_webkit.h @@ -10,14 +10,15 @@ #ifndef _WX_GTK_WEBKITCTRL_H_ #define _WX_GTK_WEBKITCTRL_H_ -#include "wx/setup.h" +#include "wx/defs.h" -#if wxUSE_WEBVIEW_WEBKIT && defined(__WXGTK__) +#if wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT && defined(__WXGTK__) -#include "webkit/webkit.h" #include "wx/sharedptr.h" #include "wx/webview.h" +typedef struct _WebKitWebView WebKitWebView; + //----------------------------------------------------------------------------- // wxWebViewWebKit //----------------------------------------------------------------------------- @@ -25,7 +26,7 @@ class WXDLLIMPEXP_WEBVIEW wxWebViewWebKit : public wxWebView { public: - wxWebViewWebKit() { Init(); } + wxWebViewWebKit(); wxWebViewWebKit(wxWindow *parent, wxWindowID id = wxID_ANY, @@ -34,8 +35,6 @@ public: const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxWebViewNameStr) { - Init(); - Create(parent, id, url, pos, size, style, name); } @@ -46,6 +45,8 @@ public: const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxWebViewNameStr); + virtual ~wxWebViewWebKit(); + virtual bool Enable( bool enable = true ); // implementation @@ -58,10 +59,11 @@ public: virtual void LoadURL(const wxString& url); virtual void GoBack(); virtual void GoForward(); - virtual void Reload(wxWebViewReloadFlags flags = wxWEB_VIEW_RELOAD_DEFAULT); + virtual void Reload(wxWebViewReloadFlags flags = wxWEBVIEW_RELOAD_DEFAULT); virtual bool CanGoBack() const; virtual bool CanGoForward() const; virtual void ClearHistory(); + virtual void EnableContextMenu(bool enable = true); virtual void EnableHistory(bool enable = true); virtual wxVector > GetBackwardHistory(); virtual wxVector > GetForwardHistory(); @@ -70,9 +72,6 @@ public: 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() const; @@ -96,6 +95,9 @@ public: virtual void Undo(); virtual void Redo(); + //Find function + virtual long Find(const wxString& text, int flags = wxWEBVIEW_FIND_DEFAULT); + //Editing functions virtual void SetEditable(bool enable = true); virtual bool IsEditable() const; @@ -109,14 +111,12 @@ public: virtual void ClearSelection(); virtual void RunScript(const wxString& javascript); - + //Virtual Filesystem Support virtual void RegisterHandler(wxSharedPtr handler); virtual wxVector > GetHandlers() { return m_handlerList; } - /** FIXME: hack to work around signals being received too early */ - bool m_ready; - + virtual void* GetNativeBackend() const { return m_web_view; } /** TODO: check if this can be made private * The native control has a getter to check for busy state, but except in @@ -133,6 +133,7 @@ public: bool m_guard; protected: + virtual void DoSetPage(const wxString& html, const wxString& baseUrl); virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const; @@ -143,17 +144,41 @@ private: void SetWebkitZoom(float level); float GetWebkitZoom() const; + //Find helper function + void FindClear(); + // focus event handler: calls GTKUpdateBitmap() void GTKOnFocus(wxFocusEvent& event); - GtkWidget *web_view; - gint m_historyLimit; + WebKitWebView *m_web_view; + int m_historyLimit; wxVector > m_handlerList; + //variables used for Find() + int m_findFlags; + wxString m_findText; + int m_findPosition; + int m_findCount; + wxDECLARE_DYNAMIC_CLASS(wxWebViewWebKit); }; -#endif // wxUSE_WEBVIEW_WEBKIT && defined(__WXGTK__) +class WXDLLIMPEXP_WEBVIEW wxWebViewFactoryWebKit : public wxWebViewFactory +{ +public: + virtual wxWebView* Create() { return new wxWebViewWebKit; } + virtual wxWebView* Create(wxWindow* parent, + wxWindowID id, + const wxString& url = wxWebViewDefaultURLStr, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxWebViewNameStr) + { return new wxWebViewWebKit(parent, id, url, pos, size, style, name); } +}; + + +#endif // wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT && defined(__WXGTK__) #endif