From 215a6ee238fdc0bafab79aab0a529aea8e6bba08 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Thu, 9 Apr 2020 22:50:19 +0200 Subject: [PATCH] Implement wxBU_EXACTFIT style for wxButton under wxGTK3 GtkButton without inner border is just as big as its contents. --- src/gtk/button.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gtk/button.cpp b/src/gtk/button.cpp index 71e4bd52f9..efbd1e1e61 100644 --- a/src/gtk/button.cpp +++ b/src/gtk/button.cpp @@ -135,6 +135,11 @@ bool wxButton::Create(wxWindow *parent, if (style & wxNO_BORDER) gtk_button_set_relief( GTK_BUTTON(m_widget), GTK_RELIEF_NONE ); +#ifdef __WXGTK3__ + if ( useLabel && (style & wxBU_EXACTFIT) ) + GTKApplyCssStyle("* { padding:0 }"); +#endif // __WXGTK3__ + g_signal_connect_after (m_widget, "clicked", G_CALLBACK (wxgtk_button_clicked_callback), this); @@ -365,5 +370,4 @@ wxButton::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) { return GetDefaultAttributesFromGTKWidget(gtk_button_new()); } - #endif // wxUSE_BUTTON