X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d4e5272b3a2abfb9d365df93c54c52de965ba7ef..e97251c58ea8b3676ec05ecccdcae77c61e97a10:/src/univ/combobox.cpp diff --git a/src/univ/combobox.cpp b/src/univ/combobox.cpp index 74b01d4174..554986b033 100644 --- a/src/univ/combobox.cpp +++ b/src/univ/combobox.cpp @@ -125,6 +125,7 @@ public: virtual bool SetSelection(const wxString& value); virtual wxControl *GetControl() { return this; } virtual void OnShow(); + virtual wxCoord GetBestWidth() const; protected: // we shouldn't return height too big from here @@ -300,8 +301,15 @@ wxSize wxComboControl::DoGetBestClientSize() const { wxSize sizeBtn = m_btn->GetBestSize(), sizeText = m_text->GetBestSize(); + wxCoord widthPopup = 0; - return wxSize(sizeText.x + g_comboMargin + sizeBtn.x, wxMax(sizeBtn.y, sizeText.y)); + if (m_popup) + { + widthPopup = m_popup->GetBestWidth(); + } + + return wxSize(wxMax(sizeText.x + g_comboMargin + sizeBtn.x, widthPopup), + wxMax(sizeBtn.y, sizeText.y)); } void wxComboControl::DoMoveWindow(int x, int y, int width, int height) @@ -615,6 +623,12 @@ void wxComboListBox::OnMouseMove(wxMouseEvent& event) } } +wxCoord wxComboListBox::GetBestWidth() const +{ + wxSize size = wxListBox::GetBestSize(); + return size.x; +} + wxSize wxComboListBox::DoGetBestClientSize() const { // don't return size too big or we risk to not fit on the screen