X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1e8d2f694e532c2bdce5e7ecc6b3709fdf6c3d68..5a2762f083962cecf9c5f226e1ad01ab29b160a6:/src/gtk/listbox.cpp diff --git a/src/gtk/listbox.cpp b/src/gtk/listbox.cpp index b3f0b65c4a..308faa01e1 100644 --- a/src/gtk/listbox.cpp +++ b/src/gtk/listbox.cpp @@ -26,7 +26,7 @@ #include "wx/tooltip.h" #endif -#include +# include #include #include @@ -231,7 +231,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 +349,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() ); @@ -361,6 +361,8 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id, wxListBox::~wxListBox() { Clear(); + if (m_strings) + delete m_strings; } void wxListBox::DoInsertItems(const wxArrayString& items, int pos) @@ -756,19 +758,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 )