+ // all objects in a keyed list should have a key
+ wxCHECK_MSG( m_keyType == wxKEY_NONE, (wxNodeBase *)NULL,
+ wxT("need a key for the object to insert") );
+
+ wxCHECK_MSG( !position || position->m_list == this, (wxNodeBase *)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 = (wxNodeBase *)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 )