-#if wxUSE_OWNER_DRAWN
- if ( m_windowStyle & wxLB_OWNERDRAW ) {
- wxOwnerDrawn *pNewItem = CreateLboxItem(index); // dummy argument
- pNewItem->SetName(item);
- m_aItems.Insert(pNewItem, index);
- ListBox_SetItemData(GetHwnd(), index, pNewItem);
- pNewItem->SetFont(GetFont());
- }
-#endif // wxUSE_OWNER_DRAWN
-
- SetHorizontalExtent(item);
-
- InvalidateBestSize();
- return index;
-}
-
-void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData)
-{
- // avoid flicker - but don't need to do this for a hidden listbox
- bool hideAndShow = IsShown();
- if ( hideAndShow )
- {
- ShowWindow(GetHwnd(), SW_HIDE);
- }
-
- ListBox_ResetContent(GetHwnd());
-
- m_noItems = choices.GetCount();
- int i;
- for (i = 0; i < m_noItems; i++)
- {
- ListBox_AddString(GetHwnd(), choices[i]);
- if ( clientData )
- {
- SetClientData(i, clientData[i]);
- }
- }
-
-#if wxUSE_OWNER_DRAWN
- if ( m_windowStyle & wxLB_OWNERDRAW ) {
- // first delete old items
- WX_CLEAR_ARRAY(m_aItems);
-
- // then create new ones
- for ( size_t ui = 0; ui < (size_t)m_noItems; ui++ ) {
- wxOwnerDrawn *pNewItem = CreateLboxItem(ui);
- pNewItem->SetName(choices[ui]);
- m_aItems.Add(pNewItem);
- ListBox_SetItemData(GetHwnd(), ui, pNewItem);
- }
- }
-#endif // wxUSE_OWNER_DRAWN
-
- SetHorizontalExtent();
-
- if ( hideAndShow )
- {
- // show the listbox back if we hid it
- ShowWindow(GetHwnd(), SW_SHOW);
- }
-
- InvalidateBestSize();
-}
-
-int wxListBox::FindString(const wxString& s) const
-{
- int pos = ListBox_FindStringExact(GetHwnd(), (WPARAM)-1, s);