]>
git.saurik.com Git - wxWidgets.git/blob - contrib/src/xrc/xh_html.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: XRC 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 XRC_ADD_STYLE(wxHW_SCROLLBAR_NEVER
);
34 XRC_ADD_STYLE(wxHW_SCROLLBAR_AUTO
);
38 wxObject
*wxHtmlWindowXmlHandler::DoCreateResource()
40 XRC_MAKE_INSTANCE(control
, wxHtmlWindow
)
42 control
->Create(m_parentAsWindow
,
44 GetPosition(), GetSize(),
45 GetStyle(wxT("style"), wxHW_SCROLLBAR_AUTO
),
48 if (HasParam(wxT("borders")))
50 control
->SetBorders(GetDimension(wxT("borders")));
53 if (HasParam(wxT("url")))
55 wxString url
= GetParamValue(wxT("url"));
56 wxFileSystem
& fsys
= GetCurFileSystem();
58 wxFSFile
*f
= fsys
.OpenFile(url
);
61 control
->LoadPage(f
->GetLocation());
65 control
->LoadPage(url
);
68 else if (HasParam(wxT("htmlcode")))
70 control
->SetPage(GetText(wxT("htmlcode")));
78 bool wxHtmlWindowXmlHandler::CanHandle(wxXmlNode
*node
)
80 return IsOfClass(node
, wxT("wxHtmlWindow"));