+void
+wxListBox::DoInsertItems(const wxArrayString& items, int pos)
+{
+ wxCHECK_RET( pos >= 0 && pos <= m_noItems,
+ wxT("invalid index in wxListBox::InsertItems") );
+
+ int nItems = items.GetCount();
+ for ( int i = 0; i < nItems; i++ )
+ ListBox_InsertString(GetHwnd(), i + pos, items[i]);
+ m_noItems += nItems;
+
+ SetHorizontalExtent();
+}
+
+void wxListBox::SetString(int N, const wxString& s)
+{
+ wxCHECK_RET( N >= 0 && N < m_noItems,
+ wxT("invalid index in wxListBox::SetString") );
+
+ // remember the state of the item
+ bool wasSelected = IsSelected(N);
+
+ void *oldData = NULL;
+ wxClientData *oldObjData = NULL;
+ if ( m_clientDataItemsType == ClientData_Void )
+ oldData = GetClientData(N);
+ else if ( m_clientDataItemsType == ClientData_Object )
+ oldObjData = GetClientObject(N);
+
+ // delete and recreate it
+ SendMessage(GetHwnd(), LB_DELETESTRING, N, 0);
+
+ int newN = N;
+ if ( N == m_noItems - 1 )
+ newN = -1;
+
+ ListBox_InsertString(GetHwnd(), newN, s);
+
+ // restore the client data
+ if ( oldData )
+ SetClientData(N, oldData);
+ else if ( oldObjData )
+ SetClientObject(N, oldObjData);
+
+ // we may have lost the selection
+ if ( wasSelected )
+ Select(N);
+
+#if wxUSE_OWNER_DRAWN
+ if ( m_windowStyle & wxLB_OWNERDRAW )
+ // update item's text
+ m_aItems[N]->SetName(s);
+#endif //USE_OWNER_DRAWN
+}
+
+int wxListBox::GetCount() const
+{
+ return m_noItems;
+}
+
+// ----------------------------------------------------------------------------
+// helpers
+// ----------------------------------------------------------------------------
+