]> git.saurik.com Git - wxWidgets.git/blob - src/html/htmlwin.cpp
Don't complain under MicroWindows if a wxDC's HDC is NULL - it happens
[wxWidgets.git] / src / html / htmlwin.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: htmlwin.cpp
3 // Purpose: wxHtmlWindow class for parsing & displaying HTML (implementation)
4 // Author: Vaclav Slavik
5 // RCS-ID: $Id$
6 // Copyright: (c) 1999 Vaclav Slavik
7 // Licence: wxWindows Licence
8 /////////////////////////////////////////////////////////////////////////////
9
10
11 #ifdef __GNUG__
12 #pragma implementation "htmlwin.h"
13 #pragma implementation "htmlproc.h"
14 #endif
15
16 #include "wx/wxprec.h"
17
18 #include "wx/defs.h"
19 #if wxUSE_HTML && wxUSE_STREAMS
20
21 #ifdef __BORDLANDC__
22 #pragma hdrstop
23 #endif
24
25 #ifndef WXPRECOMP
26 #include "wx/wx.h"
27 #endif
28
29 #include "wx/html/htmlwin.h"
30 #include "wx/html/forcelnk.h"
31 #include "wx/html/htmlproc.h"
32 #include "wx/log.h"
33 #include "wx/arrimpl.cpp"
34 #include "wx/list.h"
35 #include "wx/listimpl.cpp"
36
37 //-----------------------------------------------------------------------------
38 // wxHtmlHistoryItem
39 //-----------------------------------------------------------------------------
40
41 // item of history list
42 class WXDLLEXPORT wxHtmlHistoryItem : public wxObject
43 {
44 public:
45 wxHtmlHistoryItem(const wxString& p, const wxString& a) {m_Page = p, m_Anchor = a, m_Pos = 0;}
46 int GetPos() const {return m_Pos;}
47 void SetPos(int p) {m_Pos = p;}
48 const wxString& GetPage() const {return m_Page;}
49 const wxString& GetAnchor() const {return m_Anchor;}
50
51 private:
52 wxString m_Page;
53 wxString m_Anchor;
54 int m_Pos;
55 };
56
57
58 //-----------------------------------------------------------------------------
59 // our private arrays:
60 //-----------------------------------------------------------------------------
61
62 WX_DECLARE_OBJARRAY(wxHtmlHistoryItem, wxHtmlHistoryArray);
63 WX_DEFINE_OBJARRAY(wxHtmlHistoryArray);
64
65 WX_DECLARE_LIST(wxHtmlProcessor, wxHtmlProcessorList);
66 WX_DEFINE_LIST(wxHtmlProcessorList);
67
68 //-----------------------------------------------------------------------------
69 // wxHtmlWindow
70 //-----------------------------------------------------------------------------
71
72
73 wxHtmlWindow::wxHtmlWindow(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
74 long style, const wxString& name) : wxScrolledWindow(parent, id, pos, size, style | wxVSCROLL | wxHSCROLL, name)
75 {
76 m_tmpMouseMoved = FALSE;
77 m_tmpLastLink = NULL;
78 m_tmpCanDrawLocks = 0;
79 m_FS = new wxFileSystem();
80 m_RelatedStatusBar = -1;
81 m_RelatedFrame = NULL;
82 m_TitleFormat = wxT("%s");
83 m_OpenedPage = m_OpenedAnchor = m_OpenedPageTitle = wxEmptyString;
84 m_Cell = NULL;
85 m_Parser = new wxHtmlWinParser(this);
86 m_Parser->SetFS(m_FS);
87 SetBorders(10);
88 m_HistoryPos = -1;
89 m_HistoryOn = TRUE;
90 m_History = new wxHtmlHistoryArray;
91 m_Processors = NULL;
92 m_Style = style;
93 SetPage(wxT("<html><body></body></html>"));
94 }
95
96
97
98 wxHtmlWindow::~wxHtmlWindow()
99 {
100 HistoryClear();
101
102 if (m_Cell) delete m_Cell;
103
104 delete m_Parser;
105 delete m_FS;
106 delete m_History;
107 delete m_Processors;
108 }
109
110
111
112 void wxHtmlWindow::SetRelatedFrame(wxFrame* frame, const wxString& format)
113 {
114 m_RelatedFrame = frame;
115 m_TitleFormat = format;
116 }
117
118
119
120 void wxHtmlWindow::SetRelatedStatusBar(int bar)
121 {
122 m_RelatedStatusBar = bar;
123 }
124
125
126
127 void wxHtmlWindow::SetFonts(wxString normal_face, wxString fixed_face, const int *sizes)
128 {
129 wxString op = m_OpenedPage;
130
131 m_Parser->SetFonts(normal_face, fixed_face, sizes);
132 // fonts changed => contents invalid, so reload the page:
133 SetPage(wxT("<html><body></body></html>"));
134 if (!op.IsEmpty()) LoadPage(op);
135 }
136
137
138
139 bool wxHtmlWindow::SetPage(const wxString& source)
140 {
141 wxString newsrc(source);
142
143 // pass HTML through registered processors:
144 if (m_Processors || m_GlobalProcessors)
145 {
146 wxHtmlProcessorList::Node *nodeL, *nodeG;
147 int prL, prG;
148
149 nodeL = (m_Processors) ? m_Processors->GetFirst() : NULL;
150 nodeG = (m_GlobalProcessors) ? m_GlobalProcessors->GetFirst() : NULL;
151
152 // VS: there are two lists, global and local, both of them sorted by
153 // priority. Since we have to go through _both_ lists with
154 // decreasing priority, we "merge-sort" the lists on-line by
155 // processing that one of the two heads that has higher priority
156 // in every iteration
157 while (nodeL || nodeG)
158 {
159 prL = (nodeL) ? nodeL->GetData()->GetPriority() : -1;
160 prG = (nodeG) ? nodeG->GetData()->GetPriority() : -1;
161 if (prL > prG)
162 {
163 if (nodeL->GetData()->IsEnabled())
164 newsrc = nodeL->GetData()->Process(newsrc);
165 nodeL = nodeL->GetNext();
166 }
167 else // prL <= prG
168 {
169 if (nodeG->GetData()->IsEnabled())
170 newsrc = nodeG->GetData()->Process(newsrc);
171 nodeG = nodeG->GetNext();
172 }
173 }
174 }
175
176 // ...and run the parser on it:
177 wxClientDC *dc = new wxClientDC(this);
178 dc->SetMapMode(wxMM_TEXT);
179 SetBackgroundColour(wxColour(0xFF, 0xFF, 0xFF));
180 m_OpenedPage = m_OpenedAnchor = m_OpenedPageTitle = wxEmptyString;
181 m_Parser->SetDC(dc);
182 if (m_Cell)
183 {
184 delete m_Cell;
185 m_Cell = NULL;
186 }
187 m_Cell = (wxHtmlContainerCell*) m_Parser->Parse(newsrc);
188 delete dc;
189 m_Cell->SetIndent(m_Borders, wxHTML_INDENT_ALL, wxHTML_UNITS_PIXELS);
190 m_Cell->SetAlignHor(wxHTML_ALIGN_CENTER);
191 CreateLayout();
192 if (m_tmpCanDrawLocks == 0)
193 Refresh();
194 return TRUE;
195 }
196
197
198 bool wxHtmlWindow::LoadPage(const wxString& location)
199 {
200 wxFSFile *f;
201 bool rt_val;
202 bool needs_refresh = FALSE;
203
204 SetCursor(*wxHOURGLASS_CURSOR);
205 wxYield(); Refresh(FALSE);
206
207 m_tmpCanDrawLocks++;
208 if (m_HistoryOn && (m_HistoryPos != -1))
209 {
210 // store scroll position into history item:
211 int x, y;
212 GetViewStart(&x, &y);
213 (*m_History)[m_HistoryPos].SetPos(y);
214 }
215
216 if (location[0] == wxT('#'))
217 {
218 // local anchor:
219 wxString anch = location.Mid(1) /*1 to end*/;
220 m_tmpCanDrawLocks--;
221 rt_val = ScrollToAnchor(anch);
222 m_tmpCanDrawLocks++;
223 }
224 else if (location.Find(wxT('#')) != wxNOT_FOUND && location.BeforeFirst(wxT('#')) == m_OpenedPage)
225 {
226 wxString anch = location.AfterFirst(wxT('#'));
227 m_tmpCanDrawLocks--;
228 rt_val = ScrollToAnchor(anch);
229 m_tmpCanDrawLocks++;
230 }
231 else if (location.Find(wxT('#')) != wxNOT_FOUND &&
232 (m_FS->GetPath() + location.BeforeFirst(wxT('#'))) == m_OpenedPage)
233 {
234 wxString anch = location.AfterFirst(wxT('#'));
235 m_tmpCanDrawLocks--;
236 rt_val = ScrollToAnchor(anch);
237 m_tmpCanDrawLocks++;
238 }
239
240 else
241 {
242 needs_refresh = TRUE;
243 // load&display it:
244 if (m_RelatedStatusBar != -1)
245 {
246 m_RelatedFrame->SetStatusText(_("Connecting..."), m_RelatedStatusBar);
247 Refresh(FALSE);
248 }
249
250 f = m_FS->OpenFile(location);
251
252 if (f == NULL)
253 {
254 wxLogError(_("Unable to open requested HTML document: %s"), location.c_str());
255 m_tmpCanDrawLocks--;
256
257 SetCursor(*wxSTANDARD_CURSOR);
258 return FALSE;
259 }
260
261 else
262 {
263 wxNode *node;
264 wxString src = wxEmptyString;
265
266 if (m_RelatedStatusBar != -1)
267 {
268 wxString msg = _("Loading : ") + location;
269 m_RelatedFrame->SetStatusText(msg, m_RelatedStatusBar);
270 Refresh(FALSE);
271 }
272
273 node = m_Filters.GetFirst();
274 while (node)
275 {
276 wxHtmlFilter *h = (wxHtmlFilter*) node->GetData();
277 if (h->CanRead(*f))
278 {
279 src = h->ReadFile(*f);
280 break;
281 }
282 node = node->GetNext();
283 }
284 if (src == wxEmptyString)
285 {
286 if (m_DefaultFilter == NULL) m_DefaultFilter = GetDefaultFilter();
287 src = m_DefaultFilter->ReadFile(*f);
288 }
289
290 m_FS->ChangePathTo(f->GetLocation());
291 rt_val = SetPage(src);
292 m_OpenedPage = f->GetLocation();
293 if (f->GetAnchor() != wxEmptyString)
294 {
295 wxYield();
296 ScrollToAnchor(f->GetAnchor());
297 }
298
299 delete f;
300
301 if (m_RelatedStatusBar != -1) m_RelatedFrame->SetStatusText(_("Done"), m_RelatedStatusBar);
302 }
303 }
304
305 if (m_HistoryOn) // add this page to history there:
306 {
307 int c = m_History->GetCount() - (m_HistoryPos + 1);
308
309 if (m_HistoryPos < 0 ||
310 (*m_History)[m_HistoryPos].GetPage() != m_OpenedPage ||
311 (*m_History)[m_HistoryPos].GetAnchor() != m_OpenedAnchor)
312 {
313 m_HistoryPos++;
314 for (int i = 0; i < c; i++)
315 m_History->Remove(m_HistoryPos);
316 m_History->Add(new wxHtmlHistoryItem(m_OpenedPage, m_OpenedAnchor));
317 }
318 }
319
320 if (m_OpenedPageTitle == wxEmptyString)
321 OnSetTitle(wxFileNameFromPath(m_OpenedPage));
322 SetCursor(*wxSTANDARD_CURSOR);
323
324 if (needs_refresh)
325 {
326 wxYield();
327 m_tmpCanDrawLocks--;
328 Refresh();
329 }
330 else
331 m_tmpCanDrawLocks--;
332
333 return rt_val;
334 }
335
336
337
338 bool wxHtmlWindow::ScrollToAnchor(const wxString& anchor)
339 {
340 const wxHtmlCell *c = m_Cell->Find(wxHTML_COND_ISANCHOR, &anchor);
341 if (!c)
342 {
343 wxLogWarning(_("HTML anchor %s does not exist."), anchor.c_str());
344 return FALSE;
345 }
346 else
347 {
348 int y;
349
350 for (y = 0; c != NULL; c = c->GetParent()) y += c->GetPosY();
351 Scroll(-1, y / wxHTML_SCROLL_STEP);
352 m_OpenedAnchor = anchor;
353 return TRUE;
354 }
355 }
356
357
358 void wxHtmlWindow::OnSetTitle(const wxString& title)
359 {
360 if (m_RelatedFrame)
361 {
362 wxString tit;
363 tit.Printf(m_TitleFormat, title.c_str());
364 m_RelatedFrame->SetTitle(tit);
365 }
366 m_OpenedPageTitle = title;
367 }
368
369
370
371
372
373 void wxHtmlWindow::CreateLayout()
374 {
375 int ClientWidth, ClientHeight;
376
377 if (!m_Cell) return;
378
379 if (m_Style & wxHW_SCROLLBAR_NEVER)
380 {
381 SetScrollbars(wxHTML_SCROLL_STEP, 1, m_Cell->GetWidth() / wxHTML_SCROLL_STEP, 0); // always off
382 GetClientSize(&ClientWidth, &ClientHeight);
383 m_Cell->Layout(ClientWidth);
384 }
385
386 else {
387 GetClientSize(&ClientWidth, &ClientHeight);
388 m_Cell->Layout(ClientWidth);
389 if (ClientHeight < m_Cell->GetHeight() + GetCharHeight())
390 {
391 SetScrollbars(
392 wxHTML_SCROLL_STEP, wxHTML_SCROLL_STEP,
393 m_Cell->GetWidth() / wxHTML_SCROLL_STEP,
394 (m_Cell->GetHeight() + GetCharHeight()) / wxHTML_SCROLL_STEP
395 /*cheat: top-level frag is always container*/);
396 }
397 else /* we fit into window, no need for scrollbars */
398 {
399 SetScrollbars(wxHTML_SCROLL_STEP, 1, m_Cell->GetWidth() / wxHTML_SCROLL_STEP, 0); // disable...
400 GetClientSize(&ClientWidth, &ClientHeight);
401 m_Cell->Layout(ClientWidth); // ...and relayout
402 }
403 }
404 }
405
406
407
408 void wxHtmlWindow::ReadCustomization(wxConfigBase *cfg, wxString path)
409 {
410 wxString oldpath;
411 wxString tmp;
412 int p_fontsizes[7];
413 wxString p_fff, p_ffn;
414
415 if (path != wxEmptyString)
416 {
417 oldpath = cfg->GetPath();
418 cfg->SetPath(path);
419 }
420
421 m_Borders = cfg->Read(wxT("wxHtmlWindow/Borders"), m_Borders);
422 p_fff = cfg->Read(wxT("wxHtmlWindow/FontFaceFixed"), m_Parser->m_FontFaceFixed);
423 p_ffn = cfg->Read(wxT("wxHtmlWindow/FontFaceNormal"), m_Parser->m_FontFaceNormal);
424 for (int i = 0; i < 7; i++)
425 {
426 tmp.Printf(wxT("wxHtmlWindow/FontsSize%i"), i);
427 p_fontsizes[i] = cfg->Read(tmp, m_Parser->m_FontsSizes[i]);
428 }
429 SetFonts(p_ffn, p_fff, p_fontsizes);
430
431 if (path != wxEmptyString)
432 cfg->SetPath(oldpath);
433 }
434
435
436
437 void wxHtmlWindow::WriteCustomization(wxConfigBase *cfg, wxString path)
438 {
439 wxString oldpath;
440 wxString tmp;
441
442 if (path != wxEmptyString)
443 {
444 oldpath = cfg->GetPath();
445 cfg->SetPath(path);
446 }
447
448 cfg->Write(wxT("wxHtmlWindow/Borders"), (long) m_Borders);
449 cfg->Write(wxT("wxHtmlWindow/FontFaceFixed"), m_Parser->m_FontFaceFixed);
450 cfg->Write(wxT("wxHtmlWindow/FontFaceNormal"), m_Parser->m_FontFaceNormal);
451 for (int i = 0; i < 7; i++)
452 {
453 tmp.Printf(wxT("wxHtmlWindow/FontsSize%i"), i);
454 cfg->Write(tmp, (long) m_Parser->m_FontsSizes[i]);
455 }
456
457 if (path != wxEmptyString)
458 cfg->SetPath(oldpath);
459 }
460
461
462
463 bool wxHtmlWindow::HistoryBack()
464 {
465 wxString a, l;
466
467 if (m_HistoryPos < 1) return FALSE;
468
469 // store scroll position into history item:
470 int x, y;
471 GetViewStart(&x, &y);
472 (*m_History)[m_HistoryPos].SetPos(y);
473
474 // go to previous position:
475 m_HistoryPos--;
476
477 l = (*m_History)[m_HistoryPos].GetPage();
478 a = (*m_History)[m_HistoryPos].GetAnchor();
479 m_HistoryOn = FALSE;
480 m_tmpCanDrawLocks++;
481 if (a == wxEmptyString) LoadPage(l);
482 else LoadPage(l + wxT("#") + a);
483 m_HistoryOn = TRUE;
484 wxYield();
485 m_tmpCanDrawLocks--;
486 Scroll(0, (*m_History)[m_HistoryPos].GetPos());
487 Refresh();
488 return TRUE;
489 }
490
491 bool wxHtmlWindow::HistoryCanBack()
492 {
493 if (m_HistoryPos < 1) return FALSE;
494 return TRUE ;
495 }
496
497
498 bool wxHtmlWindow::HistoryForward()
499 {
500 wxString a, l;
501
502 if (m_HistoryPos == -1) return FALSE;
503 if (m_HistoryPos >= (int)m_History->GetCount() - 1)return FALSE;
504
505 m_OpenedPage = wxEmptyString; // this will disable adding new entry into history in LoadPage()
506
507 m_HistoryPos++;
508 l = (*m_History)[m_HistoryPos].GetPage();
509 a = (*m_History)[m_HistoryPos].GetAnchor();
510 m_HistoryOn = FALSE;
511 m_tmpCanDrawLocks++;
512 if (a == wxEmptyString) LoadPage(l);
513 else LoadPage(l + wxT("#") + a);
514 m_HistoryOn = TRUE;
515 wxYield();
516 m_tmpCanDrawLocks--;
517 Scroll(0, (*m_History)[m_HistoryPos].GetPos());
518 Refresh();
519 return TRUE;
520 }
521
522 bool wxHtmlWindow::HistoryCanForward()
523 {
524 if (m_HistoryPos == -1) return FALSE;
525 if (m_HistoryPos >= (int)m_History->GetCount() - 1)return FALSE;
526 return TRUE ;
527 }
528
529
530 void wxHtmlWindow::HistoryClear()
531 {
532 m_History->Empty();
533 m_HistoryPos = -1;
534 }
535
536 void wxHtmlWindow::AddProcessor(wxHtmlProcessor *processor)
537 {
538 if (!m_Processors)
539 {
540 m_Processors = new wxHtmlProcessorList;
541 m_Processors->DeleteContents(TRUE);
542 }
543 wxHtmlProcessorList::Node *node;
544
545 for (node = m_Processors->GetFirst(); node; node = node->GetNext())
546 {
547 if (processor->GetPriority() > node->GetData()->GetPriority())
548 {
549 m_Processors->Insert(node, processor);
550 return;
551 }
552 }
553 m_Processors->Append(processor);
554 }
555
556 /*static */ void wxHtmlWindow::AddGlobalProcessor(wxHtmlProcessor *processor)
557 {
558 if (!m_GlobalProcessors)
559 {
560 m_GlobalProcessors = new wxHtmlProcessorList;
561 m_GlobalProcessors->DeleteContents(TRUE);
562 }
563 wxHtmlProcessorList::Node *node;
564
565 for (node = m_GlobalProcessors->GetFirst(); node; node = node->GetNext())
566 {
567 if (processor->GetPriority() > node->GetData()->GetPriority())
568 {
569 m_GlobalProcessors->Insert(node, processor);
570 return;
571 }
572 }
573 m_GlobalProcessors->Append(processor);
574 }
575
576
577
578 wxList wxHtmlWindow::m_Filters;
579 wxHtmlFilter *wxHtmlWindow::m_DefaultFilter = NULL;
580 wxCursor *wxHtmlWindow::s_cur_hand = NULL;
581 wxCursor *wxHtmlWindow::s_cur_arrow = NULL;
582 wxHtmlProcessorList *wxHtmlWindow::m_GlobalProcessors = NULL;
583
584 void wxHtmlWindow::CleanUpStatics()
585 {
586 delete m_DefaultFilter;
587 m_DefaultFilter = NULL;
588 m_Filters.DeleteContents(TRUE);
589 m_Filters.Clear();
590 delete m_GlobalProcessors;
591 m_GlobalProcessors = NULL;
592 delete s_cur_hand;
593 delete s_cur_arrow;
594 }
595
596
597
598 void wxHtmlWindow::AddFilter(wxHtmlFilter *filter)
599 {
600 m_Filters.Append(filter);
601 }
602
603
604
605
606 void wxHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link)
607 {
608 LoadPage(link.GetHref());
609 }
610
611
612
613 void wxHtmlWindow::OnDraw(wxDC& dc)
614 {
615 int x, y;
616 wxRegionIterator upd(GetUpdateRegion()); // get the update rect list
617 int v_y, v_h;
618
619 if (m_tmpCanDrawLocks > 0) return;
620
621 dc.SetMapMode(wxMM_TEXT);
622 #if 0
623 /* VS - I don't think this is neccessary any longer
624 MSC_VER 1200 means MSVC 6.0 and it works fine */
625 #if defined(_MSC_VER) && (_MSC_VER == 1200)
626 ::SetMapMode((HDC)dc.GetHDC(), MM_TEXT);
627 #endif
628 #endif
629 dc.SetBackgroundMode(wxTRANSPARENT);
630 GetViewStart(&x, &y);
631
632 while (upd)
633 {
634 v_y = upd.GetY();
635 v_h = upd.GetH();
636 if (m_Cell) m_Cell->Draw(dc, 0, 0, y * wxHTML_SCROLL_STEP + v_y, y * wxHTML_SCROLL_STEP + v_h + v_y);
637 upd++;
638 }
639 }
640
641
642
643
644 void wxHtmlWindow::OnSize(wxSizeEvent& event)
645 {
646 wxScrolledWindow::OnSize(event);
647 CreateLayout();
648 Refresh();
649 }
650
651
652 void wxHtmlWindow::OnMouseEvent(wxMouseEvent& event)
653 {
654 m_tmpMouseMoved = TRUE;
655
656 if (event.ButtonDown())
657 {
658 int sx, sy;
659 wxPoint pos;
660 wxString lnk;
661
662 GetViewStart(&sx, &sy); sx *= wxHTML_SCROLL_STEP; sy *= wxHTML_SCROLL_STEP;
663 pos = event.GetPosition();
664
665 if (m_Cell)
666 m_Cell->OnMouseClick(this, sx + pos.x, sy + pos.y, event);
667 }
668 }
669
670
671
672 void wxHtmlWindow::OnIdle(wxIdleEvent& WXUNUSED(event))
673 {
674 if (s_cur_hand == NULL)
675 {
676 s_cur_hand = new wxCursor(wxCURSOR_HAND);
677 s_cur_arrow = new wxCursor(wxCURSOR_ARROW);
678 }
679
680 if (m_tmpMouseMoved && (m_Cell != NULL))
681 {
682 int sx, sy;
683 int x, y;
684 wxHtmlLinkInfo *lnk;
685
686 GetViewStart(&sx, &sy); sx *= wxHTML_SCROLL_STEP; sy *= wxHTML_SCROLL_STEP;
687 wxGetMousePosition(&x, &y);
688 ScreenToClient(&x, &y);
689 lnk = m_Cell->GetLink(sx + x, sy + y);
690
691 if (lnk != m_tmpLastLink)
692 {
693 if (lnk == NULL)
694 {
695 SetCursor(*s_cur_arrow);
696 if (m_RelatedStatusBar != -1) m_RelatedFrame->SetStatusText(wxEmptyString, m_RelatedStatusBar);
697 }
698 else
699 {
700 SetCursor(*s_cur_hand);
701 if (m_RelatedStatusBar != -1)
702 m_RelatedFrame->SetStatusText(lnk->GetHref(), m_RelatedStatusBar);
703 }
704 m_tmpLastLink = lnk;
705 }
706 m_tmpMouseMoved = FALSE;
707 }
708 }
709
710
711 IMPLEMENT_ABSTRACT_CLASS(wxHtmlProcessor,wxObject)
712
713 IMPLEMENT_DYNAMIC_CLASS(wxHtmlWindow,wxScrolledWindow)
714
715 BEGIN_EVENT_TABLE(wxHtmlWindow, wxScrolledWindow)
716 EVT_SIZE(wxHtmlWindow::OnSize)
717 EVT_LEFT_DOWN(wxHtmlWindow::OnMouseEvent)
718 EVT_MOTION(wxHtmlWindow::OnMouseEvent)
719 EVT_IDLE(wxHtmlWindow::OnIdle)
720 END_EVENT_TABLE()
721
722
723
724
725
726 // A module to allow initialization/cleanup
727 // without calling these functions from app.cpp or from
728 // the user's application.
729
730 class wxHtmlWinModule: public wxModule
731 {
732 DECLARE_DYNAMIC_CLASS(wxHtmlWinModule)
733 public:
734 wxHtmlWinModule() : wxModule() {}
735 bool OnInit() { return TRUE; }
736 void OnExit() { wxHtmlWindow::CleanUpStatics(); }
737 };
738
739 IMPLEMENT_DYNAMIC_CLASS(wxHtmlWinModule, wxModule)
740
741
742
743
744 ///// default mod handlers are forced there:
745
746 FORCE_LINK(m_layout)
747 FORCE_LINK(m_fonts)
748 FORCE_LINK(m_image)
749 FORCE_LINK(m_list)
750 FORCE_LINK(m_dflist)
751 FORCE_LINK(m_pre)
752 FORCE_LINK(m_hline)
753 FORCE_LINK(m_links)
754 FORCE_LINK(m_tables)
755 FORCE_LINK(m_meta)
756
757
758 #endif