]> git.saurik.com Git - wxWidgets.git/commitdiff
Extend history api using the ie backend to include loading history items, and getting...
authorSteve Lamerton <steve.lamerton@gmail.com>
Fri, 1 Jul 2011 10:57:37 +0000 (10:57 +0000)
committerSteve Lamerton <steve.lamerton@gmail.com>
Fri, 1 Jul 2011 10:57:37 +0000 (10:57 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/SOC2011_WEBVIEW@68120 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/msw/webview_ie.h
include/wx/webview.h
interface/wx/webview.h
src/msw/webview_ie.cpp

index 666e17b32b6b6450688eef0a4786a024c29f58ea..f71e6d52978a396708f54cda285182c4fd0760b1 100644 (file)
 #include "wx/msw/ole/automtn.h"
 #include "wx/msw/ole/activex.h"
 #include "wx/sharedptr.h"
-
-class WXDLLIMPEXP_WEB wxWebHistoryItem
-{
-public:
-    wxWebHistoryItem(const wxString& url, const wxString& title) : 
-                     m_url(url), m_title(title) {}
-    wxString GetUrl() { return m_url; }
-    wxString GetTitle() { return m_title; }
-
-private:
-    wxString m_url, m_title;
-};
+#include "wx/vector.h"
 
 class WXDLLIMPEXP_WEB wxWebViewIE : public wxWebView
 {
@@ -59,6 +48,8 @@ public:
 
     virtual void LoadUrl(const wxString& url);
     virtual void LoadHistoryItem(wxSharedPtr<wxWebHistoryItem> item);
+    virtual wxVector<wxSharedPtr<wxWebHistoryItem> > GetBackwardHistory();
+    virtual wxVector<wxSharedPtr<wxWebHistoryItem> > GetForwardHistory();
 
     virtual bool CanGoForward();
     virtual bool CanGoBack();
index 53317c3421224f2d5b2c4decd3fd8f5379ea30b4..57812cbf81e3d0cb1acda164794220e8a0e6d555 100644 (file)
 #include <wx/control.h>
 #include <wx/event.h>
 #include <wx/sstream.h>
+#include "wx/sharedptr.h"
+
+class WXDLLIMPEXP_WEB wxWebHistoryItem
+{
+public:
+    wxWebHistoryItem(const wxString& url, const wxString& title) : 
+                     m_url(url), m_title(title) {}
+    wxString GetUrl() { return m_url; }
+    wxString GetTitle() { return m_title; }
+
+private:
+    wxString m_url, m_title;
+};
 
 /**
  * Zoom level in web view component
@@ -175,6 +188,9 @@ public:
 
     virtual void ClearHistory() = 0;
     virtual void EnableHistory(bool enable = true) = 0;
+    virtual wxVector<wxSharedPtr<wxWebHistoryItem> > GetBackwardHistory() = 0;
+    virtual wxVector<wxSharedPtr<wxWebHistoryItem> > GetForwardHistory() = 0;
+    virtual void LoadHistoryItem(wxSharedPtr<wxWebHistoryItem> item) = 0;
 
     /**
      * Stop the current page loading process, if any.
index fafba64940b23be53c031f9c0aa55b897eb03306..55f3708bf5945acc41223e955a03c24eb8351a55 100644 (file)
@@ -208,6 +208,24 @@ public:
         Enable or disable the history. This will also clear the history.\r
     */\r
     virtual void EnableHistory(bool enable = true) = 0;\r
+\r
+    /**\r
+        Returns a list of items in the back history. The first item in the\r
+        vector is the first page that was loaded by the control.\r
+    */\r
+    virtual wxVector<wxSharedPtr<wxWebHistoryItem> > GetBackwardHistory() = 0;\r
+    \r
+    /**\r
+        Returns a list of items in the forward history. The first item in the \r
+        vector is the next item in the history with respect to the curently \r
+        loaded page.\r
+    */\r
+    virtual wxVector<wxSharedPtr<wxWebHistoryItem> > GetForwardHistory() = 0;\r
+    \r
+    /**\r
+        Loads a history item. \r
+    */\r
+    virtual void LoadHistoryItem(wxSharedPtr<wxWebHistoryItem> item) = 0;\r
     \r
     /**\r
         Load a HTMl document (web page) from a URL\r
index 17e6fa308eac7964640512be0a93a3848c91272a..2823949274706cbea3eadd50152fd01b46b8d8bb 100644 (file)
@@ -388,6 +388,30 @@ void wxWebViewIE::LoadHistoryItem(wxSharedPtr<wxWebHistoryItem> item)
     m_historyPosition = pos;
 }
 
+wxVector<wxSharedPtr<wxWebHistoryItem> > wxWebViewIE::GetBackwardHistory()
+{
+    wxVector<wxSharedPtr<wxWebHistoryItem> > backhist;
+    //As we don't have std::copy or an iterator constructor in the wxwidgets
+    //native vector we construct it by hand
+    for(int i = 0; i < m_historyPosition; i++)
+    {
+        backhist.push_back(m_historyList[i]);
+    }
+    return backhist;
+}
+
+wxVector<wxSharedPtr<wxWebHistoryItem> > wxWebViewIE::GetForwardHistory()
+{
+    wxVector<wxSharedPtr<wxWebHistoryItem> > forwardhist;
+    //As we don't have std::copy or an iterator constructor in the wxwidgets
+    //native vector we construct it by hand
+    for(int i = m_historyPosition + 1; i < m_historyList.size(); i++)
+    {
+        forwardhist.push_back(m_historyList[i]);
+    }
+    return forwardhist;
+}
+
 void wxWebViewIE::GoBack()
 {
     LoadHistoryItem(m_historyList[m_historyPosition - 1]);