47 * Draws the given time to the given buffer bitmap. |
48 * Draws the given time to the given buffer bitmap. |
48 * |
49 * |
49 * @since S60 5.1 |
50 * @since S60 5.1 |
50 * |
51 * |
51 * @param aAdapter Clock adapter |
52 * @param aAdapter Clock adapter |
52 * |
|
53 * @param aGc Graphics context that can be used to draw to |
53 * @param aGc Graphics context that can be used to draw to |
54 * the clock |
54 * the clock |
55 * |
55 * @param aNode Node which contains drawing info |
56 * @param aRect Rect where to scale the clock |
|
57 * |
|
58 * @param aTime Time to be used for drawing. |
56 * @param aTime Time to be used for drawing. |
|
57 * @param aAmpm Possible am\pm text to draw |
59 */ |
58 */ |
60 virtual void DrawL( CXnClockAdapter& aAdapter, |
59 virtual void DrawL( CXnClockAdapter& aAdapter, |
61 CWindowGc& aGc, |
60 CWindowGc& aGc, |
62 const TRect& aRect, |
61 CXnNodePluginIf& aNode, |
63 const TTime& aTime ) = 0; |
62 const TTime& aTime, |
|
63 CXnNodePluginIf* aAmpm ) = 0; |
|
64 |
|
65 /** |
|
66 * Reset font |
|
67 */ |
|
68 virtual void ResetFont() = 0; |
64 }; |
69 }; |
65 |
70 |
66 class CXnClockFaceDigital : public CXnClockFace |
71 class CXnClockFaceDigital : public CXnClockFace |
67 { |
72 { |
|
73 public: |
|
74 /** |
|
75 * Type of font, digital or for am/pm text |
|
76 */ |
|
77 enum TXnClockFontType { |
|
78 EClock, |
|
79 EAmpm |
|
80 }; |
|
81 |
68 public: // Constructors and destructor |
82 public: // Constructors and destructor |
69 |
83 |
70 /** |
84 /** |
71 * Two-phased constructor. |
85 * Two-phased constructor. |
72 */ |
86 */ |
82 /** |
96 /** |
83 * @see CXnClockFace::DrawL |
97 * @see CXnClockFace::DrawL |
84 */ |
98 */ |
85 void DrawL( CXnClockAdapter& aAdapter, |
99 void DrawL( CXnClockAdapter& aAdapter, |
86 CWindowGc& aGc, |
100 CWindowGc& aGc, |
87 const TRect& aRect, |
101 CXnNodePluginIf& aNode, |
88 const TTime& aTime ); |
102 const TTime& aTime, |
|
103 CXnNodePluginIf* aAmpm ); |
|
104 |
|
105 /** |
|
106 * @see CXnClockFace::ResetFont |
|
107 */ |
|
108 void ResetFont(); |
89 |
109 |
90 private: |
110 private: |
91 |
111 |
92 /** |
112 /** |
93 * C++ default constructor. |
113 * C++ default constructor. |
96 |
116 |
97 /** |
117 /** |
98 * By default Symbian 2nd phase constructor is private. |
118 * By default Symbian 2nd phase constructor is private. |
99 */ |
119 */ |
100 void ConstructL(); |
120 void ConstructL(); |
|
121 |
|
122 /** |
|
123 * Draws am/pm text |
|
124 * |
|
125 * @param aAdapter Clock adapter |
|
126 * @param aGc Graphics context that can be used to draw to |
|
127 * the clock |
|
128 * @param aTime Time to be used for drawing. |
|
129 * @param aAmpm Contains info for drawing |
|
130 */ |
|
131 void DrawAmpmL( CXnClockAdapter& aAdapter, |
|
132 CWindowGc& aGc, |
|
133 const TTime& aTime, |
|
134 CXnNodePluginIf& aAmpm ); |
|
135 |
|
136 /** |
|
137 * Creates font |
|
138 * |
|
139 * @param aAdapter Clock adapter |
|
140 * @param aNode Contains info to create font |
|
141 * @param aFontType Digital clock font or am/pm font |
|
142 * |
|
143 * @return CAknLayoutFont |
|
144 */ |
|
145 const CAknLayoutFont* CreateFontL( CXnClockAdapter& aAdapter, |
|
146 CXnNodePluginIf& aNode, |
|
147 TXnClockFontType aFontType ); |
|
148 |
|
149 /** |
|
150 * Creates font color |
|
151 * |
|
152 * @param aAdapter Clock adapter |
|
153 * @param aNode Contains info to create color |
|
154 * @param aFontType Digital clock font color or am/pm font color |
|
155 * |
|
156 * @return Color |
|
157 */ |
|
158 const TRgb& CreateColorL( CXnClockAdapter& aAdapter, |
|
159 CXnNodePluginIf& aNode, |
|
160 TXnClockFontType aFontType); |
101 |
161 |
102 private: // Data |
162 private: // Data |
|
163 // Date font, not owned |
|
164 CFont* iClockFont; |
|
165 // Date font, not owned |
|
166 CFont* iAmpmFont; |
|
167 // Digital clock font color |
|
168 TRgb iFaceColor; |
|
169 // Indicates whether digital clock color should be created |
|
170 TBool iIsFaceColorSet; |
|
171 // Am/pm text font color |
|
172 TRgb iAmpmColor; |
|
173 // Indicates whether am/pm font color should be created |
|
174 TBool iIsAmpmColorSet; |
103 }; |
175 }; |
104 |
176 |
105 class CXnClockFaceAnalog : public CXnClockFace |
177 class CXnClockFaceAnalog : public CXnClockFace |
106 { |
178 { |
107 public: // Constructors and destructor |
179 public: // Constructors and destructor |
121 /** |
193 /** |
122 * @see CXnClockFace::DrawL |
194 * @see CXnClockFace::DrawL |
123 */ |
195 */ |
124 void DrawL( CXnClockAdapter& aAdapter, |
196 void DrawL( CXnClockAdapter& aAdapter, |
125 CWindowGc& aGc, |
197 CWindowGc& aGc, |
126 const TRect& aRect, |
198 CXnNodePluginIf& aNode, |
127 const TTime& aTime ); |
199 const TTime& aTime, |
|
200 CXnNodePluginIf* aAmpm ); |
|
201 |
|
202 /** |
|
203 * @see CXnClockFace::ResetFont |
|
204 */ |
|
205 void ResetFont(); |
128 |
206 |
129 private: // New functions |
207 private: // New functions |
130 |
208 |
131 /** |
209 /** |
132 * Draws the hands of the clock. |
210 * Draws the hands of the clock. |
133 * |
211 * |
134 * @param aGc Graphics context that can be used to draw to the |
212 * @param aGc Graphics context that can be used to draw to the |
135 * clock |
213 * clock |
136 * |
|
137 * @param aRect Rectangle defining the size of the clock. |
214 * @param aRect Rectangle defining the size of the clock. |
138 * |
|
139 * @param aDateTime Time to be used for drawing. |
215 * @param aDateTime Time to be used for drawing. |
140 */ |
216 */ |
141 void DrawHandsL( CWindowGc& aGc, const TRect& aRect, |
217 void DrawHandsL( CWindowGc& aGc, const TRect& aRect, |
142 const TDateTime& aDateTime ); |
218 const TDateTime& aDateTime ); |
143 |
219 |