+#if wxUSE_CLIPBOARD
+ if ( m_selection )
+ {
+#if defined(__UNIX__) && !defined(__WXMAC__)
+ wxTheClipboard->UsePrimarySelection(t == Primary);
+#else // !__UNIX__
+ // Primary selection exists only under X11, so don't do anything under
+ // the other platforms when we try to access it
+ //
+ // TODO: this should be abstracted at wxClipboard level!
+ if ( t == Primary )
+ return false;
+#endif // __UNIX__/!__UNIX__
+
+ if ( wxTheClipboard->Open() )
+ {
+ const wxString txt(SelectionToText());
+ wxTheClipboard->SetData(new wxTextDataObject(txt));
+ wxTheClipboard->Close();
+ wxLogTrace(_T("wxhtmlselection"),
+ _("Copied to clipboard:\"%s\""), txt.c_str());
+
+ return true;
+ }
+ }
+#else
+ wxUnusedVar(t);
+#endif // wxUSE_CLIPBOARD
+
+ return false;
+}
+
+
+void wxHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link)
+{
+ const wxMouseEvent *e = link.GetEvent();
+ if (e == NULL || e->LeftUp())
+ LoadPage(link.GetHref());
+}
+
+void wxHtmlWindow::OnCellClicked(wxHtmlCell *cell,
+ wxCoord x, wxCoord y,
+ const wxMouseEvent& event)
+{
+ wxCHECK_RET( cell, _T("can't be called with NULL cell") );
+
+ cell->OnMouseClick(this, x, y, event);
+}
+
+void wxHtmlWindow::OnCellMouseHover(wxHtmlCell * WXUNUSED(cell),
+ wxCoord WXUNUSED(x), wxCoord WXUNUSED(y))
+{
+ // do nothing here
+}
+
+void wxHtmlWindow::OnEraseBackground(wxEraseEvent& event)
+{
+ if ( !m_bmpBg.Ok() )
+ {
+ // don't even skip the event, if we don't have a bg bitmap we're going
+ // to overwrite background in OnPaint() below anyhow, so letting the
+ // default handling take place would only result in flicker, just set a
+ // flag to erase the background below
+ m_eraseBgInOnPaint = true;
+ return;
+ }
+
+ wxDC& dc = *event.GetDC();
+
+ // if the image is not fully opaque, we have to erase the background before
+ // drawing it, however avoid doing it for opaque images as this would just
+ // result in extra flicker without any other effect as background is
+ // completely covered anyhow
+ if ( m_bmpBg.GetMask() )
+ {
+ dc.SetBackground(wxBrush(GetBackgroundColour(), wxSOLID));
+ dc.Clear();
+ }
+
+ const wxSize sizeWin(GetClientSize());
+ const wxSize sizeBmp(m_bmpBg.GetWidth(), m_bmpBg.GetHeight());
+ for ( wxCoord x = 0; x < sizeWin.x; x += sizeBmp.x )
+ {
+ for ( wxCoord y = 0; y < sizeWin.y; y += sizeBmp.y )
+ {
+ dc.DrawBitmap(m_bmpBg, x, y, true /* use mask */);
+ }
+ }
+}
+
+void wxHtmlWindow::OnPaint(wxPaintEvent& WXUNUSED(event))
+{
+ wxPaintDC dc(this);
+
+ if (m_tmpCanDrawLocks > 0 || m_Cell == NULL)
+ return;
+