|
1 /* |
|
2 * Copyright (c) 2002-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: Container control for Week View . |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CALENWEEKCONT_H |
|
20 #define CALENWEEKCONT_H |
|
21 |
|
22 // INCLUDES |
|
23 #include "calencontainer.h" |
|
24 #include "calenweekcallback.h" |
|
25 #include "calenweekdata.h" |
|
26 |
|
27 #include "calenglobaldata.h" |
|
28 #include <calsession.h> |
|
29 #include <calenconstants.h> |
|
30 #include <AknUtils.h> |
|
31 #include <calcommon.h> // CalCommon::TCalViewFilter |
|
32 #include <caleninstanceid.h> // TCalenInstanceId |
|
33 |
|
34 // FORWARD DECLARATIONS |
|
35 class CAknsFrameBackgroundControlContext; |
|
36 class CCalenWeekListbox; |
|
37 class CCalenWeekView; |
|
38 class CCalInstance; |
|
39 class CCalHourItem; |
|
40 class CGulIcon; |
|
41 class TAknWindowLineLayout; |
|
42 class TCalenInstanceId; |
|
43 class CCalInstanceView; |
|
44 class MCalenPreview; |
|
45 |
|
46 typedef CArrayFixFlat<CCalHourItem*>* CWeekSlotArrayPtr; |
|
47 |
|
48 NONSHARABLE_CLASS (CCalHourItem):public CBase |
|
49 { |
|
50 public: |
|
51 ~CCalHourItem(); |
|
52 static CCalHourItem* NewL(); |
|
53 static CCalHourItem* NewL(CCalInstance& aInstance); |
|
54 |
|
55 // FIXME: can be removed: |
|
56 void SetDataL( CCalInstance& aInstance, |
|
57 TTimeIntervalMinutes aStartTime, |
|
58 TBool aTimedNote, |
|
59 TCalenWeekHour aHourData); |
|
60 |
|
61 TBool HasInstance() const; |
|
62 TBool IsTimed() const; |
|
63 private: |
|
64 CCalHourItem(); |
|
65 void ConstructL(CCalInstance& aInstance); |
|
66 void ConstructL(); |
|
67 |
|
68 public: |
|
69 TTimeIntervalMinutes iStartTime; |
|
70 CCalInstance* iInstance; |
|
71 TBool iTimedNote; |
|
72 TCalenWeekHour iHourData; |
|
73 |
|
74 |
|
75 }; |
|
76 |
|
77 |
|
78 /** |
|
79 * Container control for Week View. |
|
80 */ |
|
81 NONSHARABLE_CLASS( CCalenWeekContainer ) : public CCalenContainer, |
|
82 public MCalenWeekCursorObserver |
|
83 { |
|
84 public: |
|
85 enum TLocaleChangeRedraw |
|
86 { |
|
87 ERedrawAll, |
|
88 ERedrawWeek |
|
89 }; |
|
90 |
|
91 public: // Constructors and destructor |
|
92 /** |
|
93 * C++ constructor. |
|
94 */ |
|
95 CCalenWeekContainer( CCalenNativeView* aView, |
|
96 TTime& aTime, |
|
97 TInt& aSelectedRowNumber, |
|
98 TTimeIntervalMinutes& aFirstRowTime, |
|
99 MCalenServices& aServices ); |
|
100 |
|
101 /** |
|
102 * Destructor. |
|
103 */ |
|
104 virtual ~CCalenWeekContainer(); |
|
105 |
|
106 public: |
|
107 /** |
|
108 * Create icon indices |
|
109 */ |
|
110 void CreateIconIndicesL( RArray<MCalenServices::TCalenIcons>& aIndexArray ); |
|
111 public: // New Function |
|
112 /** |
|
113 * Check with the layoutmanager for any layout chnanges |
|
114 */ |
|
115 void CheckLayoutAndExtensionL(); |
|
116 |
|
117 /** |
|
118 * Sets cursor in Active day |
|
119 */ |
|
120 void SetCursorToActiveDayL(); |
|
121 |
|
122 /** |
|
123 * Redrawing when locale change |
|
124 * @param aFlag Redraw flag: ERedrawAll | ERedrawWeek |
|
125 */ |
|
126 void RedrawLocaleChangeL(TLocaleChangeRedraw aFlag); |
|
127 |
|
128 /** |
|
129 * Set Active context based on currently focused cell. |
|
130 */ |
|
131 void SetActiveContextFromHighlightL(); |
|
132 |
|
133 /** |
|
134 * Step 1 of construction of grid data. |
|
135 */ |
|
136 void BeginPopulationWithInstanceViewL(); |
|
137 |
|
138 /** |
|
139 * Step 2 of construction of grid data. |
|
140 */ |
|
141 void FirstPopulateOfSlotTableL(); |
|
142 |
|
143 /** |
|
144 * Step 3 of construction of grid data. |
|
145 */ |
|
146 void SecondPopulateOfSlotTableL(); |
|
147 |
|
148 /** |
|
149 * Step 4 of construction of grid data. |
|
150 */ |
|
151 void CompletePopulationL(); |
|
152 |
|
153 /** |
|
154 * Hides preview popup/preview pane |
|
155 */ |
|
156 void HidePopup(); |
|
157 /** |
|
158 * Search for top row. |
|
159 */ |
|
160 TInt SearchTopIndexL(TInt aColumn); |
|
161 |
|
162 /** |
|
163 * Updates preview popup/preview pane |
|
164 */ |
|
165 void UpdatePreviewPaneL(); |
|
166 |
|
167 /* |
|
168 * @brief Find calendarinfo object based on calendar name |
|
169 * |
|
170 * @param aName calendar filename |
|
171 * @param aCalendarInfo referance for calendarinfo |
|
172 * @return TBool find status |
|
173 */ |
|
174 static TBool CalendarInfoIdentifierL(const HBufC* aName, |
|
175 const CCalCalendarInfo& aCalendarInfo); |
|
176 |
|
177 /* |
|
178 * Cleanup instances |
|
179 */ |
|
180 void CleanupInstances(); |
|
181 |
|
182 public: |
|
183 /** |
|
184 * Handles navi decorator event in week view |
|
185 * @param aDirection left or right |
|
186 */ |
|
187 void HandleNaviDecoratorEventL(TInt aDirection); |
|
188 void HandleLongTapEventL( const TPoint& aPenEventLocation, |
|
189 const TPoint& aPenEventScreenLocation ); |
|
190 |
|
191 private: // New Function |
|
192 TInt HighlightRowFromActiveContextL(TInt aColumn); |
|
193 |
|
194 /** |
|
195 * Sets highlight item in ListBox at active time |
|
196 */ |
|
197 void SelectHighlightedCellAndVisibleRangeL(); |
|
198 |
|
199 /** |
|
200 * Get the available info bar rect for this container |
|
201 */ |
|
202 TRect InfoBarRectL( TBool aToolbarAvailable ); |
|
203 |
|
204 /** |
|
205 * Calculates and Sets day from ListBox column |
|
206 */ |
|
207 void CalcDayFromColumn(); |
|
208 |
|
209 /** |
|
210 * Populate whole week daylist from Agenda server |
|
211 */ |
|
212 void PopulatesDayListsL(); |
|
213 |
|
214 /** |
|
215 * Fills slot table with timed notes. |
|
216 */ |
|
217 void InsertTimedNotesToSlotTableL(); |
|
218 |
|
219 /** |
|
220 * Fills slot table with non-timed notes |
|
221 */ |
|
222 void InsertNonTimedNotesToSlotTableL(); |
|
223 |
|
224 /** |
|
225 * Sets Week data to ListBox |
|
226 */ |
|
227 void SetListBoxDataL(); |
|
228 |
|
229 /** |
|
230 * The note contained in within a time is searched. |
|
231 * ex) |
|
232 * aDayList (Note A 9:00-, Note B 9:30-, Note C 10:00) |
|
233 * aTime 9:00 |
|
234 * Return list (Note A 9:00-, Note B 9:30-) |
|
235 * @param aDayList Data list of one day |
|
236 * @param aTime within a time |
|
237 */ |
|
238 void SearchMatchedNoteL(RPointerArray <CCalInstance>& aDayList, TTime aTime); |
|
239 |
|
240 /** |
|
241 * Check specified entry whether Timed Note. |
|
242 * @param entry Check a note |
|
243 * @return ETrue : Timed note |
|
244 */ |
|
245 TBool IsTimedNoteL(CCalEntry& aEntry); |
|
246 |
|
247 /** |
|
248 * Reset slot time table. |
|
249 */ |
|
250 void ResetSlotTable(); |
|
251 |
|
252 /** |
|
253 * Create slot table |
|
254 */ |
|
255 void InitSlotTableL(); |
|
256 |
|
257 TInt FindFirstItemOfColumn(TInt aColumn); |
|
258 TInt FindItemFromColumnL(const TCalenInstanceId& aId, TInt aColumn); |
|
259 //TInt FindFirstRowOfInstanceL(const TCalenInstanceId& aId, TInt aColumn); |
|
260 TInt FindRowForTime(TTimeIntervalMinutes aTime); |
|
261 |
|
262 /** |
|
263 * Sets highlight item in ListBox |
|
264 */ |
|
265 void SetHighlightAndVisibleRange(TInt aRow, TInt aColumn, TInt aTopLine); |
|
266 |
|
267 /** |
|
268 * Adjust active time when item is updated |
|
269 * @param aId Note Id |
|
270 */ |
|
271 //void AdjustActivetimeL(const CCalEntry& aEntry,const TCalTime& aInstanceTime); |
|
272 |
|
273 |
|
274 /** |
|
275 * Clear entry of array for cash |
|
276 */ |
|
277 void ClearOneDayEntryCache(); |
|
278 |
|
279 //TInt SearchTopIndexL( TInt aColumn ); |
|
280 |
|
281 /** |
|
282 * Gets time of top item in ListBox |
|
283 * @return time of top item in ListBox |
|
284 */ |
|
285 TTimeIntervalMinutes TopTime() const; |
|
286 |
|
287 /** |
|
288 * Arrow key pressed |
|
289 */ |
|
290 TKeyResponse HorizontalMoveL(TInt aDir); |
|
291 |
|
292 |
|
293 void PointerMovedL(TInt aNewColumn); |
|
294 void HorizontalWeekMoveL(TInt aDir); |
|
295 |
|
296 |
|
297 void FocusChangeForPopupL(); |
|
298 |
|
299 /** |
|
300 * Draw day names |
|
301 * @param aGc Graphic context |
|
302 */ |
|
303 void DrawDayNamesL(CWindowGc& aGc) const; |
|
304 void DrawBackground(CWindowGc& aGc) const; |
|
305 void DrawGridLines(CWindowGc& aGc) const; |
|
306 |
|
307 CCalenWeekView& WeekView() const; |
|
308 |
|
309 |
|
310 private: // From CCalenContainer |
|
311 /** |
|
312 * From CCalenContainer. |
|
313 * (no implementation) |
|
314 * This methods is called after calendar settings have changed. |
|
315 */ |
|
316 void UpdateSize(); |
|
317 |
|
318 /** |
|
319 * From CCalenContainer Third phase constructor. |
|
320 * This function was called CCalenView::ConstructL(). |
|
321 */ |
|
322 void ConstructImplL(); |
|
323 |
|
324 /* |
|
325 Constructs heading/side/background skin context if enabled |
|
326 */ |
|
327 void ConstructBackgroundContextL(); |
|
328 /** |
|
329 * From CCalenContainer Date cahnge operation notification handler. |
|
330 */ |
|
331 void NotifyChangeDateL(); |
|
332 |
|
333 /** |
|
334 * Notify that item is added or changed. |
|
335 * @param aEntry is the entry added or modified. |
|
336 * @param aInstanceTime is time of the modified instance. |
|
337 */ |
|
338 //void NotifyEntryChangeL(const CCalEntry& aEntry,const TCalTime& aInstanceTime); |
|
339 |
|
340 /** |
|
341 * Calling this will force to resource change to happen |
|
342 * We will use the last requested resource change type. |
|
343 */ |
|
344 void ForceResourceChange(); |
|
345 |
|
346 private: // From CCoeControl |
|
347 /** |
|
348 * From CCoeControl Resizes child controls |
|
349 */ |
|
350 void SizeChanged(); |
|
351 void FocusChanged( TDrawNow aDrawNow ); |
|
352 |
|
353 /** |
|
354 * React to skin, dynamic layout and other resource changes |
|
355 */ |
|
356 void HandleResourceChange(TInt aType); |
|
357 |
|
358 /** |
|
359 * From CCoeControl Return components count |
|
360 */ |
|
361 TInt CountComponentControls() const; |
|
362 |
|
363 /** |
|
364 * From CCoeControl Retrun the component specified by aIndex |
|
365 */ |
|
366 CCoeControl* ComponentControl(TInt aIndex) const; |
|
367 |
|
368 /** |
|
369 * From CCoeControl processing of a key event |
|
370 */ |
|
371 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); |
|
372 |
|
373 |
|
374 /** |
|
375 * From CCoeControl Handle pointer event |
|
376 */ |
|
377 void HandlePointerEventL(const TPointerEvent& aPointerEvent); |
|
378 |
|
379 |
|
380 /** |
|
381 * From CCoeControl Drawing day name |
|
382 */ |
|
383 void Draw(const TRect& aRect) const; |
|
384 |
|
385 /** |
|
386 * Pass skin information if needed. |
|
387 */ |
|
388 TTypeUid::Ptr MopSupplyObject(TTypeUid aId); |
|
389 |
|
390 /** |
|
391 * From CCoeControl Gets help context |
|
392 * @param aContext Help context |
|
393 */ |
|
394 void GetHelpContext(TCoeHelpContext& aContext) const; |
|
395 |
|
396 |
|
397 private: // From MActiveStep |
|
398 /** |
|
399 * From MActiveStep. Updates WeekView data |
|
400 */ |
|
401 //TInt DoStepL(); |
|
402 |
|
403 private: // From MCalenWeekCursorCallBack |
|
404 TKeyResponse CursorMovedL(MCalenWeekCursorObserver::TCursorMove aDir); |
|
405 |
|
406 private: // New variables |
|
407 CCalenWeekListbox* iListBox; |
|
408 CDesCArrayFlat* iDesArray; // ListBox data |
|
409 RPointerArray<CCalInstance> iIdList[KCalenDaysInWeek]; |
|
410 CWeekSlotArrayPtr iSlotTable[KCalenDaysInWeek]; |
|
411 RPointerArray<CCalInstance> iEntryCache; |
|
412 RPointerArray<CCalInstance> iOneDayEntryCache; |
|
413 MCalenPreview* iPreview; |
|
414 |
|
415 |
|
416 TTime iStartDay; // first day of week of iCurrentDay |
|
417 TInt iColumn; |
|
418 |
|
419 // In current week view, number of rows reserved for non-timed |
|
420 // notes |
|
421 TInt iNonTimedAreaRowCount; |
|
422 |
|
423 CAknsFrameBackgroundControlContext* iBackgroundSkinContext; |
|
424 |
|
425 // Cached layout values (used in many places) |
|
426 TAknLayoutRect i_listscroll_cale_week_pane; |
|
427 TBool iViewPopulationComplete; |
|
428 |
|
429 // View specific data, references to the view |
|
430 TTime& iTime; |
|
431 TInt& iSelectedRowNumber; // The row number of the highlighted cell. |
|
432 TTimeIntervalMinutes& iFirstRowTime; // The offset of the topmost row on screen to the first row. |
|
433 |
|
434 TBool iTopRowDefault; |
|
435 TBool iRow; |
|
436 TBool iValidDay; |
|
437 TBool iNativePreview; |
|
438 }; |
|
439 |
|
440 #endif //CALENWEEKCONT_H |
|
441 |
|
442 |
|
443 // End of File |