1 | /*-------------------------------------------------------------------------------------------------------*\ |
---|
2 | | Adium, Copyright (C) 2001-2005, Adam Iser (adamiser@mac.com | http://www.adiumx.com) | |
---|
3 | \---------------------------------------------------------------------------------------------------------/ |
---|
4 | | This program is free software; you can redistribute it and/or modify it under the terms of the GNU |
---|
5 | | General Public License as published by the Free Software Foundation; either version 2 of the License, |
---|
6 | | or (at your option) any later version. |
---|
7 | | |
---|
8 | | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even |
---|
9 | | the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
---|
10 | | Public License for more details. |
---|
11 | | |
---|
12 | | You should have received a copy of the GNU General Public License along with this program; if not, |
---|
13 | | write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
14 | \------------------------------------------------------------------------------------------------------ */ |
---|
15 | |
---|
16 | // |
---|
17 | // BZBezierPathAdditions.h |
---|
18 | // Adium |
---|
19 | // |
---|
20 | // Created by Mac-arena the Bored Zo and Chris Serino. |
---|
21 | |
---|
22 | @interface NSBezierPath (AIBezierPathAdditions) |
---|
23 | |
---|
24 | #pragma mark Rounded rectangles |
---|
25 | |
---|
26 | + (NSBezierPath *)bezierPathWithRoundedRect:(NSRect)rect radius:(float)radius; |
---|
27 | + (NSBezierPath *)bezierPathRoundedRectOfSize:(NSSize)backgroundSize; |
---|
28 | + (NSBezierPath *)bezierPathWithRoundedRect:(NSRect)bounds; |
---|
29 | + (NSBezierPath *)bezierPathWithRoundedTopCorners:(NSRect)rect radius:(float)radius; |
---|
30 | + (NSBezierPath *)bezierPathWithRoundedBottomCorners:(NSRect)rect radius:(float)radius; |
---|
31 | |
---|
32 | #pragma mark Arrows |
---|
33 | |
---|
34 | /* default metrics of the arrow (as returned by +bezierPathWithArrow): |
---|
35 | * ^ |
---|
36 | * / \ |
---|
37 | * / \ |
---|
38 | * /_ _\ ___ |
---|
39 | * | | | shaft length multiplier: |
---|
40 | * | | | 1.0 |
---|
41 | * | | | equals shaft length: |
---|
42 | * |_| _|_0.5 |
---|
43 | * |
---|
44 | * default shaft width: 1/3 |
---|
45 | * the bounds of this arrow are { { 0, 0 }, { 1, 1 } }. |
---|
46 | * |
---|
47 | * the other three methods allow you to override either or both of these metrics. |
---|
48 | */ |
---|
49 | + (NSBezierPath *)bezierPathWithArrowWithShaftLengthMultiplier:(float)shaftLengthMulti shaftWidth:(float)shaftWidth; |
---|
50 | + (NSBezierPath *)bezierPathWithArrowWithShaftLengthMultiplier:(float)shaftLengthMulti; |
---|
51 | + (NSBezierPath *)bezierPathWithArrowWithShaftWidth:(float)shaftWidth; |
---|
52 | + (NSBezierPath *)bezierPathWithArrow; |
---|
53 | |
---|
54 | #pragma mark Nifty things |
---|
55 | |
---|
56 | //these three are in-place. they return self, so that you can do e.g. [[NSBezierPath bezierPathWithArrow] flipVertically]. |
---|
57 | - (NSBezierPath *)flipHorizontally; |
---|
58 | - (NSBezierPath *)flipVertically; |
---|
59 | - (NSBezierPath *)scaleToSize:(NSSize)newSize; |
---|
60 | |
---|
61 | //these three return an autoreleased copy. |
---|
62 | - (NSBezierPath *)bezierPathByFlippingHorizontally; |
---|
63 | - (NSBezierPath *)bezierPathByFlippingVertically; |
---|
64 | - (NSBezierPath *)bezierPathByScalingToSize:(NSSize)newSize; |
---|
65 | |
---|
66 | @end |
---|