]>
Commit | Line | Data |
---|---|---|
c731eb47 RD |
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 | - None currently | |
34 | ||
35 | Members: | |
36 | -------- | |
37 | wxActiveX::wxActiveX(wxWindow * parent, REFCLSID clsid, wxWindowID id = -1); | |
38 | - Creates a activeX control identified by clsid | |
39 | e.g | |
40 | wxFrame *frame = new wxFrame(this, -1, "test"); | |
41 | wxActiveX *X = new wxActiveX(frame, CLSID_WebBrowser); | |
42 | ||
43 | wxActiveX::wxActiveX(wxWindow * parent, wxString progId, wxWindowID id = -1); | |
44 | - Creates a activeX control identified by progId | |
45 | e.g. | |
46 | wxFrame *frame = new wxFrame(this, -1, "test"); | |
47 | wxActiveX *X = new wxActiveX(frame, "MSCAL.Calendar"); | |
48 | ||
49 | ||
50 | wxActiveX::~wxActiveX(); | |
51 | - Destroys the control | |
52 | - disconnects all connection points | |
53 | ||
54 | HRESULT wxActiveX::ConnectAdvise(REFIID riid, IUnknown *eventSink); | |
55 | - Connects a event sink. Connections are automaticlly diconnected in the destructor | |
56 | e.g. | |
57 | FS_DWebBrowserEvents2 *events = new FS_DWebBrowserEvents2(iecontrol); | |
58 | hret = iecontrol->ConnectAdvise(DIID_DWebBrowserEvents2, events); | |
59 | if (! SUCCEEDED(hret)) | |
60 | delete events; | |
61 | ||
62 | ||
63 | ||
64 | ||
65 | wxIEHtmlWin: | |
66 | ============ | |
67 | wxIEHtmlWin is a specialisation of the wxActiveX control for hosting the MSHTML control. | |
68 | ||
69 | Derived From: | |
70 | - wxActiveX | |
71 | - wxWindow | |
72 | ||
73 | Event Handling: | |
74 | --------------- | |
75 | - class wxMSHTMLEvent | |
76 | ||
77 | - EVT_MSHTML_BEFORENAVIGATE2 | |
78 | * url = event.m_text1 | |
79 | * event.Veto() to cancel | |
80 | Generated before an attempt to browse a new url | |
81 | ||
82 | - EVT_MSHTML_NEWWINDOW2 | |
83 | * event.Veto() to cancel | |
84 | Generated when the control is asked create a new window (e.g a popup) | |
85 | ||
86 | - EVT_MSHTML_DOCUMENTCOMPLETE | |
87 | * url = event.m_text1 | |
88 | Generated after the document has finished loading | |
89 | ||
90 | - EVT_MSHTML_PROGRESSCHANGE | |
91 | * event.m_long1 = progress so far | |
92 | * event.m_long2 = max range of progress | |
93 | ||
94 | - EVT_MSHTML_STATUSTEXTCHANGE | |
95 | * status = event.m_text1 | |
96 | ||
97 | - EVT_MSHTML_TITLECHANGE | |
98 | * title = event.m_text1 | |
99 | ||
100 | Members: | |
101 | -------- | |
102 | wxIEHtmlWin::wxIEHtmlWin(wxWindow * parent, wxWindowID id = -1); | |
103 | - Constructs and initialises the MSHTML control | |
104 | - LoadUrl("about:blank") is called | |
105 | ||
106 | wxIEHtmlWin::~wxIEHtmlWin(); | |
107 | - destroys the control | |
108 | ||
109 | void wxIEHtmlWin::LoadUrl(const wxString&); | |
110 | - Attempts to browse to the url, the control uses its internal (MS) | |
111 | network streams | |
112 | ||
113 | bool wxIEHtmlWin::LoadString(wxString html); | |
114 | - Load the passed HTML string | |
115 | ||
116 | bool wxIEHtmlWin::LoadStream(istream *strm); | |
117 | - load the passed HTML stream. The control takes ownership of | |
118 | the pointer, deleting when finished. | |
119 | ||
120 | void wxIEHtmlWin::SetCharset(wxString charset); | |
121 | - Sets the charset of the loaded document | |
122 | ||
123 | void wxIEHtmlWin::SetEditMode(bool seton); | |
124 | - Sets edit mode. | |
125 | NOTE: This does work, but is bare bones - we need more events exposed before | |
126 | this is usable as an HTML editor. | |
127 | ||
128 | bool wxIEHtmlWin::GetEditMode(); | |
129 | - Returns the edit mode setting | |
130 | ||
131 | wxString wxIEHtmlWin::GetStringSelection(bool asHTML = false); | |
132 | - Returns the currently selected text (plain or HTML text) | |
133 | ||
134 | wxString GetText(bool asHTML = false); | |
135 | - Returns the body text (plain or HTML text) | |
136 | ||
137 | Lindsay Mathieson | |
138 | Email : <lmathieson@optusnet.com.au> |