a hack to make copying double clicked words to clipboard work

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21035 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2003-06-11 11:33:48 +00:00
parent 4f610b3443
commit 86ff9b45d9

View File

@@ -438,14 +438,26 @@ wxString wxHtmlWordCell::ConvertToText(wxHtmlSelection *s) const
{ {
if ( s && (this == s->GetFromCell() || this == s->GetToCell()) ) if ( s && (this == s->GetFromCell() || this == s->GetToCell()) )
{ {
wxPoint priv = (this == s->GetFromCell()) ? wxPoint priv = this == s->GetFromCell() ? s->GetFromPrivPos()
s->GetFromPrivPos() : s->GetToPrivPos(); : s->GetToPrivPos();
int part1 = priv.x;
int part2 = priv.y; // VZ: we may be called before we had a chance to re-render ourselves
return m_Word.Mid(part1, part2-part1); // and in this case GetFrom/ToPrivPos() is not set yet -- assume
// that this only happens in case of a double/triple click (which
// seems to be the case now) and so it makes sense to select the
// entire contents of the cell in this case
//
// TODO: but this really needs to be fixed in some better way later...
if ( priv != wxDefaultPosition )
{
int part1 = priv.x;
int part2 = priv.y;
return m_Word.Mid(part1, part2-part1);
}
//else: return the whole word below
} }
else
return m_Word; return m_Word;
} }
wxCursor wxHtmlWordCell::GetCursor() const wxCursor wxHtmlWordCell::GetCursor() const
@@ -461,7 +473,6 @@ wxCursor wxHtmlWordCell::GetCursor() const
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxHtmlContainerCell // wxHtmlContainerCell
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------