- for (;;)
- {
- wxObject *object = va_arg (ap, wxObject *);
-// if (object == NULL) // Doesn't work in Windows -- segment is non-zero for NULL!
-#ifdef __WXMSW__
- if ((int) object == 0)
-#else
- if ((long) object == 0)
-#endif
- break;
- else
- {
- wxNode *node = new wxNode (this, last, (wxNode *) NULL, object);
- last = node;
- n++;
- }
+void wxListBase::DoCopy(const wxListBase& list)
+{
+ wxASSERT_MSG( !list.m_destroy,
+ wxT("copying list which owns it's elements is a bad idea") );
+
+ m_destroy = list.m_destroy;
+ m_keyType = list.m_keyType;
+ m_nodeFirst =
+ m_nodeLast = (wxNodeBase *) NULL;
+
+ 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;
+ }