preparing wxHtmlWindow for text selection (highlighting works, mouse input and clipboard does not)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20787 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2003-05-31 21:48:50 +00:00
parent f65a786ffd
commit 36c4ff4d65
8 changed files with 186 additions and 63 deletions

View File

@@ -622,6 +622,14 @@ void wxHtmlWindow::AddFilter(wxHtmlFilter *filter)
}
bool wxHtmlWindow::IsSelectionEnabled() const
{
#if wxUSE_CLIPBOARD
return !(m_Style & wxHW_NO_SELECTION);
#else
return false;
#endif
}
void wxHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link)
@@ -655,9 +663,16 @@ void wxHtmlWindow::OnDraw(wxDC& dc)
dc.SetBackgroundMode(wxTRANSPARENT);
GetViewStart(&x, &y);
wxHtmlSelection sel;
sel.Set(wxPoint(20,80),
m_Cell->FindCellByPos(20,80,wxHTML_FIND_TERMINAL|wxHTML_FIND_NONTERMINAL),
wxPoint(200,300),
m_Cell->FindCellByPos(200,300,wxHTML_FIND_TERMINAL|wxHTML_FIND_NONTERMINAL));
wxHtmlRenderingState rstate(IsSelectionEnabled() ? &sel : NULL);
m_Cell->Draw(dc, 0, 0,
y * wxHTML_SCROLL_STEP + rect.GetTop(),
y * wxHTML_SCROLL_STEP + rect.GetBottom());
y * wxHTML_SCROLL_STEP + rect.GetBottom(),
rstate);
}