diff --git a/ChangeLog b/ChangeLog index 3aa822e2f..b072780ef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2013-12-03 Fred Kiefer + + * Source/GSThemeDrawing.m (-drawScrollViewRect:inView:): Use + NSRectFill() instead of line drawing to get sharper separator + lines. + * Source/GSThemeDrawing.m (-drawScrollerRect:...): Don't fill with + window background colour. + * Source/NSScroller.m (-drawRect:): Draw only the knob slot when + disabled. + * Source/NSScroller.m (-mouseDown:): Don't handle mouse down event + when disabled. + 2013-12-02 Fred Kiefer * Source/NSScroller.m (-drawKnobSlot): Draw the slot even when the diff --git a/Source/GSThemeDrawing.m b/Source/GSThemeDrawing.m index f4b65e0ce..e3dc62836 100644 --- a/Source/GSThemeDrawing.m +++ b/Source/GSThemeDrawing.m @@ -2364,8 +2364,10 @@ typedef enum { rectForPartDecrementLine = [scroller rectForPart: NSScrollerDecrementLine]; rectForPartKnobSlot = [scroller rectForPart: NSScrollerKnobSlot]; + /* [[[view window] backgroundColor] set]; NSRectFill (rect); + */ if (NSIntersectsRect (rect, rectForPartKnobSlot) == YES) { @@ -2560,7 +2562,6 @@ typedef enum { inView: (NSView *)view { NSScrollView *scrollView = (NSScrollView *)view; - NSGraphicsContext *ctxt = GSCurrentContext(); GSTheme *theme = [GSTheme theme]; NSColor *color; NSString *name; @@ -2616,45 +2617,41 @@ typedef enum { CGFloat scrollerWidth = [NSScroller scrollerWidth]; [color set]; - DPSsetlinewidth(ctxt, 1); if ([scrollView hasVerticalScroller]) { NSInterfaceStyle style; + CGFloat xpos; style = NSInterfaceStyleForKey(@"NSScrollViewInterfaceStyle", nil); if (style == NSMacintoshInterfaceStyle || style == NSWindows95InterfaceStyle) { - DPSmoveto(ctxt, [vertScroller frame].origin.x - 1, - [vertScroller frame].origin.y - 1); + xpos = [vertScroller frame].origin.x - 1.0; } else { - DPSmoveto(ctxt, [vertScroller frame].origin.x + scrollerWidth, - [vertScroller frame].origin.y - 1); + xpos = [vertScroller frame].origin.x + scrollerWidth; } - DPSrlineto(ctxt, 0, [vertScroller frame].size.height + 1); - DPSstroke(ctxt); + NSRectFill(NSMakeRect(xpos, [vertScroller frame].origin.y - 1.0, + 1.0, [vertScroller frame].size.height + 1.0)); } if ([scrollView hasHorizontalScroller]) { - float ypos; - float scrollerY = [horizScroller frame].origin.y; + CGFloat ypos; + CGFloat scrollerY = [horizScroller frame].origin.y; if ([scrollView isFlipped]) { - ypos = scrollerY - 1; + ypos = scrollerY - 1.0; } else { - ypos = scrollerY + scrollerWidth + 1; + ypos = scrollerY + scrollerWidth + 1.0; } - - DPSmoveto(ctxt, [horizScroller frame].origin.x - 1, ypos); - DPSrlineto(ctxt, [horizScroller frame].size.width + 1, 0); - DPSstroke(ctxt); + NSRectFill(NSMakeRect([horizScroller frame].origin.x - 1.0, ypos, + [horizScroller frame].size.width + 1.0, 1.0)); } } } diff --git a/Source/NSScroller.m b/Source/NSScroller.m index a50dfcd34..6a902d41f 100644 --- a/Source/NSScroller.m +++ b/Source/NSScroller.m @@ -785,6 +785,12 @@ static float buttonsOffset = 1.0; // buttonsWidth = sw - 2*buttonsOffset - (void) mouseDown: (NSEvent*)theEvent { + if (!_scFlags.isEnabled) + { + [super mouseDown: theEvent]; + return; + } + NSPoint location = [theEvent locationInWindow]; _hitPart = [self testPart: location]; [self _setTargetAndActionToCells]; @@ -1045,10 +1051,20 @@ static float buttonsOffset = 1.0; // buttonsWidth = sw - 2*buttonsOffset */ - (void) drawRect: (NSRect)rect { - [[GSTheme theme] drawScrollerRect: rect - inView: self - hitPart: _hitPart - isHorizontal: _scFlags.isHorizontal]; + if (!_scFlags.isEnabled) + { + NSRect rect1 = NSIntersectionRect(rect, NSInsetRect(_bounds, + buttonsOffset, buttonsOffset)); + [self drawKnobSlotInRect: rect1 + highlight: NO]; + } + else + { + [[GSTheme theme] drawScrollerRect: rect + inView: self + hitPart: _hitPart + isHorizontal: _scFlags.isHorizontal]; + } } /**

(Un)Highlight the button specified by whichButton. @@ -1059,11 +1075,6 @@ static float buttonsOffset = 1.0; // buttonsWidth = sw - 2*buttonsOffset */ - (void) drawArrow: (NSScrollerArrow)whichButton highlight: (BOOL)flag { - if (!_scFlags.isEnabled) - { - return; - } - NSRect rect = [self rectForPart: (whichButton == NSScrollerIncrementArrow ? NSScrollerIncrementLine : NSScrollerDecrementLine)]; id theCell = nil;