X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/94e0018723919fe2ca2f5b5f0a42804c16dbf3a1..b54a0e3913d919ed1ed2b51acb0ebbe5e4c0bb11:/src/generic/listctrl.cpp?ds=inline diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 09354910b6..03e26f11e5 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -1461,6 +1461,12 @@ bool wxListTextCtrlWrapper::AcceptChanges() } void wxListTextCtrlWrapper::OnChar( wxKeyEvent &event ) +{ + if ( !CheckForEndEditKey(event) ) + event.Skip(); +} + +bool wxListTextCtrlWrapper::CheckForEndEditKey(const wxKeyEvent& event) { switch ( event.m_keyCode ) { @@ -1473,8 +1479,10 @@ void wxListTextCtrlWrapper::OnChar( wxKeyEvent &event ) break; default: - event.Skip(); + return false; } + + return true; } void wxListTextCtrlWrapper::OnKeyUp( wxKeyEvent &event ) @@ -1518,6 +1526,7 @@ void wxListTextCtrlWrapper::OnKillFocus( wxFocusEvent &event ) BEGIN_EVENT_TABLE(wxListMainWindow, wxWindow) EVT_PAINT (wxListMainWindow::OnPaint) EVT_MOUSE_EVENTS (wxListMainWindow::OnMouse) + EVT_CHAR_HOOK (wxListMainWindow::OnCharHook) EVT_CHAR (wxListMainWindow::OnChar) EVT_KEY_DOWN (wxListMainWindow::OnKeyDown) EVT_KEY_UP (wxListMainWindow::OnKeyUp) @@ -2713,6 +2722,22 @@ void wxListMainWindow::OnKeyUp( wxKeyEvent &event ) event.Skip(); } +void wxListMainWindow::OnCharHook( wxKeyEvent &event ) +{ + if ( m_textctrlWrapper ) + { + // When an in-place editor is active we should ensure that it always + // gets the key events that are special to it. + if ( m_textctrlWrapper->CheckForEndEditKey(event) ) + { + // Skip the call to wxEvent::Skip() below. + return; + } + } + + event.Skip(); +} + void wxListMainWindow::OnChar( wxKeyEvent &event ) { wxWindow *parent = GetParent(); @@ -4027,14 +4052,14 @@ void wxListMainWindow::InsertItem( wxListItem &item ) wxListLineData *line = new wxListLineData(this); line->SetItem( item.m_col, item ); - if ( item.m_mask & wxLIST_MASK_IMAGE && item.GetImage() != -1) + if ( item.m_mask & wxLIST_MASK_IMAGE ) { // Reset the buffered height if it's not big enough for the new image. - if (m_small_image_list) + int image = item.GetImage(); + if ( m_small_image_list && image != -1 && InReportView() ) { int imageWidth, imageHeight; - m_small_image_list->GetSize(item.GetImage(), - imageWidth, imageHeight); + m_small_image_list->GetSize(image, imageWidth, imageHeight); if ( imageHeight > m_lineHeight ) m_lineHeight = 0;