]> git.saurik.com Git - wxWidgets.git/blame - src/xrc/xh_html.cpp
Reflect changes in stc.cpp in stc.cpp.in from which it's generated.
[wxWidgets.git] / src / xrc / xh_html.cpp
CommitLineData
78d14f80 1/////////////////////////////////////////////////////////////////////////////
80fdcdb9 2// Name: src/xrc/xh_html.cpp
b5d6954b 3// Purpose: XRC resource for wxHtmlWindow
78d14f80
VS
4// Author: Bob Mitchell
5// Created: 2000/03/21
78d14f80
VS
6// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
7// Licence: wxWindows licence
8/////////////////////////////////////////////////////////////////////////////
f80ea77b 9
78d14f80
VS
10// For compilers that support precompilation, includes "wx.h".
11#include "wx/wxprec.h"
12
13#ifdef __BORLANDC__
14 #pragma hdrstop
15#endif
16
621be1ec 17#if wxUSE_XRC && wxUSE_HTML
78d14f80 18
a1e4ec87 19#include "wx/xrc/xh_html.h"
78d14f80
VS
20
21#include "wx/html/htmlwin.h"
135ace6d 22#include "wx/filesys.h"
78d14f80 23
854e189f 24IMPLEMENT_DYNAMIC_CLASS(wxHtmlWindowXmlHandler, wxXmlResourceHandler)
78d14f80 25
f80ea77b
WS
26wxHtmlWindowXmlHandler::wxHtmlWindowXmlHandler()
27: wxXmlResourceHandler()
78d14f80 28{
544fee32
VS
29 XRC_ADD_STYLE(wxHW_SCROLLBAR_NEVER);
30 XRC_ADD_STYLE(wxHW_SCROLLBAR_AUTO);
161a87e6 31 XRC_ADD_STYLE(wxHW_NO_SELECTION);
78d14f80
VS
32 AddWindowStyles();
33}
34
35wxObject *wxHtmlWindowXmlHandler::DoCreateResource()
f2588180 36{
544fee32 37 XRC_MAKE_INSTANCE(control, wxHtmlWindow)
f2588180
VS
38
39 control->Create(m_parentAsWindow,
40 GetID(),
41 GetPosition(), GetSize(),
42 GetStyle(wxT("style"), wxHW_SCROLLBAR_AUTO),
43 GetName());
44
45 if (HasParam(wxT("borders")))
78d14f80 46 {
f2588180 47 control->SetBorders(GetDimension(wxT("borders")));
78d14f80
VS
48 }
49
544fee32 50 if (HasParam(wxT("url")))
78d14f80 51 {
f2588180 52 wxString url = GetParamValue(wxT("url"));
135ace6d 53 wxFileSystem& fsys = GetCurFileSystem();
f80ea77b 54
135ace6d
VS
55 wxFSFile *f = fsys.OpenFile(url);
56 if (f)
57 {
58 control->LoadPage(f->GetLocation());
59 delete f;
60 }
61 else
62 control->LoadPage(url);
78d14f80 63 }
f80ea77b 64
f2588180 65 else if (HasParam(wxT("htmlcode")))
78d14f80 66 {
f2588180 67 control->SetPage(GetText(wxT("htmlcode")));
78d14f80
VS
68 }
69
70 SetupWindow(control);
f80ea77b 71
78d14f80
VS
72 return control;
73}
74
78d14f80
VS
75bool wxHtmlWindowXmlHandler::CanHandle(wxXmlNode *node)
76{
77 return IsOfClass(node, wxT("wxHtmlWindow"));
78}
79
621be1ec 80#endif // wxUSE_XRC && wxUSE_HTML