Rename wxWebFileHandler to wxWebViewArchiveHandler, wxWebHandler to wxWebViewHandler. Update the documentation and the sample. Add a constructor taking a wxString to specify the scheme in wxWebViewHandler.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/SOC2011_WEBVIEW@68689 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Steve Lamerton
2011-08-14 12:15:34 +00:00
parent 3beb50e570
commit 7d8d6163ad
12 changed files with 62 additions and 56 deletions

View File

@@ -122,8 +122,8 @@ public:
virtual void RunScript(const wxString& javascript);
//Virtual Filesystem Support
virtual void RegisterHandler(wxSharedPtr<wxWebHandler> handler);
virtual wxVector<wxSharedPtr<wxWebHandler> > GetHandlers() { return m_handlerList; }
virtual void RegisterHandler(wxSharedPtr<wxWebViewHandler> handler);
virtual wxVector<wxSharedPtr<wxWebViewHandler> > GetHandlers() { return m_handlerList; }
/** FIXME: hack to work around signals being received too early */
bool m_ready;
@@ -155,7 +155,7 @@ private:
GtkWidget *web_view;
gint m_historyLimit;
wxVector<wxSharedPtr<wxWebHandler> > m_handlerList;
wxVector<wxSharedPtr<wxWebViewHandler> > m_handlerList;
wxDECLARE_DYNAMIC_CLASS(wxWebViewWebKit);
};

View File

@@ -110,7 +110,7 @@ public:
virtual void RunScript(const wxString& javascript);
//Virtual Filesystem Support
virtual void RegisterHandler(wxSharedPtr<wxWebHandler> handler);
virtual void RegisterHandler(wxSharedPtr<wxWebViewHandler> handler);
// ---- IE-specific methods
@@ -169,10 +169,10 @@ protected:
VOID * fileP;
wxFSFile* m_file;
wxSharedPtr<wxWebHandler> m_handler;
wxSharedPtr<wxWebViewHandler> m_handler;
public:
VirtualProtocol(wxSharedPtr<wxWebHandler> handler);
VirtualProtocol(wxSharedPtr<wxWebViewHandler> handler);
~VirtualProtocol();
//IUnknown
@@ -211,7 +211,7 @@ class ClassFactory : public IClassFactory
private:
ULONG m_refCount;
public:
ClassFactory(wxSharedPtr<wxWebHandler> handler) : m_handler(handler) {}
ClassFactory(wxSharedPtr<wxWebViewHandler> handler) : m_handler(handler) {}
//IUnknown
ULONG STDMETHODCALLTYPE AddRef();
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject);
@@ -222,7 +222,7 @@ public:
REFIID riid, void** ppvObject);
HRESULT STDMETHODCALLTYPE LockServer(BOOL fLock);
private:
wxSharedPtr<wxWebHandler> m_handler;
wxSharedPtr<wxWebViewHandler> m_handler;
};
#endif // wxUSE_WEBVIEW_IE && defined(__WXMSW__)

View File

@@ -114,7 +114,7 @@ public:
void RunScript(const wxString& javascript);
//Virtual Filesystem Support
virtual void RegisterHandler(wxSharedPtr<wxWebHandler> handler);
virtual void RegisterHandler(wxSharedPtr<wxWebViewHandler> handler);
// ---- methods not from the parent (common) interface
bool CanGetPageSource();

View File

@@ -101,11 +101,14 @@ enum wxWebViewBackend
};
//Base class for custom scheme handlers
class WXDLLIMPEXP_WEB wxWebHandler
class WXDLLIMPEXP_WEB wxWebViewHandler
{
public:
virtual wxString GetName() const = 0;
wxWebViewHandler(const wxString& scheme) : m_scheme(scheme) {}
virtual wxString GetName() const { return m_scheme; }
virtual wxFSFile* GetFile(const wxString &uri) = 0;
private:
wxString m_scheme;
};
extern WXDLLIMPEXP_DATA_WEB(const char) wxWebViewNameStr[];
@@ -339,7 +342,7 @@ public:
virtual void Redo() = 0;
//Virtual Filesystem Support
virtual void RegisterHandler(wxSharedPtr<wxWebHandler> handler) = 0;
virtual void RegisterHandler(wxSharedPtr<wxWebViewHandler> handler) = 0;
wxDECLARE_ABSTRACT_CLASS(wxWebView);
};

View File

@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
// Name: webviewfilehandler.h
// Purpose: Custom handler for the file scheme to allow archive browsing
// Name: webviewarchivehandler.h
// Purpose: Custom webview handler to allow archive browsing
// Author: Steven Lamerton
// Id: $Id$
// Copyright: (c) 2011 Steven Lamerton
@@ -19,17 +19,15 @@ class wxFileSystem;
#include "wx/webview.h"
//Loads from uris such as file:///C:/example/example.html or archives such as
//file:///C:/example/example.zip;protocol=zip/example.html
//Loads from uris such as scheme:///C:/example/example.html or archives such as
//scheme:///C:/example/example.zip;protocol=zip/example.html
class WXDLLIMPEXP_WEB wxWebFileHandler : public wxWebHandler
class WXDLLIMPEXP_WEB wxWebViewArchiveHandler : public wxWebViewHandler
{
public:
wxWebFileHandler();
virtual wxString GetName() const { return m_name; }
wxWebViewArchiveHandler(const wxString& scheme);
virtual wxFSFile* GetFile(const wxString &uri);
private:
wxString m_name;
wxFileSystem* m_fileSystem;
};