X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/00d45d0452b1305999deb02e7bdeed663f647a9c..3503581b33fe1294ab45cbd762e09a655fabd81e:/src/gtk/listbox.cpp diff --git a/src/gtk/listbox.cpp b/src/gtk/listbox.cpp index fb70b0c0c7..621f0199c9 100644 --- a/src/gtk/listbox.cpp +++ b/src/gtk/listbox.cpp @@ -34,7 +34,11 @@ #endif #include + #include +#if GTK_CHECK_VERSION(3,0,0) +#include +#endif //----------------------------------------------------------------------------- // data @@ -206,7 +210,7 @@ static gint gtk_listbox_sort_callback(GtkTreeModel * WXUNUSED(model), wxCHECK_MSG(entry2, 0, wxT("Could not get second entry")); //We compare collate keys here instead of calling g_utf8_collate - //as it is rather slow (and even the docs reccommend this) + //as it is rather slow (and even the docs recommend this) return strcmp(gtk_tree_entry_get_collate_key(entry1), gtk_tree_entry_get_collate_key(entry2)) >= 0; } @@ -237,8 +241,6 @@ static gboolean gtk_listbox_searchequal_callback(GtkTreeModel * WXUNUSED(model), // wxListBox //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControlWithItems) - // ---------------------------------------------------------------------------- // construction // ---------------------------------------------------------------------------- @@ -431,7 +433,7 @@ void wxListBox::Update() wxWindow::Update(); if (m_treeview) - gdk_window_process_updates(GTK_WIDGET(m_treeview)->window, TRUE); + gdk_window_process_updates(gtk_widget_get_window(GTK_WIDGET(m_treeview)), true); } // ---------------------------------------------------------------------------- @@ -495,6 +497,8 @@ void wxListBox::DoClear() gtk_list_store_clear( m_liststore ); /* well, THAT was easy :) */ GTKEnableEvents(); + + UpdateOldSelections(); } void wxListBox::DoDeleteOneItem(unsigned int n) @@ -580,9 +584,6 @@ void wxListBox::GTKSetItem(GtkTreeIter& iter, const GtkTreeEntry *entry) void* wxListBox::DoGetItemClientData(unsigned int n) const { - wxCHECK_MSG( IsValid(n), NULL, - wxT("Invalid index passed to GetItemClientData") ); - wxGtkObject entry(GTKGetEntry(n)); wxCHECK_MSG(entry, NULL, wxT("could not get entry")); @@ -591,9 +592,6 @@ void* wxListBox::DoGetItemClientData(unsigned int n) const void wxListBox::DoSetItemClientData(unsigned int n, void* clientData) { - wxCHECK_RET( IsValid(n), - wxT("Invalid index passed to SetItemClientData") ); - wxGtkObject entry(GTKGetEntry(n)); wxCHECK_RET(entry, wxT("could not get entry")); @@ -731,7 +729,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 ) @@ -777,7 +775,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 (m_treeview)) + if (gdk_pointer_is_grabbed () && gtk_widget_has_grab(GTK_WIDGET(m_treeview))) return; GtkTreeIter iter; @@ -845,14 +843,6 @@ int wxListBox::DoListHitTest(const wxPoint& point) const // helpers // ---------------------------------------------------------------------------- -#if wxUSE_TOOLTIPS -void wxListBox::GTKApplyToolTip( GtkTooltips *tips, const gchar *tip ) -{ - // RN: Is this needed anymore? - gtk_tooltips_set_tip( tips, GTK_WIDGET( m_treeview ), tip, NULL ); -} -#endif // wxUSE_TOOLTIPS - GtkWidget *wxListBox::GetConnectWidget() { // the correct widget for listbox events (such as mouse clicks for example) @@ -867,7 +857,7 @@ GdkWindow *wxListBox::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const void wxListBox::DoApplyWidgetStyle(GtkRcStyle *style) { - if (m_hasBgCol && m_backgroundColour.Ok()) + if (m_hasBgCol && m_backgroundColour.IsOk()) { GdkWindow *window = gtk_tree_view_get_bin_window(m_treeview); if (window)