doubleclick selects word
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20928 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -217,6 +217,7 @@ protected:
|
|||||||
void OnIdle(wxIdleEvent& event);
|
void OnIdle(wxIdleEvent& event);
|
||||||
#if wxUSE_CLIPBOARD
|
#if wxUSE_CLIPBOARD
|
||||||
void OnKeyUp(wxKeyEvent& event);
|
void OnKeyUp(wxKeyEvent& event);
|
||||||
|
void OnDoubleClick(wxMouseEvent& event);
|
||||||
void OnCopy(wxCommandEvent& event);
|
void OnCopy(wxCommandEvent& event);
|
||||||
void OnMouseEnter(wxMouseEvent& event);
|
void OnMouseEnter(wxMouseEvent& event);
|
||||||
void OnMouseLeave(wxMouseEvent& event);
|
void OnMouseLeave(wxMouseEvent& event);
|
||||||
|
@@ -1018,13 +1018,15 @@ void wxHtmlWindow::OnIdle(wxIdleEvent& WXUNUSED(event))
|
|||||||
{
|
{
|
||||||
SetCursor(*s_cur_arrow);
|
SetCursor(*s_cur_arrow);
|
||||||
if (m_RelatedStatusBar != -1)
|
if (m_RelatedStatusBar != -1)
|
||||||
m_RelatedFrame->SetStatusText(wxEmptyString, m_RelatedStatusBar);
|
m_RelatedFrame->SetStatusText(wxEmptyString,
|
||||||
|
m_RelatedStatusBar);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetCursor(*s_cur_hand);
|
SetCursor(*s_cur_hand);
|
||||||
if (m_RelatedStatusBar != -1)
|
if (m_RelatedStatusBar != -1)
|
||||||
m_RelatedFrame->SetStatusText(lnk->GetHref(), m_RelatedStatusBar);
|
m_RelatedFrame->SetStatusText(lnk->GetHref(),
|
||||||
|
m_RelatedStatusBar);
|
||||||
}
|
}
|
||||||
m_tmpLastLink = lnk;
|
m_tmpLastLink = lnk;
|
||||||
}
|
}
|
||||||
@@ -1123,13 +1125,12 @@ void wxHtmlWindow::OnMouseLeave(wxMouseEvent& event)
|
|||||||
|
|
||||||
void wxHtmlWindow::OnKeyUp(wxKeyEvent& event)
|
void wxHtmlWindow::OnKeyUp(wxKeyEvent& event)
|
||||||
{
|
{
|
||||||
if ( event.GetKeyCode() == 'C' && event.ControlDown() )
|
if ( IsSelectionEnabled() &&
|
||||||
|
event.GetKeyCode() == 'C' && event.ControlDown() )
|
||||||
{
|
{
|
||||||
if ( m_selection )
|
if ( m_selection )
|
||||||
CopySelection();
|
CopySelection();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
event.Skip();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxHtmlWindow::OnCopy(wxCommandEvent& event)
|
void wxHtmlWindow::OnCopy(wxCommandEvent& event)
|
||||||
@@ -1137,6 +1138,26 @@ void wxHtmlWindow::OnCopy(wxCommandEvent& event)
|
|||||||
if ( m_selection )
|
if ( m_selection )
|
||||||
CopySelection();
|
CopySelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxHtmlWindow::OnDoubleClick(wxMouseEvent& event)
|
||||||
|
{
|
||||||
|
// select word under cursor:
|
||||||
|
if ( IsSelectionEnabled() )
|
||||||
|
{
|
||||||
|
wxPoint pos = CalcUnscrolledPosition(event.GetPosition());
|
||||||
|
wxHtmlCell *cell = m_Cell->FindCellByPos(pos.x, pos.y);
|
||||||
|
if ( cell )
|
||||||
|
{
|
||||||
|
delete m_selection;
|
||||||
|
m_selection = new wxHtmlSelection();
|
||||||
|
m_selection->Set(cell, cell);
|
||||||
|
RefreshRect(wxRect(CalcScrolledPosition(cell->GetAbsPos()),
|
||||||
|
wxSize(cell->GetWidth(), cell->GetHeight())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
event.Skip();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -1155,6 +1176,7 @@ BEGIN_EVENT_TABLE(wxHtmlWindow, wxScrolledWindow)
|
|||||||
EVT_ERASE_BACKGROUND(wxHtmlWindow::OnEraseBackground)
|
EVT_ERASE_BACKGROUND(wxHtmlWindow::OnEraseBackground)
|
||||||
EVT_PAINT(wxHtmlWindow::OnPaint)
|
EVT_PAINT(wxHtmlWindow::OnPaint)
|
||||||
#if wxUSE_CLIPBOARD
|
#if wxUSE_CLIPBOARD
|
||||||
|
EVT_LEFT_DCLICK(wxHtmlWindow::OnDoubleClick)
|
||||||
EVT_ENTER_WINDOW(wxHtmlWindow::OnMouseEnter)
|
EVT_ENTER_WINDOW(wxHtmlWindow::OnMouseEnter)
|
||||||
EVT_LEAVE_WINDOW(wxHtmlWindow::OnMouseLeave)
|
EVT_LEAVE_WINDOW(wxHtmlWindow::OnMouseLeave)
|
||||||
EVT_KEY_UP(wxHtmlWindow::OnKeyUp)
|
EVT_KEY_UP(wxHtmlWindow::OnKeyUp)
|
||||||
|
Reference in New Issue
Block a user