source: trunk/Cocoa/AntiRSI/AntiRSIView.m@ 572

Last change on this file since 572 was 346, checked in by Nicholas Riley, 17 years ago

Updated for 1.4njr3. Fixed whitespace for consistent 8-space tabs.

File size: 2.4 KB
Line 
1/*
2 author: Onne Gorter
3
4 This file is part of AntiRSI.
5
6 AntiRSI is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 AntiRSI is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with AntiRSI; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#import "AntiRSIView.h"
22
23@implementation AntiRSIView
24
25- (void)drawRect:(NSRect)rect
26{
27 NSColor *bgColor = [NSColor colorWithCalibratedWhite:0.0 alpha:0.90];
28 NSRect bgRect = [self frame];
29 int minX = NSMinX(bgRect);
30 int midX = NSMidX(bgRect);
31 int maxX = NSMaxX(bgRect);
32 int minY = NSMinY(bgRect);
33 int midY = NSMidY(bgRect);
34 int maxY = NSMaxY(bgRect);
35 float radius = 25.0; // correct value to duplicate Panther's App Switcher
36 NSBezierPath *bgPath = [NSBezierPath bezierPath];
37
38 /* XXX from Casey Marshall's version; does it help with the hole-in-window problem? */
39 [[NSColor clearColor] set];
40 NSRectFill(bgRect);
41 /* XXX end */
42
43 // Bottom edge and bottom-right curve
44 [bgPath moveToPoint:NSMakePoint(midX, minY)];
45 [bgPath appendBezierPathWithArcFromPoint:NSMakePoint(maxX, minY)
46 toPoint:NSMakePoint(maxX, midY)
47 radius:radius];
48
49 // Right edge and top-right curve
50 [bgPath appendBezierPathWithArcFromPoint:NSMakePoint(maxX, maxY)
51 toPoint:NSMakePoint(midX, maxY)
52 radius:radius];
53
54 // Top edge and top-left curve
55 [bgPath appendBezierPathWithArcFromPoint:NSMakePoint(minX, maxY)
56 toPoint:NSMakePoint(minX, midY)
57 radius:radius];
58
59 // Left edge and bottom-left curve
60 [bgPath appendBezierPathWithArcFromPoint:bgRect.origin
61 toPoint:NSMakePoint(midX, minY)
62 radius:radius];
63 [bgPath closePath];
64
65 [bgColor set];
66 [bgPath fill];
67}
68
69@end
Note: See TracBrowser for help on using the repository browser.