]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/listctrl.cpp
tiny fixes
[wxWidgets.git] / src / msw / listctrl.cpp
index 1470b9659cac1d24aba2735c399c91cbcba5fc6c..0d71e4aeadf6a4fd75e265f3d80981802c780c08 100644 (file)
@@ -39,7 +39,7 @@
 
 #include "wx/msw/private.h"
 
-#ifdef __GNUWIN32__
+#if defined(__GNUWIN32__) && !defined(wxUSE_NORLANDER_HEADERS)
     #include "wx/msw/gnuwin32/extra.h"
 #else
     #include <commctrl.h>
@@ -149,7 +149,7 @@ bool wxListCtrl::DoCreateControl(int x, int y, int w, int h)
     // Create the ListView control.
     m_hWnd = (WXHWND)CreateWindowEx(exStyle,
                                     WC_LISTVIEW,
-                                    _T(""),
+                                    T(""),
                                     wstyle,
                                     x, y, w, h,
                                     GetWinHwnd(GetParent()),
@@ -159,7 +159,7 @@ bool wxListCtrl::DoCreateControl(int x, int y, int w, int h)
 
     if ( !m_hWnd )
     {
-        wxLogError(_T("Can't create list control window."));
+        wxLogError(T("Can't create list control window."));
 
         return FALSE;
     }
@@ -174,8 +174,7 @@ bool wxListCtrl::DoCreateControl(int x, int y, int w, int h)
     }
 #endif // ListView_SetExtendedListViewStyle
 
-    wxSystemSettings settings;
-    SetBackgroundColour(settings.GetSystemColour(wxSYS_COLOUR_WINDOW));
+    SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW));
     SetForegroundColour(GetParent()->GetForegroundColour());
 
     SubclassWin(m_hWnd);
@@ -872,7 +871,7 @@ bool wxListCtrl::DeleteAllColumns()
         m_colCount--;
     }
 
-    wxASSERT_MSG( m_colCount == 0, _T("no columns should be left") );
+    wxASSERT_MSG( m_colCount == 0, T("no columns should be left") );
 
     return TRUE;
 }
@@ -1117,7 +1116,7 @@ long wxListCtrl::InsertColumn(long col, wxListItem& item)
     }
     else
     {
-        wxLogDebug(_T("Failed to insert the column '%s' into listview!"),
+        wxLogDebug(T("Failed to insert the column '%s' into listview!"),
                    lvCol.pszText);
     }
 
@@ -1231,13 +1230,21 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
                 event.m_col = hdr->iSubItem;
                 break;
             }
+
         case LVN_DELETEALLITEMS:
-            {
-                eventType = wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS;
-                //      NM_LISTVIEW* hdr = (NM_LISTVIEW*)lParam;
-                event.m_itemIndex = -1;
-                break;
-            }
+            // what's the sense of generating a wxWin event for this when
+            // it's absolutely not portable?
+#if 0
+            eventType = wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS;
+            event.m_itemIndex = -1;
+#endif // 0
+
+            // return TRUE to suppress all additional LVN_DELETEITEM
+            // notifications - this makes deleting all items from a list ctrl
+            // much faster
+            *result = TRUE;
+            return TRUE;
+
         case LVN_DELETEITEM:
             {
                 eventType = wxEVT_COMMAND_LIST_DELETE_ITEM;
@@ -1561,6 +1568,7 @@ wxListEvent::wxListEvent(wxEventType commandType, int id)
 {
     m_code = 0;
     m_itemIndex = 0;
+    m_oldItemIndex = 0;
     m_col = 0;
     m_cancelled = FALSE;
 }