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"
23 class WXDLLIMPEXP_WEB wxWebHistoryItem
26 wxWebHistoryItem(const wxString
& url
, const wxString
& title
) :
27 m_url(url
), m_title(title
) {}
28 wxString
GetUrl() { return m_url
; }
29 wxString
GetTitle() { return m_title
; }
32 wxString m_url
, m_title
;
35 class WXDLLIMPEXP_WEB wxWebViewIE
: public wxWebView
41 wxWebViewIE(wxWindow
* parent
,
43 const wxString
& url
= wxWebViewDefaultURLStr
,
44 const wxPoint
& pos
= wxDefaultPosition
,
45 const wxSize
& size
= wxDefaultSize
,
47 const wxString
& name
= wxWebViewNameStr
)
49 Create(parent
, id
, url
, pos
, size
, style
, name
);
52 bool Create(wxWindow
* parent
,
54 const wxString
& url
= wxWebViewDefaultURLStr
,
55 const wxPoint
& pos
= wxDefaultPosition
,
56 const wxSize
& size
= wxDefaultSize
,
58 const wxString
& name
= wxWebViewNameStr
);
60 virtual void LoadUrl(const wxString
& url
);
61 virtual void LoadHistoryItem(wxSharedPtr
<wxWebHistoryItem
> item
);
63 virtual bool CanGoForward();
64 virtual bool CanGoBack();
65 virtual void GoBack();
66 virtual void GoForward();
67 virtual void ClearHistory();
68 virtual void EnableHistory(bool enable
= true);
70 virtual void Reload(wxWebViewReloadFlags flags
= wxWEB_VIEW_RELOAD_DEFAULT
);
72 virtual wxString
GetPageSource();
74 virtual bool IsBusy();
75 virtual wxString
GetCurrentURL();
76 virtual wxString
GetCurrentTitle();
78 virtual void SetZoomType(wxWebViewZoomType
);
79 virtual wxWebViewZoomType
GetZoomType() const;
80 virtual bool CanSetZoomType(wxWebViewZoomType
) const;
84 virtual void SetPage(const wxString
& html
, const wxString
& baseUrl
);
86 virtual wxWebViewZoom
GetZoom();
87 virtual void SetZoom(wxWebViewZoom zoom
);
89 // ---- IE-specific methods
91 // FIXME: I seem to be able to access remote webpages even in offline mode...
93 void SetOfflineMode(bool offline
);
97 * @return text zoom from 0 to 4
102 * @param level 0 to 4
104 void SetIETextZoom(int level
);
106 void SetIEOpticalZoom(float zoom
);
107 float GetIEOpticalZoom();
109 void onActiveXEvent(wxActiveXEvent
& evt
);
110 void onEraseBg(wxEraseEvent
& evt
) {}
112 DECLARE_EVENT_TABLE();
115 wxActiveXContainer
* m_container
;
116 wxAutomationObject m_ie
;
117 IWebBrowser2
* m_webBrowser
;
119 bool m_canNavigateBack
;
120 bool m_canNavigateForward
;
122 /** The "Busy" property of IWebBrowser2 does not always return busy when
123 * we'd want it to; this variable may be set to true in cases where the
124 * Busy property is false but should be true.
127 //We manage our own history, the history list contains the history items
128 //which are added as documentcomplete events arrive, unless we are loading
129 //an item from the history. The position is stored as an int, and reflects
130 //where we are in the history list.
131 wxVector
<wxSharedPtr
<wxWebHistoryItem
> > m_historyList
;
132 int m_historyPosition
;
133 bool m_historyLoadingFromList
;
134 bool m_historyEnabled
;
138 #endif // wxUSE_WEBVIEW_IE
140 #endif // wxWebViewIE_H