X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/59704b49c212e24f0292b6d1470fc1cd9d4afd3e..654c223bc7c5457e407ff7d127a8129c821b07e4:/src/generic/headerctrlg.cpp diff --git a/src/generic/headerctrlg.cpp b/src/generic/headerctrlg.cpp index 4bac640faa..491354c6bc 100644 --- a/src/generic/headerctrlg.cpp +++ b/src/generic/headerctrlg.cpp @@ -23,8 +23,7 @@ #pragma hdrstop #endif -#ifndef WX_PRECOMP -#endif // WX_PRECOMP +#if wxUSE_HEADERCTRL #include "wx/headerctrl.h" @@ -134,19 +133,20 @@ void wxHeaderCtrl::DoScrollHorz(int dx) wxSize wxHeaderCtrl::DoGetBestSize() const { + wxWindow *win = GetParent(); + int height = wxRendererNative::Get().GetHeaderButtonHeight( win ); + // the vertical size is rather arbitrary but it looks better if we leave // some space around the text const wxSize size(IsEmpty() ? wxHeaderCtrlBase::DoGetBestSize().x : GetColEnd(GetColumnCount() - 1), - (7*GetCharHeight())/4); + height ); // (7*GetCharHeight())/4); CacheBestSize(size); return size; } int wxHeaderCtrl::GetColStart(unsigned int idx) const { - wxHeaderCtrl * const self = const_cast(this); - int pos = m_scrollOffset; for ( unsigned n = 0; ; n++ ) { @@ -154,7 +154,7 @@ int wxHeaderCtrl::GetColStart(unsigned int idx) const if ( i == idx ) break; - const wxHeaderColumn& col = self->GetColumn(i); + const wxHeaderColumn& col = GetColumn(i); if ( col.IsShown() ) pos += col.GetWidth(); } @@ -166,19 +166,17 @@ int wxHeaderCtrl::GetColEnd(unsigned int idx) const { int x = GetColStart(idx); - return x + const_cast(this)->GetColumn(idx).GetWidth(); + return x + GetColumn(idx).GetWidth(); } unsigned int wxHeaderCtrl::FindColumnAtPoint(int x, bool *onSeparator) const { - wxHeaderCtrl * const self = const_cast(this); - int pos = 0; const unsigned count = GetColumnCount(); for ( unsigned n = 0; n < count; n++ ) { const unsigned idx = m_colIndices[n]; - const wxHeaderColumn& col = self->GetColumn(idx); + const wxHeaderColumn& col = GetColumn(idx); if ( col.IsHidden() ) continue; @@ -204,6 +202,8 @@ unsigned int wxHeaderCtrl::FindColumnAtPoint(int x, bool *onSeparator) const } } + if ( onSeparator ) + *onSeparator = false; return COL_NONE; } @@ -495,6 +495,11 @@ void wxHeaderCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) { int w, h; GetClientSize(&w, &h); + +#ifdef __WXGTK__ +// int vw; +// GetVirtualSize(&vw, NULL); +#endif wxAutoBufferedPaintDC dc(this); @@ -513,7 +518,7 @@ void wxHeaderCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) if ( col.IsHidden() ) continue; - const int colWidth = col.GetWidth(); + int colWidth = col.GetWidth(); wxHeaderSortIconType sortArrow; if ( col.IsSortKey() ) @@ -536,11 +541,22 @@ void wxHeaderCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) { state = wxCONTROL_DISABLED; } + + if (i == 0) + state |= wxCONTROL_SPECIAL; wxHeaderButtonParams params; params.m_labelText = col.GetTitle(); params.m_labelBitmap = col.GetBitmap(); params.m_labelAlignment = col.GetAlignment(); + +#ifdef __WXGTK__ + if (i == count-1) + { +// colWidth = wxMax( colWidth, vw - xpos ); + state |= wxCONTROL_DIRTY; + } +#endif wxRendererNative::Get().DrawHeaderButton ( @@ -716,3 +732,5 @@ void wxHeaderCtrl::OnMouse(wxMouseEvent& mevent) } #endif // wxHAS_GENERIC_HEADERCTRL + +#endif // wxUSE_HEADERCTRL