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:
@@ -36,6 +36,7 @@
|
||||
#endif
|
||||
|
||||
#include "wx/msw/private.h"
|
||||
#include "wx/msw/private/winstyle.h"
|
||||
|
||||
#if wxUSE_TOOLTIPS
|
||||
#include "wx/tooltip.h"
|
||||
@@ -549,15 +550,8 @@ void wxSpinCtrl::UpdateBuddyStyle()
|
||||
// otherwise this would become impossible and also if we don't use
|
||||
// hexadecimal as entering "x" of the "0x" prefix wouldn't be allowed
|
||||
// neither then
|
||||
const DWORD styleOld = ::GetWindowLong(GetBuddyHwnd(), GWL_STYLE);
|
||||
DWORD styleNew;
|
||||
if ( m_min < 0 || GetBase() != 10 )
|
||||
styleNew = styleOld & ~ES_NUMBER;
|
||||
else
|
||||
styleNew = styleOld | ES_NUMBER;
|
||||
|
||||
if ( styleNew != styleOld )
|
||||
::SetWindowLong(GetBuddyHwnd(), GWL_STYLE, styleNew);
|
||||
wxMSWWinStyleUpdater(GetBuddyHwnd())
|
||||
.TurnOnOrOff(m_min >= 0 && GetBase() == 10, ES_NUMBER);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user