|
1 /* |
|
2 * Copyright (c) 2008 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: This is the header file for the CClockMainContainer class. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __CLOCK_CONTAINER_H__ |
|
19 #define __CLOCK_CONTAINER_H__ |
|
20 |
|
21 // System includes |
|
22 #include <coecntrl.h> |
|
23 #include <eiklbo.h> |
|
24 |
|
25 // User includes |
|
26 #include "clkcommon.h" |
|
27 |
|
28 // Forward declarations |
|
29 class CClockMainView; |
|
30 class CClockAlarmArray; |
|
31 class CAknsBasicBackgroundControlContext; |
|
32 class CAknSkinnableClock; |
|
33 class CClkUiAlarmModel; |
|
34 class CCoeEnv; |
|
35 //Single click integration |
|
36 class CAknDoubleStyleListBox; |
|
37 |
|
38 class CClockMarqueeLabel; |
|
39 class CAknButton; |
|
40 |
|
41 // Constants |
|
42 const TInt KZeroAlarms( 0 ); |
|
43 |
|
44 // Class declaration |
|
45 /** |
|
46 * @class CClockMainContainer |
|
47 * @brief The CCoeControl inheriting class. |
|
48 * @exe clock.exe |
|
49 */ |
|
50 class CClockMainContainer : public CCoeControl, |
|
51 public MEikListBoxObserver, |
|
52 public MCoeControlObserver |
|
53 { |
|
54 public: // Constructor and destructor |
|
55 |
|
56 /** |
|
57 * @brief Create a CClockMainContainer object. Performs the first phase of 2-phase construction. |
|
58 * @param aView The CClockMainView object. |
|
59 * @param aRect The main rect. |
|
60 * @param aAlarmArray The CClockAlarmArray object. |
|
61 * @return CClockMainContainer* A pointer to the created instance of CClockMainContainer |
|
62 */ |
|
63 static CClockMainContainer* NewL( CClockMainView* aView, const TRect& aRect, CClockAlarmArray* aAlarmArray ); |
|
64 |
|
65 /** |
|
66 * @brief Destructor |
|
67 */ |
|
68 ~CClockMainContainer(); |
|
69 |
|
70 public: // Functions from base classes |
|
71 |
|
72 /** |
|
73 * @brief From CCoeControl. |
|
74 * @see CCoeControl |
|
75 */ |
|
76 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
77 TEventCode aType ); |
|
78 |
|
79 /** |
|
80 * @brief From CCoeControl. Draw this CClockMainContainer to the screen. |
|
81 * @param aRect the rectangle of this view that needs updating |
|
82 */ |
|
83 void Draw( const TRect& aRect ) const; |
|
84 |
|
85 /** |
|
86 * @brief From CCoeControl. |
|
87 * @param aDrawNow. |
|
88 * @see CCoeControl. |
|
89 */ |
|
90 void FocusChanged( TDrawNow aDrawNow ); |
|
91 |
|
92 /** |
|
93 * @brief From CCoeControl. |
|
94 * @param aPointerEvent. |
|
95 * @see CCoeControl. |
|
96 */ |
|
97 void HandlePointerEventL( const TPointerEvent& aPointerEvent ); |
|
98 |
|
99 /** |
|
100 * @brief Handles list box events. |
|
101 * This pure virtual function is invoked by CEikListBox to |
|
102 * notify the observer of list box events. |
|
103 * @param aListBox The originating list box. |
|
104 * @param aEventType A code for the event. Further information |
|
105 * may be obtained by accessing the list box itself. |
|
106 */ |
|
107 void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType ); |
|
108 |
|
109 void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType ); |
|
110 |
|
111 public: // New functions |
|
112 |
|
113 /** |
|
114 * @brief Updates the listbox with the newly added alarm. |
|
115 * @param aAlarmInfo The new alarm info. |
|
116 * @param aAlaramId The new alarm id. |
|
117 */ |
|
118 void UpdateAlarmListL( SClkAlarmInfo& aAlarmInfo, TAlarmId aAlarmId ); |
|
119 |
|
120 /** |
|
121 * @brief Removes the alarm at aIndex. |
|
122 * @param aIndex The index of the alarm list item. |
|
123 */ |
|
124 void RemoveAlarmL( TInt aIndex ); |
|
125 |
|
126 //Single click integration |
|
127 /** |
|
128 * @brief Returns a pointer to the listbox. |
|
129 * @return CAknDoubleStyleListBox* Pointer to the alarm listbox. |
|
130 */ |
|
131 CAknDoubleStyleListBox* ListBox(); |
|
132 |
|
133 |
|
134 /** |
|
135 * @brief Sets the information to the date and weekday displayed on the main view. |
|
136 */ |
|
137 void SetDayInfoL(); |
|
138 |
|
139 /** |
|
140 * @brief Updates the variable iDSTOn based on whether DST in ON for the current timezone. |
|
141 */ |
|
142 void UpdateDSTStateL(); |
|
143 |
|
144 /** |
|
145 * @brief Sets the zone information to be displayed in the main view. |
|
146 */ |
|
147 void SetZoneInfoL(); |
|
148 |
|
149 /** |
|
150 * @brief Reconstructs the marquee label and prepares it for marqueeing again. |
|
151 */ |
|
152 void ResetMarqueeLabelL(); |
|
153 |
|
154 /** |
|
155 * @brief Calculates correct rect and sets if ro NewAlarmButton |
|
156 */ |
|
157 void SetCorrectRectForNewAlarmButton(); |
|
158 |
|
159 /** |
|
160 * @brief Switches clock type |
|
161 */ |
|
162 void SwitchClockTypeL(); |
|
163 |
|
164 /** |
|
165 * @brief return true new alaram button is focused. |
|
166 */ |
|
167 TBool IsNewAlaramButtonFocused(); |
|
168 |
|
169 private: // Functions from base classes |
|
170 |
|
171 /** |
|
172 * From CCoeControl Gets help context |
|
173 * @param aContext Help context |
|
174 */ |
|
175 void GetHelpContext( TCoeHelpContext& aContext ) const; |
|
176 |
|
177 /** |
|
178 * brief checks automatic time update ON/OFF status. |
|
179 * @return TBool The automatic time update status. |
|
180 */ |
|
181 TBool GetAutoTimeUpdateState() const; |
|
182 |
|
183 |
|
184 /** |
|
185 * @brief From CCoeControl. Handles a chage of client area size. |
|
186 */ |
|
187 void SizeChanged(); |
|
188 |
|
189 /** |
|
190 * @brief From CCoeControl. Returns the number of components. |
|
191 * @return TInt The number of component controls. |
|
192 */ |
|
193 TInt CountComponentControls() const; |
|
194 |
|
195 /** |
|
196 * @brief From CCoeControl. Returns a pointer of component. |
|
197 * @return CCoeControl* Component control. |
|
198 */ |
|
199 CCoeControl* ComponentControl( TInt aIndex ) const; |
|
200 |
|
201 /** |
|
202 * @brief From CCoeControl. Returns the TTypeUid::Ptr, used to set the background context. |
|
203 * @param aId |
|
204 * @return TTypeUid::Ptr |
|
205 * @see CCoeControl |
|
206 */ |
|
207 TTypeUid::Ptr MopSupplyObject( TTypeUid aId ); |
|
208 |
|
209 /** |
|
210 * @brief From CCoeControl. Handles the chane in the control's resource. |
|
211 * @param aType The type of change. |
|
212 * @see CCoeControl. |
|
213 */ |
|
214 void HandleResourceChange( TInt aType ); |
|
215 |
|
216 private: // New functions |
|
217 |
|
218 /** |
|
219 * @brief By default Symbian OS constructor is private. |
|
220 * @param aView The CClockMainView object. |
|
221 * @param aRect of this container. |
|
222 * @param aAlarmArray The CClockAlarmArray object. |
|
223 */ |
|
224 void ConstructL( CClockMainView* aView, const TRect& aRect, CClockAlarmArray* aAlarmArray ); |
|
225 |
|
226 /** |
|
227 * @brief C++ default constructor. |
|
228 */ |
|
229 CClockMainContainer(); |
|
230 |
|
231 /** |
|
232 * @brief Draws the Date and day texts on the main view. |
|
233 * @param aWindowGc The graphics context. |
|
234 */ |
|
235 void DrawMainViewText( CWindowGc& aWindowGc ) const; |
|
236 |
|
237 /** |
|
238 * @brief Tells if DST is on for the specified timezone ID. |
|
239 * @param aTimeZoneId The timezone ID which we are interested in. |
|
240 * @return TBool ETrue if the DST is on, EFalse otherwise. |
|
241 */ |
|
242 TBool IsDstOnL( TInt aTimeZoneId ); |
|
243 |
|
244 /** |
|
245 * @brief Gets the offset with DST for the given timezone id. |
|
246 * @param aDstOffset This will contain the DST offset obtained from the rules. |
|
247 * @param aTzId The timezone id of zone for which we need the DST offset. |
|
248 */ |
|
249 void GetOffSetWithDstL( TInt32& aDstOffset, const CTzId& aTzId ); |
|
250 |
|
251 private: // Data |
|
252 |
|
253 /** |
|
254 * @var iView |
|
255 * @brief The CClockMainView object. |
|
256 */ |
|
257 CClockMainView* iView; |
|
258 |
|
259 /** |
|
260 * @brief iAlarmArray |
|
261 * @brief The CClockAlarmArray object. Not owned. |
|
262 */ |
|
263 CClockAlarmArray* iAlarmArray; |
|
264 |
|
265 /** |
|
266 * @var iBgContext |
|
267 * @brief The basic skin bg control context. |
|
268 */ |
|
269 CAknsBasicBackgroundControlContext* iBgContext; |
|
270 |
|
271 /** |
|
272 * @var iSkinnableClock |
|
273 * @brief The skinnable clock control. |
|
274 */ |
|
275 CAknSkinnableClock* iSkinnableClock; |
|
276 |
|
277 /** |
|
278 * @var iListBox |
|
279 * @brief To display the alarms list. |
|
280 */ |
|
281 //Single click integration |
|
282 CAknDoubleStyleListBox* iListBox; |
|
283 |
|
284 |
|
285 /** |
|
286 * @var iDayNameString |
|
287 * @brief The string holder for the day name. |
|
288 */ |
|
289 HBufC* iDayNameString; |
|
290 |
|
291 /** |
|
292 * @var iTouchFlag |
|
293 * @brief Will be ETrue if a control has been tapped. |
|
294 */ |
|
295 TBool iTouchFlag; |
|
296 |
|
297 /** |
|
298 * @var iDstIndicator |
|
299 * @brief The DST indicator icon. |
|
300 */ |
|
301 CFbsBitmap* iDstIndicator; |
|
302 |
|
303 /** |
|
304 * @var iDstIndicatorMask |
|
305 * @brief The DST indicator icon mask. |
|
306 */ |
|
307 CFbsBitmap* iDstIndicatorMask; |
|
308 |
|
309 /** |
|
310 * @var iDSTOn |
|
311 * @brief Set to ETrue if DST is ON for the current timezone, EFalse otherwise. |
|
312 */ |
|
313 TBool iDSTOn; |
|
314 |
|
315 /** |
|
316 * @var iLocationString |
|
317 * @brief The string holder for displaying the current zone details. |
|
318 */ |
|
319 HBufC* iLocationString; |
|
320 |
|
321 /** |
|
322 * @var iLocationLabel |
|
323 * @brief The label for displaying the location details. |
|
324 */ |
|
325 CClockMarqueeLabel* iLocationLabel; |
|
326 |
|
327 /** |
|
328 * @var iTimeZoneString |
|
329 * @brief Holds the timezone string in the form GMT +/-<offset> |
|
330 */ |
|
331 HBufC* iTimeZoneString; |
|
332 |
|
333 /** |
|
334 * @var iDateString |
|
335 * @brief Holds the date. |
|
336 */ |
|
337 HBufC* iDateString; |
|
338 |
|
339 CAknButton* iNewAlarmButton; |
|
340 |
|
341 TTime iPreviousClockTypeSwitch; |
|
342 /** |
|
343 * @var iClearSingleClickFlag |
|
344 * @brief if ETrue clear ESingleClickDisabledHighlight flag of listbox |
|
345 */ |
|
346 TBool iClearSingleClickFlag; |
|
347 |
|
348 }; |
|
349 |
|
350 #endif // __CLOCK_CONTAINER_H__ |
|
351 |
|
352 // End of file |