From 9485b24f43766ad97ba1b77a70c7c1f2a40184a6 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 18 Jan 2009 14:23:19 +0000 Subject: [PATCH] reduce the margins around bitmaps to avoid truncating the label unnecessarily git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58196 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/headerctrl.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/msw/headerctrl.cpp b/src/msw/headerctrl.cpp index 21d83f6388..15a690a729 100644 --- a/src/msw/headerctrl.cpp +++ b/src/msw/headerctrl.cpp @@ -26,6 +26,7 @@ #if wxUSE_HEADERCTRL #ifndef WX_PRECOMP + #include "wx/app.h" #include "wx/log.h" #endif // WX_PRECOMP @@ -73,6 +74,16 @@ bool wxHeaderCtrl::Create(wxWindow *parent, if ( !MSWCreateControl(WC_HEADER, _T(""), pos, size) ) return false; + // special hack for margins when using comctl32.dll v6 or later: the + // default margin is too big and results in label truncation when the + // column width is just about right to show it together with the sort + // indicator, so reduce it to a smaller value (in principle we could even + // use 0 here but this starts to look ugly) + if ( wxApp::GetComCtl32Version() >= 600 ) + { + Header_SetBitmapMargin(GetHwnd(), ::GetSystemMetrics(SM_CXEDGE)); + } + return true; } @@ -287,7 +298,7 @@ void wxHeaderCtrl::DoInsertItem(const wxHeaderColumn& col, unsigned int idx) if ( col.GetAlignment() != wxALIGN_NOT ) { - hdi.mask |= HDI_FORMAT; + hdi.mask |= HDI_FORMAT | HDF_LEFT; switch ( col.GetAlignment() ) { case wxALIGN_LEFT: