diff --git a/include/wx/gtk/window.h b/include/wx/gtk/window.h index 0de679577a..e4041d9a3b 100644 --- a/include/wx/gtk/window.h +++ b/include/wx/gtk/window.h @@ -412,7 +412,8 @@ protected: #ifdef __WXGTK3__ // Use the given CSS string for styling the widget. The provider must be // allocated, and remains owned, by the caller. - void ApplyCssStyle(GtkCssProvider* provider, const char* style); + void GTKApplyCssStyle(GtkCssProvider* provider, const char* style); + void GTKApplyCssStyle(const char* style); #else // GTK+ < 3 // Called by ApplyWidgetStyle (which is called by SetFont() and // SetXXXColour etc to apply style changed to native widgets) to create diff --git a/samples/widgets/button.cpp b/samples/widgets/button.cpp index 178fefb2d8..6f2dc125af 100644 --- a/samples/widgets/button.cpp +++ b/samples/widgets/button.cpp @@ -457,7 +457,8 @@ void ButtonWidgetsPage::CreateButton() if ( m_chkUseBitmapClass->GetValue() ) { bbtn = new wxBitmapButton(this, ButtonPage_Button, - CreateBitmap(wxT("normal"))); + CreateBitmap(wxT("normal")), + wxDefaultPosition, wxDefaultSize, flags); } else { diff --git a/src/gtk/control.cpp b/src/gtk/control.cpp index aff328a980..2d91017fab 100644 --- a/src/gtk/control.cpp +++ b/src/gtk/control.cpp @@ -97,6 +97,11 @@ void wxControl::PostCreation(const wxSize& size) { wxWindow::PostCreation(); +#ifdef __WXGTK3__ + if (HasFlag(wxNO_BORDER)) + GTKApplyCssStyle("*{ border:none; border-radius:0; padding:0 }"); +#endif + #ifndef __WXGTK3__ // NB: GetBestSize needs to know the style, otherwise it will assume // default font and if the user uses a different font, determined diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index 4aa72d774f..cd685f27ff 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -32,7 +32,6 @@ #include #include "wx/gtk/private.h" #include "wx/gtk/private/gtk2-compat.h" -#include "wx/gtk/private/object.h" // ---------------------------------------------------------------------------- // helpers @@ -728,18 +727,10 @@ bool wxTextCtrl::Create( wxWindow *parent, // new, empty control, see https://trac.wxwidgets.org/ticket/11409 gtk_entry_get_text((GtkEntry*)m_text); +#ifndef __WXGTK3__ if (style & wxNO_BORDER) - { -#ifdef __WXGTK3__ - // this is sort of a workaround for when the builtin theme - // won't remove the frame by itself -- see - // https://bugzilla.gnome.org/show_bug.cgi?id=789732#c1 - wxGtkObject provider(gtk_css_provider_new()); - ApplyCssStyle(provider, "* { border: none; border-radius: 0; padding: 0 }"); -#else gtk_entry_set_has_frame((GtkEntry*)m_text, FALSE); #endif - } } g_object_ref(m_widget); diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 659a455f55..bcf04ba8ad 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -4476,7 +4476,7 @@ PangoContext *wxWindowGTK::GTKGetPangoDefaultContext() } #ifdef __WXGTK3__ -void wxWindowGTK::ApplyCssStyle(GtkCssProvider* provider, const char* style) +void wxWindowGTK::GTKApplyCssStyle(GtkCssProvider* provider, const char* style) { wxCHECK_RET(m_widget, "invalid window"); @@ -4489,6 +4489,13 @@ void wxWindowGTK::ApplyCssStyle(GtkCssProvider* provider, const char* style) GTK_STYLE_PROVIDER(provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); } + +void wxWindowGTK::GTKApplyCssStyle(const char* style) +{ + GtkCssProvider* provider = gtk_css_provider_new(); + GTKApplyCssStyle(provider, style); + g_object_unref(provider); +} #else // GTK+ < 3 GtkRcStyle* wxWindowGTK::GTKCreateWidgetStyle() {