]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/combobox.cpp
cleanup mac
[wxWidgets.git] / src / gtk1 / combobox.cpp
index d6f65e2af791a4c7c9a2c2eaa3d7ec8f34bf9f6b..27a72b2bcbe3a047419a0f424bf4659837d01473 100644 (file)
@@ -618,13 +618,24 @@ void wxComboBox::SetValue( const wxString& value )
     wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
 
     GtkWidget *entry = GTK_COMBO(m_widget)->entry;
-    wxString tmp;
-    if (!value.IsNull()) tmp = value;
-    gtk_entry_set_text( GTK_ENTRY(entry), wxGTK_CONV( tmp ) );
+    gtk_entry_set_text( GTK_ENTRY(entry), wxGTK_CONV( value ) );
 
     InvalidateBestSize();
 }
 
+void wxComboBox::WriteText(const wxString& value)
+{
+    wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
+
+    GtkWidget *entry = GTK_COMBO(m_widget)->entry;
+    GtkEditable * const edit = GTK_EDITABLE(entry);
+
+    gtk_editable_delete_selection(edit);
+    gint len = gtk_editable_get_position(edit);
+    gtk_editable_insert_text(edit, wxGTK_CONV(value), -1, &len);
+    gtk_editable_set_position(edit, len);
+}
+
 void wxComboBox::Copy()
 {
     wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );