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
This commit is contained in:
parent
8639b30da1
commit
785d8330bb
@ -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
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user