]>
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 ///////////////////////////////////////////////////////////////////////////// 
  11 // For compilers that support precompilation, includes "wx.h". 
  12 #include "wx/wxprec.h" 
  18 #if wxUSE_XRC && wxUSE_HTML 
  20 #include "wx/xrc/xh_html.h" 
  22 #include "wx/html/htmlwin.h" 
  23 #include "wx/filesys.h" 
  25 IMPLEMENT_DYNAMIC_CLASS(wxHtmlWindowXmlHandler
, wxXmlResourceHandler
) 
  27 wxHtmlWindowXmlHandler::wxHtmlWindowXmlHandler() 
  28 : wxXmlResourceHandler() 
  30     XRC_ADD_STYLE(wxHW_SCROLLBAR_NEVER
); 
  31     XRC_ADD_STYLE(wxHW_SCROLLBAR_AUTO
); 
  32     XRC_ADD_STYLE(wxHW_NO_SELECTION
); 
  36 wxObject 
*wxHtmlWindowXmlHandler::DoCreateResource() 
  38     XRC_MAKE_INSTANCE(control
, wxHtmlWindow
) 
  40     control
->Create(m_parentAsWindow
, 
  42                     GetPosition(), GetSize(), 
  43                     GetStyle(wxT("style"), wxHW_SCROLLBAR_AUTO
), 
  46     if (HasParam(wxT("borders"))) 
  48         control
->SetBorders(GetDimension(wxT("borders"))); 
  51     if (HasParam(wxT("url"))) 
  53         wxString url 
= GetParamValue(wxT("url")); 
  54         wxFileSystem
& fsys 
= GetCurFileSystem(); 
  56         wxFSFile 
*f 
= fsys
.OpenFile(url
); 
  59             control
->LoadPage(f
->GetLocation()); 
  63             control
->LoadPage(url
); 
  66     else if (HasParam(wxT("htmlcode"))) 
  68         control
->SetPage(GetText(wxT("htmlcode"))); 
  76 bool wxHtmlWindowXmlHandler::CanHandle(wxXmlNode 
*node
) 
  78     return IsOfClass(node
, wxT("wxHtmlWindow")); 
  81 #endif // wxUSE_XRC && wxUSE_HTML