]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/listctrl.cpp
added debug/release DLL configurations so that VC++ chooses the right one when buildi...
[wxWidgets.git] / src / msw / listctrl.cpp
index 25c10a29294737eb8ff3bafb2b0e5f5b9d29705b..b3894f1461605ed4b76fcb91c782a553e6794b1f 100644 (file)
@@ -350,7 +350,7 @@ bool wxListCtrl::Create(wxWindow *parent,
     if ( !CreateControl(parent, id, pos, size, style, validator, name) )
         return false;
 
-    if ( !MSWCreateControl(WC_LISTVIEW, _T(""), pos, size) )
+    if ( !MSWCreateControl(WC_LISTVIEW, wxEmptyString, pos, size) )
         return false;
 
     // explicitly say that we want to use Unicode because otherwise we get ANSI
@@ -480,8 +480,6 @@ void wxListCtrl::FreeAllInternalData()
         m_ignoreChangeMessages = false;
 
         m_AnyInternalData = false;
-
-        m_count = 0;
     }
 }
 
@@ -497,9 +495,12 @@ wxListCtrl::~wxListCtrl()
         m_textCtrl = NULL;
     }
 
-    if (m_ownsImageListNormal) delete m_imageListNormal;
-    if (m_ownsImageListSmall) delete m_imageListSmall;
-    if (m_ownsImageListState) delete m_imageListState;
+    if (m_ownsImageListNormal)
+        delete m_imageListNormal;
+    if (m_ownsImageListSmall)
+        delete m_imageListSmall;
+    if (m_ownsImageListState)
+        delete m_imageListState;
 }
 
 // ----------------------------------------------------------------------------
@@ -1925,10 +1926,12 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
                 break;
 
             case LVN_DELETEITEM:
-                if (m_count == 0)
-                    // this should be prevented by the post-processing code below,
-                    // but "just in case"
+                if ( m_count == 0 )
+                {
+                    // this should be prevented by the post-processing code
+                    // below, but "just in case"
                     return false;
+                }
 
                 eventType = wxEVT_COMMAND_LIST_DELETE_ITEM;
                 event.m_itemIndex = iItem;
@@ -2194,6 +2197,10 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
             // also, we may free all user data now (couldn't do it before as
             // the user should have access to it in OnDeleteAllItems() handler)
             FreeAllInternalData();
+
+            // the control is empty now, synchronize the cached number of items
+            // with the real one
+            m_count = 0;
             return true;
 
         case LVN_ENDLABELEDITA:
@@ -2378,6 +2385,21 @@ void wxListCtrl::OnPaint(wxPaintEvent& event)
     }
 }
 
+WXLRESULT
+wxListCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
+{
+#ifdef WM_PRINT
+    if ( nMsg == WM_PRINT )
+    {
+        // we should bypass our own WM_PRINT handling as we don't handle
+        // PRF_CHILDREN flag, so leave it to the native control itself
+        return MSWDefWindowProc(nMsg, wParam, lParam);
+    }
+#endif // WM_PRINT
+
+    return wxControl::MSWWindowProc(nMsg, wParam, lParam);
+}
+
 // ----------------------------------------------------------------------------
 // virtual list controls
 // ----------------------------------------------------------------------------