]> git.saurik.com Git - wxWidgets.git/commitdiff
fixing redraw of combobox on osx_cocoa
authorStefan Csomor <csomor@advancedconcepts.ch>
Wed, 10 Jun 2009 04:38:20 +0000 (04:38 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Wed, 10 Jun 2009 04:38:20 +0000 (04:38 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60959 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/osx/carbon/combobox.cpp
src/osx/choice_osx.cpp

index 79564de842a115a100021dd0784117ceb5f717a0..a3a419dc6eab14fe4bcfaebee57ca4f755c1ec29 100644 (file)
@@ -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);
     }
 }
 
index d9b3932deefefcb224ff96470147391d2b48ca9e..9702a7da67d1634a75ee703a90f5eacbdfd3cee4 100644 (file)
@@ -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;
 
     {