From 3475a005d63807e0c2dd0384ce40af73921f983b Mon Sep 17 00:00:00 2001 From: Gilles Depeyrot Date: Wed, 8 May 2002 13:55:36 +0000 Subject: [PATCH] implemented missing copy constructor (needed for non trivial member) corrected warnings when compiling with -Wall -W git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15429 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/listctrl.h | 26 ++++++++++++++++++++------ src/generic/listctrl.cpp | 28 +++++++++++++++++++++++----- 2 files changed, 43 insertions(+), 11 deletions(-) diff --git a/include/wx/listctrl.h b/include/wx/listctrl.h index 4609981ce7..ac807f0c9e 100644 --- a/include/wx/listctrl.h +++ b/include/wx/listctrl.h @@ -187,8 +187,11 @@ private: class WXDLLEXPORT wxListItem : public wxObject { + wxListItem& operator=(const wxListItem& item); + public: wxListItem(); + wxListItem(const wxListItem& item); ~wxListItem() { delete m_attr; } // resetting @@ -361,13 +364,24 @@ class WXDLLEXPORT wxListEvent : public wxNotifyEvent public: wxListEvent(wxEventType commandType = wxEVT_NULL, int id = 0) : wxNotifyEvent(commandType, id) - { - m_code = 0; - m_itemIndex = - m_oldItemIndex = 0; - m_col = 0; - } + , m_code(0) + , m_oldItemIndex(0) + , m_itemIndex(0) + , m_col(0) + , m_pointDrag() + , m_item() + { } + wxListEvent(const wxListEvent& event) + : wxNotifyEvent(event) + , m_code(event.m_code) + , m_oldItemIndex(event.m_oldItemIndex) + , m_itemIndex(event.m_itemIndex) + , m_col(event.m_col) + , m_pointDrag(event.m_pointDrag) + , m_item(event.m_item) + { } + int GetCode() const { return m_code; } long GetIndex() const { return m_itemIndex; } int GetColumn() const { return m_col; } diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index b68ffb85ae..48b0ca5226 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -4499,6 +4499,24 @@ wxListItem::wxListItem() Clear(); } +wxListItem::wxListItem(const wxListItem& item) + : wxObject() + , m_mask(item.m_mask) + , m_itemId(item.m_itemId) + , m_col(item.m_col) + , m_state(item.m_state) + , m_stateMask(item.m_stateMask) + , m_text(item.m_text) + , m_image(item.m_image) + , m_data(item.m_data) + , m_format(item.m_format) + , m_width(item.m_width) + , m_attr(NULL) +{ + // copy list item attributes + m_attr = new wxListItemAttr(*item.GetAttributes()); +} + void wxListItem::Clear() { m_mask = 0; @@ -5099,7 +5117,7 @@ bool wxListCtrl::SortItems( wxListCtrlCompare fn, long data ) // event handlers // ---------------------------------------------------------------------------- -void wxListCtrl::OnSize(wxSizeEvent& event) +void wxListCtrl::OnSize(wxSizeEvent& WXUNUSED(event)) { if ( !m_mainWin ) return; @@ -5243,19 +5261,19 @@ void wxListCtrl::SetFocus() // virtual list control support // ---------------------------------------------------------------------------- -wxString wxListCtrl::OnGetItemText(long item, long col) const +wxString wxListCtrl::OnGetItemText(long WXUNUSED(item), long WXUNUSED(col)) const { // this is a pure virtual function, in fact - which is not really pure // because the controls which are not virtual don't need to implement it - wxFAIL_MSG( _T("not supposed to be called") ); + wxFAIL_MSG( _T("wxListCtrl::OnGetItemText not supposed to be called") ); return wxEmptyString; } -int wxListCtrl::OnGetItemImage(long item) const +int wxListCtrl::OnGetItemImage(long WXUNUSED(item)) const { // same as above - wxFAIL_MSG( _T("not supposed to be called") ); + wxFAIL_MSG( _T("wxListCtrl::OnGetItemImage not supposed to be called") ); return -1; }