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
This commit is contained in:
Vadim Zeitlin 2012-03-04 00:29:48 +00:00
parent 76c6713102
commit bcdeea5a5b
2 changed files with 14 additions and 8 deletions

View File

@ -30,7 +30,7 @@ WX_DEFINE_EXPORTED_ARRAY_PTR(wxSpinCtrl *, wxArraySpins);
class WXDLLIMPEXP_CORE wxSpinCtrl : public wxSpinButton class WXDLLIMPEXP_CORE wxSpinCtrl : public wxSpinButton
{ {
public: public:
wxSpinCtrl() { } wxSpinCtrl() { Init(); }
wxSpinCtrl(wxWindow *parent, wxSpinCtrl(wxWindow *parent,
wxWindowID id = wxID_ANY, wxWindowID id = wxID_ANY,
@ -41,6 +41,8 @@ public:
int min = 0, int max = 100, int initial = 0, int min = 0, int max = 100, int initial = 0,
const wxString& name = wxT("wxSpinCtrl")) const wxString& name = wxT("wxSpinCtrl"))
{ {
Init();
Create(parent, id, value, pos, size, style, min, max, initial, name); Create(parent, id, value, pos, size, style, min, max, initial, name);
} }
@ -143,6 +145,9 @@ protected:
bool m_blockEvent; bool m_blockEvent;
private: private:
// Common part of all ctors.
void Init();
DECLARE_DYNAMIC_CLASS(wxSpinCtrl) DECLARE_DYNAMIC_CLASS(wxSpinCtrl)
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
wxDECLARE_NO_COPY_CLASS(wxSpinCtrl); wxDECLARE_NO_COPY_CLASS(wxSpinCtrl);

View File

@ -264,6 +264,14 @@ void wxSpinCtrl::NormalizeValue()
// construction // construction
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void wxSpinCtrl::Init()
{
m_blockEvent = false;
m_hwndBuddy = NULL;
m_wndProcBuddy = NULL;
m_oldValue = INT_MIN;
}
bool wxSpinCtrl::Create(wxWindow *parent, bool wxSpinCtrl::Create(wxWindow *parent,
wxWindowID id, wxWindowID id,
const wxString& value, const wxString& value,
@ -273,13 +281,6 @@ bool wxSpinCtrl::Create(wxWindow *parent,
int min, int max, int initial, int min, int max, int initial,
const wxString& name) 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 // before using DoGetBestSize(), have to set style to let the base class
// know whether this is a horizontal or vertical control (we're always // know whether this is a horizontal or vertical control (we're always
// vertical) // vertical)