1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/html/htmlwin.cpp
3 // Purpose: wxHtmlWindow class for parsing & displaying HTML (implementation)
4 // Author: Vaclav Slavik
6 // Copyright: (c) 1999 Vaclav Slavik
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 #include "wx/wxprec.h"
16 #if wxUSE_HTML && wxUSE_STREAMS
22 #include "wx/dcclient.h"
24 #include "wx/dcmemory.h"
26 #include "wx/settings.h"
27 #include "wx/dataobj.h"
30 #include "wx/html/htmlwin.h"
31 #include "wx/html/htmlproc.h"
32 #include "wx/clipbrd.h"
34 #include "wx/arrimpl.cpp"
35 #include "wx/listimpl.cpp"
38 IMPLEMENT_DYNAMIC_CLASS(wxHtmlLinkEvent
, wxCommandEvent
)
39 IMPLEMENT_DYNAMIC_CLASS(wxHtmlCellEvent
, wxCommandEvent
)
41 DEFINE_EVENT_TYPE(wxEVT_COMMAND_HTML_CELL_CLICKED
)
42 DEFINE_EVENT_TYPE(wxEVT_COMMAND_HTML_CELL_HOVER
)
43 DEFINE_EVENT_TYPE(wxEVT_COMMAND_HTML_LINK_CLICKED
)
47 // ----------------------------------------------------------------------------
48 // wxHtmlWinAutoScrollTimer: the timer used to generate a stream of scroll
49 // events when a captured mouse is held outside the window
50 // ----------------------------------------------------------------------------
52 class wxHtmlWinAutoScrollTimer
: public wxTimer
55 wxHtmlWinAutoScrollTimer(wxScrolledWindow
*win
,
56 wxEventType eventTypeToSend
,
60 m_eventType
= eventTypeToSend
;
65 virtual void Notify();
68 wxScrolledWindow
*m_win
;
69 wxEventType m_eventType
;
73 DECLARE_NO_COPY_CLASS(wxHtmlWinAutoScrollTimer
)
76 void wxHtmlWinAutoScrollTimer::Notify()
78 // only do all this as long as the window is capturing the mouse
79 if ( wxWindow::GetCapture() != m_win
)
83 else // we still capture the mouse, continue generating events
85 // first scroll the window if we are allowed to do it
86 wxScrollWinEvent
event1(m_eventType
, m_pos
, m_orient
);
87 event1
.SetEventObject(m_win
);
88 if ( m_win
->GetEventHandler()->ProcessEvent(event1
) )
90 // and then send a pseudo mouse-move event to refresh the selection
91 wxMouseEvent
event2(wxEVT_MOTION
);
92 wxGetMousePosition(&event2
.m_x
, &event2
.m_y
);
94 // the mouse event coordinates should be client, not screen as
95 // returned by wxGetMousePosition
96 wxWindow
*parentTop
= m_win
;
97 while ( parentTop
->GetParent() )
98 parentTop
= parentTop
->GetParent();
99 wxPoint ptOrig
= parentTop
->GetPosition();
100 event2
.m_x
-= ptOrig
.x
;
101 event2
.m_y
-= ptOrig
.y
;
103 event2
.SetEventObject(m_win
);
105 // FIXME: we don't fill in the other members - ok?
106 m_win
->GetEventHandler()->ProcessEvent(event2
);
108 else // can't scroll further, stop
115 #endif // wxUSE_CLIPBOARD
119 //-----------------------------------------------------------------------------
121 //-----------------------------------------------------------------------------
123 // item of history list
124 class WXDLLIMPEXP_HTML wxHtmlHistoryItem
127 wxHtmlHistoryItem(const wxString
& p
, const wxString
& a
) {m_Page
= p
, m_Anchor
= a
, m_Pos
= 0;}
128 int GetPos() const {return m_Pos
;}
129 void SetPos(int p
) {m_Pos
= p
;}
130 const wxString
& GetPage() const {return m_Page
;}
131 const wxString
& GetAnchor() const {return m_Anchor
;}
140 //-----------------------------------------------------------------------------
141 // our private arrays:
142 //-----------------------------------------------------------------------------
144 WX_DECLARE_OBJARRAY(wxHtmlHistoryItem
, wxHtmlHistoryArray
);
145 WX_DEFINE_OBJARRAY(wxHtmlHistoryArray
)
147 WX_DECLARE_LIST(wxHtmlProcessor
, wxHtmlProcessorList
);
148 WX_DEFINE_LIST(wxHtmlProcessorList
)
150 //-----------------------------------------------------------------------------
151 // wxHtmlWindowMouseHelper
152 //-----------------------------------------------------------------------------
154 wxHtmlWindowMouseHelper::wxHtmlWindowMouseHelper(wxHtmlWindowInterface
*iface
)
155 : m_tmpMouseMoved(false),
162 void wxHtmlWindowMouseHelper::HandleMouseMoved()
164 m_tmpMouseMoved
= true;
167 bool wxHtmlWindowMouseHelper::HandleMouseClick(wxHtmlCell
*rootCell
,
169 const wxMouseEvent
& event
)
174 wxHtmlCell
*cell
= rootCell
->FindCellByPos(pos
.x
, pos
.y
);
175 // this check is needed because FindCellByPos returns terminal cell and
176 // containers may have empty borders -- in this case NULL will be
181 // adjust the coordinates to be relative to this cell:
182 wxPoint relpos
= pos
- cell
->GetAbsPos(rootCell
);
184 return OnCellClicked(cell
, relpos
.x
, relpos
.y
, event
);
187 void wxHtmlWindowMouseHelper::HandleIdle(wxHtmlCell
*rootCell
,
190 wxHtmlCell
*cell
= rootCell
? rootCell
->FindCellByPos(pos
.x
, pos
.y
) : NULL
;
192 if (cell
!= m_tmpLastCell
)
194 wxHtmlLinkInfo
*lnk
= NULL
;
197 // adjust the coordinates to be relative to this cell:
198 wxPoint relpos
= pos
- cell
->GetAbsPos(rootCell
);
199 lnk
= cell
->GetLink(relpos
.x
, relpos
.y
);
204 cur
= cell
->GetMouseCursor(m_interface
);
206 cur
= m_interface
->GetHTMLCursor(
207 wxHtmlWindowInterface::HTMLCursor_Default
);
209 m_interface
->GetHTMLWindow()->SetCursor(cur
);
211 if (lnk
!= m_tmpLastLink
)
214 m_interface
->SetHTMLStatusText(lnk
->GetHref());
216 m_interface
->SetHTMLStatusText(wxEmptyString
);
221 m_tmpLastCell
= cell
;
223 else // mouse moved but stayed in the same cell
227 OnCellMouseHover(cell
, pos
.x
, pos
.y
);
231 m_tmpMouseMoved
= false;
234 bool wxHtmlWindowMouseHelper::OnCellClicked(wxHtmlCell
*cell
,
235 wxCoord x
, wxCoord y
,
236 const wxMouseEvent
& event
)
238 wxHtmlCellEvent
ev(wxEVT_COMMAND_HTML_CELL_CLICKED
,
239 m_interface
->GetHTMLWindow()->GetId(),
240 cell
, wxPoint(x
,y
), event
);
242 if (!m_interface
->GetHTMLWindow()->GetEventHandler()->ProcessEvent(ev
))
244 // if the event wasn't handled, do the default processing here:
246 wxASSERT_MSG( cell
, _T("can't be called with NULL cell") );
248 cell
->ProcessMouseClick(m_interface
, ev
.GetPoint(), ev
.GetMouseEvent());
251 // true if a link was clicked, false otherwise
252 return ev
.GetLinkClicked();
255 void wxHtmlWindowMouseHelper::OnCellMouseHover(wxHtmlCell
* cell
,
259 wxHtmlCellEvent
ev(wxEVT_COMMAND_HTML_CELL_HOVER
,
260 m_interface
->GetHTMLWindow()->GetId(),
261 cell
, wxPoint(x
,y
), wxMouseEvent());
262 m_interface
->GetHTMLWindow()->GetEventHandler()->ProcessEvent(ev
);
268 //-----------------------------------------------------------------------------
270 //-----------------------------------------------------------------------------
272 wxList
wxHtmlWindow::m_Filters
;
273 wxHtmlFilter
*wxHtmlWindow::m_DefaultFilter
= NULL
;
274 wxHtmlProcessorList
*wxHtmlWindow::m_GlobalProcessors
= NULL
;
275 wxCursor
*wxHtmlWindow::ms_cursorLink
= NULL
;
276 wxCursor
*wxHtmlWindow::ms_cursorText
= NULL
;
278 void wxHtmlWindow::CleanUpStatics()
280 wxDELETE(m_DefaultFilter
);
281 WX_CLEAR_LIST(wxList
, m_Filters
);
282 if (m_GlobalProcessors
)
283 WX_CLEAR_LIST(wxHtmlProcessorList
, *m_GlobalProcessors
);
284 wxDELETE(m_GlobalProcessors
);
285 wxDELETE(ms_cursorLink
);
286 wxDELETE(ms_cursorText
);
289 void wxHtmlWindow::Init()
291 m_tmpCanDrawLocks
= 0;
292 m_FS
= new wxFileSystem();
294 m_RelatedStatusBar
= NULL
;
295 m_RelatedStatusBarIndex
= -1;
296 #endif // wxUSE_STATUSBAR
297 m_RelatedFrame
= NULL
;
298 m_TitleFormat
= wxT("%s");
299 m_OpenedPage
= m_OpenedAnchor
= m_OpenedPageTitle
= wxEmptyString
;
301 m_Parser
= new wxHtmlWinParser(this);
302 m_Parser
->SetFS(m_FS
);
305 m_History
= new wxHtmlHistoryArray
;
309 m_makingSelection
= false;
311 m_timerAutoScroll
= NULL
;
312 m_lastDoubleClick
= 0;
313 #endif // wxUSE_CLIPBOARD
315 m_eraseBgInOnPaint
= false;
316 m_tmpSelFromCell
= NULL
;
319 bool wxHtmlWindow::Create(wxWindow
*parent
, wxWindowID id
,
320 const wxPoint
& pos
, const wxSize
& size
,
321 long style
, const wxString
& name
)
323 if (!wxScrolledWindow::Create(parent
, id
, pos
, size
,
324 style
| wxVSCROLL
| wxHSCROLL
,
328 SetPage(wxT("<html><body></body></html>"));
333 wxHtmlWindow::~wxHtmlWindow()
337 #endif // wxUSE_CLIPBOARD
346 WX_CLEAR_LIST(wxHtmlProcessorList
, *m_Processors
);
358 void wxHtmlWindow::SetRelatedFrame(wxFrame
* frame
, const wxString
& format
)
360 m_RelatedFrame
= frame
;
361 m_TitleFormat
= format
;
367 void wxHtmlWindow::SetRelatedStatusBar(int index
)
369 m_RelatedStatusBarIndex
= index
;
372 void wxHtmlWindow::SetRelatedStatusBar(wxStatusBar
* statusbar
, int index
)
374 m_RelatedStatusBar
= statusbar
;
375 m_RelatedStatusBarIndex
= index
;
378 #endif // wxUSE_STATUSBAR
382 void wxHtmlWindow::SetFonts(const wxString
& normal_face
, const wxString
& fixed_face
, const int *sizes
)
384 m_Parser
->SetFonts(normal_face
, fixed_face
, sizes
);
386 // re-layout the page after changing fonts:
387 DoSetPage(*(m_Parser
->GetSource()));
390 void wxHtmlWindow::SetStandardFonts(int size
,
391 const wxString
& normal_face
,
392 const wxString
& fixed_face
)
394 m_Parser
->SetStandardFonts(size
, normal_face
, fixed_face
);
396 // re-layout the page after changing fonts:
397 DoSetPage(*(m_Parser
->GetSource()));
400 bool wxHtmlWindow::SetPage(const wxString
& source
)
402 m_OpenedPage
= m_OpenedAnchor
= m_OpenedPageTitle
= wxEmptyString
;
403 return DoSetPage(source
);
406 bool wxHtmlWindow::DoSetPage(const wxString
& source
)
408 wxString
newsrc(source
);
410 wxDELETE(m_selection
);
412 // we will soon delete all the cells, so clear pointers to them:
413 m_tmpSelFromCell
= NULL
;
415 // pass HTML through registered processors:
416 if (m_Processors
|| m_GlobalProcessors
)
418 wxHtmlProcessorList::compatibility_iterator nodeL
, nodeG
;
422 nodeL
= m_Processors
->GetFirst();
423 if ( m_GlobalProcessors
)
424 nodeG
= m_GlobalProcessors
->GetFirst();
426 // VS: there are two lists, global and local, both of them sorted by
427 // priority. Since we have to go through _both_ lists with
428 // decreasing priority, we "merge-sort" the lists on-line by
429 // processing that one of the two heads that has higher priority
430 // in every iteration
431 while (nodeL
|| nodeG
)
433 prL
= (nodeL
) ? nodeL
->GetData()->GetPriority() : -1;
434 prG
= (nodeG
) ? nodeG
->GetData()->GetPriority() : -1;
437 if (nodeL
->GetData()->IsEnabled())
438 newsrc
= nodeL
->GetData()->Process(newsrc
);
439 nodeL
= nodeL
->GetNext();
443 if (nodeG
->GetData()->IsEnabled())
444 newsrc
= nodeG
->GetData()->Process(newsrc
);
445 nodeG
= nodeG
->GetNext();
450 // ...and run the parser on it:
451 wxClientDC
*dc
= new wxClientDC(this);
452 dc
->SetMapMode(wxMM_TEXT
);
453 SetBackgroundColour(wxColour(0xFF, 0xFF, 0xFF));
454 SetBackgroundImage(wxNullBitmap
);
462 m_Cell
= (wxHtmlContainerCell
*) m_Parser
->Parse(newsrc
);
464 m_Cell
->SetIndent(m_Borders
, wxHTML_INDENT_ALL
, wxHTML_UNITS_PIXELS
);
465 m_Cell
->SetAlignHor(wxHTML_ALIGN_CENTER
);
467 if (m_tmpCanDrawLocks
== 0)
472 bool wxHtmlWindow::AppendToPage(const wxString
& source
)
474 return DoSetPage(*(GetParser()->GetSource()) + source
);
477 bool wxHtmlWindow::LoadPage(const wxString
& location
)
479 wxCHECK_MSG( !location
.empty(), false, "location must be non-empty" );
481 wxBusyCursor busyCursor
;
484 bool needs_refresh
= false;
487 if (m_HistoryOn
&& (m_HistoryPos
!= -1))
489 // store scroll position into history item:
491 GetViewStart(&x
, &y
);
492 (*m_History
)[m_HistoryPos
].SetPos(y
);
495 // first check if we're moving to an anchor in the same page
496 size_t posLocalAnchor
= location
.Find('#');
497 if ( posLocalAnchor
!= wxString::npos
&& posLocalAnchor
!= 0 )
499 // check if the part before the anchor is the same as the (either
500 // relative or absolute) URI of the current page
501 const wxString beforeAnchor
= location
.substr(0, posLocalAnchor
);
502 if ( beforeAnchor
!= m_OpenedPage
&&
503 m_FS
->GetPath() + beforeAnchor
!= m_OpenedPage
)
505 // indicate that we're not moving to a local anchor
506 posLocalAnchor
= wxString::npos
;
510 if ( posLocalAnchor
!= wxString::npos
)
513 rt_val
= ScrollToAnchor(location
.substr(posLocalAnchor
+ 1));
516 else // moving to another page
518 needs_refresh
= true;
521 if (m_RelatedStatusBarIndex
!= -1)
523 SetHTMLStatusText(_("Connecting..."));
526 #endif // wxUSE_STATUSBAR
528 wxFSFile
*f
= m_Parser
->OpenURL(wxHTML_URL_PAGE
, location
);
530 // try to interpret 'location' as filename instead of URL:
533 wxFileName
fn(location
);
534 wxString location2
= wxFileSystem::FileNameToURL(fn
);
535 f
= m_Parser
->OpenURL(wxHTML_URL_PAGE
, location2
);
540 wxLogError(_("Unable to open requested HTML document: %s"), location
.c_str());
542 SetHTMLStatusText(wxEmptyString
);
548 wxList::compatibility_iterator node
;
549 wxString src
= wxEmptyString
;
552 if (m_RelatedStatusBarIndex
!= -1)
554 wxString msg
= _("Loading : ") + location
;
555 SetHTMLStatusText(msg
);
558 #endif // wxUSE_STATUSBAR
560 node
= m_Filters
.GetFirst();
563 wxHtmlFilter
*h
= (wxHtmlFilter
*) node
->GetData();
566 src
= h
->ReadFile(*f
);
569 node
= node
->GetNext();
571 if (src
== wxEmptyString
)
573 if (m_DefaultFilter
== NULL
) m_DefaultFilter
= GetDefaultFilter();
574 src
= m_DefaultFilter
->ReadFile(*f
);
577 m_FS
->ChangePathTo(f
->GetLocation());
578 rt_val
= SetPage(src
);
579 m_OpenedPage
= f
->GetLocation();
580 if (f
->GetAnchor() != wxEmptyString
)
582 ScrollToAnchor(f
->GetAnchor());
588 if (m_RelatedStatusBarIndex
!= -1)
590 SetHTMLStatusText(_("Done"));
592 #endif // wxUSE_STATUSBAR
596 if (m_HistoryOn
) // add this page to history there:
598 int c
= m_History
->GetCount() - (m_HistoryPos
+ 1);
600 if (m_HistoryPos
< 0 ||
601 (*m_History
)[m_HistoryPos
].GetPage() != m_OpenedPage
||
602 (*m_History
)[m_HistoryPos
].GetAnchor() != m_OpenedAnchor
)
605 for (int i
= 0; i
< c
; i
++)
606 m_History
->RemoveAt(m_HistoryPos
);
607 m_History
->Add(new wxHtmlHistoryItem(m_OpenedPage
, m_OpenedAnchor
));
611 if (m_OpenedPageTitle
== wxEmptyString
)
612 OnSetTitle(wxFileNameFromPath(m_OpenedPage
));
626 bool wxHtmlWindow::LoadFile(const wxFileName
& filename
)
628 wxString url
= wxFileSystem::FileNameToURL(filename
);
629 return LoadPage(url
);
633 bool wxHtmlWindow::ScrollToAnchor(const wxString
& anchor
)
635 const wxHtmlCell
*c
= m_Cell
->Find(wxHTML_COND_ISANCHOR
, &anchor
);
638 wxLogWarning(_("HTML anchor %s does not exist."), anchor
.c_str());
645 for (y
= 0; c
!= NULL
; c
= c
->GetParent()) y
+= c
->GetPosY();
646 Scroll(-1, y
/ wxHTML_SCROLL_STEP
);
647 m_OpenedAnchor
= anchor
;
653 void wxHtmlWindow::OnSetTitle(const wxString
& title
)
658 tit
.Printf(m_TitleFormat
, title
.c_str());
659 m_RelatedFrame
->SetTitle(tit
);
661 m_OpenedPageTitle
= title
;
668 void wxHtmlWindow::CreateLayout()
670 int ClientWidth
, ClientHeight
;
674 if ( HasFlag(wxHW_SCROLLBAR_NEVER
) )
676 SetScrollbars(1, 1, 0, 0); // always off
677 GetClientSize(&ClientWidth
, &ClientHeight
);
678 m_Cell
->Layout(ClientWidth
);
680 else // !wxHW_SCROLLBAR_NEVER
682 GetClientSize(&ClientWidth
, &ClientHeight
);
683 m_Cell
->Layout(ClientWidth
);
684 if (ClientHeight
< m_Cell
->GetHeight() + GetCharHeight())
687 wxHTML_SCROLL_STEP
, wxHTML_SCROLL_STEP
,
688 m_Cell
->GetWidth() / wxHTML_SCROLL_STEP
,
689 (m_Cell
->GetHeight() + GetCharHeight()) / wxHTML_SCROLL_STEP
690 /*cheat: top-level frag is always container*/);
692 else /* we fit into window, no need for scrollbars */
694 SetScrollbars(wxHTML_SCROLL_STEP
, 1, m_Cell
->GetWidth() / wxHTML_SCROLL_STEP
, 0); // disable...
695 GetClientSize(&ClientWidth
, &ClientHeight
);
696 m_Cell
->Layout(ClientWidth
); // ...and relayout
703 void wxHtmlWindow::ReadCustomization(wxConfigBase
*cfg
, wxString path
)
708 wxString p_fff
, p_ffn
;
710 if (path
!= wxEmptyString
)
712 oldpath
= cfg
->GetPath();
716 m_Borders
= cfg
->Read(wxT("wxHtmlWindow/Borders"), m_Borders
);
717 p_fff
= cfg
->Read(wxT("wxHtmlWindow/FontFaceFixed"), m_Parser
->m_FontFaceFixed
);
718 p_ffn
= cfg
->Read(wxT("wxHtmlWindow/FontFaceNormal"), m_Parser
->m_FontFaceNormal
);
719 for (int i
= 0; i
< 7; i
++)
721 tmp
.Printf(wxT("wxHtmlWindow/FontsSize%i"), i
);
722 p_fontsizes
[i
] = cfg
->Read(tmp
, m_Parser
->m_FontsSizes
[i
]);
724 SetFonts(p_ffn
, p_fff
, p_fontsizes
);
726 if (path
!= wxEmptyString
)
727 cfg
->SetPath(oldpath
);
732 void wxHtmlWindow::WriteCustomization(wxConfigBase
*cfg
, wxString path
)
737 if (path
!= wxEmptyString
)
739 oldpath
= cfg
->GetPath();
743 cfg
->Write(wxT("wxHtmlWindow/Borders"), (long) m_Borders
);
744 cfg
->Write(wxT("wxHtmlWindow/FontFaceFixed"), m_Parser
->m_FontFaceFixed
);
745 cfg
->Write(wxT("wxHtmlWindow/FontFaceNormal"), m_Parser
->m_FontFaceNormal
);
746 for (int i
= 0; i
< 7; i
++)
748 tmp
.Printf(wxT("wxHtmlWindow/FontsSize%i"), i
);
749 cfg
->Write(tmp
, (long) m_Parser
->m_FontsSizes
[i
]);
752 if (path
!= wxEmptyString
)
753 cfg
->SetPath(oldpath
);
758 bool wxHtmlWindow::HistoryBack()
762 if (m_HistoryPos
< 1) return false;
764 // store scroll position into history item:
766 GetViewStart(&x
, &y
);
767 (*m_History
)[m_HistoryPos
].SetPos(y
);
769 // go to previous position:
772 l
= (*m_History
)[m_HistoryPos
].GetPage();
773 a
= (*m_History
)[m_HistoryPos
].GetAnchor();
776 if (a
== wxEmptyString
) LoadPage(l
);
777 else LoadPage(l
+ wxT("#") + a
);
780 Scroll(0, (*m_History
)[m_HistoryPos
].GetPos());
785 bool wxHtmlWindow::HistoryCanBack()
787 if (m_HistoryPos
< 1) return false;
792 bool wxHtmlWindow::HistoryForward()
796 if (m_HistoryPos
== -1) return false;
797 if (m_HistoryPos
>= (int)m_History
->GetCount() - 1)return false;
799 m_OpenedPage
= wxEmptyString
; // this will disable adding new entry into history in LoadPage()
802 l
= (*m_History
)[m_HistoryPos
].GetPage();
803 a
= (*m_History
)[m_HistoryPos
].GetAnchor();
806 if (a
== wxEmptyString
) LoadPage(l
);
807 else LoadPage(l
+ wxT("#") + a
);
810 Scroll(0, (*m_History
)[m_HistoryPos
].GetPos());
815 bool wxHtmlWindow::HistoryCanForward()
817 if (m_HistoryPos
== -1) return false;
818 if (m_HistoryPos
>= (int)m_History
->GetCount() - 1)return false;
823 void wxHtmlWindow::HistoryClear()
829 void wxHtmlWindow::AddProcessor(wxHtmlProcessor
*processor
)
833 m_Processors
= new wxHtmlProcessorList
;
835 wxHtmlProcessorList::compatibility_iterator node
;
837 for (node
= m_Processors
->GetFirst(); node
; node
= node
->GetNext())
839 if (processor
->GetPriority() > node
->GetData()->GetPriority())
841 m_Processors
->Insert(node
, processor
);
845 m_Processors
->Append(processor
);
848 /*static */ void wxHtmlWindow::AddGlobalProcessor(wxHtmlProcessor
*processor
)
850 if (!m_GlobalProcessors
)
852 m_GlobalProcessors
= new wxHtmlProcessorList
;
854 wxHtmlProcessorList::compatibility_iterator node
;
856 for (node
= m_GlobalProcessors
->GetFirst(); node
; node
= node
->GetNext())
858 if (processor
->GetPriority() > node
->GetData()->GetPriority())
860 m_GlobalProcessors
->Insert(node
, processor
);
864 m_GlobalProcessors
->Append(processor
);
869 void wxHtmlWindow::AddFilter(wxHtmlFilter
*filter
)
871 m_Filters
.Append(filter
);
875 bool wxHtmlWindow::IsSelectionEnabled() const
878 return !HasFlag(wxHW_NO_SELECTION
);
886 wxString
wxHtmlWindow::DoSelectionToText(wxHtmlSelection
*sel
)
889 return wxEmptyString
;
893 const wxHtmlCell
*end
= sel
->GetToCell();
895 wxHtmlTerminalCellsInterator
i(sel
->GetFromCell(), end
);
898 text
<< i
->ConvertToText(sel
);
901 const wxHtmlCell
*prev
= *i
;
904 if ( prev
->GetParent() != i
->GetParent() )
906 text
<< i
->ConvertToText(*i
== end
? sel
: NULL
);
913 wxString
wxHtmlWindow::ToText()
918 sel
.Set(m_Cell
->GetFirstTerminal(), m_Cell
->GetLastTerminal());
919 return DoSelectionToText(&sel
);
922 return wxEmptyString
;
925 #endif // wxUSE_CLIPBOARD
927 bool wxHtmlWindow::CopySelection(ClipboardType t
)
932 #if defined(__UNIX__) && !defined(__WXMAC__)
933 wxTheClipboard
->UsePrimarySelection(t
== Primary
);
935 // Primary selection exists only under X11, so don't do anything under
936 // the other platforms when we try to access it
938 // TODO: this should be abstracted at wxClipboard level!
941 #endif // __UNIX__/!__UNIX__
943 if ( wxTheClipboard
->Open() )
945 const wxString
txt(SelectionToText());
946 wxTheClipboard
->SetData(new wxTextDataObject(txt
));
947 wxTheClipboard
->Close();
948 wxLogTrace(_T("wxhtmlselection"),
949 _("Copied to clipboard:\"%s\""), txt
.c_str());
956 #endif // wxUSE_CLIPBOARD
962 void wxHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo
& link
)
964 wxHtmlLinkEvent
event(GetId(), link
);
965 event
.SetEventObject(this);
966 if (!GetEventHandler()->ProcessEvent(event
))
968 // the default behaviour is to load the URL in this window
969 const wxMouseEvent
*e
= event
.GetLinkInfo().GetEvent();
970 if (e
== NULL
|| e
->LeftUp())
971 LoadPage(event
.GetLinkInfo().GetHref());
975 void wxHtmlWindow::OnEraseBackground(wxEraseEvent
& event
)
979 // don't even skip the event, if we don't have a bg bitmap we're going
980 // to overwrite background in OnPaint() below anyhow, so letting the
981 // default handling take place would only result in flicker, just set a
982 // flag to erase the background below
983 m_eraseBgInOnPaint
= true;
987 wxDC
& dc
= *event
.GetDC();
989 // if the image is not fully opaque, we have to erase the background before
990 // drawing it, however avoid doing it for opaque images as this would just
991 // result in extra flicker without any other effect as background is
992 // completely covered anyhow
993 if ( m_bmpBg
.GetMask() )
995 dc
.SetBackground(wxBrush(GetBackgroundColour(), wxBRUSHSTYLE_SOLID
));
999 const wxSize
sizeWin(GetClientSize());
1000 const wxSize
sizeBmp(m_bmpBg
.GetWidth(), m_bmpBg
.GetHeight());
1001 for ( wxCoord x
= 0; x
< sizeWin
.x
; x
+= sizeBmp
.x
)
1003 for ( wxCoord y
= 0; y
< sizeWin
.y
; y
+= sizeBmp
.y
)
1005 dc
.DrawBitmap(m_bmpBg
, x
, y
, true /* use mask */);
1010 void wxHtmlWindow::OnPaint(wxPaintEvent
& WXUNUSED(event
))
1014 if (m_tmpCanDrawLocks
> 0 || m_Cell
== NULL
)
1018 GetViewStart(&x
, &y
);
1019 wxRect rect
= GetUpdateRegion().GetBox();
1020 wxSize sz
= GetSize();
1023 if ( !m_backBuffer
)
1024 m_backBuffer
= new wxBitmap(sz
.x
, sz
.y
);
1025 dcm
.SelectObject(*m_backBuffer
);
1027 if ( m_eraseBgInOnPaint
)
1029 dcm
.SetBackground(wxBrush(GetBackgroundColour(), wxBRUSHSTYLE_SOLID
));
1032 m_eraseBgInOnPaint
= false;
1034 else // someone has already erased the background, keep it
1036 // preserve the existing background, otherwise we'd erase anything the
1037 // user code had drawn in its EVT_ERASE_BACKGROUND handler when we do
1038 // the Blit back below
1039 dcm
.Blit(0, rect
.GetTop(),
1040 sz
.x
, rect
.GetBottom() - rect
.GetTop() + 1,
1046 dcm
.SetMapMode(wxMM_TEXT
);
1047 dcm
.SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT
);
1049 wxHtmlRenderingInfo rinfo
;
1050 wxDefaultHtmlRenderingStyle rstyle
;
1051 rinfo
.SetSelection(m_selection
);
1052 rinfo
.SetStyle(&rstyle
);
1053 m_Cell
->Draw(dcm
, 0, 0,
1054 y
* wxHTML_SCROLL_STEP
+ rect
.GetTop(),
1055 y
* wxHTML_SCROLL_STEP
+ rect
.GetBottom(),
1058 //#define DEBUG_HTML_SELECTION
1059 #ifdef DEBUG_HTML_SELECTION
1062 wxGetMousePosition(&xc
, &yc
);
1063 ScreenToClient(&xc
, &yc
);
1064 CalcUnscrolledPosition(xc
, yc
, &x
, &y
);
1065 wxHtmlCell
*at
= m_Cell
->FindCellByPos(x
, y
);
1066 wxHtmlCell
*before
=
1067 m_Cell
->FindCellByPos(x
, y
, wxHTML_FIND_NEAREST_BEFORE
);
1069 m_Cell
->FindCellByPos(x
, y
, wxHTML_FIND_NEAREST_AFTER
);
1071 dcm
.SetBrush(*wxTRANSPARENT_BRUSH
);
1072 dcm
.SetPen(*wxBLACK_PEN
);
1074 dcm
.DrawRectangle(at
->GetAbsPos(),
1075 wxSize(at
->GetWidth(),at
->GetHeight()));
1076 dcm
.SetPen(*wxGREEN_PEN
);
1078 dcm
.DrawRectangle(before
->GetAbsPos().x
+1, before
->GetAbsPos().y
+1,
1079 before
->GetWidth()-2,before
->GetHeight()-2);
1080 dcm
.SetPen(*wxRED_PEN
);
1082 dcm
.DrawRectangle(after
->GetAbsPos().x
+2, after
->GetAbsPos().y
+2,
1083 after
->GetWidth()-4,after
->GetHeight()-4);
1087 dcm
.SetDeviceOrigin(0,0);
1088 dc
.Blit(0, rect
.GetTop(),
1089 sz
.x
, rect
.GetBottom() - rect
.GetTop() + 1,
1097 void wxHtmlWindow::OnSize(wxSizeEvent
& event
)
1099 wxDELETE(m_backBuffer
);
1101 wxScrolledWindow::OnSize(event
);
1104 // Recompute selection if necessary:
1107 m_selection
->Set(m_selection
->GetFromCell(),
1108 m_selection
->GetToCell());
1109 m_selection
->ClearPrivPos();
1116 void wxHtmlWindow::OnMouseMove(wxMouseEvent
& WXUNUSED(event
))
1118 wxHtmlWindowMouseHelper::HandleMouseMoved();
1121 void wxHtmlWindow::OnMouseDown(wxMouseEvent
& event
)
1124 if ( event
.LeftDown() && IsSelectionEnabled() )
1126 const long TRIPLECLICK_LEN
= 200; // 0.2 sec after doubleclick
1127 if ( wxGetLocalTimeMillis() - m_lastDoubleClick
<= TRIPLECLICK_LEN
)
1129 SelectLine(CalcUnscrolledPosition(event
.GetPosition()));
1131 (void) CopySelection();
1135 m_makingSelection
= true;
1139 wxDELETE(m_selection
);
1142 m_tmpSelFromPos
= CalcUnscrolledPosition(event
.GetPosition());
1143 m_tmpSelFromCell
= NULL
;
1148 #endif // wxUSE_CLIPBOARD
1150 // in any case, let the default handler set focus to this window
1154 void wxHtmlWindow::OnMouseUp(wxMouseEvent
& event
)
1157 if ( m_makingSelection
)
1160 m_makingSelection
= false;
1162 // if m_selection=NULL, the user didn't move the mouse far enough from
1163 // starting point and the mouse up event is part of a click, the user
1164 // is not selecting text:
1167 CopySelection(Primary
);
1169 // we don't want mouse up event that ended selecting to be
1170 // handled as mouse click and e.g. follow hyperlink:
1174 #endif // wxUSE_CLIPBOARD
1176 wxPoint pos
= CalcUnscrolledPosition(event
.GetPosition());
1177 wxHtmlWindowMouseHelper::HandleMouseClick(m_Cell
, pos
, event
);
1181 void wxHtmlWindow::OnMouseCaptureLost(wxMouseCaptureLostEvent
& WXUNUSED(event
))
1183 if ( !m_makingSelection
)
1186 // discard the selecting operation
1187 m_makingSelection
= false;
1188 wxDELETE(m_selection
);
1189 m_tmpSelFromCell
= NULL
;
1192 #endif // wxUSE_CLIPBOARD
1195 void wxHtmlWindow::OnInternalIdle()
1197 wxWindow::OnInternalIdle();
1199 if (m_Cell
!= NULL
&& DidMouseMove())
1201 #ifdef DEBUG_HTML_SELECTION
1205 wxGetMousePosition(&xc
, &yc
);
1206 ScreenToClient(&xc
, &yc
);
1207 CalcUnscrolledPosition(xc
, yc
, &x
, &y
);
1209 wxHtmlCell
*cell
= m_Cell
->FindCellByPos(x
, y
);
1211 // handle selection update:
1212 if ( m_makingSelection
)
1214 if ( !m_tmpSelFromCell
)
1215 m_tmpSelFromCell
= m_Cell
->FindCellByPos(
1216 m_tmpSelFromPos
.x
,m_tmpSelFromPos
.y
);
1218 // NB: a trick - we adjust selFromPos to be upper left or bottom
1219 // right corner of the first cell of the selection depending
1220 // on whether the mouse is moving to the right or to the left.
1221 // This gives us more "natural" behaviour when selecting
1222 // a line (specifically, first cell of the next line is not
1223 // included if you drag selection from left to right over
1226 if ( !m_tmpSelFromCell
)
1228 dirFromPos
= m_tmpSelFromPos
;
1232 dirFromPos
= m_tmpSelFromCell
->GetAbsPos();
1233 if ( x
< m_tmpSelFromPos
.x
)
1235 dirFromPos
.x
+= m_tmpSelFromCell
->GetWidth();
1236 dirFromPos
.y
+= m_tmpSelFromCell
->GetHeight();
1239 bool goingDown
= dirFromPos
.y
< y
||
1240 (dirFromPos
.y
== y
&& dirFromPos
.x
< x
);
1242 // determine selection span:
1243 if ( /*still*/ !m_tmpSelFromCell
)
1247 m_tmpSelFromCell
= m_Cell
->FindCellByPos(
1248 m_tmpSelFromPos
.x
,m_tmpSelFromPos
.y
,
1249 wxHTML_FIND_NEAREST_AFTER
);
1250 if (!m_tmpSelFromCell
)
1251 m_tmpSelFromCell
= m_Cell
->GetFirstTerminal();
1255 m_tmpSelFromCell
= m_Cell
->FindCellByPos(
1256 m_tmpSelFromPos
.x
,m_tmpSelFromPos
.y
,
1257 wxHTML_FIND_NEAREST_BEFORE
);
1258 if (!m_tmpSelFromCell
)
1259 m_tmpSelFromCell
= m_Cell
->GetLastTerminal();
1263 wxHtmlCell
*selcell
= cell
;
1268 selcell
= m_Cell
->FindCellByPos(x
, y
,
1269 wxHTML_FIND_NEAREST_BEFORE
);
1271 selcell
= m_Cell
->GetLastTerminal();
1275 selcell
= m_Cell
->FindCellByPos(x
, y
,
1276 wxHTML_FIND_NEAREST_AFTER
);
1278 selcell
= m_Cell
->GetFirstTerminal();
1282 // NB: it may *rarely* happen that the code above didn't find one
1283 // of the cells, e.g. if wxHtmlWindow doesn't contain any
1285 if ( selcell
&& m_tmpSelFromCell
)
1289 // start selecting only if mouse movement was big enough
1290 // (otherwise it was meant as mouse click, not selection):
1291 const int PRECISION
= 2;
1292 wxPoint diff
= m_tmpSelFromPos
- wxPoint(x
,y
);
1293 if (abs(diff
.x
) > PRECISION
|| abs(diff
.y
) > PRECISION
)
1295 m_selection
= new wxHtmlSelection();
1300 if ( m_tmpSelFromCell
->IsBefore(selcell
) )
1302 m_selection
->Set(m_tmpSelFromPos
, m_tmpSelFromCell
,
1303 wxPoint(x
,y
), selcell
);
1307 m_selection
->Set(wxPoint(x
,y
), selcell
,
1308 m_tmpSelFromPos
, m_tmpSelFromCell
);
1310 m_selection
->ClearPrivPos();
1316 // handle cursor and status bar text changes:
1318 // NB: because we're passing in 'cell' and not 'm_Cell' (so that the
1319 // leaf cell lookup isn't done twice), we need to adjust the
1320 // position for the new root:
1321 wxPoint
posInCell(x
, y
);
1323 posInCell
-= cell
->GetAbsPos();
1324 wxHtmlWindowMouseHelper::HandleIdle(cell
, posInCell
);
1329 void wxHtmlWindow::StopAutoScrolling()
1331 if ( m_timerAutoScroll
)
1333 wxDELETE(m_timerAutoScroll
);
1337 void wxHtmlWindow::OnMouseEnter(wxMouseEvent
& event
)
1339 StopAutoScrolling();
1343 void wxHtmlWindow::OnMouseLeave(wxMouseEvent
& event
)
1345 // don't prevent the usual processing of the event from taking place
1348 // when a captured mouse leave a scrolled window we start generate
1349 // scrolling events to allow, for example, extending selection beyond the
1350 // visible area in some controls
1351 if ( wxWindow::GetCapture() == this )
1353 // where is the mouse leaving?
1355 wxPoint pt
= event
.GetPosition();
1358 orient
= wxHORIZONTAL
;
1361 else if ( pt
.y
< 0 )
1363 orient
= wxVERTICAL
;
1366 else // we're lower or to the right of the window
1368 wxSize size
= GetClientSize();
1369 if ( pt
.x
> size
.x
)
1371 orient
= wxHORIZONTAL
;
1372 pos
= GetVirtualSize().x
/ wxHTML_SCROLL_STEP
;
1374 else if ( pt
.y
> size
.y
)
1376 orient
= wxVERTICAL
;
1377 pos
= GetVirtualSize().y
/ wxHTML_SCROLL_STEP
;
1379 else // this should be impossible
1381 // but seems to happen sometimes under wxMSW - maybe it's a bug
1382 // there but for now just ignore it
1384 //wxFAIL_MSG( _T("can't understand where has mouse gone") );
1390 // only start the auto scroll timer if the window can be scrolled in
1392 if ( !HasScrollbar(orient
) )
1395 delete m_timerAutoScroll
;
1396 m_timerAutoScroll
= new wxHtmlWinAutoScrollTimer
1399 pos
== 0 ? wxEVT_SCROLLWIN_LINEUP
1400 : wxEVT_SCROLLWIN_LINEDOWN
,
1404 m_timerAutoScroll
->Start(50); // FIXME: make configurable
1408 void wxHtmlWindow::OnKeyUp(wxKeyEvent
& event
)
1410 if ( IsSelectionEnabled() &&
1411 (event
.GetKeyCode() == 'C' && event
.CmdDown()) )
1413 wxClipboardTextEvent
evt(wxEVT_COMMAND_TEXT_COPY
, GetId());
1415 evt
.SetEventObject(this);
1417 GetEventHandler()->ProcessEvent(evt
);
1421 void wxHtmlWindow::OnCopy(wxCommandEvent
& WXUNUSED(event
))
1423 (void) CopySelection();
1426 void wxHtmlWindow::OnClipboardEvent(wxClipboardTextEvent
& WXUNUSED(event
))
1428 (void) CopySelection();
1431 void wxHtmlWindow::OnDoubleClick(wxMouseEvent
& event
)
1433 // select word under cursor:
1434 if ( IsSelectionEnabled() )
1436 SelectWord(CalcUnscrolledPosition(event
.GetPosition()));
1438 (void) CopySelection(Primary
);
1440 m_lastDoubleClick
= wxGetLocalTimeMillis();
1446 void wxHtmlWindow::SelectWord(const wxPoint
& pos
)
1450 wxHtmlCell
*cell
= m_Cell
->FindCellByPos(pos
.x
, pos
.y
);
1454 m_selection
= new wxHtmlSelection();
1455 m_selection
->Set(cell
, cell
);
1456 RefreshRect(wxRect(CalcScrolledPosition(cell
->GetAbsPos()),
1457 wxSize(cell
->GetWidth(), cell
->GetHeight())));
1462 void wxHtmlWindow::SelectLine(const wxPoint
& pos
)
1466 wxHtmlCell
*cell
= m_Cell
->FindCellByPos(pos
.x
, pos
.y
);
1469 // We use following heuristic to find a "line": let the line be all
1470 // cells in same container as the cell under mouse cursor that are
1471 // neither completely above nor completely bellow the clicked cell
1472 // (i.e. are likely to be words positioned on same line of text).
1474 int y1
= cell
->GetAbsPos().y
;
1475 int y2
= y1
+ cell
->GetHeight();
1477 const wxHtmlCell
*c
;
1478 const wxHtmlCell
*before
= NULL
;
1479 const wxHtmlCell
*after
= NULL
;
1481 // find last cell of line:
1482 for ( c
= cell
->GetNext(); c
; c
= c
->GetNext())
1484 y
= c
->GetAbsPos().y
;
1485 if ( y
+ c
->GetHeight() > y1
&& y
< y2
)
1493 // find first cell of line:
1494 for ( c
= cell
->GetParent()->GetFirstChild();
1495 c
&& c
!= cell
; c
= c
->GetNext())
1497 y
= c
->GetAbsPos().y
;
1498 if ( y
+ c
->GetHeight() > y1
&& y
< y2
)
1510 m_selection
= new wxHtmlSelection();
1511 m_selection
->Set(before
, after
);
1518 void wxHtmlWindow::SelectAll()
1523 m_selection
= new wxHtmlSelection();
1524 m_selection
->Set(m_Cell
->GetFirstTerminal(), m_Cell
->GetLastTerminal());
1529 #endif // wxUSE_CLIPBOARD
1533 IMPLEMENT_ABSTRACT_CLASS(wxHtmlProcessor
,wxObject
)
1535 #if wxUSE_EXTENDED_RTTI
1536 IMPLEMENT_DYNAMIC_CLASS_XTI(wxHtmlWindow
, wxScrolledWindow
,"wx/html/htmlwin.h")
1538 wxBEGIN_PROPERTIES_TABLE(wxHtmlWindow
)
1541 style , wxHW_SCROLLBAR_AUTO
1542 borders , (dimension)
1546 wxEND_PROPERTIES_TABLE()
1548 wxBEGIN_HANDLERS_TABLE(wxHtmlWindow
)
1549 wxEND_HANDLERS_TABLE()
1551 wxCONSTRUCTOR_5( wxHtmlWindow
, wxWindow
* , Parent
, wxWindowID
, Id
, wxPoint
, Position
, wxSize
, Size
, long , WindowStyle
)
1553 IMPLEMENT_DYNAMIC_CLASS(wxHtmlWindow
,wxScrolledWindow
)
1556 BEGIN_EVENT_TABLE(wxHtmlWindow
, wxScrolledWindow
)
1557 EVT_SIZE(wxHtmlWindow::OnSize
)
1558 EVT_LEFT_DOWN(wxHtmlWindow::OnMouseDown
)
1559 EVT_LEFT_UP(wxHtmlWindow::OnMouseUp
)
1560 EVT_RIGHT_UP(wxHtmlWindow::OnMouseUp
)
1561 EVT_MOTION(wxHtmlWindow::OnMouseMove
)
1562 EVT_ERASE_BACKGROUND(wxHtmlWindow::OnEraseBackground
)
1563 EVT_PAINT(wxHtmlWindow::OnPaint
)
1565 EVT_LEFT_DCLICK(wxHtmlWindow::OnDoubleClick
)
1566 EVT_ENTER_WINDOW(wxHtmlWindow::OnMouseEnter
)
1567 EVT_LEAVE_WINDOW(wxHtmlWindow::OnMouseLeave
)
1568 EVT_MOUSE_CAPTURE_LOST(wxHtmlWindow::OnMouseCaptureLost
)
1569 EVT_KEY_UP(wxHtmlWindow::OnKeyUp
)
1570 EVT_MENU(wxID_COPY
, wxHtmlWindow::OnCopy
)
1571 EVT_TEXT_COPY(wxID_ANY
, wxHtmlWindow::OnClipboardEvent
)
1572 #endif // wxUSE_CLIPBOARD
1575 //-----------------------------------------------------------------------------
1576 // wxHtmlWindowInterface implementation in wxHtmlWindow
1577 //-----------------------------------------------------------------------------
1579 void wxHtmlWindow::SetHTMLWindowTitle(const wxString
& title
)
1584 void wxHtmlWindow::OnHTMLLinkClicked(const wxHtmlLinkInfo
& link
)
1586 OnLinkClicked(link
);
1589 wxHtmlOpeningStatus
wxHtmlWindow::OnHTMLOpeningURL(wxHtmlURLType type
,
1590 const wxString
& url
,
1591 wxString
*redirect
) const
1593 return OnOpeningURL(type
, url
, redirect
);
1596 wxPoint
wxHtmlWindow::HTMLCoordsToWindow(wxHtmlCell
*WXUNUSED(cell
),
1597 const wxPoint
& pos
) const
1599 return CalcScrolledPosition(pos
);
1602 wxWindow
* wxHtmlWindow::GetHTMLWindow()
1607 wxColour
wxHtmlWindow::GetHTMLBackgroundColour() const
1609 return GetBackgroundColour();
1612 void wxHtmlWindow::SetHTMLBackgroundColour(const wxColour
& clr
)
1614 SetBackgroundColour(clr
);
1617 void wxHtmlWindow::SetHTMLBackgroundImage(const wxBitmap
& bmpBg
)
1619 SetBackgroundImage(bmpBg
);
1622 void wxHtmlWindow::SetHTMLStatusText(const wxString
& text
)
1625 if (m_RelatedStatusBarIndex
!= -1)
1627 if (m_RelatedStatusBar
)
1629 m_RelatedStatusBar
->SetStatusText(text
, m_RelatedStatusBarIndex
);
1631 else if (m_RelatedFrame
)
1633 m_RelatedFrame
->SetStatusText(text
, m_RelatedStatusBarIndex
);
1638 #endif // wxUSE_STATUSBAR
1642 wxCursor
wxHtmlWindow::GetDefaultHTMLCursor(HTMLCursor type
)
1646 case HTMLCursor_Link
:
1647 if ( !ms_cursorLink
)
1648 ms_cursorLink
= new wxCursor(wxCURSOR_HAND
);
1649 return *ms_cursorLink
;
1651 case HTMLCursor_Text
:
1652 if ( !ms_cursorText
)
1653 ms_cursorText
= new wxCursor(wxCURSOR_IBEAM
);
1654 return *ms_cursorText
;
1656 case HTMLCursor_Default
:
1658 return *wxSTANDARD_CURSOR
;
1662 wxCursor
wxHtmlWindow::GetHTMLCursor(HTMLCursor type
) const
1664 return GetDefaultHTMLCursor(type
);
1668 //-----------------------------------------------------------------------------
1670 //-----------------------------------------------------------------------------
1672 // A module to allow initialization/cleanup
1673 // without calling these functions from app.cpp or from
1674 // the user's application.
1676 class wxHtmlWinModule
: public wxModule
1678 DECLARE_DYNAMIC_CLASS(wxHtmlWinModule
)
1680 wxHtmlWinModule() : wxModule() {}
1681 bool OnInit() { return true; }
1682 void OnExit() { wxHtmlWindow::CleanUpStatics(); }
1685 IMPLEMENT_DYNAMIC_CLASS(wxHtmlWinModule
, wxModule
)
1688 // This hack forces the linker to always link in m_* files
1689 // (wxHTML doesn't work without handlers from these files)
1690 #include "wx/html/forcelnk.h"
1691 FORCE_WXHTML_MODULES()
1693 #endif // wxUSE_HTML