Simplify changing window styles in wxMSW code

Add wxMSWWinStyleUpdater and wxMSWWinExStyleUpdater helper classes which
allow writing code changing GWL_STYLE and GWL_EXSTYLE bits,
respectively, in a shorter and more clear way.

There should be no real changes in behaviour.
This commit is contained in:
Vadim Zeitlin
2017-12-09 23:47:05 +01:00
parent 588ae3744c
commit 17105cfd07
17 changed files with 206 additions and 131 deletions

View File

@@ -38,6 +38,7 @@
#include "wx/msw/wrapcctl.h"
#include "wx/msw/private.h"
#include "wx/msw/private/customdraw.h"
#include "wx/msw/private/winstyle.h"
#ifndef HDM_SETBITMAPMARGIN
#define HDM_SETBITMAPMARGIN 0x1234
@@ -402,12 +403,8 @@ void wxHeaderCtrl::DoInsertItem(const wxHeaderColumn& col, unsigned int idx)
}
}
long controlStyle = ::GetWindowLong(GetHwnd(), GWL_STYLE);
if ( hasResizableColumns )
controlStyle &= ~HDS_NOSIZING;
else
controlStyle |= HDS_NOSIZING;
::SetWindowLong(GetHwnd(), GWL_STYLE, controlStyle);
wxMSWWinStyleUpdater(GetHwnd())
.TurnOnOrOff(!hasResizableColumns, HDS_NOSIZING);
}
void wxHeaderCtrl::DoSetColumnsOrder(const wxArrayInt& order)