From 1ff4714de0e94507bfbca0e0f4a46907bb37f3d4 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 26 Jul 2001 09:58:19 +0000 Subject: [PATCH] respect SetFont/SetXXXColour in wxTextCtrl even when using styles git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11180 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/textctrl.cpp | 24 ++++++++++++++---------- src/gtk1/textctrl.cpp | 24 ++++++++++++++---------- 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index 57de39f9ff..23abc60f42 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -564,19 +564,21 @@ void wxTextCtrl::AppendText( const wxString &text ) { if ( !m_defaultStyle.IsDefault() ) { - GdkFont *font = m_defaultStyle.HasFont() - ? m_defaultStyle.GetFont().GetInternalFont() - : NULL; + wxFont font = m_defaultStyle.HasFont() ? m_defaultStyle.GetFont() + : m_font; + GdkFont *fnt = font.Ok() ? font.GetInternalFont() : NULL; - GdkColor *colFg = m_defaultStyle.HasTextColour() - ? m_defaultStyle.GetTextColour().GetColor() - : NULL; + wxColour col = m_defaultStyle.HasTextColour() + ? m_defaultStyle.GetTextColour() + : m_foregroundColour; + GdkColor *colFg = col.Ok() ? col.GetColor() : NULL; - GdkColor *colBg = m_defaultStyle.HasBackgroundColour() - ? m_defaultStyle.GetBackgroundColour().GetColor() - : NULL; + col = m_defaultStyle.HasBackgroundColour() + ? m_defaultStyle.GetBackgroundColour() + : m_backgroundColour; + GdkColor *colBg = col.Ok() ? col.GetColor() : NULL; - gtk_text_insert( GTK_TEXT(m_text), font, colFg, colBg, txt, txtlen ); + gtk_text_insert( GTK_TEXT(m_text), fnt, colFg, colBg, txt, txtlen ); } else // no style { @@ -1058,6 +1060,8 @@ bool wxTextCtrl::SetFont( const wxFont &font ) { m_updateFont = TRUE; + m_defaultStyle.SetFont(font); + ChangeFontGlobally(); } diff --git a/src/gtk1/textctrl.cpp b/src/gtk1/textctrl.cpp index 57de39f9ff..23abc60f42 100644 --- a/src/gtk1/textctrl.cpp +++ b/src/gtk1/textctrl.cpp @@ -564,19 +564,21 @@ void wxTextCtrl::AppendText( const wxString &text ) { if ( !m_defaultStyle.IsDefault() ) { - GdkFont *font = m_defaultStyle.HasFont() - ? m_defaultStyle.GetFont().GetInternalFont() - : NULL; + wxFont font = m_defaultStyle.HasFont() ? m_defaultStyle.GetFont() + : m_font; + GdkFont *fnt = font.Ok() ? font.GetInternalFont() : NULL; - GdkColor *colFg = m_defaultStyle.HasTextColour() - ? m_defaultStyle.GetTextColour().GetColor() - : NULL; + wxColour col = m_defaultStyle.HasTextColour() + ? m_defaultStyle.GetTextColour() + : m_foregroundColour; + GdkColor *colFg = col.Ok() ? col.GetColor() : NULL; - GdkColor *colBg = m_defaultStyle.HasBackgroundColour() - ? m_defaultStyle.GetBackgroundColour().GetColor() - : NULL; + col = m_defaultStyle.HasBackgroundColour() + ? m_defaultStyle.GetBackgroundColour() + : m_backgroundColour; + GdkColor *colBg = col.Ok() ? col.GetColor() : NULL; - gtk_text_insert( GTK_TEXT(m_text), font, colFg, colBg, txt, txtlen ); + gtk_text_insert( GTK_TEXT(m_text), fnt, colFg, colBg, txt, txtlen ); } else // no style { @@ -1058,6 +1060,8 @@ bool wxTextCtrl::SetFont( const wxFont &font ) { m_updateFont = TRUE; + m_defaultStyle.SetFont(font); + ChangeFontGlobally(); } -- 2.47.2