X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f31a409829d5d410f38e64896470afcaff12635b..b9efe021b554fa3967d1442cf758435c5cd5ae8f:/src/msw/choice.cpp diff --git a/src/msw/choice.cpp b/src/msw/choice.cpp index ae626177ce..859e700b71 100644 --- a/src/msw/choice.cpp +++ b/src/msw/choice.cpp @@ -236,6 +236,7 @@ int wxChoice::DoAppend(const wxString& item) UpdateVisibleHeight(); } + InvalidateBestSize(); return n; } @@ -255,6 +256,7 @@ int wxChoice::DoInsert(const wxString& item, int pos) UpdateVisibleHeight(); } + InvalidateBestSize(); return n; } @@ -271,6 +273,8 @@ void wxChoice::Delete(int n) if ( !IsFrozen() ) UpdateVisibleHeight(); + + InvalidateBestSize(); } void wxChoice::Clear() @@ -281,6 +285,8 @@ void wxChoice::Clear() if ( !IsFrozen() ) UpdateVisibleHeight(); + + InvalidateBestSize(); } void wxChoice::Free() @@ -335,12 +341,12 @@ int wxChoice::FindString(const wxString& s) const #else // !Watcom //TODO: Evidently some MSW versions (all?) don't like empty strings //passed to SendMessage, so we have to do it ourselves in that case - if ( s.size() == 0 ) + if ( s.empty() ) { int count = GetCount(); for ( int i = 0; i < count; i++ ) { - if ( GetString(i).size() == 0 ) + if ( GetString(i).empty() ) return i; } @@ -383,6 +389,8 @@ void wxChoice::SetString(int n, const wxString& s) DoSetItemClientData(n, data); } //else: it's already NULL by default + + InvalidateBestSize(); } wxString wxChoice::GetString(int n) const @@ -567,7 +575,9 @@ wxSize wxChoice::DoGetBestSize() const // the combobox should be slightly larger than the widest string wChoice += 5*GetCharWidth(); - return wxSize(wChoice, EDIT_HEIGHT_FROM_CHAR_HEIGHT(GetCharHeight())); + wxSize best(wChoice, EDIT_HEIGHT_FROM_CHAR_HEIGHT(GetCharHeight())); + CacheBestSize(best); + return best; } WXLRESULT wxChoice::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) @@ -599,7 +609,7 @@ WXLRESULT wxChoice::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) WXHWND hwnd; UnpackCtlColor(wParam, lParam, &hdc, &hwnd); - WXHBRUSH hbr = MSWControlColor((WXHDC)hdc); + WXHBRUSH hbr = MSWControlColor((WXHDC)hdc, hwnd); if ( hbr ) return (WXLRESULT)hbr; //else: fall through to default window proc @@ -634,12 +644,12 @@ bool wxChoice::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) return true; } -WXHBRUSH wxChoice::MSWControlColor(WXHDC hDC) +WXHBRUSH wxChoice::MSWControlColor(WXHDC hDC, WXHWND hWnd) { if ( !IsEnabled() ) return MSWControlColorDisabled(hDC); - return wxChoiceBase::MSWControlColorSolid(hDC); + return wxChoiceBase::MSWControlColor(hDC, hWnd); } #endif // wxUSE_CHOICE && !(__SMARTPHONE__ && __WXWINCE__)