X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ebf82d2b4b8790a3f216f94acd56cbed07e8915a..e36dcd10d0528529a055c63111b3aa64538d4313:/src/generic/listctrl.cpp?ds=inline diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 4486e729b2..c42fded26c 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -25,7 +25,7 @@ #include "wx/listctrl.h" -#if ((!defined(__WXMSW__) && !defined(__WXMAC__)) || defined(__WXUNIVERSAL__)) +#if ((!defined(__WXMSW__) && !(defined(__WXMAC__) && wxOSX_USE_CARBON)) || defined(__WXUNIVERSAL__)) // if we have a native version, its implementation file does all this IMPLEMENT_DYNAMIC_CLASS(wxListItem, wxObject) IMPLEMENT_DYNAMIC_CLASS(wxListView, wxListCtrl) @@ -51,6 +51,8 @@ #ifdef __WXMAC__ #include "wx/osx/private.h" + // for themeing support + #include #endif @@ -615,6 +617,8 @@ public: void OnPaint( wxPaintEvent &event ); + void OnChildFocus(wxChildFocusEvent& event); + void DrawImage( int index, wxDC *dc, int x, int y ); void GetImageSize( int index, int &width, int &height ) const; int GetTextLength( const wxString &s ) const; @@ -1410,7 +1414,7 @@ bool wxListLineData::SetAttributes(wxDC *dc, #ifdef __WXMAC__ { if (m_owner->HasFocus() -#if !defined(__WXUNIVERSAL__) +#if !defined(__WXUNIVERSAL__) && wxOSX_USE_CARBON && IsControlActive( (ControlRef)m_owner->GetHandle() ) #endif ) @@ -1474,7 +1478,7 @@ void wxListLineData::Draw( wxDC *dc ) { int flags = wxCONTROL_SELECTED; if (m_owner->HasFocus() -#if defined( __WXMAC__ ) && !defined(__WXUNIVERSAL__) +#if defined( __WXMAC__ ) && !defined(__WXUNIVERSAL__) && wxOSX_USE_CARBON && IsControlActive( (ControlRef)m_owner->GetHandle() ) #endif ) @@ -1895,6 +1899,19 @@ void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) x += wCol; } + + // Fill in what's missing to the right of the columns, otherwise we will + // leave an unpainted area when columns are removed (and it looks better) + if ( x < w ) + { + wxRendererNative::Get().DrawHeaderButton + ( + this, + dc, + wxRect(x, HEADER_OFFSET_Y, w - x, h), + 0 + ); + } } void wxListHeaderWindow::DrawCurrent() @@ -2246,6 +2263,7 @@ BEGIN_EVENT_TABLE(wxListMainWindow,wxScrolledCanvas) EVT_SET_FOCUS (wxListMainWindow::OnSetFocus) EVT_KILL_FOCUS (wxListMainWindow::OnKillFocus) EVT_SCROLLWIN (wxListMainWindow::OnScroll) + EVT_CHILD_FOCUS (wxListMainWindow::OnChildFocus) END_EVENT_TABLE() void wxListMainWindow::Init() @@ -2857,6 +2875,13 @@ void wxListMainWindow::HighlightAll( bool on ) } } +void wxListMainWindow::OnChildFocus(wxChildFocusEvent& WXUNUSED(event)) +{ + // Do nothing here. This prevents the default handler in wxScrolledWindow + // from needlessly scrolling the window when the edit control is + // dismissed. See ticket #9563. +} + void wxListMainWindow::SendNotify( size_t line, wxEventType command, const wxPoint& point ) @@ -5020,10 +5045,9 @@ bool wxGenericListCtrl::Create(wxWindow *parent, m_headerHeight = 0; - if ( !(style & wxLC_MASK_TYPE) ) - { - style = style | wxLC_LIST; - } + // just like in other ports, an assert will fail if the user doesn't give any type style: + wxASSERT_MSG( (style & wxLC_MASK_TYPE), + _T("wxListCtrl style should have exactly one mode bit set") ); if ( !wxControl::Create( parent, id, pos, size, style, validator, name ) ) return false; @@ -5041,7 +5065,11 @@ bool wxGenericListCtrl::Create(wxWindow *parent, if ( GetWindowVariant() == wxWINDOW_VARIANT_NORMAL ) { wxFont font; +#if wxOSX_USE_CARBON font.MacCreateFromThemeFont( kThemeViewsFont ); +#else + font.MacCreateFromUIFont( kCTFontViewsFontType ); +#endif SetFont( font ); } #endif @@ -5054,7 +5082,11 @@ bool wxGenericListCtrl::Create(wxWindow *parent, if (m_headerWin) { wxFont font; +#if wxOSX_USE_CARBON font.MacCreateFromThemeFont( kThemeSmallSystemFont ); +#else + font.MacCreateFromUIFont( kCTFontSystemFontType ); +#endif m_headerWin->SetFont( font ); CalculateAndSetHeaderHeight(); }