]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/combobox.cpp
don't generate duplicate resume events for PBT_APMRESUMEAUTOMATIC
[wxWidgets.git] / src / gtk / combobox.cpp
index eb6ffdd4274573dd0740fa0d0b391c82b64ce2ba..6f6c9fecdcdffba8c7c9839a22d7205824572784 100644 (file)
@@ -36,7 +36,7 @@ gtkcombobox_text_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *comb
     wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() );
     event.SetString( combo->GetValue() );
     event.SetEventObject( combo );
-    combo->GetEventHandler()->ProcessEvent( event );
+    combo->HandleWindowEvent( event );
 }
 
 static void
@@ -51,7 +51,7 @@ gtkcombobox_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
     event.SetInt( combo->GetSelection() );
     event.SetString( combo->GetStringSelection() );
     event.SetEventObject( combo );
-    combo->GetEventHandler()->ProcessEvent( event );
+    combo->HandleWindowEvent( event );
 }
 }
 
@@ -170,17 +170,6 @@ wxComboBox::~wxComboBox()
     delete m_strings;
 }
 
-void wxComboBox::SetFocus()
-{
-    if ( m_hasFocus )
-    {
-        // don't do anything if we already have focus
-        return;
-    }
-
-    gtk_widget_grab_focus( m_focusWidget );
-}
-
 int wxComboBox::DoInsertItems(const wxArrayStringsAdapter & items,
                               unsigned int pos,
                               void **clientData, wxClientDataType type)
@@ -386,13 +375,24 @@ void wxComboBox::OnChar( wxKeyEvent &event )
                 eventEnter.SetInt( GetSelection() );
                 eventEnter.SetEventObject( this );
 
-                if ( GetEventHandler()->ProcessEvent(eventEnter) )
+                if ( HandleWindowEvent(eventEnter) )
                 {
                     // Catch GTK event so that GTK doesn't open the drop
                     // down list upon RETURN.
                     return;
                 }
             }
+
+            // On enter key press, we must give a signal to default control, 
+            // Otherwise, nothing happens when pressing Enter from inside a 
+            // combo box in a dialog. 
+            wxWindow *top_frame = wxGetTopLevelParent(this);
+            if( top_frame && GTK_IS_WINDOW(top_frame->m_widget) )
+            {
+                GtkWindow *window = GTK_WINDOW(top_frame->m_widget);
+                if ( window->default_widget )
+                    gtk_widget_activate( window->default_widget );
+            }
             break;
     }