X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/72a16063d3c25a933e2ded1c3b906d082142686f..2b2edbedb47a54bea26df1bede371bf761e3a233:/src/gtk1/combobox.cpp diff --git a/src/gtk1/combobox.cpp b/src/gtk1/combobox.cpp index 7c2a75604b..efbe51763d 100644 --- a/src/gtk1/combobox.cpp +++ b/src/gtk1/combobox.cpp @@ -12,6 +12,9 @@ #endif #include "wx/combobox.h" + +#if wxUSE_COMBOBOX + #include "wx/settings.h" #include @@ -41,7 +44,7 @@ gtk_combo_clicked_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo ) { if (g_isIdle) wxapp_install_idle_handler(); - if (!combo->HasVMT()) return; + if (!combo->m_hasVMT) return; if (g_blockEventsOnDrag) return; @@ -70,6 +73,8 @@ gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo ) { if (g_isIdle) wxapp_install_idle_handler(); + if (!combo->m_hasVMT) return; + wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() ); event.SetString( combo->GetValue() ); event.SetEventObject( combo ); @@ -99,7 +104,9 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value, PreCreation( parent, id, pos, size, style, name ); +#if wxUSE_VALIDATORS SetValidator( validator ); +#endif m_widget = gtk_combo_new(); @@ -117,6 +124,10 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value, for (int i = 0; i < n; i++) { + /* don't send first event, which GTK sends aways when + inserting the first item */ + m_alreadySent = TRUE; + GtkWidget *list_item = gtk_list_item_new_with_label( choices[i].mbc_str() ); m_clientDataList.Append( (wxObject*)NULL ); @@ -124,15 +135,13 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value, gtk_container_add( GTK_CONTAINER(list), list_item ); - gtk_widget_show( list_item ); - gtk_signal_connect( GTK_OBJECT(list_item), "select", - GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this ); - } + GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this ); - m_parent->AddChild( this ); + gtk_widget_show( list_item ); + } - (m_parent->m_insertCallback)( m_parent, this ); + m_parent->DoAddChild( this ); PostCreation(); @@ -322,7 +331,7 @@ int wxComboBox::FindString( const wxString &item ) { GtkBin *bin = GTK_BIN( child->data ); GtkLabel *label = GTK_LABEL( bin->child ); - if (item == label->label) + if (item == wxString(label->label,*wxConvCurrent)) return count; count++; child = child->next; @@ -367,7 +376,7 @@ wxString wxComboBox::GetString( int n ) const { GtkBin *bin = GTK_BIN( child->data ); GtkLabel *label = GTK_LABEL( bin->child ); - str = label->label; + str = wxString(label->label,*wxConvCurrent); } else { @@ -387,7 +396,7 @@ wxString wxComboBox::GetStringSelection() const if (selection) { GtkBin *bin = GTK_BIN( selection->data ); - wxString tmp = GTK_LABEL( bin->child )->label; + wxString tmp = wxString(GTK_LABEL( bin->child )->label,*wxConvCurrent); return tmp; } @@ -428,7 +437,7 @@ void wxComboBox::SetStringSelection( const wxString &string ) wxString wxComboBox::GetValue() const { GtkWidget *entry = GTK_COMBO(m_widget)->entry; - wxString tmp = gtk_entry_get_text( GTK_ENTRY(entry) ); + wxString tmp = wxString(gtk_entry_get_text( GTK_ENTRY(entry) ),*wxConvCurrent); return tmp; } @@ -578,7 +587,9 @@ void wxComboBox::OnChar( wxKeyEvent &event ) void wxComboBox::OnSize( wxSizeEvent &event ) { - wxControl::OnSize( event ); + event.Skip(); + + return; int w = 21; gtk_widget_set_usize( GTK_COMBO(m_widget)->entry, m_width-w-1, m_height ); @@ -619,3 +630,4 @@ bool wxComboBox::IsOwnGtkWindow( GdkWindow *window ) (window == GTK_COMBO(m_widget)->button->window ) ); } +#endif