fixing redraw of combobox on osx_cocoa

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60959 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2009-06-10 04:38:20 +00:00
parent 17ad51edc7
commit d33e45f134
2 changed files with 9 additions and 5 deletions

View File

@@ -261,12 +261,11 @@ wxSize wxComboBox::DoGetBestSize() const
if ( m_text != NULL ) if ( m_text != NULL )
{ {
wxSize sizeText = m_text->GetBestSize(); wxSize sizeText = m_text->GetBestSize();
if (sizeText.y > size.y) if (sizeText.y + 2 * TEXTFOCUSBORDER > size.y)
size.y = sizeText.y; size.y = sizeText.y + 2 * TEXTFOCUSBORDER;
size.x = m_choice->GetPopupWidth() + sizeText.x + MARGIN; size.x = m_choice->GetPopupWidth() + sizeText.x + MARGIN;
size.x += TEXTFOCUSBORDER ; size.x += TEXTFOCUSBORDER ;
size.y += 2 * TEXTFOCUSBORDER ;
} }
else else
{ {
@@ -291,9 +290,13 @@ void wxComboBox::DoMoveWindow(int x, int y, int width, int height)
{ {
wxCoord wText = width - m_choice->GetPopupWidth() - MARGIN; wxCoord wText = width - m_choice->GetPopupWidth() - MARGIN;
m_text->SetSize(TEXTFOCUSBORDER, TEXTFOCUSBORDER, wText, -1); 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 // 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);
} }
} }

View File

@@ -256,7 +256,8 @@ bool wxChoice::OSXHandleClicked( double WXUNUSED(timestampsec) )
wxSize wxChoice::DoGetBestSize() const wxSize wxChoice::DoGetBestSize() const
{ {
int lbWidth = GetCount() > 0 ? 20 : 100; // some defaults int lbWidth = GetCount() > 0 ? 20 : 100; // some defaults
int lbHeight = 20; wxSize baseSize = wxWindow::DoGetBestSize();
int lbHeight = baseSize.y;
int wLine; int wLine;
{ {