From d33e45f134004bdb8199de60d60a251569bbed96 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Wed, 10 Jun 2009 04:38:20 +0000 Subject: [PATCH] fixing redraw of combobox on osx_cocoa git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60959 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/osx/carbon/combobox.cpp | 11 +++++++---- src/osx/choice_osx.cpp | 3 ++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/osx/carbon/combobox.cpp b/src/osx/carbon/combobox.cpp index 79564de842..a3a419dc6e 100644 --- a/src/osx/carbon/combobox.cpp +++ b/src/osx/carbon/combobox.cpp @@ -261,12 +261,11 @@ wxSize wxComboBox::DoGetBestSize() const if ( m_text != NULL ) { wxSize sizeText = m_text->GetBestSize(); - if (sizeText.y > size.y) - size.y = sizeText.y; + if (sizeText.y + 2 * TEXTFOCUSBORDER > size.y) + size.y = sizeText.y + 2 * TEXTFOCUSBORDER; size.x = m_choice->GetPopupWidth() + sizeText.x + MARGIN; size.x += TEXTFOCUSBORDER ; - size.y += 2 * TEXTFOCUSBORDER ; } else { @@ -291,9 +290,13 @@ void wxComboBox::DoMoveWindow(int x, int y, int width, int height) { wxCoord wText = width - m_choice->GetPopupWidth() - MARGIN; m_text->SetSize(TEXTFOCUSBORDER, TEXTFOCUSBORDER, wText, -1); + wxSize tSize = m_text->GetSize(); + wxSize cSize = m_choice->GetSize(); + + int yOffset = ( tSize.y + 2 * TEXTFOCUSBORDER - cSize.y ) / 2; // put it at an inset of 1 to have outer area shadows drawn as well - m_choice->SetSize(TEXTFOCUSBORDER + wText + MARGIN - 1 , TEXTFOCUSBORDER, m_choice->GetPopupWidth() , -1); + m_choice->SetSize(TEXTFOCUSBORDER + wText + MARGIN - 1 , yOffset, m_choice->GetPopupWidth() , -1); } } diff --git a/src/osx/choice_osx.cpp b/src/osx/choice_osx.cpp index d9b3932dee..9702a7da67 100644 --- a/src/osx/choice_osx.cpp +++ b/src/osx/choice_osx.cpp @@ -256,7 +256,8 @@ bool wxChoice::OSXHandleClicked( double WXUNUSED(timestampsec) ) wxSize wxChoice::DoGetBestSize() const { int lbWidth = GetCount() > 0 ? 20 : 100; // some defaults - int lbHeight = 20; + wxSize baseSize = wxWindow::DoGetBestSize(); + int lbHeight = baseSize.y; int wLine; { -- 2.47.2