X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e721a2a2a41393346e0c86965cfd04f056196c2a..15cac64f7564d48c274c6490774a77bd8c09f808:/src/msw/headerctrl.cpp diff --git a/src/msw/headerctrl.cpp b/src/msw/headerctrl.cpp index 21d83f6388..c4beb2534d 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 @@ -38,6 +39,15 @@ #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); @@ -73,6 +83,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 +307,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: