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
This commit is contained in:
Vadim Zeitlin
2009-01-18 14:23:19 +00:00
parent bd27a41da5
commit 9485b24f43

View File

@@ -26,6 +26,7 @@
#if wxUSE_HEADERCTRL #if wxUSE_HEADERCTRL
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/app.h"
#include "wx/log.h" #include "wx/log.h"
#endif // WX_PRECOMP #endif // WX_PRECOMP
@@ -73,6 +74,16 @@ bool wxHeaderCtrl::Create(wxWindow *parent,
if ( !MSWCreateControl(WC_HEADER, _T(""), pos, size) ) if ( !MSWCreateControl(WC_HEADER, _T(""), pos, size) )
return false; 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; return true;
} }
@@ -287,7 +298,7 @@ void wxHeaderCtrl::DoInsertItem(const wxHeaderColumn& col, unsigned int idx)
if ( col.GetAlignment() != wxALIGN_NOT ) if ( col.GetAlignment() != wxALIGN_NOT )
{ {
hdi.mask |= HDI_FORMAT; hdi.mask |= HDI_FORMAT | HDF_LEFT;
switch ( col.GetAlignment() ) switch ( col.GetAlignment() )
{ {
case wxALIGN_LEFT: case wxALIGN_LEFT: