+ wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
+
+ GtkWidget *entry = GTK_COMBO(m_widget)->entry;
+ gtk_editable_delete_text( GTK_EDITABLE(entry), (gint)from, (gint)to );
+}
+
+void wxComboBox::SetSelection( long from, long to )
+{
+ GtkWidget *entry = GTK_COMBO(m_widget)->entry;
+ gtk_editable_select_region( GTK_EDITABLE(entry), (gint)from, (gint)to );
+}
+
+void wxComboBox::SetEditable( bool editable )
+{
+ GtkWidget *entry = GTK_COMBO(m_widget)->entry;
+ gtk_entry_set_editable( GTK_ENTRY(entry), editable );
+}
+
+void wxComboBox::OnChar( wxKeyEvent &event )
+{
+ if ( event.KeyCode() == WXK_RETURN )
+ {
+ wxString value = GetValue();
+
+ if ( Number() == 0 )
+ {
+ // make Enter generate "selected" event if there is only one item
+ // in the combobox - without it, it's impossible to select it at
+ // all!
+ wxCommandEvent event( wxEVT_COMMAND_COMBOBOX_SELECTED, GetId() );
+ event.SetInt( 0 );
+ event.SetString( value );
+ event.SetEventObject( this );
+ GetEventHandler()->ProcessEvent( event );
+ }
+ else
+ {
+ // add the item to the list if it's not there yet
+ if ( FindString(value) == wxNOT_FOUND )
+ {
+ Append(value);
+ SetStringSelection(value);
+
+ // and generate the selected event for it
+ wxCommandEvent event( wxEVT_COMMAND_COMBOBOX_SELECTED, GetId() );
+ event.SetInt( Number() - 1 );
+ event.SetString( value );
+ event.SetEventObject( this );
+ GetEventHandler()->ProcessEvent( event );
+ }
+
+ // 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);
+ return;
+ }
+ }
+
+ return;
+ }
+ }
+
+ event.Skip();
+}
+
+void wxComboBox::DisableEvents()
+{
+ GtkList *list = GTK_LIST( GTK_COMBO(m_widget)->list );
+ GList *child = list->children;
+ while (child)
+ {
+ gtk_signal_disconnect_by_func( GTK_OBJECT(child->data),
+ GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
+
+ child = child->next;
+ }
+}
+
+void wxComboBox::EnableEvents()
+{
+ GtkList *list = GTK_LIST( GTK_COMBO(m_widget)->list );
+ GList *child = list->children;
+ while (child)
+ {
+ gtk_signal_connect( GTK_OBJECT(child->data), "select",
+ GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
+
+ child = child->next;
+ }
+}
+
+void wxComboBox::OnSize( wxSizeEvent &event )
+{
+ event.Skip();
+
+#if 0
+ int w = 21;
+ gtk_widget_set_usize( GTK_COMBO(m_widget)->entry, m_width-w-1, m_height );
+
+ gtk_widget_set_uposition( GTK_COMBO(m_widget)->button, m_x+m_width-w, m_y );
+ gtk_widget_set_usize( GTK_COMBO(m_widget)->button, w, m_height );
+#endif // 0
+}
+
+void wxComboBox::ApplyWidgetStyle()
+{
+ SetWidgetStyle();
+
+// gtk_widget_set_style( GTK_COMBO(m_widget)->button, m_widgetStyle );
+ gtk_widget_set_style( GTK_COMBO(m_widget)->entry, m_widgetStyle );
+ gtk_widget_set_style( GTK_COMBO(m_widget)->list, m_widgetStyle );
+
+ GtkList *list = GTK_LIST( GTK_COMBO(m_widget)->list );
+ GList *child = list->children;
+ while (child)
+ {
+ gtk_widget_set_style( GTK_WIDGET(child->data), m_widgetStyle );
+
+ GtkBin *bin = GTK_BIN(child->data);
+ gtk_widget_set_style( bin->child, m_widgetStyle );
+
+ child = child->next;
+ }
+}
+
+GtkWidget* wxComboBox::GetConnectWidget()
+{
+ return GTK_COMBO(m_widget)->entry;
+}