1 /////////////////////////////////////////////////////////////////////////////
2 // Name: include/wx/msw/webviewie.h
3 // Purpose: wxMSW IE wxWebView backend
4 // Author: Marianne Gagnon
6 // Copyright: (c) 2010 Marianne Gagnon, Steven Lamerton
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
17 #include "wx/control.h"
18 #include "wx/webview.h"
19 #include "wx/msw/ole/automtn.h"
20 #include "wx/msw/ole/activex.h"
21 #include "wx/sharedptr.h"
22 #include "wx/vector.h"
24 class WXDLLIMPEXP_WEB wxWebViewIE
: public wxWebView
30 wxWebViewIE(wxWindow
* parent
,
32 const wxString
& url
= wxWebViewDefaultURLStr
,
33 const wxPoint
& pos
= wxDefaultPosition
,
34 const wxSize
& size
= wxDefaultSize
,
36 const wxString
& name
= wxWebViewNameStr
)
38 Create(parent
, id
, url
, pos
, size
, style
, name
);
41 bool Create(wxWindow
* parent
,
43 const wxString
& url
= wxWebViewDefaultURLStr
,
44 const wxPoint
& pos
= wxDefaultPosition
,
45 const wxSize
& size
= wxDefaultSize
,
47 const wxString
& name
= wxWebViewNameStr
);
49 virtual void LoadUrl(const wxString
& url
);
50 virtual void LoadHistoryItem(wxSharedPtr
<wxWebHistoryItem
> item
);
51 virtual wxVector
<wxSharedPtr
<wxWebHistoryItem
> > GetBackwardHistory();
52 virtual wxVector
<wxSharedPtr
<wxWebHistoryItem
> > GetForwardHistory();
54 virtual bool CanGoForward();
55 virtual bool CanGoBack();
56 virtual void GoBack();
57 virtual void GoForward();
58 virtual void ClearHistory();
59 virtual void EnableHistory(bool enable
= true);
61 virtual void Reload(wxWebViewReloadFlags flags
= wxWEB_VIEW_RELOAD_DEFAULT
);
63 virtual wxString
GetPageSource();
65 virtual bool IsBusy();
66 virtual wxString
GetCurrentURL();
67 virtual wxString
GetCurrentTitle();
69 virtual void SetZoomType(wxWebViewZoomType
);
70 virtual wxWebViewZoomType
GetZoomType() const;
71 virtual bool CanSetZoomType(wxWebViewZoomType
) const;
75 virtual void SetPage(const wxString
& html
, const wxString
& baseUrl
);
77 virtual wxWebViewZoom
GetZoom();
78 virtual void SetZoom(wxWebViewZoom zoom
);
80 // ---- IE-specific methods
82 // FIXME: I seem to be able to access remote webpages even in offline mode...
84 void SetOfflineMode(bool offline
);
88 * @return text zoom from 0 to 4
95 void SetIETextZoom(int level
);
97 void SetIEOpticalZoom(float zoom
);
98 float GetIEOpticalZoom();
100 void onActiveXEvent(wxActiveXEvent
& evt
);
101 void onEraseBg(wxEraseEvent
& evt
) {}
103 DECLARE_EVENT_TABLE();
106 wxActiveXContainer
* m_container
;
107 wxAutomationObject m_ie
;
108 IWebBrowser2
* m_webBrowser
;
110 bool m_canNavigateBack
;
111 bool m_canNavigateForward
;
113 /** The "Busy" property of IWebBrowser2 does not always return busy when
114 * we'd want it to; this variable may be set to true in cases where the
115 * Busy property is false but should be true.
118 //We manage our own history, the history list contains the history items
119 //which are added as documentcomplete events arrive, unless we are loading
120 //an item from the history. The position is stored as an int, and reflects
121 //where we are in the history list.
122 wxVector
<wxSharedPtr
<wxWebHistoryItem
> > m_historyList
;
123 int m_historyPosition
;
124 bool m_historyLoadingFromList
;
125 bool m_historyEnabled
;
129 #endif // wxUSE_WEBVIEW_IE
131 #endif // wxWebViewIE_H