]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/gtk/webview_webkit.h
Rename GetHref to GetURL in wxWebNavigationEvent, this brings it into line with the...
[wxWidgets.git] / include / wx / gtk / webview_webkit.h
index 04364f913d0bd23fc8cdbd7b230d01594880d2b4..3dc9acc282416dda3ded036c375322e9aa835b05 100644 (file)
 
 #if wxUSE_WEBVIEW_WEBKIT
 
+#include "webkit/webkit.h"
+#include "wx/sharedptr.h"
 #include "wx/webview.h"
 
+//A set of hash function so we can map wxWebHistoryItems to WebKitWebHistoryItems
+class SharedPtrHash
+{
+public:
+    SharedPtrHash() { }
+
+    unsigned long operator()( const wxSharedPtr<wxWebHistoryItem> & item ) const
+    {
+        
+        return wxPointerHash()(item.get());
+    }
+    SharedPtrHash& operator=(const SharedPtrHash&) { return *this; }
+};
+
+class SharedPtrEqual
+{
+public:
+    SharedPtrEqual() { }
+    bool operator()( const wxSharedPtr<wxWebHistoryItem> & a,
+                     const wxSharedPtr<wxWebHistoryItem> & b ) const
+    {
+        return wxPointerEqual()(a.get(), b.get());
+    }
+
+    SharedPtrEqual& operator=(const SharedPtrEqual&) { return *this; }
+};
+
+WX_DECLARE_HASH_MAP(wxSharedPtr<wxWebHistoryItem>, WebKitWebHistoryItem*,
+                    SharedPtrHash, SharedPtrEqual, HistoryItemHash);
+
 //-----------------------------------------------------------------------------
 // wxWebViewWebKit
 //-----------------------------------------------------------------------------
@@ -70,9 +102,17 @@ public:
     virtual void Reload(wxWebViewReloadFlags flags = wxWEB_VIEW_RELOAD_DEFAULT);
     virtual bool CanGoBack();
     virtual bool CanGoForward();
+    virtual void ClearHistory();
+    virtual void EnableHistory(bool enable = true);
+    virtual wxVector<wxSharedPtr<wxWebHistoryItem> > GetBackwardHistory();
+    virtual wxVector<wxSharedPtr<wxWebHistoryItem> > GetForwardHistory();
+    virtual void LoadHistoryItem(wxSharedPtr<wxWebHistoryItem> item);
     virtual wxString GetCurrentURL();
     virtual wxString GetCurrentTitle();
     virtual wxString GetPageSource();
+    virtual wxString GetPageText();
+    //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();
@@ -83,7 +123,33 @@ public:
     virtual wxWebViewZoom GetZoom();
     virtual void SetZoom(wxWebViewZoom);
 
-
+    //Clipboard functions
+    virtual bool CanCut();
+    virtual bool CanCopy();
+    virtual bool CanPaste();
+    virtual void Cut();
+    virtual void Copy();
+    virtual void Paste();
+
+    //Undo / redo functionality
+    virtual bool CanUndo();
+    virtual bool CanRedo();
+    virtual void Undo();
+    virtual void Redo();
+
+    //Editing functions
+    virtual void SetEditable(bool enable = true);
+    virtual bool IsEditable();
+
+    //Selection
+    virtual void DeleteSelection();
+    virtual bool HasSelection();
+    virtual void SelectAll();
+    virtual wxString GetSelectedText();
+    virtual wxString GetSelectedSource();
+    virtual void ClearSelection();
+
+    virtual void RunScript(const wxString& javascript);
 
     /** FIXME: hack to work around signals being received too early */
     bool m_ready;
@@ -107,6 +173,8 @@ private:
     void GTKOnFocus(wxFocusEvent& event);
 
     GtkWidget *web_view;
+    gint m_historyLimit;
+    HistoryItemHash m_historyMap;
 
     // FIXME: try to get DECLARE_DYNAMIC_CLASS macros & stuff right
     //DECLARE_DYNAMIC_CLASS(wxWebViewWebKit)