]>
git.saurik.com Git - wxWidgets.git/blob - src/xrc/xh_html.cpp
f7fe6ae91f8483edea130ddaaee5b6b96af50ef5
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 /////////////////////////////////////////////////////////////////////////////
11 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
12 #pragma implementation "xh_html.h"
15 // For compilers that support precompilation, includes "wx.h".
16 #include "wx/wxprec.h"
22 #if wxUSE_XRC && wxUSE_HTML
24 #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"));
85 #endif // wxUSE_XRC && wxUSE_HTML