]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/listbox.cpp
small change to avoid floating point exception in wxScrolledWindow::Scroll
[wxWidgets.git] / src / gtk / listbox.cpp
index b3f0b65c4aa276c43876470bba0d6a5d6bb9ddec..4f29dfdb2b2719133887dd22dd746d9d290a82d4 100644 (file)
 #include "wx/tooltip.h"
 #endif
 
-#include <gdk/gdk.h>
+#ifdef __VMS__
+#define gtk_scrolled_window_add_with_viewport gtk_scrolled_window_add_with_vi
+#define gtk_container_set_focus_vadjustment gtk_container_set_focus_vadjust
+#define gtk_scrolled_window_get_vadjustment gtk_scrolled_window_get_vadjust
+#endif
+# include <gdk/gdk.h>
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
 
@@ -231,7 +236,7 @@ static void gtk_listitem_select_callback( GtkWidget *WXUNUSED(widget), wxListBox
 
     if (!listbox->m_hasVMT) return;
     if (g_blockEventsOnDrag) return;
-
+    
     wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, listbox->GetId() );
     event.SetEventObject( listbox );
 
@@ -349,7 +354,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
 
     PostCreation();
 
-    SetBackgroundColour( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_WINDOW ) );
+    SetBackgroundColour( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_LISTBOX ) );
     SetForegroundColour( parent->GetForegroundColour() );
     SetFont( parent->GetFont() );
 
@@ -756,19 +761,10 @@ bool wxListBox::IsSelected( int n ) const
     wxCHECK_MSG( m_list != NULL, FALSE, wxT("invalid listbox") );
 
     GList *target = g_list_nth( m_list->children, n );
-    if (target)
-    {
-        GList *child = m_list->selection;
-        while (child)
-        {
-            if (child->data == target->data) return TRUE;
-            child = child->next;
-        }
-    }
-
-    wxFAIL_MSG(wxT("wrong listbox index"));
-
-    return FALSE;
+    
+    wxCHECK_MSG( target, FALSE, wxT("invalid listbox index") );
+    
+    return (GTK_WIDGET(target->data)->state == GTK_STATE_SELECTED) ;
 }
 
 void wxListBox::SetSelection( int n, bool select )