]> git.saurik.com Git - wxWidgets.git/commitdiff
reduce the margins around bitmaps to avoid truncating the label unnecessarily
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 18 Jan 2009 14:23:19 +0000 (14:23 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 18 Jan 2009 14:23:19 +0000 (14:23 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58196 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/headerctrl.cpp

index 21d83f63888f3360c4d5a9e271d14b362927f640..15a690a729113e04b336ec8a9d8013b139f309df 100644 (file)
@@ -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: