]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/listbox.cpp
Check accelerators before sending EVT_CHAR
[wxWidgets.git] / src / gtk / listbox.cpp
index d8810ddae08a9a1170624ff9a3d1f597483d0dd9..5ad87b3027680ead6de8762350e56ca8c2d025fa 100644 (file)
@@ -194,7 +194,7 @@ gtk_listbox_button_release_callback( GtkWidget * WXUNUSED(widget),
         n = -1;
     }
 
-    event.m_commandInt = n;
+    event.SetInt(n);
 
     listbox->GetEventHandler()->ProcessEvent( event );
 
@@ -320,7 +320,7 @@ gtk_listbox_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxLis
             {
                 n = -1;
             }
-            new_event.m_commandInt = n;
+            new_event.SetInt(n);
             listbox->GetEventHandler()->ProcessEvent( new_event );
         }
     }
@@ -393,7 +393,7 @@ static void gtk_listitem_select_cb( GtkWidget *widget,
         n = -1;
     }
 
-    event.m_commandInt = n;
+    event.SetInt(n);
 
 //    No longer required with new code in wxLB_SINGLE
 //    listbox->GetEventHandler()->AddPendingEvent( event );
@@ -404,6 +404,23 @@ static void gtk_listitem_select_cb( GtkWidget *widget,
 // wxListBox
 //-----------------------------------------------------------------------------
 
+static gint
+gtk_listbox_realized_callback( GtkWidget *m_widget, wxListBox *win )
+{
+    if (g_isIdle)
+        wxapp_install_idle_handler();
+        
+    GList *child = win->m_list->children;
+    for (child = win->m_list->children; child != NULL; child = child->next)
+        gtk_widget_show( GTK_WIDGET(child->data) );
+    
+    return false;
+}
+
+//-----------------------------------------------------------------------------
+// wxListBox
+//-----------------------------------------------------------------------------
+
 IMPLEMENT_DYNAMIC_CLASS(wxListBox,wxControl)
 
 // ----------------------------------------------------------------------------
@@ -490,6 +507,9 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
 
     gtk_widget_show( GTK_WIDGET(m_list) );
 
+    gtk_signal_connect( GTK_OBJECT(m_list), "realize",
+                        GTK_SIGNAL_FUNC(gtk_listbox_realized_callback), (gpointer) this );
+                            
     if ( style & wxLB_SORT )
     {
         // this will change DoAppend() behaviour
@@ -649,11 +669,11 @@ void wxListBox::GtkAddItem( const wxString &item, int pos )
     else
         gtk_list_insert_items( GTK_LIST (m_list), gitem_list, pos );
 
-    gtk_signal_connect( GTK_OBJECT(list_item), "select",
+    gtk_signal_connect_after( GTK_OBJECT(list_item), "select",
       GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
 
     if (HasFlag(wxLB_MULTIPLE) || HasFlag(wxLB_EXTENDED))
-        gtk_signal_connect( GTK_OBJECT(list_item), "deselect",
+        gtk_signal_connect_after( GTK_OBJECT(list_item), "deselect",
           GTK_SIGNAL_FUNC(gtk_listitem_deselect_callback), (gpointer)this );
 
     gtk_signal_connect( GTK_OBJECT(list_item),
@@ -678,13 +698,12 @@ void wxListBox::GtkAddItem( const wxString &item, int pos )
     gtk_signal_connect( GTK_OBJECT(list_item), "focus_out_event",
             GTK_SIGNAL_FUNC(gtk_listitem_focus_out_callback), (gpointer)this );
 
-
     ConnectWidget( list_item );
 
-    gtk_widget_show( list_item );
-
     if (GTK_WIDGET_REALIZED(m_widget))
     {
+        gtk_widget_show( list_item );
+        
         gtk_widget_realize( list_item );
         gtk_widget_realize( GTK_BIN(list_item)->child );