From: Vadim Zeitlin Date: Tue, 8 Sep 2009 12:23:06 +0000 (+0000) Subject: Use correct visual attributes for wxSpinCtrl. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/ddc4214a4f290e2653a49d921945a416a357fcc2?ds=inline Use correct visual attributes for wxSpinCtrl. The default colours for this control are wxTextCtrl-like and not wxButton-like (which is the default). Override GetDefaultAttributes() to indicate this and to avoid returning a wrong background from wxControl::DoMSWControlColor() when just a foreground is set. See #1691. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61858 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/msw/spinctrl.h b/include/wx/msw/spinctrl.h index 02d229c748..551eb064eb 100644 --- a/include/wx/msw/spinctrl.h +++ b/include/wx/msw/spinctrl.h @@ -79,6 +79,18 @@ public: // wxSpinButton doesn't accept focus, but we do virtual bool AcceptsFocus() const { return wxWindow::AcceptsFocus(); } + // we're like wxTextCtrl and not (default) wxButton + virtual wxVisualAttributes GetDefaultAttributes() const + { + return GetClassDefaultAttributes(GetWindowVariant()); + } + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL) + { + return GetCompositeControlsDefaultAttributes(variant); + } + // for internal use only // get the subclassed window proc of the buddy text