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