]> git.saurik.com Git - wxWidgets.git/commitdiff
Allow returning NULL windows from GetCompositeWindowParts().
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 27 Aug 2011 12:13:18 +0000 (12:13 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 27 Aug 2011 12:13:18 +0000 (12:13 +0000)
wxCompositeWindow::GetCompositeWindowParts() becomes simpler to implement in
the derived classes with optionally shown elements if NULL windows are allowed
(and ignored) in the list returned by it.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68910 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/compositewin.h
src/generic/datectlg.cpp

index 9e7b5fd6a1cca1d4c2260c11c19642d7fbf2b55f..9ac62639c2ace5804d40f7f28572d86bf6fa5b3b 100644 (file)
@@ -110,7 +110,11 @@ private:
         {
             wxWindow * const child = *i;
 
-            (child->*func)(arg);
+            // Allow NULL elements in the list, this makes the code of derived
+            // composite controls which may have optionally shown children
+            // simpler and it doesn't cost us much here.
+            if ( child )
+                (child->*func)(arg);
         }
     }
 
index f45dba82ab5e824d7f60823826e163f12657402a..7ee0b66c889d4ca76c70f8e416f0b089e95f1742 100644 (file)
@@ -385,10 +385,8 @@ wxSize wxDatePickerCtrlGeneric::DoGetBestSize() const
 wxWindowList wxDatePickerCtrlGeneric::GetCompositeWindowParts() const
 {
     wxWindowList parts;
-    if (m_combo)
-        parts.push_back(m_combo);
-    if (m_popup)
-        parts.push_back(m_popup);
+    parts.push_back(m_combo);
+    parts.push_back(m_popup);
     return parts;
 }