]>
Commit | Line | Data |
---|---|---|
5526e819 VS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: htmlwin.cpp | |
3 | // Purpose: wxHtmlWindow class for parsing & displaying HTML (implementation) | |
4 | // Author: Vaclav Slavik | |
69941f05 | 5 | // RCS-ID: $Id$ |
5526e819 VS |
6 | // Copyright: (c) 1999 Vaclav Slavik |
7 | // Licence: wxWindows Licence | |
8 | ///////////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | ||
11 | #ifdef __GNUG__ | |
12 | #pragma implementation | |
13 | #endif | |
14 | ||
3096bd2f | 15 | #include "wx/wxprec.h" |
5526e819 VS |
16 | |
17 | #include "wx/defs.h" | |
18 | #if wxUSE_HTML | |
19 | ||
20 | #ifdef __BORDLANDC__ | |
21 | #pragma hdrstop | |
22 | #endif | |
23 | ||
24 | #ifndef WXPRECOMP | |
3096bd2f | 25 | #include "wx/wx.h" |
5526e819 VS |
26 | #endif |
27 | ||
69941f05 | 28 | #include "wx/html/htmlwin.h" |
69941f05 | 29 | #include "wx/html/forcelnk.h" |
5526e819 | 30 | |
5526e819 VS |
31 | |
32 | ||
33 | //----------------------------------------------------------------------------- | |
34 | // wxHtmlWindow | |
35 | //----------------------------------------------------------------------------- | |
36 | ||
37 | ||
38 | ||
3096bd2f | 39 | #include "wx/arrimpl.cpp" |
5526e819 VS |
40 | WX_DEFINE_OBJARRAY(HtmlHistoryArray) |
41 | ||
42 | ||
269e8200 | 43 | wxHtmlWindow::wxHtmlWindow(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, |
f3bcfd9b | 44 | long style, const wxString& name) : wxScrolledWindow(parent, id, pos, size, wxVSCROLL | wxHSCROLL, name) |
5526e819 VS |
45 | { |
46 | m_tmpMouseMoved = FALSE; | |
846914d1 | 47 | m_tmpLastLink = NULL; |
89de9af3 | 48 | m_tmpCanDrawLocks = 0; |
5526e819 VS |
49 | m_FS = new wxFileSystem(); |
50 | m_RelatedStatusBar = -1; | |
51 | m_RelatedFrame = NULL; | |
52 | m_TitleFormat = "%s"; | |
d5db80c2 | 53 | m_OpenedPage = m_OpenedAnchor = m_OpenedPageTitle = wxEmptyString; |
5526e819 VS |
54 | m_Cell = NULL; |
55 | m_Parser = new wxHtmlWinParser(this); | |
56 | m_Parser -> SetFS(m_FS); | |
57 | SetBorders(10); | |
58 | m_HistoryPos = -1; | |
59 | m_HistoryOn = TRUE; | |
a547ebff | 60 | m_Style = style; |
5526e819 VS |
61 | SetPage("<html><body></body></html>"); |
62 | } | |
63 | ||
64 | ||
65 | ||
66 | wxHtmlWindow::~wxHtmlWindow() | |
67 | { | |
68 | HistoryClear(); | |
69 | ||
70 | if (m_Cell) delete m_Cell; | |
71 | ||
5526e819 VS |
72 | delete m_Parser; |
73 | delete m_FS; | |
74 | } | |
75 | ||
76 | ||
77 | ||
78 | void wxHtmlWindow::SetRelatedFrame(wxFrame* frame, const wxString& format) | |
79 | { | |
80 | m_RelatedFrame = frame; | |
81 | m_TitleFormat = format; | |
82 | } | |
83 | ||
84 | ||
85 | ||
86 | void wxHtmlWindow::SetRelatedStatusBar(int bar) | |
87 | { | |
88 | m_RelatedStatusBar = bar; | |
89 | } | |
269e8200 RD |
90 | |
91 | ||
92 | ||
8eb2940f | 93 | void wxHtmlWindow::SetFonts(wxString normal_face, wxString fixed_face, const int *sizes) |
5526e819 | 94 | { |
d5db80c2 VS |
95 | wxString op = m_OpenedPage; |
96 | ||
8eb2940f | 97 | m_Parser -> SetFonts(normal_face, fixed_face, sizes); |
fb5700fe | 98 | SetPage(wxT("<html><body></body></html>")); // fonts changed => contents invalid |
d5db80c2 | 99 | if (!op.IsEmpty()) LoadPage(op); |
5526e819 VS |
100 | } |
101 | ||
102 | ||
103 | ||
104 | bool wxHtmlWindow::SetPage(const wxString& source) | |
105 | { | |
106 | wxClientDC *dc = new wxClientDC(this); | |
107 | ||
108 | dc -> SetMapMode(wxMM_TEXT); | |
109 | SetBackgroundColour(wxColour(0xFF, 0xFF, 0xFF)); | |
d5db80c2 | 110 | m_OpenedPage = m_OpenedAnchor = m_OpenedPageTitle = wxEmptyString; |
5526e819 | 111 | m_Parser -> SetDC(dc); |
f61815af | 112 | if (m_Cell) { |
89de9af3 VS |
113 | delete m_Cell; |
114 | m_Cell = NULL; | |
f61815af | 115 | } |
5526e819 VS |
116 | m_Cell = (wxHtmlContainerCell*) m_Parser -> Parse(source); |
117 | delete dc; | |
efba2b89 VS |
118 | m_Cell -> SetIndent(m_Borders, wxHTML_INDENT_ALL, wxHTML_UNITS_PIXELS); |
119 | m_Cell -> SetAlignHor(wxHTML_ALIGN_CENTER); | |
5526e819 | 120 | CreateLayout(); |
89de9af3 | 121 | if (m_tmpCanDrawLocks == 0) Refresh(); |
5526e819 VS |
122 | return TRUE; |
123 | } | |
124 | ||
125 | ||
126 | bool wxHtmlWindow::LoadPage(const wxString& location) | |
127 | { | |
128 | wxFSFile *f; | |
129 | bool rt_val; | |
169ee06c VS |
130 | |
131 | SetCursor(*wxHOURGLASS_CURSOR); | |
132 | wxYield(); | |
5526e819 | 133 | |
89de9af3 | 134 | m_tmpCanDrawLocks++; |
5526e819 VS |
135 | if (m_HistoryOn && (m_HistoryPos != -1)) { // store scroll position into history item |
136 | int x, y; | |
137 | ViewStart(&x, &y); | |
138 | m_History[m_HistoryPos].SetPos(y); | |
139 | } | |
140 | ||
141 | if (location[0] == '#') { // local anchor | |
142 | wxString anch = location.Mid(1) /*1 to end*/; | |
89de9af3 | 143 | m_tmpCanDrawLocks--; |
5526e819 VS |
144 | rt_val = ScrollToAnchor(anch); |
145 | } | |
146 | ||
147 | else { | |
148 | // load&display it: | |
149 | if (m_RelatedStatusBar != -1) { | |
150 | m_RelatedFrame -> SetStatusText(_("Connecting..."), m_RelatedStatusBar); | |
151 | Refresh(); | |
152 | } | |
153 | ||
154 | f = m_FS -> OpenFile(location); | |
155 | if (f == NULL) { | |
156 | wxString err; | |
157 | ||
f3bcfd9b | 158 | err.Printf(_("Unable to open requested location :\n\n%s"), WXSTRINGCAST location); |
89de9af3 | 159 | m_tmpCanDrawLocks--; |
483ff5a5 VS |
160 | Refresh(); |
161 | wxMessageBox(err, "Error"); | |
169ee06c VS |
162 | |
163 | SetCursor(*wxSTANDARD_CURSOR); | |
5526e819 VS |
164 | return FALSE; |
165 | } | |
166 | ||
167 | else { | |
168 | wxNode *node; | |
169 | wxString src = wxEmptyString; | |
170 | ||
171 | if (m_RelatedStatusBar != -1) { | |
172 | wxString msg = _("Loading : ") + location; | |
173 | m_RelatedFrame -> SetStatusText(msg, m_RelatedStatusBar); | |
174 | Refresh(); | |
175 | } | |
176 | ||
177 | node = m_Filters.GetFirst(); | |
178 | while (node){ | |
179 | wxHtmlFilter *h = (wxHtmlFilter*) node -> GetData(); | |
180 | if (h -> CanRead(*f)) { | |
181 | src = h -> ReadFile(*f); | |
182 | break; | |
183 | } | |
184 | node = node -> GetNext(); | |
185 | } | |
a76015e6 | 186 | if (src == wxEmptyString) { |
89de9af3 VS |
187 | if (m_DefaultFilter == NULL) m_DefaultFilter = GetDefaultFilter(); |
188 | src = m_DefaultFilter -> ReadFile(*f); | |
189 | } | |
5526e819 VS |
190 | |
191 | m_FS -> ChangePathTo(f -> GetLocation()); | |
192 | rt_val = SetPage(src); | |
193 | m_OpenedPage = f -> GetLocation(); | |
194 | if (f -> GetAnchor() != wxEmptyString) { | |
89de9af3 | 195 | // m_tmpCanDrawLocks--; |
5526e819 | 196 | ScrollToAnchor(f -> GetAnchor()); |
89de9af3 | 197 | // m_tmpCanDrawLocks++; |
5526e819 VS |
198 | } |
199 | ||
200 | delete f; | |
201 | ||
202 | if (m_RelatedStatusBar != -1) m_RelatedFrame -> SetStatusText(_("Done"), m_RelatedStatusBar); | |
203 | } | |
204 | } | |
205 | ||
206 | if (m_HistoryOn) { // add this page to history there: | |
207 | int c = m_History.GetCount() - (m_HistoryPos + 1); | |
208 | ||
209 | m_HistoryPos++; | |
210 | for (int i = 0; i < c; i++) | |
211 | m_History.Remove(m_HistoryPos); | |
212 | m_History.Add(new HtmlHistoryItem(m_OpenedPage, m_OpenedAnchor)); | |
213 | } | |
214 | ||
169ee06c VS |
215 | SetCursor(*wxSTANDARD_CURSOR); |
216 | ||
89de9af3 VS |
217 | wxYield(); |
218 | m_tmpCanDrawLocks--; | |
5526e819 VS |
219 | Refresh(); |
220 | return rt_val; | |
221 | } | |
222 | ||
223 | ||
224 | ||
225 | bool wxHtmlWindow::ScrollToAnchor(const wxString& anchor) | |
226 | { | |
efba2b89 | 227 | const wxHtmlCell *c = m_Cell -> Find(wxHTML_COND_ISANCHOR, &anchor); |
5526e819 VS |
228 | if (!c) return FALSE; |
229 | else { | |
230 | int y; | |
269e8200 | 231 | |
5526e819 | 232 | for (y = 0; c != NULL; c = c -> GetParent()) y += c -> GetPosY(); |
efba2b89 | 233 | Scroll(-1, y / wxHTML_SCROLL_STEP); |
5526e819 VS |
234 | m_OpenedAnchor = anchor; |
235 | return TRUE; | |
236 | } | |
237 | } | |
238 | ||
239 | ||
d5db80c2 | 240 | void wxHtmlWindow::OnSetTitle(const wxString& title) |
5526e819 VS |
241 | { |
242 | if (m_RelatedFrame) { | |
243 | wxString tit; | |
244 | tit.Printf(m_TitleFormat, title.c_str()); | |
245 | m_RelatedFrame -> SetTitle(tit); | |
246 | } | |
d5db80c2 | 247 | m_OpenedPageTitle = title; |
5526e819 VS |
248 | } |
249 | ||
250 | ||
251 | ||
252 | ||
253 | ||
254 | void wxHtmlWindow::CreateLayout() | |
255 | { | |
256 | int ClientWidth, ClientHeight; | |
257 | ||
258 | if (!m_Cell) return; | |
a547ebff VS |
259 | |
260 | if (m_Style == wxHW_SCROLLBAR_NEVER) { | |
08d038e7 | 261 | SetScrollbars(wxHTML_SCROLL_STEP, 1, m_Cell -> GetWidth() / wxHTML_SCROLL_STEP, 0); // always off |
a547ebff VS |
262 | GetClientSize(&ClientWidth, &ClientHeight); |
263 | m_Cell -> Layout(ClientWidth); | |
264 | } | |
265 | ||
266 | else { | |
267 | GetClientSize(&ClientWidth, &ClientHeight); | |
d54ed754 VS |
268 | #ifndef __WXMSW__ |
269 | // VS : this looks extremely ugly under windoze, better fix needed! | |
08d038e7 | 270 | SetScrollbars(wxHTML_SCROLL_STEP, 1, m_Cell -> GetWidth() / wxHTML_SCROLL_STEP, ClientHeight * 2); // always on |
d54ed754 | 271 | #endif |
a547ebff VS |
272 | GetClientSize(&ClientWidth, &ClientHeight); |
273 | m_Cell -> Layout(ClientWidth); | |
f3bcfd9b VS |
274 | if (ClientHeight < m_Cell -> GetHeight() + GetCharHeight()) { |
275 | SetScrollbars( | |
276 | wxHTML_SCROLL_STEP, wxHTML_SCROLL_STEP, | |
277 | m_Cell -> GetWidth() / wxHTML_SCROLL_STEP, | |
278 | (m_Cell -> GetHeight() + GetCharHeight()) / wxHTML_SCROLL_STEP | |
279 | /*cheat: top-level frag is always container*/); | |
a547ebff | 280 | } |
89de9af3 | 281 | else { /* we fit into window, no need for scrollbars */ |
08d038e7 | 282 | SetScrollbars(wxHTML_SCROLL_STEP, 1, m_Cell -> GetWidth() / wxHTML_SCROLL_STEP, 0); // disable... |
89de9af3 VS |
283 | GetClientSize(&ClientWidth, &ClientHeight); |
284 | m_Cell -> Layout(ClientWidth); // ...and relayout | |
285 | } | |
a547ebff | 286 | } |
5526e819 VS |
287 | } |
288 | ||
269e8200 | 289 | |
5526e819 VS |
290 | |
291 | void wxHtmlWindow::ReadCustomization(wxConfigBase *cfg, wxString path) | |
292 | { | |
293 | wxString oldpath; | |
294 | wxString tmp; | |
d5db80c2 VS |
295 | int p_fontsizes[7]; |
296 | wxString p_fff, p_ffn; | |
5526e819 VS |
297 | |
298 | if (path != wxEmptyString) { | |
299 | oldpath = cfg -> GetPath(); | |
300 | cfg -> SetPath(path); | |
301 | } | |
302 | ||
303 | m_Borders = cfg -> Read("wxHtmlWindow/Borders", m_Borders); | |
d5db80c2 VS |
304 | p_fff = cfg -> Read("wxHtmlWindow/FontFaceFixed", m_Parser -> m_FontFaceFixed); |
305 | p_ffn = cfg -> Read("wxHtmlWindow/FontFaceNormal", m_Parser -> m_FontFaceNormal); | |
5526e819 | 306 | for (int i = 0; i < 7; i++) { |
66a77a74 | 307 | tmp.Printf(wxT("wxHtmlWindow/FontsSize%i"), i); |
d5db80c2 | 308 | p_fontsizes[i] = cfg -> Read(tmp, m_Parser -> m_FontsSizes[i]); |
5526e819 | 309 | } |
8eb2940f | 310 | SetFonts(p_ffn, p_fff, p_fontsizes); |
5526e819 VS |
311 | |
312 | if (path != wxEmptyString) | |
313 | cfg -> SetPath(oldpath); | |
314 | } | |
315 | ||
316 | ||
317 | ||
318 | void wxHtmlWindow::WriteCustomization(wxConfigBase *cfg, wxString path) | |
319 | { | |
320 | wxString oldpath; | |
321 | wxString tmp; | |
322 | ||
323 | if (path != wxEmptyString) { | |
324 | oldpath = cfg -> GetPath(); | |
325 | cfg -> SetPath(path); | |
326 | } | |
327 | ||
328 | cfg -> Write("wxHtmlWindow/Borders", (long) m_Borders); | |
329 | cfg -> Write("wxHtmlWindow/FontFaceFixed", m_Parser -> m_FontFaceFixed); | |
330 | cfg -> Write("wxHtmlWindow/FontFaceNormal", m_Parser -> m_FontFaceNormal); | |
5526e819 | 331 | for (int i = 0; i < 7; i++) { |
66a77a74 | 332 | tmp.Printf(wxT("wxHtmlWindow/FontsSize%i"), i); |
5526e819 VS |
333 | cfg -> Write(tmp, (long) m_Parser -> m_FontsSizes[i]); |
334 | } | |
335 | ||
336 | if (path != wxEmptyString) | |
337 | cfg -> SetPath(oldpath); | |
338 | } | |
339 | ||
340 | ||
341 | ||
342 | bool wxHtmlWindow::HistoryBack() | |
343 | { | |
344 | wxString a, l; | |
345 | ||
346 | if (m_HistoryPos < 1) return FALSE; | |
347 | ||
348 | m_HistoryPos--; | |
349 | ||
350 | l = m_History[m_HistoryPos].GetPage(); | |
351 | a = m_History[m_HistoryPos].GetAnchor(); | |
352 | m_HistoryOn = FALSE; | |
89de9af3 | 353 | m_tmpCanDrawLocks++; |
5526e819 VS |
354 | if (a == wxEmptyString) LoadPage(l); |
355 | else LoadPage(l + "#" + a); | |
356 | m_HistoryOn = TRUE; | |
c88293a4 | 357 | wxYield(); |
89de9af3 | 358 | m_tmpCanDrawLocks--; |
c88293a4 | 359 | Scroll(0, m_History[m_HistoryPos].GetPos()); |
5526e819 VS |
360 | Refresh(); |
361 | return TRUE; | |
362 | } | |
363 | ||
364 | ||
365 | ||
366 | bool wxHtmlWindow::HistoryForward() | |
367 | { | |
368 | wxString a, l; | |
369 | ||
370 | if (m_HistoryPos == -1) return FALSE; | |
371 | if (m_HistoryPos >= (int)m_History.GetCount() - 1)return FALSE; | |
372 | ||
373 | m_OpenedPage = wxEmptyString; // this will disable adding new entry into history in LoadPage() | |
374 | ||
375 | m_HistoryPos++; | |
376 | l = m_History[m_HistoryPos].GetPage(); | |
377 | a = m_History[m_HistoryPos].GetAnchor(); | |
378 | m_HistoryOn = FALSE; | |
89de9af3 | 379 | m_tmpCanDrawLocks++; |
5526e819 VS |
380 | if (a == wxEmptyString) LoadPage(l); |
381 | else LoadPage(l + "#" + a); | |
382 | m_HistoryOn = TRUE; | |
c88293a4 | 383 | wxYield(); |
89de9af3 | 384 | m_tmpCanDrawLocks--; |
c88293a4 | 385 | Scroll(0, m_History[m_HistoryPos].GetPos()); |
5526e819 VS |
386 | Refresh(); |
387 | return TRUE; | |
388 | } | |
389 | ||
390 | ||
391 | ||
392 | void wxHtmlWindow::HistoryClear() | |
393 | { | |
394 | m_History.Empty(); | |
395 | m_HistoryPos = -1; | |
396 | } | |
397 | ||
398 | ||
399 | ||
400 | wxList wxHtmlWindow::m_Filters; | |
a76015e6 VS |
401 | wxHtmlFilter *wxHtmlWindow::m_DefaultFilter = NULL; |
402 | ||
403 | void wxHtmlWindow::CleanUpStatics() | |
404 | { | |
405 | if (m_DefaultFilter) delete m_DefaultFilter; | |
406 | m_DefaultFilter = NULL; | |
269e8200 RD |
407 | m_Filters.DeleteContents(TRUE); |
408 | m_Filters.Clear(); | |
409 | ||
a76015e6 VS |
410 | } |
411 | ||
412 | ||
5526e819 VS |
413 | |
414 | void wxHtmlWindow::AddFilter(wxHtmlFilter *filter) | |
415 | { | |
5526e819 VS |
416 | m_Filters.Append(filter); |
417 | } | |
418 | ||
419 | ||
420 | ||
421 | ||
0b2dadd3 | 422 | void wxHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link) |
5526e819 | 423 | { |
0b2dadd3 | 424 | LoadPage(link.GetHref()); |
5526e819 VS |
425 | } |
426 | ||
427 | ||
428 | ||
429 | void wxHtmlWindow::OnDraw(wxDC& dc) | |
430 | { | |
431 | int x, y; | |
432 | wxRegionIterator upd(GetUpdateRegion()); // get the update rect list | |
433 | int v_y, v_h; | |
434 | ||
89de9af3 | 435 | if (m_tmpCanDrawLocks > 0) return; |
5526e819 VS |
436 | dc.SetMapMode(wxMM_TEXT); |
437 | #if defined(_MSC_VER) && (_MSC_VER == 1200) | |
438 | ::SetMapMode((HDC)dc.GetHDC(), MM_TEXT); | |
439 | #endif | |
440 | dc.SetBackgroundMode(wxTRANSPARENT); | |
441 | ViewStart(&x, &y); | |
442 | ||
443 | while (upd) { | |
444 | v_y = upd.GetY(); | |
445 | v_h = upd.GetH(); | |
efba2b89 | 446 | if (m_Cell) m_Cell -> Draw(dc, 0, 0, y * wxHTML_SCROLL_STEP + v_y, y * wxHTML_SCROLL_STEP + v_h + v_y); |
5526e819 VS |
447 | upd++; |
448 | } | |
449 | } | |
450 | ||
451 | ||
452 | ||
453 | ||
454 | void wxHtmlWindow::OnSize(wxSizeEvent& event) | |
455 | { | |
456 | wxScrolledWindow::OnSize(event); | |
457 | CreateLayout(); | |
458 | } | |
459 | ||
460 | ||
461 | ||
462 | void wxHtmlWindow::OnKeyDown(wxKeyEvent& event) | |
463 | { | |
464 | int dummy; | |
465 | int sty, szy, cliy; | |
466 | ||
467 | ViewStart(&dummy, &sty); | |
efba2b89 VS |
468 | GetClientSize(&dummy, &cliy); cliy /= wxHTML_SCROLL_STEP; |
469 | GetVirtualSize(&dummy, &szy); szy /= wxHTML_SCROLL_STEP; | |
5526e819 VS |
470 | |
471 | switch (event.KeyCode()) { | |
472 | case WXK_PAGEUP : | |
473 | case WXK_PRIOR : | |
474 | Scroll(-1, sty - cliy); | |
475 | break; | |
476 | case WXK_PAGEDOWN : | |
477 | case WXK_NEXT : | |
478 | Scroll(-1, sty + cliy); | |
479 | break; | |
480 | case WXK_HOME : | |
481 | Scroll(-1, 0); | |
482 | break; | |
483 | case WXK_END : | |
484 | Scroll(-1, szy - cliy); | |
485 | break; | |
486 | case WXK_UP : | |
487 | Scroll(-1, sty - 1); | |
488 | break; | |
489 | case WXK_DOWN : | |
490 | Scroll(-1, sty + 1); | |
491 | break; | |
492 | } | |
493 | } | |
494 | ||
495 | ||
496 | ||
497 | void wxHtmlWindow::OnMouseEvent(wxMouseEvent& event) | |
498 | { | |
499 | m_tmpMouseMoved = TRUE; | |
500 | ||
501 | if (event.ButtonDown()) { | |
502 | int sx, sy; | |
503 | wxPoint pos; | |
504 | wxString lnk; | |
505 | ||
efba2b89 | 506 | ViewStart(&sx, &sy); sx *= wxHTML_SCROLL_STEP; sy *= wxHTML_SCROLL_STEP; |
5526e819 VS |
507 | pos = event.GetPosition(); |
508 | ||
509 | if (m_Cell) | |
0b2dadd3 | 510 | m_Cell -> OnMouseClick(this, sx + pos.x, sy + pos.y, event); |
5526e819 VS |
511 | } |
512 | } | |
513 | ||
514 | ||
515 | ||
516 | void wxHtmlWindow::OnIdle(wxIdleEvent& event) | |
517 | { | |
518 | static wxCursor cur_hand(wxCURSOR_HAND), cur_arrow(wxCURSOR_ARROW); | |
519 | ||
520 | if (m_tmpMouseMoved && (m_Cell != NULL)) { | |
521 | int sx, sy; | |
522 | int x, y; | |
846914d1 | 523 | wxHtmlLinkInfo *lnk; |
5526e819 | 524 | |
efba2b89 | 525 | ViewStart(&sx, &sy); sx *= wxHTML_SCROLL_STEP; sy *= wxHTML_SCROLL_STEP; |
5526e819 VS |
526 | wxGetMousePosition(&x, &y); |
527 | ScreenToClient(&x, &y); | |
528 | lnk = m_Cell -> GetLink(sx + x, sy + y); | |
529 | ||
622ea783 | 530 | if (lnk != m_tmpLastLink) { |
846914d1 | 531 | if (lnk == NULL) { |
622ea783 VS |
532 | SetCursor(cur_arrow); |
533 | if (m_RelatedStatusBar != -1) m_RelatedFrame -> SetStatusText(wxEmptyString, m_RelatedStatusBar); | |
534 | } | |
535 | else { | |
536 | SetCursor(cur_hand); | |
846914d1 VS |
537 | if (m_RelatedStatusBar != -1) |
538 | m_RelatedFrame -> SetStatusText(lnk -> GetHref(), m_RelatedStatusBar); | |
622ea783 VS |
539 | } |
540 | m_tmpLastLink = lnk; | |
5526e819 VS |
541 | } |
542 | m_tmpMouseMoved = FALSE; | |
543 | } | |
544 | } | |
545 | ||
546 | ||
547 | ||
548 | ||
549 | IMPLEMENT_DYNAMIC_CLASS(wxHtmlWindow,wxScrolledWindow) | |
550 | ||
551 | BEGIN_EVENT_TABLE(wxHtmlWindow, wxScrolledWindow) | |
552 | EVT_SIZE(wxHtmlWindow::OnSize) | |
553 | EVT_LEFT_DOWN(wxHtmlWindow::OnMouseEvent) | |
554 | EVT_MOTION(wxHtmlWindow::OnMouseEvent) | |
555 | EVT_IDLE(wxHtmlWindow::OnIdle) | |
556 | EVT_KEY_DOWN(wxHtmlWindow::OnKeyDown) | |
557 | END_EVENT_TABLE() | |
558 | ||
559 | ||
560 | ||
561 | ||
562 | ||
a76015e6 VS |
563 | // A module to allow initialization/cleanup |
564 | // without calling these functions from app.cpp or from | |
565 | // the user's application. | |
566 | ||
567 | class wxHtmlWinModule: public wxModule | |
568 | { | |
569 | DECLARE_DYNAMIC_CLASS(wxHtmlWinModule) | |
570 | public: | |
571 | wxHtmlWinModule() : wxModule() {} | |
572 | bool OnInit() { return TRUE; } | |
573 | void OnExit() { wxHtmlWindow::CleanUpStatics(); } | |
574 | }; | |
575 | ||
576 | IMPLEMENT_DYNAMIC_CLASS(wxHtmlWinModule, wxModule) | |
577 | ||
5526e819 VS |
578 | |
579 | ||
580 | ||
581 | ///// default mod handlers are forced there: | |
582 | ||
c88293a4 VS |
583 | FORCE_LINK(m_layout) |
584 | FORCE_LINK(m_fonts) | |
585 | FORCE_LINK(m_image) | |
586 | FORCE_LINK(m_list) | |
587 | FORCE_LINK(m_dflist) | |
588 | FORCE_LINK(m_pre) | |
589 | FORCE_LINK(m_hline) | |
590 | FORCE_LINK(m_links) | |
591 | FORCE_LINK(m_tables) | |
fa146dd7 | 592 | FORCE_LINK(m_meta) |
5526e819 VS |
593 | |
594 | ||
483ff5a5 | 595 | #endif |