]> git.saurik.com Git - wxWidgets.git/blob - wxPython/contrib/iewin/IEHtmlWin.h
a7635817ff471c73818cdd112a965d0803055be7
[wxWidgets.git] / wxPython / contrib / iewin / IEHtmlWin.h
1 #ifndef _IEHTMLWIN_H_
2 #define _IEHTMLWIN_H_
3 #pragma warning( disable : 4101 4786)
4 #pragma warning( disable : 4786)
5
6
7 #include <wx/setup.h>
8 #include <wx/wx.h>
9 #include <exdisp.h>
10 #include <iostream>
11 using namespace std;
12
13 #include "wxactivex.h"
14
15 class wxMSHTMLEvent : public wxNotifyEvent
16 {
17 public:
18 wxMSHTMLEvent(wxEventType commandType = wxEVT_NULL, int id = 0)
19 : wxNotifyEvent(commandType, id)
20 {}
21
22 wxString GetText() { return m_text1; }
23 long GetLong1() { return m_long1; }
24 long GetLong2() { return m_long2; }
25
26 wxString m_text1;
27 long m_long1, m_long2;
28
29 virtual wxEvent *Clone() const { return new wxMSHTMLEvent(*this); }
30
31 private:
32 DECLARE_DYNAMIC_CLASS(wxMSHTMLEvent)
33 };
34
35 BEGIN_DECLARE_EVENT_TYPES()
36 DECLARE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_MSHTML_BEFORENAVIGATE2, 0)
37 DECLARE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_MSHTML_NEWWINDOW2, 0)
38 DECLARE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_MSHTML_DOCUMENTCOMPLETE, 0)
39 DECLARE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_MSHTML_PROGRESSCHANGE, 0)
40 DECLARE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_MSHTML_STATUSTEXTCHANGE, 0)
41 DECLARE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_MSHTML_TITLECHANGE, 0)
42 END_DECLARE_EVENT_TYPES()
43
44 typedef void (wxEvtHandler::*wxMSHTMLEventFunction)(wxMSHTMLEvent&);
45
46 #define EVT_MSHTML_BEFORENAVIGATE2(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_MSHTML_BEFORENAVIGATE2, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxMSHTMLEventFunction) & fn, NULL ),
47 #define EVT_MSHTML_NEWWINDOW2(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_MSHTML_NEWWINDOW2, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxMSHTMLEventFunction) & fn, NULL ),
48 #define EVT_MSHTML_DOCUMENTCOMPLETE(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_MSHTML_DOCUMENTCOMPLETE, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxMSHTMLEventFunction) & fn, NULL ),
49 #define EVT_MSHTML_PROGRESSCHANGE(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_MSHTML_PROGRESSCHANGE, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxMSHTMLEventFunction) & fn, NULL ),
50 #define EVT_MSHTML_STATUSTEXTCHANGE(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_MSHTML_STATUSTEXTCHANGE, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxMSHTMLEventFunction) & fn, NULL ),
51 #define EVT_MSHTML_TITLECHANGE(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_MSHTML_TITLECHANGE, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxMSHTMLEventFunction) & fn, NULL ),
52
53
54 enum wxIEHtmlRefreshLevel {
55 wxIEHTML_REFRESH_NORMAL = 0,
56 wxIEHTML_REFRESH_IFEXPIRED = 1,
57 wxIEHTML_REFRESH_CONTINUE = 2,
58 wxIEHTML_REFRESH_COMPLETELY = 3
59 };
60
61
62 class wxIEHtmlWin : public wxActiveX
63 {
64 public:
65 wxIEHtmlWin(wxWindow * parent, wxWindowID id = -1,
66 const wxPoint& pos = wxDefaultPosition,
67 const wxSize& size = wxDefaultSize,
68 long style = 0,
69 const wxString& name = wxPanelNameStr);
70 virtual ~wxIEHtmlWin();
71
72 void LoadUrl(const wxString&);
73 bool LoadString(wxString html);
74 bool LoadStream(istream *strm);
75
76 void SetCharset(wxString charset);
77 void SetEditMode(bool seton);
78 bool GetEditMode();
79 wxString GetStringSelection(bool asHTML = false);
80 wxString GetText(bool asHTML = false);
81
82 bool GoBack();
83 bool GoForward();
84 bool GoHome();
85 bool GoSearch();
86 bool Refresh(wxIEHtmlRefreshLevel level);
87 bool Stop();
88
89 DECLARE_EVENT_TABLE();
90
91 protected:
92 void SetupBrowser();
93
94 wxAutoOleInterface<IWebBrowser2> m_webBrowser;
95 };
96
97 #endif /* _IEHTMLWIN_H_ */