Fixing the project's missing files, and updating the background view for renaming
[ITKit.git] / ITTSWBackgroundView.m
1 #import "ITTSWBackgroundView.h"
2
3
4 @implementation ITTSWBackgroundView
5
6 - (id)initWithFrame:(NSRect)frameRect
7 {
8     if ( (self = [super initWithFrame:frameRect]) ) {
9         _path = [[NSBezierPath bezierPath] retain];
10     }
11     
12     return self;
13 }
14
15 - (void)drawRect:(NSRect)theRect
16 {
17     float vh = NSHeight(theRect);
18     float vw = NSWidth(theRect);
19     
20     NSPoint pointA = NSMakePoint( 24.0        , 0.0         );
21 //  NSPoint pointB = NSMakePoint( 0.0         , 24.0        );  reference
22     NSPoint pointC = NSMakePoint( 0.0         , (vh - 24.0) );
23 //  NSPoint pointD = NSMakePoint( 24.0        , vh          );  reference
24     NSPoint pointE = NSMakePoint( (vw - 24.0) , vh          );
25 //  NSPoint pointF = NSMakePoint( vw          , (vh - 24.0) );  reference
26     NSPoint pointG = NSMakePoint( vw          , 24.0        );
27 //  NSPoint pointH = NSMakePoint( (vw - 24.0) , 0.0         );  reference
28
29     NSPoint ctrAB  = NSMakePoint( 24.0        , 24.0        );
30     NSPoint ctrCD  = NSMakePoint( 24.0        , (vh - 24.0) );
31     NSPoint ctrEF  = NSMakePoint( (vw - 24.0) , (vh - 24.0) );
32     NSPoint ctrGH  = NSMakePoint( (vw - 24.0) , 24.0        );
33     
34     /*
35      *        D                    E
36      *      +------------------------+
37      *    C | * ctrCD        ctrEF * | F
38      *      |                        |
39      *    B | * ctrAB        ctrGH * | G
40      *      +------------------------+
41      *        A                    H
42      */
43     
44     [_path autorelease];
45     _path = [[NSBezierPath bezierPath] retain];
46
47     [_path moveToPoint:pointA];                         //  first point
48     [_path appendBezierPathWithArcWithCenter:ctrAB      //  bottom-left curve
49                                       radius:24.0
50                                   startAngle:90.0
51                                     endAngle:180.0];
52     [_path lineToPoint:pointC];                         //  left line
53     [_path appendBezierPathWithArcWithCenter:ctrCD      //  top-left curve
54                                       radius:24.0
55                                   startAngle:180.0
56                                     endAngle:270.0];
57     [_path lineToPoint:pointE];                         //  top line
58     [_path appendBezierPathWithArcWithCenter:ctrEF      //  top-right curve
59                                       radius:24.0
60                                   startAngle:270.0
61                                     endAngle:0.0];
62     [_path lineToPoint:pointG];                         //  right line
63     [_path appendBezierPathWithArcWithCenter:ctrGH      //  bottom-right curve
64                                       radius:24.0
65                                   startAngle:0.0
66                                     endAngle:90.0];
67     [_path lineToPoint:pointA];                         //  right line
68     
69     [[NSColor colorWithCalibratedWhite:0.0 alpha:0.15] set];
70     [_path fill];
71 }
72
73 - (BOOL)isOpaque
74 {
75     return NO;
76 }
77
78 @end