-void wxComboBox::SetSelection( long from, long to )
-{
- GtkEntry *entry = NULL;
-#ifdef __WXGTK24__
- if (!gtk_check_version(2,4,0))
- entry = GTK_ENTRY( GTK_BIN(m_widget)->child );
- else
-#endif
- entry = GTK_ENTRY( GTK_COMBO(m_widget)->entry );
-
- gtk_editable_select_region( GTK_EDITABLE(entry), (gint)from, (gint)to );
-}
-
-void wxComboBox::GetSelection( long* from, long* to ) const
-{
- GtkEntry *entry = NULL;
-#ifdef __WXGTK24__
- if (!gtk_check_version(2,4,0))
- entry = GTK_ENTRY( GTK_BIN(m_widget)->child );
- else
-#endif
- entry = GTK_ENTRY( GTK_COMBO(m_widget)->entry );
-
- if (IsEditable())
- {
- GtkEditable *editable = GTK_EDITABLE(entry);
- gint start, end;
- gtk_editable_get_selection_bounds(editable, & start, & end);
- *from = start;
- *to = end;
- }
-}
-
-void wxComboBox::SetEditable( bool editable )
-{
- GtkEntry *entry = NULL;
-#ifdef __WXGTK24__
- if (!gtk_check_version(2,4,0))
- entry = GTK_ENTRY( GTK_BIN(m_widget)->child );
- else
-#endif
- entry = GTK_ENTRY( GTK_COMBO(m_widget)->entry );
-
- gtk_entry_set_editable( GTK_ENTRY(entry), editable );
-}
-
-void wxComboBox::OnChar( wxKeyEvent &event )
-{
- if ( event.GetKeyCode() == WXK_RETURN )
- {
- // GTK automatically selects an item if its in the list
- wxCommandEvent eventEnter(wxEVT_COMMAND_TEXT_ENTER, GetId());
- eventEnter.SetString( GetValue() );
- eventEnter.SetInt( GetSelection() );
- eventEnter.SetEventObject( this );
-
- if (!GetEventHandler()->ProcessEvent( eventEnter ))
- {
- // This will invoke the dialog default action, such
- // as the clicking the default button.
-
- wxWindow *top_frame = m_parent;
- while (top_frame->GetParent() && !(top_frame->IsTopLevel()))
- top_frame = top_frame->GetParent();
-
- 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);
- }
- }
-
- // Catch GTK event so that GTK doesn't open the drop
- // down list upon RETURN.
- return;
- }
-
- event.Skip();
-}
-
-void wxComboBox::DisableEvents()
-{
-#ifdef __WXGTK24__
- if (!gtk_check_version(2,4,0))
- {
- g_signal_handlers_disconnect_by_func (GTK_BIN(m_widget)->child,
- (gpointer)gtkcombobox_text_changed_callback, this);
-
- g_signal_handlers_disconnect_by_func (m_widget,
- (gpointer)gtkcombobox_changed_callback, this);
- }
- else
-#endif
- {
- g_signal_handlers_disconnect_by_func (GTK_COMBO(m_widget)->list,
- (gpointer) gtkcombo_combo_select_child_callback, this);
-
- g_signal_handlers_disconnect_by_func (GTK_COMBO(m_widget)->entry,
- (gpointer) gtkcombo_text_changed_callback, this);
- }
-}
-
-void wxComboBox::EnableEvents()
-{
-#ifdef __WXGTK24__
- if (!gtk_check_version(2,4,0))
- {
- g_signal_connect_after (GTK_BIN(m_widget)->child, "changed",
- G_CALLBACK (gtkcombobox_text_changed_callback), this);
-
- g_signal_connect_after (m_widget, "changed",
- G_CALLBACK (gtkcombobox_changed_callback), this);
- }
- else
-#endif
- {
- g_signal_connect_after (GTK_COMBO(m_widget)->list, "select-child",
- G_CALLBACK (gtkcombo_combo_select_child_callback),
- this);
- g_signal_connect_after (GTK_COMBO(m_widget)->entry, "changed",
- G_CALLBACK (gtkcombo_text_changed_callback),
- this );
- }
-}
-
-void wxComboBox::OnSize( wxSizeEvent &event )