]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/listbox.cpp
Fix compilation with MinGW -std=c++11 option.
[wxWidgets.git] / src / gtk / listbox.cpp
index 52e14405a153a59cf085725a6fec103a675debfb..6cdf71a549755354d7520cda572ee79c64a516a9 100644 (file)
     #include "wx/arrstr.h"
 #endif
 
-#include "wx/gtk/private.h"
-#include "wx/gtk/private/object.h"
-#include "wx/gtk/treeentry_gtk.h"
-
 #if wxUSE_TOOLTIPS
     #include "wx/tooltip.h"
 #endif
 
 #include <gtk/gtk.h>
+#include "wx/gtk/private.h"
+#include "wx/gtk/private/gtk2-compat.h"
+#include "wx/gtk/private/object.h"
+#include "wx/gtk/treeentry_gtk.h"
 
 #include <gdk/gdkkeysyms.h>
-#if GTK_CHECK_VERSION(3,0,0)
+#ifdef __WXGTK3__
 #include <gdk/gdkkeysyms-compat.h>
 #endif
 
@@ -404,7 +404,13 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
 
 wxListBox::~wxListBox()
 {
-    m_hasVMT = false;
+    if (m_treeview)
+    {
+        GTKDisconnect(m_treeview);
+        GtkTreeSelection* selection = gtk_tree_view_get_selection(m_treeview);
+        if (selection)
+            GTKDisconnect(selection);
+    }
 
     Clear();
 }
@@ -497,6 +503,8 @@ void wxListBox::DoClear()
     gtk_list_store_clear( m_liststore ); /* well, THAT was easy :) */
 
     GTKEnableEvents();
+
+    UpdateOldSelections();
 }
 
 void wxListBox::DoDeleteOneItem(unsigned int n)
@@ -727,7 +735,7 @@ bool wxListBox::IsSelected( int n ) const
     GtkTreeIter iter;
     wxCHECK_MSG( GTKGetIteratorFor(n, &iter), false, wxT("Invalid index") );
 
-    return gtk_tree_selection_iter_is_selected(selection, &iter);
+    return gtk_tree_selection_iter_is_selected(selection, &iter) != 0;
 }
 
 void wxListBox::DoSetSelection( int n, bool select )
@@ -773,7 +781,7 @@ void wxListBox::DoScrollToCell(int n, float alignY, float alignX)
     wxCHECK_RET( IsValid(n), wxT("invalid index"));
 
     //RN: I have no idea why this line is needed...
-    if (gdk_pointer_is_grabbed () && gtk_widget_has_grab(GTK_WIDGET(m_treeview)))
+    if (gtk_widget_has_grab(GTK_WIDGET(m_treeview)))
         return;
 
     GtkTreeIter iter;
@@ -814,7 +822,7 @@ int wxListBox::DoListHitTest(const wxPoint& point) const
     // need to translate from master window since it is in client coords
     gint binx, biny;
     gdk_window_get_geometry(gtk_tree_view_get_bin_window(m_treeview),
-                            &binx, &biny, NULL, NULL, NULL);
+                            &binx, &biny, NULL, NULL);
 
     GtkTreePath* path;
     if ( !gtk_tree_view_get_path_at_pos
@@ -855,6 +863,9 @@ GdkWindow *wxListBox::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const
 
 void wxListBox::DoApplyWidgetStyle(GtkRcStyle *style)
 {
+#ifdef __WXGTK3__
+    // don't know if this is even necessary, or how to do it
+#else
     if (m_hasBgCol && m_backgroundColour.IsOk())
     {
         GdkWindow *window = gtk_tree_view_get_bin_window(m_treeview);
@@ -865,8 +876,9 @@ void wxListBox::DoApplyWidgetStyle(GtkRcStyle *style)
             gdk_window_clear( window );
         }
     }
+#endif
 
-    gtk_widget_modify_style( GTK_WIDGET(m_treeview), style );
+    GTKApplyStyle(GTK_WIDGET(m_treeview), style);
 }
 
 wxSize wxListBox::DoGetBestSize() const
@@ -919,7 +931,7 @@ wxSize wxListBox::DoGetBestSize() const
 wxVisualAttributes
 wxListBox::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
 {
-    return GetDefaultAttributesFromGTKWidget(gtk_tree_view_new, true);
+    return GetDefaultAttributesFromGTKWidget(gtk_tree_view_new(), true);
 }
 
 #endif // wxUSE_LISTBOX