int wxListBox::DoInsertItems(const wxArrayStringsAdapter& items, unsigned int pos, void **clientData, wxClientDataType type) { int idx = wxNOT_FOUND; unsigned int startpos = pos; const unsigned int numItems = items.GetCount(); for ( unsigned int i = 0; i < numItems; ++i ) { const wxString& item = items[i]; idx = IsSorted() ? m_strings.sorted->Add(item) : (m_strings.unsorted->Insert(item, pos), pos++); m_itemsClientData.Insert(NULL, idx); AssignNewItemClientData(idx, clientData, i, type); GetListPeer()->ListInsert(startpos+i); OnItemInserted(idx); } GetListPeer()->UpdateLineToEnd(startpos); UpdateOldSelections(); return idx; }
int wxListBox::DoInsertItems(const wxArrayStringsAdapter& items, unsigned int pos, void **clientData, wxClientDataType type) { int idx = wxNOT_FOUND; unsigned int startpos = pos; const unsigned int numItems = items.GetCount(); #if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */ # pragma ivdep # pragma swp # pragma unroll # pragma prefetch # if 0 # pragma simd noassert # endif #endif /* VDM auto patch */ for ( unsigned int i = 0; i < numItems; ++i ) { const wxString& item = items[i]; idx = IsSorted() ? m_strings.sorted->Add(item) : (m_strings.unsorted->Insert(item, pos), pos++); m_itemsClientData.Insert(NULL, idx); AssignNewItemClientData(idx, clientData, i, type); GetListPeer()->ListInsert(startpos+i); OnItemInserted(idx); } GetListPeer()->UpdateLineToEnd(startpos); // Inserting the items may scroll the listbox down to show the last // selected one but we don't want to do it as it could result in e.g. the // first items of a listbox be hidden immediately after its creation so // show the first selected item instead. Ideal would probably be to // preserve the old selection unchanged, in fact, but I don't know how to // get the first visible item so for now do at least this. SetFirstItem(startpos); UpdateOldSelections(); return idx; }