summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXScrlbr.c
diff options
context:
space:
mode:
authorKevin Walzer <kw@codebykevin.com>2014-12-24 07:13:08 (GMT)
committerKevin Walzer <kw@codebykevin.com>2014-12-24 07:13:08 (GMT)
commit25af82850347b3fec95a0c04c3277942f41db2c5 (patch)
tree2ee09a3ba19356ffa7761ef39f46f0714491fc41 /macosx/tkMacOSXScrlbr.c
parentdf487fa7f2296cda3e3bd23546b545ca6ecd3751 (diff)
downloadtk-25af82850347b3fec95a0c04c3277942f41db2c5.zip
tk-25af82850347b3fec95a0c04c3277942f41db2c5.tar.gz
tk-25af82850347b3fec95a0c04c3277942f41db2c5.tar.bz2
Refinement of custom scrollbars on Tk-Cocoa; now more centered, virtually identical to scrollbars in Safari, etc.
Diffstat (limited to 'macosx/tkMacOSXScrlbr.c')
-rw-r--r--macosx/tkMacOSXScrlbr.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/macosx/tkMacOSXScrlbr.c b/macosx/tkMacOSXScrlbr.c
index bd05df8..6b4d1ff 100644
--- a/macosx/tkMacOSXScrlbr.c
+++ b/macosx/tkMacOSXScrlbr.c
@@ -39,6 +39,7 @@ NSRect TkMacOSXGetScrollFrame(TkScrollbar *scrlPtr);
* graphical-glitches-lag. Only supported on 10.7 and above.
*/
+
@interface TkNSScroller: NSScroller
-(void) drawRect:(NSRect)dirtyRect;
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
@@ -91,7 +92,7 @@ NSRect TkMacOSXGetScrollFrame(TkScrollbar *scrlPtr);
}
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
-- (BOOL)isHorizontal {
+- (BOOL)isVertical {
NSRect bounds = [self bounds];
return NSWidth(bounds) < NSHeight (bounds);
}
@@ -101,18 +102,18 @@ NSRect TkMacOSXGetScrollFrame(TkScrollbar *scrlPtr);
{
NSRect knobRect = [self rectForPart:NSScrollerKnob];
- if ([self isHorizontal]) {
- NSRect newRect = NSMakeRect(knobRect.origin.x, knobRect.origin.y, knobRect.size.width - 5, knobRect.size.height);
- NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:newRect xRadius:7 yRadius:7];
+ if ([self isVertical]) {
+ NSRect newRect = NSMakeRect(knobRect.origin.x + 3, knobRect.origin.y, knobRect.size.width - 6, knobRect.size.height);
+ NSBezierPath *scrollerPath = [NSBezierPath bezierPathWithRoundedRect:newRect xRadius:4 yRadius:4];
[[NSColor lightGrayColor] set];
- [path fill];
+ [scrollerPath fill];
} else {
- NSRect newRect = NSMakeRect(knobRect.origin.x, knobRect.origin.y, knobRect.size.width, knobRect.size.height - 5);
- NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:newRect xRadius:7 yRadius:7];
+ NSRect newRect = NSMakeRect(knobRect.origin.x, knobRect.origin.y + 3, knobRect.size.width, knobRect.size.height - 6);
+ NSBezierPath *scrollerPath = [NSBezierPath bezierPathWithRoundedRect:newRect xRadius:4 yRadius:4];
[[NSColor lightGrayColor] set];
- [path fill];
+ [scrollerPath fill];
}
}
@@ -124,8 +125,9 @@ NSRect TkMacOSXGetScrollFrame(TkScrollbar *scrlPtr);
- (void)drawKnobSlotInRect:(NSRect)rect highlight:(BOOL)highlight
{
-
+
}
+
#endif
@end