From 121ac8742dc615d068edfad83b24a0bcffe46d0a Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Wed, 20 Dec 2017 22:29:21 -0800 Subject: [PATCH] Fix wxStaticBox non-default background with GTK+2 See #15466 --- src/gtk/statbox.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/gtk/statbox.cpp b/src/gtk/statbox.cpp index cfbd915fd3..71ec2c0dde 100644 --- a/src/gtk/statbox.cpp +++ b/src/gtk/statbox.cpp @@ -44,6 +44,14 @@ static void size_allocate(GtkWidget* widget, GtkAllocation* alloc, void*) gtk_widget_size_allocate(label_widget, &a); } } + +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 @@ -137,6 +145,14 @@ void wxStaticBox::SetLabel( const wxString& label ) void wxStaticBox::DoApplyWidgetStyle(GtkRcStyle *style) { GTKFrameApplyWidgetStyle(GTK_FRAME(m_widget), style); + if (m_wxwindow) + GTKApplyStyle(m_wxwindow, style); + +#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 wxStaticBox::GTKWidgetNeedsMnemonic() const