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
This commit is contained in:
Vadim Zeitlin
2001-07-26 09:58:19 +00:00
parent 1f4774338e
commit 1ff4714de0
2 changed files with 28 additions and 20 deletions

View File

@@ -564,19 +564,21 @@ void wxTextCtrl::AppendText( const wxString &text )
{ {
if ( !m_defaultStyle.IsDefault() ) if ( !m_defaultStyle.IsDefault() )
{ {
GdkFont *font = m_defaultStyle.HasFont() wxFont font = m_defaultStyle.HasFont() ? m_defaultStyle.GetFont()
? m_defaultStyle.GetFont().GetInternalFont() : m_font;
: NULL; GdkFont *fnt = font.Ok() ? font.GetInternalFont() : NULL;
GdkColor *colFg = m_defaultStyle.HasTextColour() wxColour col = m_defaultStyle.HasTextColour()
? m_defaultStyle.GetTextColour().GetColor() ? m_defaultStyle.GetTextColour()
: NULL; : m_foregroundColour;
GdkColor *colFg = col.Ok() ? col.GetColor() : NULL;
GdkColor *colBg = m_defaultStyle.HasBackgroundColour() col = m_defaultStyle.HasBackgroundColour()
? m_defaultStyle.GetBackgroundColour().GetColor() ? m_defaultStyle.GetBackgroundColour()
: NULL; : 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 else // no style
{ {
@@ -1058,6 +1060,8 @@ bool wxTextCtrl::SetFont( const wxFont &font )
{ {
m_updateFont = TRUE; m_updateFont = TRUE;
m_defaultStyle.SetFont(font);
ChangeFontGlobally(); ChangeFontGlobally();
} }

View File

@@ -564,19 +564,21 @@ void wxTextCtrl::AppendText( const wxString &text )
{ {
if ( !m_defaultStyle.IsDefault() ) if ( !m_defaultStyle.IsDefault() )
{ {
GdkFont *font = m_defaultStyle.HasFont() wxFont font = m_defaultStyle.HasFont() ? m_defaultStyle.GetFont()
? m_defaultStyle.GetFont().GetInternalFont() : m_font;
: NULL; GdkFont *fnt = font.Ok() ? font.GetInternalFont() : NULL;
GdkColor *colFg = m_defaultStyle.HasTextColour() wxColour col = m_defaultStyle.HasTextColour()
? m_defaultStyle.GetTextColour().GetColor() ? m_defaultStyle.GetTextColour()
: NULL; : m_foregroundColour;
GdkColor *colFg = col.Ok() ? col.GetColor() : NULL;
GdkColor *colBg = m_defaultStyle.HasBackgroundColour() col = m_defaultStyle.HasBackgroundColour()
? m_defaultStyle.GetBackgroundColour().GetColor() ? m_defaultStyle.GetBackgroundColour()
: NULL; : 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 else // no style
{ {
@@ -1058,6 +1060,8 @@ bool wxTextCtrl::SetFont( const wxFont &font )
{ {
m_updateFont = TRUE; m_updateFont = TRUE;
m_defaultStyle.SetFont(font);
ChangeFontGlobally(); ChangeFontGlobally();
} }