]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/combobox.cpp
Those wxTRACE_* string constants appears to need wxT()
[wxWidgets.git] / src / gtk / combobox.cpp
index 3f8b535c07aea54202ea68115b68104ee5d82ffd..0571f48fe4a20fad2ff53a4c456d706c217a0829 100644 (file)
@@ -101,19 +101,21 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
     m_needParent = TRUE;
     m_acceptsFocus = TRUE;
 
-    wxSize newSize( size );
+    wxSize newSize = size,
+           bestSize = DoGetBestSize();
+
     if (newSize.x == -1)
-       newSize.x = 80;
+        newSize.x = bestSize.x;
     if (newSize.y == -1)
-       newSize.y = 26;
-    if (newSize.y > 30)
-       newSize.y = 30;
-       
+        newSize.y = bestSize.y;
+    if (newSize.y > 22)
+        newSize.y = 22;
+
     if (!PreCreation( parent, pos, newSize ) ||
         !CreateBase( parent, id, pos, size, style, validator, name ))
     {
         wxFAIL_MSG( wxT("wxComboBox creation failed") );
-       return FALSE;
+        return FALSE;
     }
 
     m_widget = gtk_combo_new();
@@ -126,7 +128,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
     for (int i = 0; i < n; i++)
     {
         /* don't send first event, which GTK sends aways when
-          inserting the first item */
+           inserting the first item */
         m_alreadySent = TRUE;
 
         GtkWidget *list_item = gtk_list_item_new_with_label( choices[i].mbc_str() );
@@ -461,7 +463,7 @@ void wxComboBox::Copy()
     wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
 
     GtkWidget *entry = GTK_COMBO(m_widget)->entry;
-#if (GTK_MINOR_VERSION > 0)
+#if defined(__WXGTK13__) || (GTK_MINOR_VERSION > 0)
     gtk_editable_copy_clipboard( GTK_EDITABLE(entry) );
 #else
     gtk_editable_copy_clipboard( GTK_EDITABLE(entry), 0 );
@@ -473,7 +475,7 @@ void wxComboBox::Cut()
     wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
 
     GtkWidget *entry = GTK_COMBO(m_widget)->entry;
-#if (GTK_MINOR_VERSION > 0)
+#if defined(__WXGTK13__) || (GTK_MINOR_VERSION > 0)
     gtk_editable_cut_clipboard( GTK_EDITABLE(entry) );
 #else
     gtk_editable_cut_clipboard( GTK_EDITABLE(entry), 0 );
@@ -485,7 +487,7 @@ void wxComboBox::Paste()
     wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
 
     GtkWidget *entry = GTK_COMBO(m_widget)->entry;
-#if (GTK_MINOR_VERSION > 0)
+#if defined(__WXGTK13__) || (GTK_MINOR_VERSION > 0)
     gtk_editable_paste_clipboard( GTK_EDITABLE(entry) );
 #else
     gtk_editable_paste_clipboard( GTK_EDITABLE(entry), 0 );
@@ -663,7 +665,8 @@ bool wxComboBox::IsOwnGtkWindow( GdkWindow *window )
 
 wxSize wxComboBox::DoGetBestSize() const
 {
-    return wxSize(100, 26);
+    // totally bogus - should measure the strings in the combo!
+    return wxSize(100, 22);
 }
 
 #endif