From c72b150f5d6552b577d0e1070672af41208da7b2 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Sat, 8 Jan 2000 16:53:37 +0000 Subject: [PATCH] Applied listbox isselected fix. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5308 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/listbox.cpp | 17 ++++------------- src/gtk1/listbox.cpp | 17 ++++------------- 2 files changed, 8 insertions(+), 26 deletions(-) diff --git a/src/gtk/listbox.cpp b/src/gtk/listbox.cpp index b3f0b65c4a..e03436d1fa 100644 --- a/src/gtk/listbox.cpp +++ b/src/gtk/listbox.cpp @@ -756,19 +756,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 ) diff --git a/src/gtk1/listbox.cpp b/src/gtk1/listbox.cpp index b3f0b65c4a..e03436d1fa 100644 --- a/src/gtk1/listbox.cpp +++ b/src/gtk1/listbox.cpp @@ -756,19 +756,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 )