From bcdeea5a5b347dd2de201ca5f8c7b1f17e2b1034 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 4 Mar 2012 00:29:48 +0000 Subject: [PATCH] No changes, just add wxSpinCtrl::Init() to wxMSW. Remove a "TODO" comment about adding it and initialize all member variables there instead of doing it only in Create(). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70799 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/msw/spinctrl.h | 7 ++++++- src/msw/spinctrl.cpp | 15 ++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/include/wx/msw/spinctrl.h b/include/wx/msw/spinctrl.h index fcc3a80fb1..fd8c7ab1d8 100644 --- a/include/wx/msw/spinctrl.h +++ b/include/wx/msw/spinctrl.h @@ -30,7 +30,7 @@ WX_DEFINE_EXPORTED_ARRAY_PTR(wxSpinCtrl *, wxArraySpins); class WXDLLIMPEXP_CORE wxSpinCtrl : public wxSpinButton { public: - wxSpinCtrl() { } + wxSpinCtrl() { Init(); } wxSpinCtrl(wxWindow *parent, wxWindowID id = wxID_ANY, @@ -41,6 +41,8 @@ public: int min = 0, int max = 100, int initial = 0, const wxString& name = wxT("wxSpinCtrl")) { + Init(); + Create(parent, id, value, pos, size, style, min, max, initial, name); } @@ -143,6 +145,9 @@ protected: bool m_blockEvent; private: + // Common part of all ctors. + void Init(); + DECLARE_DYNAMIC_CLASS(wxSpinCtrl) DECLARE_EVENT_TABLE() wxDECLARE_NO_COPY_CLASS(wxSpinCtrl); diff --git a/src/msw/spinctrl.cpp b/src/msw/spinctrl.cpp index 6cc84eac58..7d79dc76d9 100644 --- a/src/msw/spinctrl.cpp +++ b/src/msw/spinctrl.cpp @@ -264,6 +264,14 @@ void wxSpinCtrl::NormalizeValue() // construction // ---------------------------------------------------------------------------- +void wxSpinCtrl::Init() +{ + m_blockEvent = false; + m_hwndBuddy = NULL; + m_wndProcBuddy = NULL; + m_oldValue = INT_MIN; +} + bool wxSpinCtrl::Create(wxWindow *parent, wxWindowID id, const wxString& value, @@ -273,13 +281,6 @@ bool wxSpinCtrl::Create(wxWindow *parent, int min, int max, int initial, const wxString& name) { - m_blockEvent = false; - - // this should be in ctor/init function but I don't want to add one to 2.8 - // to avoid problems with default ctor which can be inlined in the user - // code and so might not get this fix without recompilation - m_oldValue = INT_MIN; - // before using DoGetBestSize(), have to set style to let the base class // know whether this is a horizontal or vertical control (we're always // vertical)