]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/listctrl.cpp
added test mode to wxLongLongWx which allowed to find the bug in operator*=()
[wxWidgets.git] / src / msw / listctrl.cpp
index 3d4eb964bb76e38372219b9d833ca177ad24fd02..b74816ce5baf8d36293df3c8053027fc93d862f2 100644 (file)
@@ -61,15 +61,48 @@ static void wxConvertFromMSWListItem(const wxListCtrl *ctrl, wxListItem& info, L
 // macros
 // ----------------------------------------------------------------------------
 
 // macros
 // ----------------------------------------------------------------------------
 
-#if !USE_SHARED_LIBRARY
-    IMPLEMENT_DYNAMIC_CLASS(wxListCtrl, wxControl)
-    IMPLEMENT_DYNAMIC_CLASS(wxListItem, wxObject)
-#endif // USE_SHARED_LIBRARY
+IMPLEMENT_DYNAMIC_CLASS(wxListCtrl, wxControl)
+IMPLEMENT_DYNAMIC_CLASS(wxListItem, wxObject)
 
 // ============================================================================
 // implementation
 // ============================================================================
 
 
 // ============================================================================
 // implementation
 // ============================================================================
 
+// ----------------------------------------------------------------------------
+// wxListEvent
+// ----------------------------------------------------------------------------
+
+void wxListEvent::CopyObject(wxObject& object_dest) const
+{
+    wxListEvent *obj = (wxListEvent *)&object_dest;
+
+    wxNotifyEvent::CopyObject(object_dest);
+
+    obj->m_code = m_code;
+    obj->m_itemIndex = m_itemIndex;
+    obj->m_oldItemIndex = m_oldItemIndex;
+    obj->m_col = m_col;
+    obj->m_cancelled = m_cancelled;
+    obj->m_pointDrag = m_pointDrag;
+    obj->m_item.m_mask = m_item.m_mask;
+    obj->m_item.m_itemId = m_item.m_itemId;
+    obj->m_item.m_col = m_item.m_col;
+    obj->m_item.m_state = m_item.m_state;
+    obj->m_item.m_stateMask = m_item.m_stateMask;
+    obj->m_item.m_text = m_item.m_text;
+    obj->m_item.m_image = m_item.m_image;
+    obj->m_item.m_data = m_item.m_data;
+    obj->m_item.m_format = m_item.m_format;
+    obj->m_item.m_width = m_item.m_width;
+
+    if ( m_item.HasAttributes() )
+    {
+        obj->m_item.SetTextColour(m_item.GetTextColour());
+        obj->m_item.SetBackgroundColour(m_item.GetBackgroundColour());
+        obj->m_item.SetFont(m_item.GetFont());
+    }
+}
+
 // ----------------------------------------------------------------------------
 // wxListCtrl construction
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // wxListCtrl construction
 // ----------------------------------------------------------------------------
@@ -93,7 +126,10 @@ bool wxListCtrl::Create(wxWindow *parent,
                         const wxValidator& validator,
                         const wxString& name)
 {
                         const wxValidator& validator,
                         const wxString& name)
 {
+#if wxUSE_VALIDATORS
     SetValidator(validator);
     SetValidator(validator);
+#endif // wxUSE_VALIDATORS
+
     SetName(name);
 
     int x = pos.x;
     SetName(name);
 
     int x = pos.x;
@@ -1280,7 +1316,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
 
                 if ( m_hasAnyAttr )
                 {
 
                 if ( m_hasAnyAttr )
                 {
-                    delete m_attrs.Delete(hdr->iItem);
+                    delete (wxListItemAttr *)m_attrs.Delete(hdr->iItem);
                 }
             }
             break;
                 }
             }
             break;
@@ -1438,7 +1474,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
             break;
 #endif // 0
 
             break;
 #endif // 0
 
-#ifdef NM_CUSTOMDRAW
+#if defined(_WIN32_IE) && _WIN32_IE >= 0x300
         case NM_CUSTOMDRAW:
             {
                 LPNMLVCUSTOMDRAW lplvcd = (LPNMLVCUSTOMDRAW)lParam;
         case NM_CUSTOMDRAW:
             {
                 LPNMLVCUSTOMDRAW lplvcd = (LPNMLVCUSTOMDRAW)lParam;
@@ -1519,7 +1555,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
                 }
             }
             break;
                 }
             }
             break;
-#endif // NM_CUSTOMDRAW
+#endif // _WIN32_IE >= 0x300
 
         default:
             return wxControl::MSWOnNotify(idCtrl, lParam, result);
 
         default:
             return wxControl::MSWOnNotify(idCtrl, lParam, result);
@@ -1601,6 +1637,29 @@ wxListItem::wxListItem()
     m_attr = NULL;
 }
 
     m_attr = NULL;
 }
 
+void wxListItem::Clear()
+{
+    m_mask = 0;
+    m_itemId = 0;
+    m_col = 0;
+    m_state = 0;
+    m_stateMask = 0;
+    m_image = 0;
+    m_data = 0;
+    m_format = wxLIST_FORMAT_CENTRE;
+    m_width = 0;
+    m_text = wxEmptyString;
+
+    if (m_attr) delete m_attr;
+    m_attr = NULL;
+}
+
+void wxListItem::ClearAttributes()
+{
+    if (m_attr) delete m_attr;
+    m_attr = NULL;
+}
+
 static void wxConvertFromMSWListItem(const wxListCtrl *ctrl, wxListItem& info, LV_ITEM& lvItem, HWND getFullInfo)
 {
     info.m_data = lvItem.lParam;
 static void wxConvertFromMSWListItem(const wxListCtrl *ctrl, wxListItem& info, LV_ITEM& lvItem, HWND getFullInfo)
 {
     info.m_data = lvItem.lParam;