]> git.saurik.com Git - wxWidgets.git/commitdiff
No changes, just refactor wxListBox initialization in wxMSW.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 5 Jun 2010 22:57:59 +0000 (22:57 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 5 Jun 2010 22:57:59 +0000 (22:57 +0000)
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

include/wx/msw/listbox.h
src/msw/listbox.cpp

index 54a53b1c58872800c72daa96a4cc8a9a0cee3ffe..38b1afcd158a889d3437634dfb07b84ba89e4cdd 100644 (file)
@@ -38,7 +38,7 @@ class WXDLLIMPEXP_CORE wxListBox : public wxListBoxBase
 {
 public:
     // ctors and such
-    wxListBox();
+    wxListBox() { Init(); }
     wxListBox(wxWindow *parent, wxWindowID id,
             const wxPoint& pos = wxDefaultPosition,
             const wxSize& size = wxDefaultSize,
@@ -47,6 +47,8 @@ public:
             const wxValidator& validator = wxDefaultValidator,
             const wxString& name = wxListBoxNameStr)
     {
+        Init();
+
         Create(parent, id, pos, size, n, choices, style, validator, name);
     }
     wxListBox(wxWindow *parent, wxWindowID id,
@@ -177,6 +179,9 @@ protected:
 #endif
 
 private:
+    // common part of all ctors
+    void Init();
+
     // call this when items are added to or deleted from the listbox or an
     // items text changes
     void MSWOnItemsChanged();
index 8d2d266c7270f1aa7c6401b1c90fe0471bd2bd48..8a2dd34eecf4a197f94cbd355dda4d6db0a1dae7 100644 (file)
@@ -149,8 +149,7 @@ wxOwnerDrawn *wxListBox::CreateLboxItem(size_t WXUNUSED(n))
 // creation
 // ----------------------------------------------------------------------------
 
-// Listbox item
-wxListBox::wxListBox()
+void wxListBox::Init()
 {
     m_noItems = 0;
     m_updateHorizontalExtent = false;
@@ -165,9 +164,6 @@ bool wxListBox::Create(wxWindow *parent,
                        const wxValidator& validator,
                        const wxString& name)
 {
-    m_noItems = 0;
-    m_updateHorizontalExtent = false;
-
     // initialize base class fields
     if ( !CreateControl(parent, id, pos, size, style, validator, name) )
         return false;