No changes, just refactor wxListBox initialization in wxMSW.

Extract member fields initialization in Init() method instead of duplicating
it in default ctor and Create().

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64497 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-06-05 22:57:59 +00:00
parent 53f60d4ab6
commit 096d544752
2 changed files with 7 additions and 6 deletions

View File

@@ -38,7 +38,7 @@ class WXDLLIMPEXP_CORE wxListBox : public wxListBoxBase
{ {
public: public:
// ctors and such // ctors and such
wxListBox(); wxListBox() { Init(); }
wxListBox(wxWindow *parent, wxWindowID id, wxListBox(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
@@ -47,6 +47,8 @@ public:
const wxValidator& validator = wxDefaultValidator, const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxListBoxNameStr) const wxString& name = wxListBoxNameStr)
{ {
Init();
Create(parent, id, pos, size, n, choices, style, validator, name); Create(parent, id, pos, size, n, choices, style, validator, name);
} }
wxListBox(wxWindow *parent, wxWindowID id, wxListBox(wxWindow *parent, wxWindowID id,
@@ -177,6 +179,9 @@ protected:
#endif #endif
private: private:
// common part of all ctors
void Init();
// call this when items are added to or deleted from the listbox or an // call this when items are added to or deleted from the listbox or an
// items text changes // items text changes
void MSWOnItemsChanged(); void MSWOnItemsChanged();

View File

@@ -149,8 +149,7 @@ wxOwnerDrawn *wxListBox::CreateLboxItem(size_t WXUNUSED(n))
// creation // creation
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Listbox item void wxListBox::Init()
wxListBox::wxListBox()
{ {
m_noItems = 0; m_noItems = 0;
m_updateHorizontalExtent = false; m_updateHorizontalExtent = false;
@@ -165,9 +164,6 @@ bool wxListBox::Create(wxWindow *parent,
const wxValidator& validator, const wxValidator& validator,
const wxString& name) const wxString& name)
{ {
m_noItems = 0;
m_updateHorizontalExtent = false;
// initialize base class fields // initialize base class fields
if ( !CreateControl(parent, id, pos, size, style, validator, name) ) if ( !CreateControl(parent, id, pos, size, style, validator, name) )
return false; return false;