// Purpose: Common interface and events for web view component
// Author: Marianne Gagnon
// Id: $Id$
-// Copyright: (c) 2010 Marianne Gagnon
+// Copyright: (c) 2010 Marianne Gagnon, 2011 Steven Lamerton
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "wx/sharedptr.h"
#include "wx/vector.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; }
+#include "wx/osx/webhistoryitem_webkit.h"
+#include "wx/gtk/webhistoryitem_webkit.h"
+#include "wx/msw/webhistoryitem_ie.h"
+
+class wxFSFile;
+class wxFileSystem;
-private:
- wxString m_url, m_title;
-};
/**
* Zoom level in web view component
wxWEB_VIEW_BACKEND_IE
};
+//Base class for custom scheme handlers
+class WXDLLIMPEXP_WEB wxWebHandler
+{
+public:
+ virtual wxString GetName() const = 0;
+ virtual wxFSFile* GetFile(const wxString &uri) = 0;
+ virtual wxString CombineURIs(const wxString &baseuri, const wxString &newuri) = 0;
+};
+
extern WXDLLIMPEXP_DATA_WEB(const char) wxWebViewNameStr[];
extern WXDLLIMPEXP_DATA_WEB(const char) wxWebViewDefaultURLStr[];
virtual bool CanRedo() = 0;
virtual void Undo() = 0;
virtual void Redo() = 0;
+
+ //Virtual Filesystem Support
+ virtual void RegisterHandler(wxWebHandler* handler) = 0;
+
+ wxDECLARE_ABSTRACT_CLASS(wxWebView);
};
class WXDLLIMPEXP_WEB wxWebNavigationEvent : public wxCommandEvent
{
public:
wxWebNavigationEvent() {}
- wxWebNavigationEvent(wxEventType type, int id, const wxString href,
+ wxWebNavigationEvent(wxEventType type, int id, const wxString url,
const wxString target, bool canVeto)
: wxCommandEvent(type, id)
{
- m_href = href;
+ m_url = url;
m_target = target;
m_vetoed = false;
m_canVeto = canVeto;
/**
* Get the URL being visited
*/
- const wxString& GetHref() const { return m_href; }
+ const wxString& GetURL() const { return m_url; }
/**
* Get the target (frame or window) in which the URL that caused this event
void Veto() { wxASSERT(m_canVeto); m_vetoed = true; }
private:
- wxString m_href;
+ wxString m_url;
wxString m_target;
bool m_canVeto;
bool m_vetoed;
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEB, wxEVT_COMMAND_WEB_VIEW_LOADED, wxWebNavigationEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEB, wxEVT_COMMAND_WEB_VIEW_ERROR, wxWebNavigationEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEB, wxEVT_COMMAND_WEB_VIEW_NEWWINDOW, wxWebNavigationEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEB, wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED, wxWebNavigationEvent );
typedef void (wxEvtHandler::*wxWebNavigationEventFunction)
(wxWebNavigationEvent&);
wx__DECLARE_EVT1(wxEVT_COMMAND_WEB_VIEW_NEWWINDOW, id, \
wxHtmlNavigatingEventHandler(fn))
+#define EVT_WEB_VIEW_TITLE_CHANGED(id, fn) \
+ wx__DECLARE_EVT1(wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED, id, \
+ wxHtmlNavigatingEventHandler(fn))
+
#endif // wxUSE_WEB
#endif // _WX_WEB_VIEW_H_