]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/webviewfshandler.cpp
Add generic wxFileSystem support to wxWebView using wxWebViewFSHandler.
[wxWidgets.git] / src / common / webviewfshandler.cpp
diff --git a/src/common/webviewfshandler.cpp b/src/common/webviewfshandler.cpp
new file mode 100644 (file)
index 0000000..bf50748
--- /dev/null
@@ -0,0 +1,38 @@
+/////////////////////////////////////////////////////////////////////////////\r
+// Name:        webviewfshandler.cpp\r
+// Purpose:     Custom webview handler for virtual file system\r
+// Author:      Nick Matthews\r
+// Id:          $Id$\r
+// Copyright:   (c) 2012 Steven Lamerton\r
+// Licence:     wxWindows licence\r
+/////////////////////////////////////////////////////////////////////////////\r
+\r
+// For compilers that support precompilation, includes "wx.h".\r
+#include "wx/wxprec.h"\r
+\r
+#if wxUSE_WEBVIEW\r
+\r
+#if defined(__BORLANDC__)\r
+    #pragma hdrstop\r
+#endif\r
+\r
+#include "wx/webviewfshandler.h"\r
+#include "wx/filesys.h"\r
+\r
+wxWebViewFSHandler::wxWebViewFSHandler(const wxString& scheme) :\r
+                         wxWebViewHandler(scheme)\r
+{\r
+    m_fileSystem = new wxFileSystem();\r
+}\r
+\r
+wxWebViewFSHandler::~wxWebViewFSHandler()\r
+{\r
+    wxDELETE(m_fileSystem);\r
+}\r
+\r
+wxFSFile* wxWebViewFSHandler::GetFile(const wxString &uri)\r
+{\r
+    return m_fileSystem->OpenFile(uri);\r
+}\r
+\r
+#endif // wxUSE_WEBVIEW\r