Fix wxBORDER_NONE handling for wxTextCtrl under GTK+ 3
Remove the border by applying custom CSS, which seems to be the only way to do it with recent GTK+ versions. Closes https://github.com/wxWidgets/wxWidgets/pull/576
This commit is contained in:
parent
1903c9615e
commit
80e2264373
@ -167,6 +167,7 @@ All (GUI):
|
|||||||
wxGTK:
|
wxGTK:
|
||||||
|
|
||||||
- Make wxUIActionSimulator work with GTK+ 3 (Scott Talbert).
|
- Make wxUIActionSimulator work with GTK+ 3 (Scott Talbert).
|
||||||
|
- Make wxBORDER_NONE work for wxTextCtrl with GTK+ 3 (Adrien Tétar).
|
||||||
- Apply wxTextCtrl::SetDefaultStyle() to user-entered text (Andreas Falkenhahn).
|
- Apply wxTextCtrl::SetDefaultStyle() to user-entered text (Andreas Falkenhahn).
|
||||||
- Support background colour in wxDataViewCtrl attributes.
|
- Support background colour in wxDataViewCtrl attributes.
|
||||||
- Improve wxSpinCtrl best size calculation.
|
- Improve wxSpinCtrl best size calculation.
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include "wx/gtk/private.h"
|
#include "wx/gtk/private.h"
|
||||||
#include "wx/gtk/private/gtk2-compat.h"
|
#include "wx/gtk/private/gtk2-compat.h"
|
||||||
|
#include "wx/gtk/private/object.h"
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// helpers
|
// helpers
|
||||||
@ -728,7 +729,17 @@ bool wxTextCtrl::Create( wxWindow *parent,
|
|||||||
gtk_entry_get_text((GtkEntry*)m_text);
|
gtk_entry_get_text((GtkEntry*)m_text);
|
||||||
|
|
||||||
if (style & wxNO_BORDER)
|
if (style & wxNO_BORDER)
|
||||||
g_object_set (m_text, "has-frame", FALSE, NULL);
|
{
|
||||||
|
#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<GtkCssProvider> 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);
|
g_object_ref(m_widget);
|
||||||
|
Loading…
Reference in New Issue
Block a user