X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/937013e0fd914d4c42f9f5ec98da665986b93dfa..d155b6f47ec66e85e2d96ee22f59a885f7515b51:/src/gtk/combobox.cpp diff --git a/src/gtk/combobox.cpp b/src/gtk/combobox.cpp index d64524fbe0..0ad836e685 100644 --- a/src/gtk/combobox.cpp +++ b/src/gtk/combobox.cpp @@ -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) @@ -393,6 +382,17 @@ void wxComboBox::OnChar( wxKeyEvent &event ) 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; } @@ -493,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) @@ -536,7 +533,7 @@ void wxComboBox::OnUpdateDelete(wxUpdateUIEvent& event) void wxComboBox::OnUpdateSelectAll(wxUpdateUIEvent& event) { - event.Enable(GetLastPosition() > 0); + event.Enable(!wxTextEntry::IsEmpty()); } #endif // wxUSE_COMBOBOX