]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/listctrl.cpp
Fixed bug that was giving the wrong size of wxCustomDataObjects to the receiver.
[wxWidgets.git] / src / msw / listctrl.cpp
index b4bd7519b7cef9c8361baa3a124eab03c575f53c..2180a542101d7c0a11e109dec0b485dfa997337b 100644 (file)
@@ -72,9 +72,26 @@ static void wxConvertToMSWListItem(const wxListCtrl *ctrl, wxListItem& info, LV_
 static void wxConvertFromMSWListItem(const wxListCtrl *ctrl, wxListItem& info, LV_ITEM& tvItem, HWND getFullInfo = 0);
 
 // ----------------------------------------------------------------------------
-// macros
+// events
 // ----------------------------------------------------------------------------
 
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_BEGIN_DRAG)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_BEGIN_RDRAG)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_END_LABEL_EDIT)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_DELETE_ITEM)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_GET_INFO)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_SET_INFO)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_SELECTED)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_DESELECTED)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_KEY_DOWN)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_INSERT_ITEM)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_COL_CLICK)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_ACTIVATED)
+
 IMPLEMENT_DYNAMIC_CLASS(wxListCtrl, wxControl)
 IMPLEMENT_DYNAMIC_CLASS(wxListItem, wxObject)
 
@@ -1081,8 +1098,10 @@ long wxListCtrl::FindItem(long start, const wxString& str, bool partial)
 
     // ListView_FindItem() excludes the first item from search and to look
     // through all the items you need to start from -1 which is unnatural and
-    // inconsitent with the generic version - so we adjust the index
-    return ListView_FindItem(GetHwnd(), (int) start - 1, &findInfo);
+    // inconsistent with the generic version - so we adjust the index
+    if (start != -1)
+        start --;
+    return ListView_FindItem(GetHwnd(), (int) start, &findInfo);
 }
 
 // Find an item whose data matches this data, starting from the item after 'start'
@@ -1540,6 +1559,8 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
                     {
                         eventType = wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK;
                         event.m_itemIndex = lvhti.iItem;
+                        event.m_pointDrag.x = lvhti.pt.x;
+                        event.m_pointDrag.y = lvhti.pt.y;
                     }
                 }
             }
@@ -1737,7 +1758,6 @@ void wxListCtrl::OnPaint(wxPaintEvent& event)
     wxRect itemRect;
     int cy=0;
 
-    int lastH = 0;
     int itemCount = GetItemCount();
     int i;
     for (i = 0; i < itemCount; i++)
@@ -1748,13 +1768,12 @@ void wxListCtrl::OnPaint(wxPaintEvent& event)
             if (i != 0) // Don't draw the first one
             {
                 dc.DrawLine(0, cy, clientSize.x, cy);
-
-                // Draw last line
-                if (i == (GetItemCount() - 1))
-                {
-                    cy = itemRect.GetBottom();
-                    dc.DrawLine(0, cy, clientSize.x, cy);
-                }
+            }
+            // Draw last line
+            if (i == (GetItemCount() - 1))
+            {
+                cy = itemRect.GetBottom();
+                dc.DrawLine(0, cy, clientSize.x, cy);
             }
         }
     }