+ // all objects in a keyed list should have a key
+ wxCHECK_MSG( m_keyType == wxKEY_NONE, NULL,
+ wxT("need a key for the object to insert") );
+
+ wxCHECK_MSG( !position || position->m_list == this, NULL,
+ wxT("can't insert before a node from another list") );
+
+ // previous and next node for the node being inserted
+ wxNodeBase *prev, *next;
+ if ( position )
+ {
+ prev = position->GetPrevious();
+ next = position;
+ }
+ else
+ {
+ // inserting in the beginning of the list
+ prev = NULL;
+ next = m_nodeFirst;
+ }
+
+ // wxDefaultListKey: see comment in Append() above
+ wxNodeBase *node = CreateNode(prev, next, object, wxDefaultListKey);
+ if ( !m_nodeFirst )
+ {
+ m_nodeLast = node;
+ }
+
+ if ( prev == NULL )