|
1 /* |
|
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Border brush definition |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef C_ALFBORDERBRUSH_H |
|
21 #define C_ALFBORDERBRUSH_H |
|
22 |
|
23 #include <alf/alfbrush.h> |
|
24 |
|
25 class CAlfEnv; |
|
26 class TRgb; |
|
27 class TAlfImage; |
|
28 struct TAlfXYMetric; |
|
29 |
|
30 /** |
|
31 * Border brush draws borders for visuals. |
|
32 * Border brush draws a border at a configurable distance. It can be inside |
|
33 * or outside the visual edges. The horizontal and vertical edges can be |
|
34 * configured separately. The border can either be a solid color or |
|
35 * texture-mapped. A texture offset is supported for animated texture mapping. |
|
36 * |
|
37 * Usage: |
|
38 * @code |
|
39 * |
|
40 * // Creates a 2-unit pixel-border brush and adds it to a visual. |
|
41 * CAlfBorderBrush* borderBrush = CAlfBorderBrush::NewL( *iEnv, TAlfXYMetric(TAlfMetric(2)), |
|
42 * TAlfXYMetric(TAlfMetric(2, EAlfUnitPixel), |
|
43 * TAlfMetric(2, EAlfUnitPixel))); |
|
44 * //Enable brush |
|
45 * visualWithBorders->EnableBrushesL(); |
|
46 * |
|
47 * //Add border brush in brush array, with ownership trnasfered to brush array |
|
48 * visualWithBorders->Brushes()->AppendL( borderBrush, EAlfHasOwnership ); |
|
49 * |
|
50 * //Cleanup |
|
51 * borderBrush = 0; // ownership transferred to the brush array |
|
52 * |
|
53 * @endcode |
|
54 * @lib alfclient.lib |
|
55 * @since S60 v3.2 |
|
56 */ |
|
57 NONSHARABLE_CLASS( CAlfBorderBrush ) : public CAlfBrush |
|
58 { |
|
59 |
|
60 public: |
|
61 |
|
62 /** |
|
63 * Constructor. |
|
64 * @param aEnv Environment |
|
65 * @param aThickness Border width in specified metric units. |
|
66 * @param aEdgeOffset Border edge offset in specified metric units. |
|
67 * |
|
68 */ |
|
69 IMPORT_C static CAlfBorderBrush* NewL( |
|
70 CAlfEnv& aEnv, |
|
71 const TAlfXYMetric& aThickness, |
|
72 const TAlfXYMetric& aEdgeOffset); |
|
73 |
|
74 /** |
|
75 * Constructor. The new brush is left on the cleanup stack. |
|
76 * @param aEnv Environment |
|
77 * @param aThickness Border width in specified metric units. |
|
78 * @param aEdgeOffset Border edge offset in specified metric units. |
|
79 */ |
|
80 IMPORT_C static CAlfBorderBrush* NewLC( |
|
81 CAlfEnv& aEnv, |
|
82 const TAlfXYMetric& aThickness, |
|
83 const TAlfXYMetric& aEdgeOffset); |
|
84 |
|
85 /** |
|
86 * Constructor. |
|
87 * @deprecated |
|
88 * @param aEnv Environment |
|
89 * @param aThicknessWidth Border width in pixels. |
|
90 * @param aThicknessHeight Border height in pixels. |
|
91 * @param aEdgeOffsetX Edge offset X coordinate in pixels |
|
92 * @param aEdgeOffsetY Edge offset Y coordinate in pixels |
|
93 * |
|
94 */ |
|
95 IMPORT_C static CAlfBorderBrush* NewL( |
|
96 CAlfEnv& aEnv, |
|
97 TInt aThicknessWidth, |
|
98 TInt aThicknessHeight, |
|
99 TInt aEdgeOffsetX, |
|
100 TInt aEdgeOffsetY ); |
|
101 |
|
102 /** |
|
103 * Constructor. The new brush is left on the cleanup stack. |
|
104 * @deprecated |
|
105 * @param aEnv Environment |
|
106 * @param aThicknessWidth Border width in pixels. |
|
107 * @param aThicknessHeight Border height in pixels. |
|
108 * @param aEdgeOffsetX Edge offset X coordinate in pixels |
|
109 * @param aEdgeOffsetY Edge offset Y coordinate in pixels |
|
110 */ |
|
111 IMPORT_C static CAlfBorderBrush* NewLC( |
|
112 CAlfEnv& aEnv, |
|
113 TInt aThicknessWidth, |
|
114 TInt aThicknessHeight, |
|
115 TInt aEdgeOffsetX, |
|
116 TInt aEdgeOffsetY ); |
|
117 |
|
118 /** |
|
119 * Destructor. |
|
120 */ |
|
121 virtual ~CAlfBorderBrush(); |
|
122 |
|
123 /** |
|
124 * Sets an image for the borders. |
|
125 * |
|
126 * @param aImage Texture image for the borders. |
|
127 */ |
|
128 IMPORT_C void SetImage(const TAlfImage& aImage); |
|
129 |
|
130 /** |
|
131 * Returns the border image. |
|
132 */ |
|
133 IMPORT_C const TAlfImage& Image() const; |
|
134 |
|
135 /** |
|
136 * Sets a color for the borders. |
|
137 * |
|
138 * @param aColor Border color. |
|
139 */ |
|
140 IMPORT_C void SetColor(const TRgb& aColor); |
|
141 |
|
142 /** |
|
143 * Gets border thickness in currently used metric units. |
|
144 * |
|
145 * @return Border thickness |
|
146 */ |
|
147 IMPORT_C const TAlfTimedPoint& Thickness() const; |
|
148 |
|
149 /** |
|
150 * Sets border thickness in currently used metric units. |
|
151 * |
|
152 * @param aThickness Border thickness |
|
153 */ |
|
154 IMPORT_C void SetThickness(const TAlfTimedPoint& aThickness); |
|
155 |
|
156 /** |
|
157 * Sets border thickness and used metric unit type. |
|
158 * |
|
159 * @param aThickness Border thickness including metric unit type. |
|
160 */ |
|
161 IMPORT_C void SetThickness(const TAlfXYMetric& aThickness); |
|
162 |
|
163 /** |
|
164 * Gets edge offset in currently used metric units. |
|
165 * |
|
166 * @return Border edge offset |
|
167 */ |
|
168 IMPORT_C const TAlfTimedPoint& EdgeOffset() const; |
|
169 |
|
170 /** |
|
171 * Sets edge offset in currently used metric units. |
|
172 * |
|
173 * @param aEdgeOffset Border edge offset. |
|
174 */ |
|
175 IMPORT_C void SetEdgeOffset(const TAlfTimedPoint& aEdgeOffset); |
|
176 |
|
177 /** |
|
178 * Sets edge offset and used metric unit type. |
|
179 * |
|
180 * @param aEdgeOffset Border edge offset including metric unit type. |
|
181 */ |
|
182 IMPORT_C void SetEdgeOffset(const TAlfXYMetric& aEdgeOffset); |
|
183 |
|
184 /** |
|
185 * Gets image offset in currently used metric units. |
|
186 * |
|
187 * @return Image offset |
|
188 */ |
|
189 IMPORT_C const TAlfTimedPoint& ImageOffset() const; |
|
190 |
|
191 /** |
|
192 * Sets image offset in currently used metric units. |
|
193 * |
|
194 * @param aImageOffset Image offset. |
|
195 */ |
|
196 IMPORT_C void SetImageOffset(const TAlfTimedPoint& aImageOffset); |
|
197 |
|
198 /** |
|
199 * Sets image offset and used metric unit type. |
|
200 * |
|
201 * @param aImageOffset Image offset including metric unit type. |
|
202 */ |
|
203 IMPORT_C void SetImageOffset(const TAlfXYMetric& aImageOffset); |
|
204 |
|
205 private: |
|
206 |
|
207 /** |
|
208 * 1st pahse constructor. |
|
209 */ |
|
210 CAlfBorderBrush(); |
|
211 |
|
212 /** |
|
213 * 2nd phase constructor. |
|
214 */ |
|
215 void ConstructL( |
|
216 CAlfEnv& aEnv, |
|
217 const TAlfXYMetric& aThickness, |
|
218 const TAlfXYMetric& aEdgeOffset); |
|
219 |
|
220 /** |
|
221 * 2nd phase constructor. |
|
222 */ |
|
223 void ConstructL( |
|
224 CAlfEnv& aEnv, |
|
225 TInt aThicknessWidth, |
|
226 TInt aThicknessHeight, |
|
227 TInt aEdgeOffsetX, |
|
228 TInt aEdgeOffsetY); |
|
229 |
|
230 private: |
|
231 |
|
232 struct TBorderBrushPrivateData; |
|
233 TBorderBrushPrivateData* iBorderBrushData; |
|
234 |
|
235 }; |
|
236 |
|
237 |
|
238 |
|
239 #endif // C_ALFBORDERBRUSH_H |