Further attempts at getting the header buttons right

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58299 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2009-01-22 14:09:32 +00:00
parent 09e72468cf
commit b047e876e0
4 changed files with 42 additions and 26 deletions

View File

@@ -133,11 +133,14 @@ 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;
}
@@ -492,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);
@@ -510,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() )
@@ -533,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_EXPANDED;
}
#endif
wxRendererNative::Get().DrawHeaderButton
(