]>
git.saurik.com Git - wxWidgets.git/blob - contrib/src/xrc/xh_html.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: XML resource for wxHtmlWindow
4 // Author: Bob Mitchell
7 // Copyright: (c) 2000 Bob Mitchell and Verant Interactive
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
12 #pragma implementation "xh_html.h"
15 // For compilers that support precompilation, includes "wx.h".
16 #include "wx/wxprec.h"
22 #include "wx/xrc/xh_html.h"
26 #include "wx/html/htmlwin.h"
27 #include "wx/filesys.h"
30 wxHtmlWindowXmlHandler::wxHtmlWindowXmlHandler()
31 : wxXmlResourceHandler()
33 ADD_STYLE( wxHW_SCROLLBAR_NEVER
);
34 ADD_STYLE( wxHW_SCROLLBAR_AUTO
);
38 wxObject
*wxHtmlWindowXmlHandler::DoCreateResource()
40 wxHtmlWindow
*control
= new wxHtmlWindow(m_parentAsWindow
,
42 GetPosition(), GetSize(),
43 GetStyle( wxT("style" ), wxHW_SCROLLBAR_AUTO
),
47 if( HasParam( wxT("borders") ))
49 control
->SetBorders( GetDimension( wxT("borders" )));
52 if( HasParam( wxT("url") ))
54 wxString url
= GetParamValue(wxT("url" ));
55 wxFileSystem
& fsys
= GetCurFileSystem();
57 wxFSFile
*f
= fsys
.OpenFile(url
);
60 control
->LoadPage(f
->GetLocation());
64 control
->LoadPage(url
);
67 else if( HasParam( wxT("htmlcode") ))
69 control
->SetPage( GetText(wxT("htmlcode")) );
79 bool wxHtmlWindowXmlHandler::CanHandle(wxXmlNode
*node
)
81 return IsOfClass(node
, wxT("wxHtmlWindow"));