]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/cocoa/combobox.mm
no-op change to get build bot running
[wxWidgets.git] / src / osx / cocoa / combobox.mm
index a6c9e9b7c47883a0898f0ff3f3ba24a18a6b4bc3..1666c33b83e687475b56dcee0521f3a6125fc618 100644 (file)
@@ -78,7 +78,8 @@
 }
 @end
 
-wxNSComboBoxControl::wxNSComboBoxControl( wxWindow *wxPeer, WXWidget w ) : wxNSTextFieldControl(wxPeer, w)
+wxNSComboBoxControl::wxNSComboBoxControl( wxComboBox *wxPeer, WXWidget w )
+    : wxNSTextFieldControl(wxPeer, wxPeer, w)
 {
     m_comboBox = (NSComboBox*)w;
 }
@@ -137,7 +138,7 @@ int wxNSComboBoxControl::FindString(const wxString& text) const
     return result;
 }
 
-wxWidgetImplType* wxWidgetImpl::CreateComboBox( wxWindowMac* wxpeer, 
+wxWidgetImplType* wxWidgetImpl::CreateComboBox( wxComboBox* wxpeer, 
                                     wxWindowMac* WXUNUSED(parent), 
                                     wxWindowID WXUNUSED(id), 
                                     wxMenu* menu,
@@ -154,4 +155,33 @@ wxWidgetImplType* wxWidgetImpl::CreateComboBox( wxWindowMac* wxpeer,
     return c;
 }
 
-#endif // wxUSE_COMBOBOX
\ No newline at end of file
+wxSize wxComboBox::DoGetBestSize() const
+{
+    int lbWidth = GetCount() > 0 ? 20 : 100;  // some defaults
+    wxSize baseSize = wxWindow::DoGetBestSize();
+    int lbHeight = baseSize.y;
+    int wLine;
+    
+    {
+        wxClientDC dc(const_cast<wxComboBox*>(this));
+        
+        // Find the widest line
+        for(unsigned int i = 0; i < GetCount(); i++)
+        {
+            wxString str(GetString(i));
+            
+            wxCoord width, height ;
+            dc.GetTextExtent( str , &width, &height);
+            wLine = width ;
+            
+            lbWidth = wxMax( lbWidth, wLine ) ;
+        }
+        
+        // Add room for the popup arrow
+        lbWidth += 2 * lbHeight ;
+    }
+    
+    return wxSize( lbWidth, lbHeight );
+}
+
+#endif // wxUSE_COMBOBOX