Implement extended history api in gtk

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/SOC2011_WEBVIEW@68122 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Steve Lamerton
2011-07-01 19:46:31 +00:00
parent 5cbda74b66
commit 19fc1a2f0d
2 changed files with 86 additions and 0 deletions

View File

@@ -14,8 +14,40 @@
#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
//-----------------------------------------------------------------------------
@@ -72,6 +104,9 @@ public:
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();
@@ -110,6 +145,7 @@ private:
GtkWidget *web_view;
gint m_historyLimit;
HistoryItemHash m_historyMap;
// FIXME: try to get DECLARE_DYNAMIC_CLASS macros & stuff right
//DECLARE_DYNAMIC_CLASS(wxWebViewWebKit)