From dfc9124f0835ff8aab3aef4fc66a83f36f5e85b7 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 4 Nov 2012 23:52:43 +0000 Subject: [PATCH] No changes, just remove unnecessary wxTextAttr tests. If wxTextAttr::HasFoo() returns true, there is no need to test for GetFoo().IsOk(). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72891 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/osx/cocoa/textctrl.mm | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/osx/cocoa/textctrl.mm b/src/osx/cocoa/textctrl.mm index fd54310108..e68590a4db 100644 --- a/src/osx/cocoa/textctrl.mm +++ b/src/osx/cocoa/textctrl.mm @@ -694,18 +694,14 @@ void wxNSTextViewControl::SetStyle(long start, range = [m_textView selectedRange]; NSTextStorage* storage = [m_textView textStorage]; + if ( style.HasFont() ) + [storage addAttribute:NSFontAttributeName value:style.GetFont().OSXGetNSFont() range:range]; + + if ( style.HasBackgroundColour() ) + [storage addAttribute:NSBackgroundColorAttributeName value:style.GetBackgroundColour().OSXGetNSColor() range:range]; - wxFont font = style.GetFont(); - if (style.HasFont() && font.IsOk()) - [storage addAttribute:NSFontAttributeName value:font.OSXGetNSFont() range:range]; - - wxColour bgcolor = style.GetBackgroundColour(); - if (style.HasBackgroundColour() && bgcolor.IsOk()) - [storage addAttribute:NSBackgroundColorAttributeName value:bgcolor.OSXGetNSColor() range:range]; - - wxColour fgcolor = style.GetTextColour(); - if (style.HasTextColour() && fgcolor.IsOk()) - [storage addAttribute:NSForegroundColorAttributeName value:fgcolor.OSXGetNSColor() range:range]; + if ( style.HasTextColour() ) + [storage addAttribute:NSForegroundColorAttributeName value:style.GetTextColour().OSXGetNSColor() range:range]; } } -- 2.45.2