]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/combobox.cpp
revert nested event loop support for wxGTK1 because it causes applications hangs
[wxWidgets.git] / src / gtk1 / combobox.cpp
index 352310b904a13448755e77d42f6f11b11c3c9ed9..e21c718950cac7fd8b8c7dc1a703ac701e81f60e 100644 (file)
@@ -2,7 +2,6 @@
 // Name:        src/gtk1/combobox.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id$
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -17,7 +16,7 @@
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
     #include "wx/settings.h"
-    #include "wx/textctrl.h"    // for wxEVT_COMMAND_TEXT_UPDATED
+    #include "wx/textctrl.h"    // for wxEVT_TEXT
     #include "wx/arrstr.h"
 #endif
 
@@ -56,7 +55,7 @@ gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
 
     if (!combo->m_hasVMT) return;
 
-    wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() );
+    wxCommandEvent event( wxEVT_TEXT, combo->GetId() );
     event.SetString( combo->GetValue() );
     event.SetEventObject( combo );
     combo->HandleWindowEvent( event );
@@ -87,14 +86,14 @@ gtk_popup_hide_callback(GtkCombo *WXUNUSED(gtk_combo), wxComboBox *combo)
 
     if ( hasChanged )
     {
-        wxCommandEvent event( wxEVT_COMMAND_COMBOBOX_SELECTED, combo->GetId() );
+        wxCommandEvent event( wxEVT_COMBOBOX, combo->GetId() );
         event.SetInt( curSelection );
         event.SetString( combo->GetStringSelection() );
         event.SetEventObject( combo );
         combo->HandleWindowEvent( event );
 
         // for consistency with the other ports, send TEXT event
-        wxCommandEvent event2( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() );
+        wxCommandEvent event2( wxEVT_TEXT, combo->GetId() );
         event2.SetString( combo->GetStringSelection() );
         event2.SetEventObject( combo );
         combo->HandleWindowEvent( event2 );
@@ -150,7 +149,7 @@ gtk_combo_select_child_callback( GtkList *WXUNUSED(list), GtkWidget *WXUNUSED(wi
     // and select other items ...
     if (g_SelectionBeforePopup == wxID_NONE)
     {
-        wxCommandEvent event( wxEVT_COMMAND_COMBOBOX_SELECTED, combo->GetId() );
+        wxCommandEvent event( wxEVT_COMBOBOX, combo->GetId() );
         event.SetInt( curSelection );
         event.SetString( combo->GetStringSelection() );
         event.SetEventObject( combo );
@@ -158,7 +157,7 @@ gtk_combo_select_child_callback( GtkList *WXUNUSED(list), GtkWidget *WXUNUSED(wi
 
         // for consistency with the other ports, don't generate text update
         // events while the user is browsing the combobox neither
-        wxCommandEvent event2( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() );
+        wxCommandEvent event2( wxEVT_TEXT, combo->GetId() );
         event2.SetString( combo->GetValue() );
         event2.SetEventObject( combo );
         combo->HandleWindowEvent( event2 );
@@ -170,8 +169,6 @@ gtk_combo_select_child_callback( GtkList *WXUNUSED(list), GtkWidget *WXUNUSED(wi
 // wxComboBox
 //-----------------------------------------------------------------------------
 
-IMPLEMENT_DYNAMIC_CLASS(wxComboBox,wxControl)
-
 BEGIN_EVENT_TABLE(wxComboBox, wxControl)
     EVT_SIZE(wxComboBox::OnSize)
     EVT_CHAR(wxComboBox::OnChar)
@@ -247,8 +244,8 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
     {
         GtkWidget *list_item = gtk_list_item_new_with_label( wxGTK_CONV( choices[i] ) );
 
-        m_clientDataList.Append( (wxObject*)NULL );
-        m_clientObjectList.Append( (wxObject*)NULL );
+        m_clientDataList.Append( NULL );
+        m_clientObjectList.Append( NULL );
 
         gtk_container_add( GTK_CONTAINER(list), list_item );
 
@@ -365,9 +362,9 @@ int wxComboBox::DoInsertItems(const wxArrayStringsAdapter& items,
         gtk_widget_show( list_item );
 
         if ( m_clientDataList.GetCount() < GetCount() )
-            m_clientDataList.Insert( pos, (wxObject*) NULL );
+            m_clientDataList.Insert( pos, NULL );
         if ( m_clientObjectList.GetCount() < GetCount() )
-            m_clientObjectList.Insert( pos, (wxObject*) NULL );
+            m_clientObjectList.Insert( pos, NULL );
 
         AssignNewItemClientData(pos, clientData, i, type);
     }
@@ -435,7 +432,7 @@ void wxComboBox::DoDeleteOneItem(unsigned int n)
 
     DisableEvents();
 
-    GList *list = g_list_append( (GList*) NULL, child->data );
+    GList *list = g_list_append( NULL, child->data );
     gtk_list_remove_items( listbox, list );
     g_list_free( list );
 
@@ -596,7 +593,7 @@ void wxComboBox::SetSelection( int n )
     EnableEvents();
 }
 
-wxString wxComboBox::GetValue() const
+wxString wxComboBox::DoGetValue() const
 {
     GtkEntry *entry = GTK_ENTRY( GTK_COMBO(m_widget)->entry );
     wxString tmp( wxGTK_CONV_BACK( gtk_entry_get_text( entry ) ) );
@@ -746,7 +743,7 @@ void wxComboBox::Replace( long from, long to, const wxString& value )
 
     GtkWidget *entry = GTK_COMBO(m_widget)->entry;
     gtk_editable_delete_text( GTK_EDITABLE(entry), (gint)from, (gint)to );
-    if (value.IsNull()) return;
+    if ( value.empty() ) return;
     gint pos = (gint)to;
 
 #if wxUSE_UNICODE
@@ -784,7 +781,7 @@ 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());
+        wxCommandEvent eventEnter(wxEVT_TEXT_ENTER, GetId());
         eventEnter.SetString( GetValue() );
         eventEnter.SetInt( GetSelection() );
         eventEnter.SetEventObject( this );