* 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.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@37428 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2013-12-03 21:37:41 +00:00
parent b0bf0e98c6
commit ab576bf677
3 changed files with 45 additions and 25 deletions

View file

@ -1,3 +1,15 @@
2013-12-03 Fred Kiefer <FredKiefer@gmx.de>
* 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 <FredKiefer@gmx.de>
* Source/NSScroller.m (-drawKnobSlot): Draw the slot even when the

View file

@ -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));
}
}
}

View file

@ -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];
}
}
/**<p>(Un)Highlight the button specified by <var>whichButton</var>.
@ -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;