Add basic history api and implement it under gtk.
[wxWidgets.git] / include / wx / msw / webview_ie.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: include/wx/msw/webviewie.h
3 // Purpose: wxMSW IE wxWebView backend
4 // Author: Marianne Gagnon
5 // Id: $Id$
6 // Copyright: (c) 2010 Marianne Gagnon
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifndef wxWebViewIE_H
11 #define wxWebViewIE_H
12
13 #include "wx/setup.h"
14
15 #if wxUSE_WEBVIEW_IE
16
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
22 class WXDLLIMPEXP_WEB wxWebViewIE : public wxWebView
23 {
24 public:
25
26 wxWebViewIE() {}
27
28 wxWebViewIE(wxWindow* parent,
29 wxWindowID id,
30 const wxString& url = wxWebViewDefaultURLStr,
31 const wxPoint& pos = wxDefaultPosition,
32 const wxSize& size = wxDefaultSize,
33 long style = 0,
34 const wxString& name = wxWebViewNameStr)
35 {
36 Create(parent, id, url, pos, size, style, name);
37 }
38
39 bool Create(wxWindow* parent,
40 wxWindowID id,
41 const wxString& url = wxWebViewDefaultURLStr,
42 const wxPoint& pos = wxDefaultPosition,
43 const wxSize& size = wxDefaultSize,
44 long style = 0,
45 const wxString& name = wxWebViewNameStr);
46
47 virtual void LoadUrl(const wxString& url);
48
49 virtual bool CanGoForward() { return m_canNavigateForward; }
50 virtual bool CanGoBack() { return m_canNavigateBack; }
51 virtual void GoBack();
52 virtual void GoForward();
53 virtual void ClearHistory() {};
54 virtual void EnableHistory(bool enable = true) {};
55 virtual void Stop();
56 virtual void Reload(wxWebViewReloadFlags flags = wxWEB_VIEW_RELOAD_DEFAULT);
57
58 virtual wxString GetPageSource();
59
60 virtual bool IsBusy();
61 virtual wxString GetCurrentURL();
62 virtual wxString GetCurrentTitle();
63
64 virtual void SetZoomType(wxWebViewZoomType);
65 virtual wxWebViewZoomType GetZoomType() const;
66 virtual bool CanSetZoomType(wxWebViewZoomType) const;
67
68 virtual void Print();
69
70 virtual void SetPage(const wxString& html, const wxString& baseUrl);
71
72 virtual wxWebViewZoom GetZoom();
73 virtual void SetZoom(wxWebViewZoom zoom);
74
75 // ---- IE-specific methods
76
77 // FIXME: I seem to be able to access remote webpages even in offline mode...
78 bool IsOfflineMode();
79 void SetOfflineMode(bool offline);
80
81 /**
82 * Get text zoom
83 * @return text zoom from 0 to 4
84 */
85 int GetIETextZoom();
86
87 /**
88 * @param level 0 to 4
89 */
90 void SetIETextZoom(int level);
91
92 void SetIEOpticalZoom(float zoom);
93 float GetIEOpticalZoom();
94
95 void onActiveXEvent(wxActiveXEvent& evt);
96 void onEraseBg(wxEraseEvent& evt) {}
97
98 DECLARE_EVENT_TABLE();
99
100 private:
101 wxActiveXContainer* m_container;
102 wxAutomationObject m_ie;
103 IWebBrowser2* m_webBrowser;
104 DWORD m_dwCookie;
105 bool m_canNavigateBack;
106 bool m_canNavigateForward;
107
108 /** The "Busy" property of IWebBrowser2 does not always return busy when
109 * we'd want it to; this variable may be set to true in cases where the
110 * Busy property is false but should be true.
111 */
112 bool m_isBusy;
113 };
114
115 #endif // wxUSE_WEBVIEW_IE
116
117 #endif // wxWebViewIE_H