#if wxUSE_HEADERCTRL
#ifndef WX_PRECOMP
+ #include "wx/app.h"
#include "wx/log.h"
#endif // WX_PRECOMP
#include "wx/msw/wrapcctl.h"
#include "wx/msw/private.h"
+#ifndef HDM_SETBITMAPMARGIN
+ #define HDM_SETBITMAPMARGIN 0x1234
+#endif
+
+#ifndef Header_SetBitmapMargin
+ #define Header_SetBitmapMargin(hwnd, margin) \
+ ::SendMessage((hwnd), HDM_SETBITMAPMARGIN, (WPARAM)(margin), 0)
+#endif
+
// from src/msw/listctrl.cpp
extern int WXDLLIMPEXP_CORE wxMSWGetColumnClicked(NMHDR *nmhdr, POINT *ptClick);
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;
}
if ( col.GetAlignment() != wxALIGN_NOT )
{
- hdi.mask |= HDI_FORMAT;
+ hdi.mask |= HDI_FORMAT | HDF_LEFT;
switch ( col.GetAlignment() )
{
case wxALIGN_LEFT: