|
1 /* |
|
2 * Copyright (c) 2003 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: Definitions for screensaver indicator array. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef C_SCREENSAVERINDICATOR_H |
|
21 #define C_SCREENSAVERINDICATOR_H |
|
22 |
|
23 //#include <aknconsts.h> |
|
24 #include <coecntrl.h> |
|
25 #include <coeccntx.h> |
|
26 #include <e32base.h> |
|
27 #include <AknIconArray.h> |
|
28 #include <gulicon.h> |
|
29 #include <AknsItemID.h> |
|
30 #include <AknUtils.h> |
|
31 #include <screensaverplugin.h> |
|
32 |
|
33 #include "screensaver.hrh" |
|
34 |
|
35 |
|
36 /* |
|
37 * Base class for all indicators. |
|
38 */ |
|
39 class CScreensaverIndicator : public CBase |
|
40 { |
|
41 public: |
|
42 |
|
43 /** |
|
44 * Destructor |
|
45 */ |
|
46 virtual ~CScreensaverIndicator(); |
|
47 |
|
48 /** |
|
49 * Draw the indicator. it should be implemented by the derived class |
|
50 */ |
|
51 virtual void Draw(CWindowGc& aGc) const = 0; |
|
52 |
|
53 /** |
|
54 * two-phased constructor |
|
55 * |
|
56 * @param aReader the resource read of the STRUCT |
|
57 * SCREENSAVER_PARAMETERS_ARRAY defined by ourself |
|
58 * STRUCT SCREENSAVER_PARAMETERS_ARRAY |
|
59 * { |
|
60 * WORD KIndicatorMargin; |
|
61 * WORD KIndicatorGap; |
|
62 * WORD KIndicatorTopMargin; |
|
63 * WORD KIndicatorTextLevel; |
|
64 * LONG KBackGroundColor; |
|
65 * WORD KHeight; |
|
66 * } |
|
67 * @param aBgColor the background color of display screen |
|
68 * @param aTextColor the text color |
|
69 */ |
|
70 virtual void ConstructL(TResourceReader &aReader, TUint32 aBgColor, TUint aTextColor); |
|
71 |
|
72 /** |
|
73 * Set the parameters of drawing |
|
74 * |
|
75 * @param aCorner the position of the lefttop of the indicator |
|
76 * @param aParentRect |
|
77 */ |
|
78 virtual void SetupDrawingParameters(const TPoint& aCorner, const TRect& aParentRect) = 0; |
|
79 |
|
80 /** |
|
81 * Check if indicator is visible or not |
|
82 * |
|
83 * @return TBool |
|
84 */ |
|
85 virtual TBool CheckVisibilityConditions() const = 0; |
|
86 |
|
87 /** |
|
88 * Get the payload through the property |
|
89 * |
|
90 * @param aPayload the reference to the payload |
|
91 */ |
|
92 virtual void Payload(TIndicatorPayload& aPayload) const = 0; |
|
93 |
|
94 /** |
|
95 * Set the property through the payload |
|
96 * |
|
97 * @param aPayload |
|
98 */ |
|
99 virtual void SetPayload(const TIndicatorPayload& aPayload) = 0; |
|
100 |
|
101 /** |
|
102 * Set the Id by the parameter |
|
103 * |
|
104 * @param aId the Id value |
|
105 */ |
|
106 void SetId(TScreensaverIndicatorId aId); |
|
107 |
|
108 /** |
|
109 * Check if visible or not |
|
110 * |
|
111 * @return TBool if visible return ETrue, or EFalse. |
|
112 */ |
|
113 virtual TBool Visible() const; |
|
114 |
|
115 /** |
|
116 * Set the visibility |
|
117 * |
|
118 * @param aValue |
|
119 */ |
|
120 void SetVisibility(TBool aValue); |
|
121 |
|
122 /** |
|
123 * Returns the indicator width |
|
124 * |
|
125 * @return TInt |
|
126 */ |
|
127 TInt Width() const; |
|
128 |
|
129 /** |
|
130 * Returns the indicator Id |
|
131 * |
|
132 * @return TScreensaverIndicatorId |
|
133 */ |
|
134 TScreensaverIndicatorId Id() const; |
|
135 |
|
136 /** |
|
137 * Returns the indicator alighment |
|
138 * enum TScreensaverAlignment |
|
139 * { |
|
140 * ESsAlignLeft, |
|
141 * ESsAlignRight |
|
142 * }; |
|
143 * |
|
144 * @return TScreensaverAlignment |
|
145 */ |
|
146 TScreensaverAlignment Alignment() const; |
|
147 |
|
148 /** |
|
149 * Returns the indicator DrawType, DrawType defined as below |
|
150 * enum TScreensaverDrawType |
|
151 * { |
|
152 * ESsDrawTypeNotDrawn, |
|
153 * ESsDrawTypeSecondary, |
|
154 * ESsDrawTypePrimary |
|
155 * }; |
|
156 * |
|
157 * @return TScreensaverDrawType |
|
158 */ |
|
159 TScreensaverDrawType DrawType() const; |
|
160 |
|
161 /** |
|
162 * Makes a skin item ID from skinned bitmap id |
|
163 * |
|
164 * @param aSkinBmpId |
|
165 * |
|
166 * @return TAknsItemID |
|
167 */ |
|
168 TAknsItemID MakeSkinItemId(TInt aSkinBmpId); |
|
169 |
|
170 /** |
|
171 * Sets the indicator type |
|
172 * enum TScreensaverIndicatorType |
|
173 * { |
|
174 * ESsNumericIndicator, |
|
175 * ESsIconIndicator, |
|
176 * ESsTextIndicator, |
|
177 * ESsNumberAndIconIndicator |
|
178 * }; |
|
179 * |
|
180 * @param aType the type you want to set |
|
181 */ |
|
182 void SetType(TScreensaverIndicatorType aType); |
|
183 |
|
184 /** |
|
185 * Returns the type of indicator |
|
186 * |
|
187 * @return TScreensaverIndicatorType |
|
188 */ |
|
189 TScreensaverIndicatorType Type(); |
|
190 |
|
191 /** |
|
192 * Depending on indicator type these may or may not be implemented |
|
193 * in derived classes. Replaces setupdrawingparameters. |
|
194 * Used for new layout * |
|
195 */ |
|
196 virtual void SetIconLayout(TAknLayoutRect&, TInt); |
|
197 virtual void SetTextLayout(TAknLayoutText&, TInt); |
|
198 |
|
199 /** |
|
200 * Get the desired width of the indicator (where it fits completely) |
|
201 */ |
|
202 virtual TInt PreferredWidth(); |
|
203 |
|
204 /** |
|
205 * Get the minimum width of the indicator |
|
206 * (absolute minimum space it can be drawn in) |
|
207 */ |
|
208 virtual TInt MinimumWidth(); |
|
209 |
|
210 /** |
|
211 * Set the width allowed for the indicator. This has effect only on |
|
212 * indicators that have text, which may then be truncated. Bitmap |
|
213 * widths are not adjusted |
|
214 */ |
|
215 virtual void SetWidth(TInt); |
|
216 |
|
217 /** |
|
218 * Set X-position of indicator |
|
219 */ |
|
220 virtual void SetXPos(TInt); |
|
221 |
|
222 protected: |
|
223 |
|
224 /** |
|
225 * The indicator Id |
|
226 */ |
|
227 TScreensaverIndicatorId iId; |
|
228 |
|
229 /** |
|
230 * The topleft position of indicator |
|
231 */ |
|
232 TPoint iTopLeft; |
|
233 |
|
234 /** |
|
235 * The flag indicates the indicator is visible or not |
|
236 */ |
|
237 TBool iVisible; |
|
238 |
|
239 /** |
|
240 * The area of indicator |
|
241 */ |
|
242 TRect iRect; |
|
243 |
|
244 /** |
|
245 * The indicator draw type |
|
246 */ |
|
247 TScreensaverDrawType iDrawType; |
|
248 |
|
249 /** |
|
250 * The indicator alignment |
|
251 */ |
|
252 TScreensaverAlignment iAlignment; |
|
253 |
|
254 /** |
|
255 * The indicator type. |
|
256 */ |
|
257 TScreensaverIndicatorType iType; |
|
258 |
|
259 /** |
|
260 * Colors to be used to draw indicators |
|
261 */ |
|
262 TRgb iBgColor; |
|
263 TRgb iTextColor; |
|
264 |
|
265 }; |
|
266 |
|
267 |
|
268 #endif // C_SCREENSAVERINDICATOR_H |
|
269 |
|
270 // End of file. |