From ecf9e593f8f77a9105bfaf6c94aae1baa84020da Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Wed, 27 Oct 1999 23:32:54 +0000 Subject: [PATCH] bugfix: wxList's copy ctor now works with keyed lists git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4231 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/list.cpp | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/src/common/list.cpp b/src/common/list.cpp index e442699d80..9d88dea967 100644 --- a/src/common/list.cpp +++ b/src/common/list.cpp @@ -171,9 +171,38 @@ void wxListBase::DoCopy(const wxListBase& list) m_nodeFirst = m_nodeLast = (wxNodeBase *) NULL; - for ( wxNodeBase *node = list.GetFirst(); node; node = node->GetNext() ) - { - Append(node); + switch (m_keyType) { + + case wxKEY_INTEGER: + { + long key; + for ( wxNodeBase *node = list.GetFirst(); node; node = node->GetNext() ) + { + key = node->GetKeyInteger(); + Append(key, node->GetData()); + } + break; + } + + case wxKEY_STRING: + { + const wxChar *key; + for ( wxNodeBase *node = list.GetFirst(); node; node = node->GetNext() ) + { + key = node->GetKeyString(); + Append(key, node->GetData()); + } + break; + } + + default: + { + for ( wxNodeBase *node = list.GetFirst(); node; node = node->GetNext() ) + { + Append(node->GetData()); + } + break; + } } } -- 2.45.2