]>
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"
29 IMPLEMENT_DYNAMIC_CLASS(wxHtmlWindowXmlHandler
, wxXmlResourceHandler
)
31 wxHtmlWindowXmlHandler::wxHtmlWindowXmlHandler()
32 : wxXmlResourceHandler()
34 XRC_ADD_STYLE(wxHW_SCROLLBAR_NEVER
);
35 XRC_ADD_STYLE(wxHW_SCROLLBAR_AUTO
);
36 XRC_ADD_STYLE(wxHW_NO_SELECTION
);
40 wxObject
*wxHtmlWindowXmlHandler::DoCreateResource()
42 XRC_MAKE_INSTANCE(control
, wxHtmlWindow
)
44 control
->Create(m_parentAsWindow
,
46 GetPosition(), GetSize(),
47 GetStyle(wxT("style"), wxHW_SCROLLBAR_AUTO
),
50 if (HasParam(wxT("borders")))
52 control
->SetBorders(GetDimension(wxT("borders")));
55 if (HasParam(wxT("url")))
57 wxString url
= GetParamValue(wxT("url"));
58 wxFileSystem
& fsys
= GetCurFileSystem();
60 wxFSFile
*f
= fsys
.OpenFile(url
);
63 control
->LoadPage(f
->GetLocation());
67 control
->LoadPage(url
);
70 else if (HasParam(wxT("htmlcode")))
72 control
->SetPage(GetText(wxT("htmlcode")));
80 bool wxHtmlWindowXmlHandler::CanHandle(wxXmlNode
*node
)
82 return IsOfClass(node
, wxT("wxHtmlWindow"));