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