+#ifdef __WXGTK3__
+ if (!gtk_cairo_should_draw_window(cr, gtk_widget_get_window(widget)))
+ return false;
+
+ GtkStyleContext* sc = gtk_widget_get_style_context(widget);
+ gtk_style_context_save(sc);
+ gtk_style_context_add_class(sc, GTK_STYLE_CLASS_BUTTON);
+ gtk_render_frame(sc, cr, 0, 0, win->m_width, win->m_height);
+ gtk_style_context_restore(sc);
+
+ wxGTKCairoDC dc(cr);
+#else
+ if (!win->m_hasVMT || gdk_event->count > 0 ||
+ gdk_event->window != gtk_widget_get_window(widget))
+ {
+ return false;
+ }
+
+ gtk_paint_shadow (gtk_widget_get_style(widget),
+ gtk_widget_get_window(widget),
+ GTK_STATE_NORMAL,
+ GTK_SHADOW_OUT,
+ NULL, NULL, NULL, // FIXME: No clipping?
+ 0, 0,
+ win->m_width, win->m_height);
+
+ wxClientDC dc(win);
+
+ wxDCImpl *impl = dc.GetImpl();
+ wxClientDCImpl *gtk_impl = wxDynamicCast( impl, wxClientDCImpl );
+ gtk_impl->m_gdkwindow = gtk_widget_get_window(widget); // Hack alert
+#endif
+
+ int style = win->GetWindowStyle();
+
+#ifndef __WXGTK3__
+ if (style & wxRESIZE_BORDER)
+ {
+ dc.SetBrush( *wxGREY_BRUSH );
+ dc.SetPen( *wxTRANSPARENT_PEN );
+ dc.DrawRectangle( win->m_width - 14, win->m_height-14, 14, 14 );
+ }
+#endif
+
+ if (win->m_miniTitle && !win->GetTitle().empty())
+ {
+ dc.SetFont( *wxSMALL_FONT );
+
+ wxBrush brush( LightContrastColour( wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT) ) );
+ dc.SetBrush( brush );
+ dc.SetPen( *wxTRANSPARENT_PEN );
+ dc.DrawRectangle( win->m_miniEdge-1,
+ win->m_miniEdge-1,
+ win->m_width - (2*(win->m_miniEdge-1)),
+ 15 );
+
+ dc.SetTextForeground( *wxWHITE );
+ dc.DrawText( win->GetTitle(), 6, 4 );
+
+ if (style & wxCLOSE_BOX)
+ dc.DrawBitmap( win->m_closeButton, win->m_width-18, 3, true );
+ }
+
+ return false;
+}