1 ///////////////////////////////////////////////////////////////////////////// 
   3 // Purpose:     Common interface and events for web view component 
   4 // Author:      Marianne Gagnon 
   6 // Copyright:   (c) 2010 Marianne Gagnon 
   7 // Licence:     wxWindows licence 
   8 ///////////////////////////////////////////////////////////////////////////// 
  10 // For compilers that support precompilation, includes "wx.h". 
  11 #include "wx/wxprec.h" 
  13 #if defined(__BORLANDC__) 
  17 #include "wx/webview.h" 
  19 #include "wx/osx/webview.h" 
  20 #include "wx/gtk/webview.h" 
  21 #include "wx/msw/webviewie.h" 
  23 // DLL options compatibility check: 
  25 WX_CHECK_BUILD_OPTIONS("wxWEB") 
  27 extern WXDLLEXPORT_DATA(const char) wxWebViewNameStr
[] = "wxWebView"; 
  28 extern WXDLLEXPORT_DATA(const char) wxWebViewDefaultURLStr
[] = "about:blank"; 
  30 IMPLEMENT_DYNAMIC_CLASS(wxWebNavigationEvent
, wxCommandEvent
) 
  32 wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NAVIGATING
, wxWebNavigationEvent 
); 
  33 wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NAVIGATED
, wxWebNavigationEvent 
); 
  34 wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_LOADED
, wxWebNavigationEvent 
); 
  35 wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_ERROR
, wxWebNavigationEvent 
); 
  38 wxWebView
* wxWebView::New(wxWebViewBackend backend
) 
  42         #if wxHAVE_WEB_BACKEND_OSX_WEBKIT 
  43             case wxWEB_VIEW_BACKEND_OSX_WEBKIT
: 
  44                 return new wxOSXWebKitCtrl(); 
  47         #if wxHAVE_WEB_BACKEND_GTK_WEBKIT 
  48             case wxWEB_VIEW_BACKEND_GTK_WEBKIT
: 
  49                 return new wxGtkWebKitCtrl(); 
  52         #if wxHAVE_WEB_BACKEND_IE 
  53             case wxWEB_VIEW_BACKEND_IE
: 
  54                 return new wxIEPanel(); 
  57         case wxWEB_VIEW_BACKEND_DEFAULT
: 
  59             #if wxHAVE_WEB_BACKEND_OSX_WEBKIT 
  60             return new wxOSXWebKitCtrl(); 
  63             #if wxHAVE_WEB_BACKEND_GTK_WEBKIT 
  64             return new wxGtkWebKitCtrl(); 
  67             #if wxHAVE_WEB_BACKEND_IE 
  68             return new wxIEPanel(); 
  71         // fall-through intended 
  78 wxWebView
* wxWebView::New(wxWindow
* parent
, 
  83        wxWebViewBackend backend
, 
  89         #if wxHAVE_WEB_BACKEND_OSX_WEBKIT 
  90             case wxWEB_VIEW_BACKEND_OSX_WEBKIT
: 
  91                 return new wxOSXWebKitCtrl(parent
, id
, url
, pos
, size
, style
, 
  95         #if wxHAVE_WEB_BACKEND_GTK_WEBKIT 
  96             case wxWEB_VIEW_BACKEND_GTK_WEBKIT
: 
  97                 return new wxGtkWebKitCtrl(parent
, id
, url
, pos
, size
, style
, 
 101         #if wxHAVE_WEB_BACKEND_IE 
 102             case wxWEB_VIEW_BACKEND_IE
: 
 103                 return new wxIEPanel(parent
, id
, url
, pos
, size
, style
, name
); 
 106         case wxWEB_VIEW_BACKEND_DEFAULT
: 
 108             #if wxHAVE_WEB_BACKEND_OSX_WEBKIT 
 109             return new wxOSXWebKitCtrl(parent
, id
, url
, pos
, size
, style
, name
); 
 112             #if wxHAVE_WEB_BACKEND_GTK_WEBKIT 
 113             return new wxGtkWebKitCtrl(parent
, id
, url
, pos
, size
, style
, name
); 
 116             #if wxHAVE_WEB_BACKEND_IE 
 117             return new wxIEPanel(parent
, id
, url
, pos
, size
, style
, name
); 
 120         // fall-through intended