]>
git.saurik.com Git - wxWidgets.git/blob - src/xrc/xh_html.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/xrc/xh_html.cpp
3 // Purpose: XRC resource for wxHtmlWindow
4 // Author: Bob Mitchell
6 // Copyright: (c) 2000 Bob Mitchell and Verant Interactive
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
17 #if wxUSE_XRC && wxUSE_HTML
19 #include "wx/xrc/xh_html.h"
21 #include "wx/html/htmlwin.h"
22 #include "wx/filesys.h"
24 IMPLEMENT_DYNAMIC_CLASS(wxHtmlWindowXmlHandler
, wxXmlResourceHandler
)
26 wxHtmlWindowXmlHandler::wxHtmlWindowXmlHandler()
27 : wxXmlResourceHandler()
29 XRC_ADD_STYLE(wxHW_SCROLLBAR_NEVER
);
30 XRC_ADD_STYLE(wxHW_SCROLLBAR_AUTO
);
31 XRC_ADD_STYLE(wxHW_NO_SELECTION
);
35 wxObject
*wxHtmlWindowXmlHandler::DoCreateResource()
37 XRC_MAKE_INSTANCE(control
, wxHtmlWindow
)
39 control
->Create(m_parentAsWindow
,
41 GetPosition(), GetSize(),
42 GetStyle(wxT("style"), wxHW_SCROLLBAR_AUTO
),
45 if (HasParam(wxT("borders")))
47 control
->SetBorders(GetDimension(wxT("borders")));
50 if (HasParam(wxT("url")))
52 wxString url
= GetParamValue(wxT("url"));
53 wxFileSystem
& fsys
= GetCurFileSystem();
55 wxFSFile
*f
= fsys
.OpenFile(url
);
58 control
->LoadPage(f
->GetLocation());
62 control
->LoadPage(url
);
65 else if (HasParam(wxT("htmlcode")))
67 control
->SetPage(GetText(wxT("htmlcode")));
75 bool wxHtmlWindowXmlHandler::CanHandle(wxXmlNode
*node
)
77 return IsOfClass(node
, wxT("wxHtmlWindow"));
80 #endif // wxUSE_XRC && wxUSE_HTML