X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f5e27805de786dbb3976782ba2a3365c27256031..7b218dfaf47dc47705f6d6cba9408fa9f9cca70e:/src/gtk1/listbox.cpp diff --git a/src/gtk1/listbox.cpp b/src/gtk1/listbox.cpp index 1f71e9aad8..2793afeb92 100644 --- a/src/gtk1/listbox.cpp +++ b/src/gtk1/listbox.cpp @@ -17,6 +17,16 @@ #include "wx/utils.h" #include +//------------------------------------------------------------------------- +// conditional compilation +//------------------------------------------------------------------------- + +#if (GTK_MINOR_VERSION == 1) +#if (GTK_MICRO_VERSION >= 5) +#define NEW_GTK_SCROLL_CODE +#endif +#endif + //----------------------------------------------------------------------------- // data //----------------------------------------------------------------------------- @@ -91,7 +101,12 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id, gtk_list_set_selection_mode( GTK_LIST(m_list), mode ); +#ifdef NEW_GTK_SCROLL_CODE + gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW(m_widget), GTK_WIDGET(m_list) ); +#else gtk_container_add( GTK_CONTAINER(m_widget), GTK_WIDGET(m_list) ); +#endif + gtk_widget_show( GTK_WIDGET(m_list) ); wxSize newSize = size; @@ -163,7 +178,9 @@ void wxListBox::AppendCommon( const wxString &item ) ConnectWidget( list_item ); - ConnectDnDWidget( list_item ); +#ifndef NEW_GTK_DND_CODE + if (m_dropTarget) m_dropTarget->RegisterWidget( list_item ); +#endif } void wxListBox::Append( const wxString &item ) @@ -481,21 +498,31 @@ void wxListBox::SetDropTarget( wxDropTarget *dropTarget ) { wxCHECK_RET( m_list != NULL, "invalid listbox" ); - GList *child = m_list->children; - while (child) +#ifndef NEW_GTK_DND_CODE + if (m_dropTarget) { - DisconnectDnDWidget( GTK_WIDGET( child->data ) ); - child = child->next; + GList *child = m_list->children; + while (child) + { + m_dropTarget->UnregisterWidget( GTK_WIDGET( child->data ) ); + child = child->next; + } } +#endif + + wxWindow::SetDropTarget( dropTarget ); - wxWindow::SetDropTarget( dropTarget ); - - child = m_list->children; - while (child) +#ifndef NEW_GTK_DND_CODE + if (m_dropTarget) { - ConnectDnDWidget( GTK_WIDGET( child->data ) ); - child = child->next; + GList *child = m_list->children; + while (child) + { + m_dropTarget->RegisterWidget( GTK_WIDGET( child->data ) ); + child = child->next; + } } +#endif } GtkWidget *wxListBox::GetConnectWidget() @@ -522,10 +549,13 @@ void wxListBox::ApplyWidgetStyle() { SetWidgetStyle(); - GdkWindow *window = GTK_WIDGET(m_list)->window; - m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) ); - gdk_window_set_background( window, m_backgroundColour.GetColor() ); - gdk_window_clear( window ); + if (m_backgroundColour.Ok()) + { + GdkWindow *window = GTK_WIDGET(m_list)->window; + m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) ); + gdk_window_set_background( window, m_backgroundColour.GetColor() ); + gdk_window_clear( window ); + } GList *child = m_list->children; while (child)