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 | //This documentation comment doesn't show up. I don't know why. --boredzo |
---|
17 | /*! @enum AIDirection |
---|
18 | * @brief A gradient direction. |
---|
19 | * Can be left-to-right or bottom-to-top. |
---|
20 | */ |
---|
21 | enum AIDirection { |
---|
22 | /*! @brief Left-to-right. |
---|
23 | * The far left point in the gradient will be the first color; the far right point will be the second color. |
---|
24 | */ |
---|
25 | AIHorizontal, |
---|
26 | /*! @brief Bottom-to-top. |
---|
27 | * The bottom point in the gradient will be the first color; the top point will be the second color. |
---|
28 | */ |
---|
29 | AIVertical |
---|
30 | }; |
---|
31 | |
---|
32 | /*! @class AIGradient |
---|
33 | * @brief Cocoa wrapper around lower level (CoreGraphics) gradient drawing functions, implementing two-color linear gradients. |
---|
34 | */ |
---|
35 | @interface AIGradient : NSObject { |
---|
36 | enum AIDirection direction; |
---|
37 | NSColor *color1; |
---|
38 | NSColor *color2; |
---|
39 | } |
---|
40 | |
---|
41 | /*! |
---|
42 | * @brief Create a horizontal or vertical gradient between two colors |
---|
43 | * |
---|
44 | * @param inColor1 The starting NSColor |
---|
45 | * @param inColor2 The ending NSColor |
---|
46 | * @param inDirection The \c AIDirection for the gradient |
---|
47 | * @return An autoreleased \c AIGradient |
---|
48 | */ |
---|
49 | + (AIGradient*)gradientWithFirstColor:(NSColor*)inColor1 |
---|
50 | secondColor:(NSColor*)inColor2 |
---|
51 | direction:(enum AIDirection)inDirection; |
---|
52 | |
---|
53 | /*! |
---|
54 | * @brief Create a gradient for a selected control |
---|
55 | * |
---|
56 | * Use the system selectedControl color to create a gradient in the specified direction. This gradient is appropriate |
---|
57 | * for a Tiger-style selected highlight. |
---|
58 | * |
---|
59 | * @param inDirection The \c AIDirection for the gradient |
---|
60 | * @return An autoreleased \c AIGradient for a selected control |
---|
61 | */ |
---|
62 | + (AIGradient*)selectedControlGradientWithDirection:(enum AIDirection)inDirection; |
---|
63 | |
---|
64 | /*! |
---|
65 | * @brief Set the first (left or bottom) color. |
---|
66 | * |
---|
67 | * @param inColor The first \c NSColor. |
---|
68 | */ |
---|
69 | - (void)setFirstColor:(NSColor*)inColor; |
---|
70 | |
---|
71 | /*! |
---|
72 | * @brief Return the first (left or bottom) color. |
---|
73 | * |
---|
74 | * @result The first color. |
---|
75 | */ |
---|
76 | - (NSColor*)firstColor; |
---|
77 | |
---|
78 | /*! |
---|
79 | * @brief Set the second (right or top) color. |
---|
80 | * |
---|
81 | * @param inColor The second \c NSColor. |
---|
82 | */ |
---|
83 | - (void)setSecondColor:(NSColor*)inColor; |
---|
84 | |
---|
85 | /*! |
---|
86 | * @brief Return the second (right or top) color. |
---|
87 | * |
---|
88 | * @result The second color. |
---|
89 | */ |
---|
90 | - (NSColor*)secondColor; |
---|
91 | |
---|
92 | /*! |
---|
93 | * @brief Set the direction for the gradient. |
---|
94 | * |
---|
95 | * @param inDirection The \c AIDirection for the gradient. |
---|
96 | */ |
---|
97 | - (void)setDirection:(enum AIDirection)inDirection; |
---|
98 | |
---|
99 | /*! |
---|
100 | * @brief Return the direction for the gradient. |
---|
101 | * |
---|
102 | * @result The \c AIDirection for the gradient. |
---|
103 | */ |
---|
104 | - (enum AIDirection)direction; |
---|
105 | |
---|
106 | /*! |
---|
107 | * @brief Draw the gradient in an \c NSRect. |
---|
108 | * |
---|
109 | * @param rect The \c NSRect in which to render the gradient. |
---|
110 | */ |
---|
111 | - (void)drawInRect:(NSRect)rect; |
---|
112 | |
---|
113 | /*! @brief Draw the gradient in an \c NSBezierPath. |
---|
114 | * |
---|
115 | * The gradient will fill the specified path according to the path's winding rule, transformation matrix, and so on. |
---|
116 | * |
---|
117 | * @param inPath The \c NSBezierPath in which to render to gradient. |
---|
118 | */ |
---|
119 | - (void)drawInBezierPath:(NSBezierPath *)inPath; |
---|
120 | |
---|
121 | @end |
---|