X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c1fae0d0ee4122b96a83c6e3bdd4f2ade9e71698..75504144d2ee5ce2bc62d186f04b2d445c2048c5:/src/generic/listctrl.cpp diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index d42d0c43bb..60305d7c2b 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -1160,7 +1160,7 @@ void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) // draw the text and image clipping them so that they // don't overwrite the column boundary - wxDCClipper clipper(dc, x, HEADER_OFFSET_Y, cw, h - 4 ); + wxDCClipper clipper(dc, x, HEADER_OFFSET_Y, cw, h); // if we have an image, draw it on the right of the label if ( imageList ) @@ -1170,13 +1170,13 @@ void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) image, dc, xAligned + wLabel - ix - HEADER_IMAGE_MARGIN_IN_REPORT_MODE, - HEADER_OFFSET_Y + (h - 4 - iy)/2, + HEADER_OFFSET_Y + (h - iy)/2, wxIMAGELIST_DRAW_TRANSPARENT ); } dc.DrawText( item.GetText(), - xAligned + EXTRA_WIDTH, h / 2 - hLabel / 2 ); //HEADER_OFFSET_Y + EXTRA_HEIGHT ); + xAligned + EXTRA_WIDTH, (h - hLabel) / 2 ); x += wCol; } @@ -1650,6 +1650,15 @@ wxListMainWindow::~wxListMainWindow() delete m_renameTimer; } +void wxListMainWindow::SetReportView(bool inReportView) +{ + const size_t count = m_lines.size(); + for ( size_t n = 0; n < count; n++ ) + { + m_lines[n].SetReportView(inReportView); + } +} + void wxListMainWindow::CacheLineData(size_t line) { wxGenericListCtrl *listctrl = GetListCtrl(); @@ -4307,17 +4316,11 @@ void wxGenericListCtrl::CreateOrDestroyHeaderWindowAsNeeded() ); #if defined( __WXMAC__ ) - wxFont font; - font.CreateSystemFont( wxOSX_SYSTEM_FONT_SMALL ); + static wxFont font( wxOSX_SYSTEM_FONT_SMALL ); m_headerWin->SetFont( font ); #endif GetSizer()->Prepend( m_headerWin, 0, wxGROW ); -#ifdef __WXOSX__ - // TODO not tested under other platforms, remove the platform condition if - // it works on those as well - GetSizer()->SetItemMinSize( m_headerWin, wxSize(-1, m_headerWin->GetSize().y) ); -#endif } else { @@ -4449,12 +4452,22 @@ void wxGenericListCtrl::SetSingleStyle( long style, bool add ) void wxGenericListCtrl::SetWindowStyleFlag( long flag ) { + const bool wasInReportView = HasFlag(wxLC_REPORT); + // update the window style first so that the header is created or destroyed // corresponding to the new style wxWindow::SetWindowStyleFlag( flag ); if (m_mainWin) { + const bool inReportView = (flag & wxLC_REPORT) != 0; + if ( inReportView != wasInReportView ) + { + // we need to notify the main window about this change as it must + // update its data structures + m_mainWin->SetReportView(inReportView); + } + // m_mainWin->DeleteEverything(); wxMSW doesn't do that CreateOrDestroyHeaderWindowAsNeeded();