]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/listbox.cpp
some wxArtProv docs
[wxWidgets.git] / src / gtk / listbox.cpp
index de25cc767e69da38ed150f6a3b268457f7f4ad91..afdac346504226cb169136cc376f4a1eca99c17f 100644 (file)
 extern void wxapp_install_idle_handler();
 extern bool g_isIdle;
 
-//-------------------------------------------------------------------------
-// conditional compilation
-//-------------------------------------------------------------------------
-
-#if (GTK_MINOR_VERSION > 0)
-    #define NEW_GTK_SCROLL_CODE
-#endif
-
 //-----------------------------------------------------------------------------
 // private functions
 //-----------------------------------------------------------------------------
@@ -84,14 +76,20 @@ struct wxlistbox_idle_struct
     gint         m_tag;
 };
 
-static gint wxlistbox_idle_callback( gpointer gdata )
+extern "C" gint wxlistbox_idle_callback( gpointer gdata )
 {
     wxlistbox_idle_struct* data = (wxlistbox_idle_struct*) gdata;
     gdk_threads_enter();
 
     gtk_idle_remove( data->m_tag );
 
-    data->m_listbox->SetFirstItem( data->m_item );
+    // check that the items haven't been deleted from the listbox since we had
+    // installed this callback
+    wxListBox *lbox = data->m_listbox;
+    if ( data->m_item < lbox->GetCount() )
+    {
+        lbox->SetFirstItem( data->m_item );
+    }
 
     delete data;
 
@@ -379,11 +377,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
 
     gtk_list_set_selection_mode( GTK_LIST(m_list), mode );
 
-#ifdef NEW_GTK_SCROLL_CODE
     gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW(m_widget), GTK_WIDGET(m_list) );
-#else
-    gtk_container_add( GTK_CONTAINER(m_widget), GTK_WIDGET(m_list) );
-#endif
 
     /* make list scroll when moving the focus down using cursor keys */
     gtk_container_set_focus_vadjustment(