]>
git.saurik.com Git - wxWidgets.git/blob - 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
);
35 XRC_ADD_STYLE(wxHW_NO_SELECTION
);
39 wxObject
*wxHtmlWindowXmlHandler::DoCreateResource()
41 XRC_MAKE_INSTANCE(control
, wxHtmlWindow
)
43 control
->Create(m_parentAsWindow
,
45 GetPosition(), GetSize(),
46 GetStyle(wxT("style"), wxHW_SCROLLBAR_AUTO
),
49 if (HasParam(wxT("borders")))
51 control
->SetBorders(GetDimension(wxT("borders")));
54 if (HasParam(wxT("url")))
56 wxString url
= GetParamValue(wxT("url"));
57 wxFileSystem
& fsys
= GetCurFileSystem();
59 wxFSFile
*f
= fsys
.OpenFile(url
);
62 control
->LoadPage(f
->GetLocation());
66 control
->LoadPage(url
);
69 else if (HasParam(wxT("htmlcode")))
71 control
->SetPage(GetText(wxT("htmlcode")));
79 bool wxHtmlWindowXmlHandler::CanHandle(wxXmlNode
*node
)
81 return IsOfClass(node
, wxT("wxHtmlWindow"));