From c867e0a23bb0222ee84c55be4901d9c310fef525 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Wed, 20 Dec 2017 22:33:07 -0800 Subject: [PATCH] Fix wxRadioBox non-default background with GTK+2 --- src/gtk/radiobox.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/gtk/radiobox.cpp b/src/gtk/radiobox.cpp index 4a47baaa5b..a92985a16a 100644 --- a/src/gtk/radiobox.cpp +++ b/src/gtk/radiobox.cpp @@ -183,6 +183,17 @@ static void gtk_radiobutton_size_allocate( GtkWidget *widget, } } +#ifndef __WXGTK3__ +extern "C" { +static gboolean expose_event(GtkWidget* widget, GdkEventExpose*, wxWindow*) +{ + const GtkAllocation& a = widget->allocation; + gtk_paint_flat_box(gtk_widget_get_style(widget), gtk_widget_get_window(widget), + GTK_STATE_NORMAL, GTK_SHADOW_NONE, NULL, widget, "", a.x, a.y, a.width, a.height); + return false; +} +} +#endif //----------------------------------------------------------------------------- // wxRadioBox @@ -605,6 +616,12 @@ void wxRadioBox::DoApplyWidgetStyle(GtkRcStyle *style) node = node->GetNext(); } + +#ifndef __WXGTK3__ + g_signal_handlers_disconnect_by_func(m_widget, (void*)expose_event, this); + if (m_backgroundColour.IsOk()) + g_signal_connect(m_widget, "expose-event", G_CALLBACK(expose_event), this); +#endif } bool wxRadioBox::GTKWidgetNeedsMnemonic() const