From c23acc7a91072ea6b1ba64d10ffdb75d557286d2 Mon Sep 17 00:00:00 2001 From: nico Date: Wed, 5 Dec 2001 13:01:43 +0000 Subject: [PATCH] Automatically mark the NSClipView as needing redisplay when the background color - or the drawsBackground flag - changes git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@11631 72102866-910b-0410-8b05-ffd578937521 --- Source/NSClipView.m | 47 ++++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/Source/NSClipView.m b/Source/NSClipView.m index 16753ce24..39195cc79 100644 --- a/Source/NSClipView.m +++ b/Source/NSClipView.m @@ -569,31 +569,42 @@ static inline NSRect integralRect (NSRect rect, NSView *view) - (void) setBackgroundColor: (NSColor*)aColor { - ASSIGN (_backgroundColor, aColor); - - if (_drawsBackground == NO || _backgroundColor == nil - || [_backgroundColor alphaComponent] < 1.0) + if (![_backgroundColor isEqual: aColor]) { - _isOpaque = NO; - } - else - { - _isOpaque = YES; + ASSIGN (_backgroundColor, aColor); + + [self setNeedsDisplay: YES]; + + if (_drawsBackground == NO || _backgroundColor == nil + || [_backgroundColor alphaComponent] < 1.0) + { + _isOpaque = NO; + } + else + { + _isOpaque = YES; + } } + } - (void) setDrawsBackground:(BOOL)flag { - _drawsBackground = flag; + if (_drawsBackground != flag) + { + _drawsBackground = flag; - if (_drawsBackground == NO || _backgroundColor == nil - || [_backgroundColor alphaComponent] < 1.0) - { - _isOpaque = NO; - } - else - { - _isOpaque = YES; + [self setNeedsDisplay: YES]; + + if (_drawsBackground == NO || _backgroundColor == nil + || [_backgroundColor alphaComponent] < 1.0) + { + _isOpaque = NO; + } + else + { + _isOpaque = YES; + } } }