]>
Commit | Line | Data |
---|---|---|
61b98a2d SL |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: include/wx/msw/webviewie.h | |
3 | // Purpose: wxMSW IE wxWebView backend | |
4 | // Author: Marianne Gagnon | |
5 | // Id: $Id$ | |
74af0b13 | 6 | // Copyright: (c) 2010 Marianne Gagnon, Steven Lamerton |
61b98a2d SL |
7 | // Licence: wxWindows licence |
8 | ///////////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | #ifndef wxWebViewIE_H | |
11 | #define wxWebViewIE_H | |
12 | ||
13 | #include "wx/setup.h" | |
14 | ||
66f2aa61 | 15 | #if wxUSE_WEBVIEW_IE |
61b98a2d SL |
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" | |
74af0b13 | 21 | #include "wx/sharedptr.h" |
5cbda74b | 22 | #include "wx/vector.h" |
61b98a2d | 23 | |
617227c3 SL |
24 | class IHTMLDocument2; |
25 | ||
3046dbdc | 26 | class WXDLLIMPEXP_WEB wxWebViewIE : public wxWebView |
61b98a2d SL |
27 | { |
28 | public: | |
29 | ||
30 | wxWebViewIE() {} | |
31 | ||
32 | wxWebViewIE(wxWindow* parent, | |
33 | wxWindowID id, | |
34 | const wxString& url = wxWebViewDefaultURLStr, | |
35 | const wxPoint& pos = wxDefaultPosition, | |
36 | const wxSize& size = wxDefaultSize, | |
37 | long style = 0, | |
38 | const wxString& name = wxWebViewNameStr) | |
39 | { | |
40 | Create(parent, id, url, pos, size, style, name); | |
41 | } | |
42 | ||
43 | bool Create(wxWindow* parent, | |
44 | wxWindowID id, | |
45 | const wxString& url = wxWebViewDefaultURLStr, | |
46 | const wxPoint& pos = wxDefaultPosition, | |
47 | const wxSize& size = wxDefaultSize, | |
48 | long style = 0, | |
49 | const wxString& name = wxWebViewNameStr); | |
50 | ||
51 | virtual void LoadUrl(const wxString& url); | |
3e7968c2 | 52 | virtual void LoadHistoryItem(wxSharedPtr<wxWebHistoryItem> item); |
5cbda74b SL |
53 | virtual wxVector<wxSharedPtr<wxWebHistoryItem> > GetBackwardHistory(); |
54 | virtual wxVector<wxSharedPtr<wxWebHistoryItem> > GetForwardHistory(); | |
61b98a2d | 55 | |
74af0b13 SL |
56 | virtual bool CanGoForward(); |
57 | virtual bool CanGoBack(); | |
61b98a2d SL |
58 | virtual void GoBack(); |
59 | virtual void GoForward(); | |
74af0b13 SL |
60 | virtual void ClearHistory(); |
61 | virtual void EnableHistory(bool enable = true); | |
61b98a2d | 62 | virtual void Stop(); |
a703012a | 63 | virtual void Reload(wxWebViewReloadFlags flags = wxWEB_VIEW_RELOAD_DEFAULT); |
61b98a2d SL |
64 | |
65 | virtual wxString GetPageSource(); | |
66 | ||
67 | virtual bool IsBusy(); | |
68 | virtual wxString GetCurrentURL(); | |
69 | virtual wxString GetCurrentTitle(); | |
70 | ||
71 | virtual void SetZoomType(wxWebViewZoomType); | |
72 | virtual wxWebViewZoomType GetZoomType() const; | |
73 | virtual bool CanSetZoomType(wxWebViewZoomType) const; | |
74 | ||
75 | virtual void Print(); | |
76 | ||
77 | virtual void SetPage(const wxString& html, const wxString& baseUrl); | |
78 | ||
79 | virtual wxWebViewZoom GetZoom(); | |
80 | virtual void SetZoom(wxWebViewZoom zoom); | |
81 | ||
4681a3ea SL |
82 | //Clipboard functions |
83 | virtual bool CanCut(); | |
84 | virtual bool CanCopy(); | |
85 | virtual bool CanPaste(); | |
86 | virtual void Cut(); | |
87 | virtual void Copy(); | |
88 | virtual void Paste(); | |
89 | ||
97e49559 SL |
90 | //Undo / redo functionality |
91 | virtual bool CanUndo(); | |
92 | virtual bool CanRedo(); | |
93 | virtual void Undo(); | |
94 | virtual void Redo(); | |
95 | ||
61b98a2d SL |
96 | // ---- IE-specific methods |
97 | ||
98 | // FIXME: I seem to be able to access remote webpages even in offline mode... | |
99 | bool IsOfflineMode(); | |
100 | void SetOfflineMode(bool offline); | |
101 | ||
102 | /** | |
103 | * Get text zoom | |
104 | * @return text zoom from 0 to 4 | |
105 | */ | |
106 | int GetIETextZoom(); | |
107 | ||
108 | /** | |
109 | * @param level 0 to 4 | |
110 | */ | |
111 | void SetIETextZoom(int level); | |
112 | ||
113 | void SetIEOpticalZoom(float zoom); | |
114 | float GetIEOpticalZoom(); | |
115 | ||
116 | void onActiveXEvent(wxActiveXEvent& evt); | |
117 | void onEraseBg(wxEraseEvent& evt) {} | |
118 | ||
119 | DECLARE_EVENT_TABLE(); | |
120 | ||
121 | private: | |
122 | wxActiveXContainer* m_container; | |
123 | wxAutomationObject m_ie; | |
124 | IWebBrowser2* m_webBrowser; | |
125 | DWORD m_dwCookie; | |
126 | bool m_canNavigateBack; | |
127 | bool m_canNavigateForward; | |
128 | ||
129 | /** The "Busy" property of IWebBrowser2 does not always return busy when | |
130 | * we'd want it to; this variable may be set to true in cases where the | |
131 | * Busy property is false but should be true. | |
132 | */ | |
133 | bool m_isBusy; | |
3e7968c2 SL |
134 | //We manage our own history, the history list contains the history items |
135 | //which are added as documentcomplete events arrive, unless we are loading | |
136 | //an item from the history. The position is stored as an int, and reflects | |
137 | //where we are in the history list. | |
74af0b13 SL |
138 | wxVector<wxSharedPtr<wxWebHistoryItem> > m_historyList; |
139 | int m_historyPosition; | |
140 | bool m_historyLoadingFromList; | |
141 | bool m_historyEnabled; | |
142 | ||
4681a3ea SL |
143 | //Generic helper functions for IHtmlDocument commands |
144 | bool CanExecCommand(wxString command); | |
145 | void ExecCommand(wxString command); | |
617227c3 | 146 | IHTMLDocument2* GetDocument(); |
4681a3ea | 147 | |
61b98a2d SL |
148 | }; |
149 | ||
66f2aa61 | 150 | #endif // wxUSE_WEBVIEW_IE |
61b98a2d SL |
151 | |
152 | #endif // wxWebViewIE_H |