X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8158e0e169f1deb45cfffe9c50453bb926fdcd5c..359878c33e86222a2156e25705ec97ab630a8763:/src/generic/listctrl.cpp diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 32f5bd7060..3a2774b15e 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -2074,12 +2074,14 @@ void wxListTextCtrl::OnChar( wxKeyEvent &event ) switch ( event.m_keyCode ) { case WXK_RETURN: - if ( !AcceptChanges() ) + if ( AcceptChanges() ) { - // vetoed by the user code - break; + // Close the text control, changes were accepted + Finish(); } - //else: fall through + // else do nothing, do not accept and do not close + + break; case WXK_ESCAPE: Finish(); @@ -4290,17 +4292,18 @@ long wxListMainWindow::FindItem(long start, long data) long wxListMainWindow::FindItem( const wxPoint& pt ) { - wxPoint p; - long topItem = GetTopItem(); + size_t topItem; + GetVisibleLinesRange(&topItem, NULL); - GetItemPosition( GetItemCount()-1, p ); - if( p.y == 0 ) - return topItem; - long id = (long) floor( pt.y*(GetItemCount()-topItem-1)/p.y+topItem ); - if( id >= 0 && id < (long)GetItemCount() ) - return id; + wxPoint p; + GetItemPosition( GetItemCount()-1, p ); + if( p.y == 0 ) + return topItem; + long id = (long) floor( pt.y*double(GetItemCount()-topItem-1)/p.y+topItem ); + if( id >= 0 && id < (long)GetItemCount() ) + return id; - return wxNOT_FOUND; + return wxNOT_FOUND; } long wxListMainWindow::HitTest( int x, int y, int &flags ) @@ -4656,9 +4659,13 @@ bool wxGenericListCtrl::Create(wxWindow *parent, m_mainWin = new wxListMainWindow( this, wxID_ANY, wxPoint(0,0), size, style ); #if defined( __WXMAC__ ) && __WXMAC_CARBON__ - wxFont font ; - font.MacCreateThemeFont( kThemeViewsFont ) ; - SetFont( font ) ; + // Human Interface Guidelines ask us for a special font in this case + if ( GetWindowVariant() == wxWINDOW_VARIANT_NORMAL ) + { + wxFont font ; + font.MacCreateThemeFont( kThemeViewsFont ) ; + SetFont( font ) ; + } #endif if ( InReportView() ) { @@ -5348,6 +5355,14 @@ void wxGenericListCtrl::SetFocus() m_mainWin->SetFocus(); } +wxSize wxGenericListCtrl::DoGetBestSize() const +{ + // Something is better than nothing... + // 100x80 is what the MSW version will get from the default + // wxControl::DoGetBestSize + return wxSize(100,80); +} + // ---------------------------------------------------------------------------- // virtual list control support // ----------------------------------------------------------------------------