]> git.saurik.com Git - wxWidgets.git/blob - wxPython/contrib/iewin/readme.txt
Cosmetic cleanup (-1 -> wxID_ANY, TRUE->true).
[wxWidgets.git] / wxPython / contrib / iewin / readme.txt
1 Lindsay Mathieson
2 Email : <lmathieson@optusnet.com.au>
3
4 This is prelimanary stuff - the controls need extra methods and events etc,
5 feel free to email with suggestions &/or patches.
6
7 Tested with wxWindows 2.3.2.
8 Built with MS Visual C++ 6.0 & DevStudio
9 Minor use of templates and STL
10
11 -----------------------------------------------------------
12 This sample illustrates using wxActiveX and wxIEHtmlWin too:
13 1. Host an arbitrary ActiveX control
14 2. Specifically host the MSHTML Control
15
16
17 wxActiveX:
18 ==========
19 wxActiveX is used to host and siplay any activeX control, all the wxWindows developer
20 needs to know is either the ProgID or CLSID of the control in question.
21
22 Derived From:
23 - wxWindow
24
25 Include Files:
26 - wxactivex.h
27
28 Source Files:
29 - wxactivex.cpp
30
31 Event Handling:
32 ---------------
33 - EVT_ACTIVEX(id, eventName, handler) (handler = void OnActiveX(wxActiveXEvent& event))
34 class wxActiveXEvent : public wxNotifyEvent
35 int ParamCount() const;
36 wxVariant operator[] (int idx) const; // parameter by index
37 wxVariant& operator[] (int idx);
38 wxVariant operator[] (wxString name) const; // named parameters
39 wxVariant& operator[] (wxString name);
40
41
42 Members:
43 --------
44 wxActiveX::wxActiveX(wxWindow * parent, REFCLSID clsid, wxWindowID id = -1);
45 - Creates a activeX control identified by clsid
46 e.g
47 wxFrame *frame = new wxFrame(this, -1, "test");
48 wxActiveX *X = new wxActiveX(frame, CLSID_WebBrowser);
49
50 wxActiveX::wxActiveX(wxWindow * parent, wxString progId, wxWindowID id = -1);
51 - Creates a activeX control identified by progId
52 e.g.
53 wxFrame *frame = new wxFrame(this, -1, "test");
54 wxActiveX *X = new wxActiveX(frame, "MSCAL.Calendar");
55
56
57 wxActiveX::~wxActiveX();
58 - Destroys the control
59 - disconnects all connection points
60
61 HRESULT wxActiveX::ConnectAdvise(REFIID riid, IUnknown *eventSink);
62 - Connects a event sink. Connections are automaticlly diconnected in the destructor
63 e.g.
64 FS_DWebBrowserEvents2 *events = new FS_DWebBrowserEvents2(iecontrol);
65 hret = iecontrol->ConnectAdvise(DIID_DWebBrowserEvents2, events);
66 if (! SUCCEEDED(hret))
67 delete events;
68
69
70 Sample Events:
71 --------------
72 EVT_ACTIVEX(ID_MSHTML, "BeforeNavigate2", OnMSHTMLBeforeNavigate2X)
73
74 void wxIEFrame::OnMSHTMLBeforeNavigate2X(wxActiveXEvent& event)
75 {
76 wxString url = event["Url"];
77
78 int rc = wxMessageBox(url, "Allow open url ?", wxYES_NO);
79
80 if (rc != wxYES)
81 event["Cancel"] = true;
82 };
83
84
85 wxIEHtmlWin:
86 ============
87 wxIEHtmlWin is a specialisation of the wxActiveX control for hosting the MSHTML control.
88
89 Derived From:
90 - wxActiveX
91 - wxWindow
92
93 Event Handling:
94 ---------------
95 - class wxMSHTMLEvent
96
97 - EVT_MSHTML_BEFORENAVIGATE2
98 * url = event.m_text1
99 * event.Veto() to cancel
100 Generated before an attempt to browse a new url
101
102 - EVT_MSHTML_NEWWINDOW2
103 * event.Veto() to cancel
104 Generated when the control is asked create a new window (e.g a popup)
105
106 - EVT_MSHTML_DOCUMENTCOMPLETE
107 * url = event.m_text1
108 Generated after the document has finished loading
109
110 - EVT_MSHTML_PROGRESSCHANGE
111 * event.m_long1 = progress so far
112 * event.m_long2 = max range of progress
113
114 - EVT_MSHTML_STATUSTEXTCHANGE
115 * status = event.m_text1
116
117 - EVT_MSHTML_TITLECHANGE
118 * title = event.m_text1
119
120 Members:
121 --------
122 wxIEHtmlWin::wxIEHtmlWin(wxWindow * parent, wxWindowID id = -1);
123 - Constructs and initialises the MSHTML control
124 - LoadUrl("about:blank") is called
125
126 wxIEHtmlWin::~wxIEHtmlWin();
127 - destroys the control
128
129 void wxIEHtmlWin::LoadUrl(const wxString&);
130 - Attempts to browse to the url, the control uses its internal (MS)
131 network streams
132
133 bool wxIEHtmlWin::LoadString(wxString html);
134 - Load the passed HTML string
135
136 bool wxIEHtmlWin::LoadStream(istream *strm);
137 - load the passed HTML stream. The control takes ownership of
138 the pointer, deleting when finished.
139
140 void wxIEHtmlWin::SetCharset(wxString charset);
141 - Sets the charset of the loaded document
142
143 void wxIEHtmlWin::SetEditMode(bool seton);
144 - Sets edit mode.
145 NOTE: This does work, but is bare bones - we need more events exposed before
146 this is usable as an HTML editor.
147
148 bool wxIEHtmlWin::GetEditMode();
149 - Returns the edit mode setting
150
151 wxString wxIEHtmlWin::GetStringSelection(bool asHTML = false);
152 - Returns the currently selected text (plain or HTML text)
153
154 wxString GetText(bool asHTML = false);
155 - Returns the body text (plain or HTML text)
156
157 Lindsay Mathieson
158 Email : <lmathieson@optusnet.com.au>