Fix changing colours of wxSpinCtrl in wxMSW

Ensure that the new colours are actually shown after Refresh() is called
by refreshing the text part of the control as well, and not just the
spin button.

Closes https://github.com/wxWidgets/wxWidgets/pull/1468

Closes #12382.
This commit is contained in:
Kvaz1r 2019-08-05 15:21:10 +03:00 committed by Vadim Zeitlin
parent 75134c752e
commit 88f04f551e
2 changed files with 15 additions and 0 deletions

View File

@ -65,6 +65,8 @@ public:
virtual int GetBase() const;
virtual bool SetBase(int base);
virtual void Refresh( bool eraseBackground = true,
const wxRect *rect = (const wxRect *) NULL ) wxOVERRIDE;
// implementation only from now on
// -------------------------------

View File

@ -404,6 +404,19 @@ wxSpinCtrl::~wxSpinCtrl()
gs_spinForTextCtrl.erase(GetBuddyHwnd());
}
void wxSpinCtrl::Refresh(bool eraseBackground, const wxRect *rect)
{
wxControl::Refresh(eraseBackground, rect);
UINT flags = RDW_INVALIDATE;
if ( eraseBackground )
flags |= RDW_ERASE;
// Don't bother computing the intersection of the given rectangle with the
// buddy control, just always refresh it entirely, as it's much simpler.
::RedrawWindow(GetBuddyHwnd(), NULL, NULL, flags);
}
// ----------------------------------------------------------------------------
// wxSpinCtrl-specific methods
// ----------------------------------------------------------------------------