]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/combobox.cpp
Drop the Array class added in the last scintilla patch and switch to using wxVector...
[wxWidgets.git] / src / gtk1 / combobox.cpp
index d6f65e2af791a4c7c9a2c2eaa3d7ec8f34bf9f6b..ebbbc0c0a4fc8e313a445e04d8d366f730110cd7 100644 (file)
@@ -59,7 +59,7 @@ gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
     wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() );
     event.SetString( combo->GetValue() );
     event.SetEventObject( combo );
-    combo->GetEventHandler()->ProcessEvent( event );
+    combo->HandleWindowEvent( event );
 }
 }
 
@@ -91,13 +91,13 @@ gtk_popup_hide_callback(GtkCombo *WXUNUSED(gtk_combo), wxComboBox *combo)
         event.SetInt( curSelection );
         event.SetString( combo->GetStringSelection() );
         event.SetEventObject( combo );
-        combo->GetEventHandler()->ProcessEvent( event );
+        combo->HandleWindowEvent( event );
 
         // for consistency with the other ports, send TEXT event
         wxCommandEvent event2( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() );
         event2.SetString( combo->GetStringSelection() );
         event2.SetEventObject( combo );
-        combo->GetEventHandler()->ProcessEvent( event2 );
+        combo->HandleWindowEvent( event2 );
     }
 }
 }
@@ -154,14 +154,14 @@ gtk_combo_select_child_callback( GtkList *WXUNUSED(list), GtkWidget *WXUNUSED(wi
         event.SetInt( curSelection );
         event.SetString( combo->GetStringSelection() );
         event.SetEventObject( combo );
-        combo->GetEventHandler()->ProcessEvent( event );
+        combo->HandleWindowEvent( event );
 
         // for consistency with the other ports, don't generate text update
         // events while the user is browsing the combobox neither
         wxCommandEvent event2( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() );
         event2.SetString( combo->GetValue() );
         event2.SetEventObject( combo );
-        combo->GetEventHandler()->ProcessEvent( event2 );
+        combo->HandleWindowEvent( event2 );
     }
 }
 }
@@ -247,8 +247,8 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
     {
         GtkWidget *list_item = gtk_list_item_new_with_label( wxGTK_CONV( choices[i] ) );
 
-        m_clientDataList.Append( (wxObject*)NULL );
-        m_clientObjectList.Append( (wxObject*)NULL );
+        m_clientDataList.Append( NULL );
+        m_clientObjectList.Append( NULL );
 
         gtk_container_add( GTK_CONTAINER(list), list_item );
 
@@ -365,9 +365,9 @@ int wxComboBox::DoInsertItems(const wxArrayStringsAdapter& items,
         gtk_widget_show( list_item );
 
         if ( m_clientDataList.GetCount() < GetCount() )
-            m_clientDataList.Insert( pos, (wxObject*) NULL );
+            m_clientDataList.Insert( pos, NULL );
         if ( m_clientObjectList.GetCount() < GetCount() )
-            m_clientObjectList.Insert( pos, (wxObject*) NULL );
+            m_clientObjectList.Insert( pos, NULL );
 
         AssignNewItemClientData(pos, clientData, i, type);
     }
@@ -435,7 +435,7 @@ void wxComboBox::DoDeleteOneItem(unsigned int n)
 
     DisableEvents();
 
-    GList *list = g_list_append( (GList*) NULL, child->data );
+    GList *list = g_list_append( NULL, child->data );
     gtk_list_remove_items( listbox, list );
     g_list_free( list );
 
@@ -596,7 +596,7 @@ void wxComboBox::SetSelection( int n )
     EnableEvents();
 }
 
-wxString wxComboBox::GetValue() const
+wxString wxComboBox::DoGetValue() const
 {
     GtkEntry *entry = GTK_ENTRY( GTK_COMBO(m_widget)->entry );
     wxString tmp( wxGTK_CONV_BACK( gtk_entry_get_text( entry ) ) );
@@ -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") );
@@ -778,7 +789,7 @@ void wxComboBox::OnChar( wxKeyEvent &event )
         eventEnter.SetInt( GetSelection() );
         eventEnter.SetEventObject( this );
 
-        if (!GetEventHandler()->ProcessEvent( eventEnter ))
+        if (!HandleWindowEvent( eventEnter ))
         {
             // This will invoke the dialog default action, such
             // as the clicking the default button.