#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
//-----------------------------------------------------------------------------
virtual void RunScript(const wxString& javascript);
//Virtual Filesystem Support
- virtual void RegisterHandler(wxWebHandler* handler);
+ virtual void RegisterHandler(wxWebHandler* handler) {};
/** FIXME: hack to work around signals being received too early */
bool m_ready;
GtkWidget *web_view;
gint m_historyLimit;
- HistoryItemHash m_historyMap;
// FIXME: try to get DECLARE_DYNAMIC_CLASS macros & stuff right
//DECLARE_DYNAMIC_CLASS(wxWebViewWebKit)
for(int i = g_list_length(list) - 1; i >= 0 ; i--)
{
WebKitWebHistoryItem* gtkitem = (WebKitWebHistoryItem*)g_list_nth_data(list, i);
- wxSharedPtr<wxWebHistoryItem> item(new wxWebHistoryItem(
- webkit_web_history_item_get_uri(gtkitem),
- webkit_web_history_item_get_title(gtkitem)));
+ wxWebHistoryItem* wxitem = new wxWebHistoryItem(
+ webkit_web_history_item_get_uri(gtkitem),
+ webkit_web_history_item_get_title(gtkitem));
+ wxitem->m_histItem = gtkitem;
+ wxSharedPtr<wxWebHistoryItem> item(wxitem);
backhist.push_back(item);
- m_historyMap[item] = gtkitem;
}
return backhist;
}
for(guint i = 0; i < g_list_length(list); i++)
{
WebKitWebHistoryItem* gtkitem = (WebKitWebHistoryItem*)g_list_nth_data(list, i);
- wxSharedPtr<wxWebHistoryItem> item(new wxWebHistoryItem(
- webkit_web_history_item_get_uri(gtkitem),
- webkit_web_history_item_get_title(gtkitem)));
+ wxWebHistoryItem* wxitem = new wxWebHistoryItem(
+ webkit_web_history_item_get_uri(gtkitem),
+ webkit_web_history_item_get_title(gtkitem));
+ wxitem->m_histItem = gtkitem;
+ wxSharedPtr<wxWebHistoryItem> item(wxitem);
forwardhist.push_back(item);
- m_historyMap[item] = gtkitem;
}
return forwardhist;
}
void wxWebViewWebKit::LoadHistoryItem(wxSharedPtr<wxWebHistoryItem> item)
{
- WebKitWebHistoryItem* gtkitem = m_historyMap[item];
+ WebKitWebHistoryItem* gtkitem = item->m_histItem;
if(gtkitem)
{
WebKitWebBackForwardList* history;
history = webkit_web_view_get_back_forward_list(WEBKIT_WEB_VIEW(web_view));
- webkit_web_back_forward_list_go_to_item(history, gtkitem);
+ webkit_web_back_forward_list_go_to_item(WEBKIT_WEB_BACK_FORWARD_LIST(history),
+ WEBKIT_WEB_HISTORY_ITEM(gtkitem));
}
}