]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/combobox.cpp
removed wxAcceleratorTable copy ctor docs, no port implements it
[wxWidgets.git] / src / gtk / combobox.cpp
index 1fdea4fd204e689369d8d7270c62aca6ba3e1617..0ad836e685034143b84072119c68215ce7795fc3 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 );
 }
 }
 
@@ -111,11 +111,17 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
         return false;
     }
 
-    if(HasFlag(wxCB_SORT))
+    if (HasFlag(wxCB_SORT))
         m_strings = new wxSortedArrayString();
 
     m_widget = gtk_combo_box_entry_new_text();
 
+    if (HasFlag(wxBORDER_NONE))
+    {
+        // Doesn't seem to work
+        // g_object_set (m_widget, "has-frame", FALSE, NULL);
+    }
+
     GtkEntry * const entry = GetEntry();
 
     gtk_entry_set_editable( entry, TRUE );
@@ -164,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)
@@ -380,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;
     }
 
@@ -487,15 +493,12 @@ void wxComboBox::OnRedo(wxCommandEvent& WXUNUSED(event))
 
 void wxComboBox::OnDelete(wxCommandEvent& WXUNUSED(event))
 {
-    long from, to;
-    GetSelection(& from, & to);
-    if (from != -1 && to != -1)
-        Remove(from, to);
+    RemoveSelection();
 }
 
 void wxComboBox::OnSelectAll(wxCommandEvent& WXUNUSED(event))
 {
-    SetSelection(-1, -1);
+    SelectAll();
 }
 
 void wxComboBox::OnUpdateCut(wxUpdateUIEvent& event)
@@ -530,7 +533,7 @@ void wxComboBox::OnUpdateDelete(wxUpdateUIEvent& event)
 
 void wxComboBox::OnUpdateSelectAll(wxUpdateUIEvent& event)
 {
-    event.Enable(GetLastPosition() > 0);
+    event.Enable(!wxTextEntry::IsEmpty());
 }
 
 #endif // wxUSE_COMBOBOX