From 20a504707a6608a8ac405f652c2047c969af9d57 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Sun, 11 Dec 2016 23:32:23 -0800 Subject: [PATCH] Draw a blank header button in any remaining space after last header column (cherry picked from commit c70abf23aace0caa7e0b07ea1368b44ef2bfa29c) --- src/generic/headerctrlg.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/generic/headerctrlg.cpp b/src/generic/headerctrlg.cpp index 6dcccfdce8..394c0c3896 100644 --- a/src/generic/headerctrlg.cpp +++ b/src/generic/headerctrlg.cpp @@ -487,9 +487,6 @@ void wxHeaderCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) wxAutoBufferedPaintDC dc(this); - dc.SetBackground(GetBackgroundColour()); - dc.Clear(); - // account for the horizontal scrollbar offset in the parent window dc.SetDeviceOrigin(m_scrollOffset, 0); @@ -535,7 +532,7 @@ void wxHeaderCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) params.m_labelAlignment = col.GetAlignment(); #ifdef __WXGTK__ - if (i == count-1) + if (i == count-1 && xpos + colWidth >= w) { // colWidth = wxMax( colWidth, vw - xpos ); state |= wxCONTROL_DIRTY; @@ -554,6 +551,14 @@ void wxHeaderCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) xpos += colWidth; } + if (xpos < w) + { + int state = wxCONTROL_DIRTY; + if (!IsEnabled()) + state |= wxCONTROL_DISABLED; + wxRendererNative::Get().DrawHeaderButton( + this, dc, wxRect(xpos, 0, w - xpos, h), state); + } } void wxHeaderCtrl::OnCaptureLost(wxMouseCaptureLostEvent& WXUNUSED(event))