Patch #1203934: enable best size caching for MSW widgets
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34120 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -279,12 +279,12 @@ void wxListBox::Delete(int N)
|
||||
m_noItems--;
|
||||
|
||||
SetHorizontalExtent(wxEmptyString);
|
||||
|
||||
InvalidateBestSize();
|
||||
}
|
||||
|
||||
int wxListBox::DoAppend(const wxString& item)
|
||||
{
|
||||
InvalidateBestSize();
|
||||
|
||||
int index = ListBox_AddString(GetHwnd(), item);
|
||||
m_noItems++;
|
||||
|
||||
@@ -300,6 +300,7 @@ int wxListBox::DoAppend(const wxString& item)
|
||||
|
||||
SetHorizontalExtent(item);
|
||||
|
||||
InvalidateBestSize();
|
||||
return index;
|
||||
}
|
||||
|
||||
@@ -347,6 +348,8 @@ void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData)
|
||||
// show the listbox back if we hid it
|
||||
ShowWindow(GetHwnd(), SW_SHOW);
|
||||
}
|
||||
|
||||
InvalidateBestSize();
|
||||
}
|
||||
|
||||
int wxListBox::FindString(const wxString& s) const
|
||||
@@ -366,6 +369,8 @@ void wxListBox::Clear()
|
||||
|
||||
m_noItems = 0;
|
||||
SetHorizontalExtent();
|
||||
|
||||
InvalidateBestSize();
|
||||
}
|
||||
|
||||
void wxListBox::Free()
|
||||
@@ -520,8 +525,6 @@ wxListBox::DoInsertItems(const wxArrayString& items, int pos)
|
||||
wxCHECK_RET( pos >= 0 && pos <= m_noItems,
|
||||
wxT("invalid index in wxListBox::InsertItems") );
|
||||
|
||||
InvalidateBestSize();
|
||||
|
||||
int nItems = items.GetCount();
|
||||
for ( int i = 0; i < nItems; i++ )
|
||||
{
|
||||
@@ -545,6 +548,8 @@ wxListBox::DoInsertItems(const wxArrayString& items, int pos)
|
||||
m_noItems += nItems;
|
||||
|
||||
SetHorizontalExtent();
|
||||
|
||||
InvalidateBestSize();
|
||||
}
|
||||
|
||||
void wxListBox::SetString(int N, const wxString& s)
|
||||
@@ -591,6 +596,8 @@ void wxListBox::SetString(int N, const wxString& s)
|
||||
// we may have lost the selection
|
||||
if ( wasSelected )
|
||||
Select(N);
|
||||
|
||||
InvalidateBestSize();
|
||||
}
|
||||
|
||||
int wxListBox::GetCount() const
|
||||
@@ -691,7 +698,9 @@ wxSize wxListBox::DoGetBestSize() const
|
||||
int hListbox = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy)*
|
||||
wxMin(wxMax(m_noItems, 3), 10);
|
||||
|
||||
return wxSize(wListbox, hListbox);
|
||||
wxSize best(wListbox, hListbox);
|
||||
CacheBestSize(best);
|
||||
return best;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user