Box With A Point

 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
- (void)drawRect:(NSRect)frameRect {
	
    [NSGraphicsContext saveGraphicsState];
	
	NSRect frameBounds = [self bounds];
	NSRect myRect = NSMakeRect(frameBounds.origin.x +1 , frameBounds.origin.y+1, frameBounds.size.width-2, frameBounds.size.height - 20);

    NSBezierPath *path = [NSBezierPath bezierPath];
    [path setLineJoinStyle:NSRoundLineJoinStyle];
    [path appendBezierPathWithRoundedRect:myRect xRadius:6.0 yRadius:6.0];    

	[[NSColor colorFromHexRGB:@"bbbbbb"] setStroke];
	[path setLineWidth:1.0];

	[path moveToPoint:NSMakePoint((myRect.size.width / 2) + 20, myRect.size.height)];
	[path lineToPoint:NSMakePoint((myRect.size.width / 2), frameBounds.size.height - 5)];
	[path lineToPoint:NSMakePoint((myRect.size.width / 2) - 20 , myRect.size.height)];
	
	[path stroke];
	[path addClip];

	[[NSColor colorWithPatternImage:[NSImage imageNamed:@"bgpattern.png"]] set];
	[path fill];

    [NSGraphicsContext restoreGraphicsState];
}