From: Václav Slavík Date: Tue, 28 Aug 2001 22:12:44 +0000 (+0000) Subject: make it possible to open files from XRC in wxHtmlWindow X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/135ace6d7bc9a861b93b9482ad1518688bc6e6bd make it possible to open files from XRC in wxHtmlWindow git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11507 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/contrib/src/xrc/xh_html.cpp b/contrib/src/xrc/xh_html.cpp index affa03f68f..dab79dc4c5 100644 --- a/contrib/src/xrc/xh_html.cpp +++ b/contrib/src/xrc/xh_html.cpp @@ -24,6 +24,7 @@ #if wxUSE_HTML #include "wx/html/htmlwin.h" +#include "wx/filesys.h" wxHtmlWindowXmlHandler::wxHtmlWindowXmlHandler() @@ -50,8 +51,19 @@ wxObject *wxHtmlWindowXmlHandler::DoCreateResource() if( HasParam( wxT("url") )) { - control->LoadPage( GetParamValue( wxT("url" ))); + wxString url = GetParamValue(wxT("url" )); + wxFileSystem& fsys = GetCurFileSystem(); + + wxFSFile *f = fsys.OpenFile(url); + if (f) + { + control->LoadPage(f->GetLocation()); + delete f; + } + else + control->LoadPage(url); } + else if( HasParam( wxT("htmlcode") )) { control->SetPage( GetText(wxT("htmlcode")) ); diff --git a/src/xrc/xh_html.cpp b/src/xrc/xh_html.cpp index affa03f68f..dab79dc4c5 100644 --- a/src/xrc/xh_html.cpp +++ b/src/xrc/xh_html.cpp @@ -24,6 +24,7 @@ #if wxUSE_HTML #include "wx/html/htmlwin.h" +#include "wx/filesys.h" wxHtmlWindowXmlHandler::wxHtmlWindowXmlHandler() @@ -50,8 +51,19 @@ wxObject *wxHtmlWindowXmlHandler::DoCreateResource() if( HasParam( wxT("url") )) { - control->LoadPage( GetParamValue( wxT("url" ))); + wxString url = GetParamValue(wxT("url" )); + wxFileSystem& fsys = GetCurFileSystem(); + + wxFSFile *f = fsys.OpenFile(url); + if (f) + { + control->LoadPage(f->GetLocation()); + delete f; + } + else + control->LoadPage(url); } + else if( HasParam( wxT("htmlcode") )) { control->SetPage( GetText(wxT("htmlcode")) );