-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathSSYMenuAddButton.m
37 lines (30 loc) · 930 Bytes
/
SSYMenuAddButton.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#import "SSYMenuAddButton.h"
#import "NSMenu+PopOntoView.h"
@implementation SSYMenuAddButton
- (void)drawRect:(NSRect)dirtyRect {
[super drawRect:dirtyRect] ;
[self lockFocus] ;
// Draw the "+"
// The y-axis seems to be flipped in here.
NSImage* image = [NSImage imageNamed:@"NSAddTemplate"] ;
[image drawInRect:NSMakeRect(8,
8,
8,
8)
fromRect:NSZeroRect
operation:NSCompositeSourceOver fraction:0.7
] ;
// Above, the size of 8x8 and fraction 0.7 matches the
// look that I get when I simply set NSAddTemplate as
// the image of the button.
// Draw the Triangle
[[NSColor colorWithCalibratedWhite:0.0 alpha:0.7] set] ;
NSBezierPath* path = [NSBezierPath bezierPath] ;
[path moveToPoint:NSMakePoint(15, 17)] ;
[path relativeLineToPoint:NSMakePoint(6, 0)] ;
[path relativeLineToPoint:NSMakePoint(-3, 3)] ;
[path closePath] ;
[path fill] ;
[self unlockFocus] ;
}
@end