From 785d8330bb0f410320ea840fdc35269b9a235481 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 25 Mar 2007 01:30:46 +0000 Subject: [PATCH] respect the current default style in SetValue() (modified patch 1684613) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45048 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/textctrl.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index 7c574619e3..caa6405299 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -1003,7 +1003,13 @@ void wxTextCtrl::DoSetValue( const wxString &value, int flags ) m_modified = false; DontMarkDirtyOnNextChange(); - const wxCharBuffer buffer(wxGTK_CONV_ENC(value, GetTextEncoding())); + wxFontEncoding enc = m_defaultStyle.HasFont() + ? m_defaultStyle.GetFont().GetEncoding() + : wxFONTENCODING_SYSTEM; + if ( enc == wxFONTENCODING_SYSTEM ) + enc = GetTextEncoding(); + + const wxCharBuffer buffer(wxGTK_CONV_ENC(value, enc)); if ( !buffer ) { // see comment in WriteText() as to why we must warn the user about @@ -1024,6 +1030,14 @@ void wxTextCtrl::DoSetValue( const wxString &value, int flags ) if ( IsMultiLine() ) { gtk_text_buffer_set_text( m_buffer, buffer, strlen(buffer) ); + + if ( !m_defaultStyle.IsDefault() ) + { + GtkTextIter start, end; + gtk_text_buffer_get_bounds( m_buffer, &start, &end ); + wxGtkTextApplyTagsFromAttr(m_widget, m_buffer, m_defaultStyle, + &start, &end); + } } else // single line {