]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/combobox.cpp
at the moment built in 'old' textcontrol has better overall appearance, added fix...
[wxWidgets.git] / src / gtk1 / combobox.cpp
index 0fb03dc36a270e5cb0e8174c043f94da11e1b032..7660f4a9fa47db790490bf376103e86a2d88d512 100644 (file)
@@ -19,6 +19,7 @@
 #if wxUSE_COMBOBOX
 
 #include "wx/settings.h"
+#include "wx/arrstr.h"
 #include "wx/intl.h"
 
 #include "wx/textctrl.h"    // for wxEVT_COMMAND_TEXT_UPDATED
@@ -102,6 +103,19 @@ BEGIN_EVENT_TABLE(wxComboBox, wxControl)
     EVT_CHAR(wxComboBox::OnChar)
 END_EVENT_TABLE()
 
+bool wxComboBox::Create( wxWindow *parent, wxWindowID id,
+                         const wxString& value,
+                         const wxPoint& pos, const wxSize& size,
+                         const wxArrayString& choices,
+                         long style, const wxValidator& validator,
+                         const wxString& name )
+{
+    wxCArrayString chs(choices);
+
+    return Create( parent, id, value, pos, size, chs.GetCount(),
+                   chs.GetStrings(), style, validator, name );
+}
+
 bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
                          const wxPoint& pos, const wxSize& size,
                          int n, const wxString choices[],
@@ -158,6 +172,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
     m_focusWidget = combo->entry;
 
     PostCreation();
+    InheritAttributes();
 
     ConnectWidget( combo->button );
 
@@ -190,9 +205,6 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
         gtk_widget_set_usize( m_widget, new_size.x, new_size.y );
     }
 
-    SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
-    SetForegroundColour( parent->GetForegroundColour() );
-
     Show( TRUE );
 
     return TRUE;
@@ -329,8 +341,7 @@ void wxComboBox::DoSetItemClientObject( int n, wxClientData* clientData )
     wxList::compatibility_iterator node = m_clientObjectList.Item( n );
     if (!node) return;
 
-    wxClientData *cd = (wxClientData*) node->GetData();
-    if (cd) delete cd;
+    // wxItemContainer already deletes data for us
 
     node->SetData( (wxObject*) clientData );
 }
@@ -546,13 +557,14 @@ void wxComboBox::SetSelection( int n )
     EnableEvents();
 }
 
-void wxComboBox::SetStringSelection( const wxString &string )
+bool wxComboBox::SetStringSelection( const wxString &string )
 {
-    wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
+    wxCHECK_MSG( m_widget != NULL, false, wxT("invalid combobox") );
 
     int res = FindString( string );
-    if (res == -1) return;
+    if (res == -1) return false;
     SetSelection( res );
+    return true;
 }
 
 wxString wxComboBox::GetValue() const
@@ -768,7 +780,7 @@ wxSize wxComboBox::DoGetBestSize() const
         size_t count = GetCount();
         for ( size_t n = 0; n < count; n++ )
         {
-            GetTextExtent( GetString(n), &width, NULL, NULL, NULL, &m_font );
+            GetTextExtent( GetString(n), &width, NULL, NULL, NULL );
             if ( width > ret.x )
                 ret.x = width;
         }