|
1 /* |
|
2 * Copyright (c) 2007 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: Month View container control. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CALENMONTHCONT_H |
|
21 #define CALENMONTHCONT_H |
|
22 |
|
23 // INCLUDES |
|
24 |
|
25 #include <eiklbo.h> |
|
26 #include <e32std.h> |
|
27 #include <gestureobserver.h> //MGestureObserver |
|
28 |
|
29 #include "calencontainer.h" |
|
30 #include "calenmonthdata.h" // CMonthDataArray is typedef |
|
31 |
|
32 // FORWARD DECLARATIONS |
|
33 class CAknGrid; |
|
34 class CAknIconArray; |
|
35 class CAknsFrameBackgroundControlContext; |
|
36 class CCalInstance; |
|
37 class CCalenMonthGrid; |
|
38 class CCalenMonthView; |
|
39 class CEikLabel; |
|
40 class TAknLayoutRect; |
|
41 class CCalenPreview; |
|
42 |
|
43 namespace GestureHelper |
|
44 { |
|
45 class CGestureHelper; |
|
46 } |
|
47 |
|
48 // CLASS DEFINITIONS |
|
49 |
|
50 /** |
|
51 * Month View container control |
|
52 */ |
|
53 |
|
54 NONSHARABLE_CLASS( CCalenMonthContainer ) : public CCalenContainer, |
|
55 public MEikListBoxObserver, |
|
56 public GestureHelper::MGestureObserver |
|
57 { |
|
58 public: // Constructors and destructor |
|
59 /** |
|
60 * C++ constructor. |
|
61 */ |
|
62 CCalenMonthContainer( CCalenNativeView* aView, |
|
63 TTime& aDate, |
|
64 MCalenServices& aServices ); |
|
65 |
|
66 /** |
|
67 * Destructor. |
|
68 */ |
|
69 virtual ~CCalenMonthContainer(); |
|
70 |
|
71 public: |
|
72 /** |
|
73 * Create icon indices for month view |
|
74 */ |
|
75 void CreateIconIndicesL( RArray<MCalenServices::TCalenIcons>& aIndexArray ); |
|
76 |
|
77 public: // New Function |
|
78 /** |
|
79 * Called when Midnight cross over |
|
80 * Redraw today's indicator |
|
81 */ |
|
82 void ChangesMidnightCrossover(); |
|
83 |
|
84 /** |
|
85 * Initilizes grid data. |
|
86 */ |
|
87 void InitDataForMonthL();//const TTime& aNewActiveDay); |
|
88 |
|
89 /** |
|
90 * Population step with no instance view. |
|
91 * Step 1 of construction of grid data. |
|
92 */ |
|
93 void PrepareForPopulationL(); |
|
94 |
|
95 /** |
|
96 * Populates data from agenda server and sets number of notes. |
|
97 * Step 2 of construction of grid data. |
|
98 */ |
|
99 void PopulateWithInstanceViewL(); |
|
100 |
|
101 /** |
|
102 * Set event indicator to each day. |
|
103 * Step 3 of construction of grid data. |
|
104 */ |
|
105 void SetIndicatorL(); |
|
106 |
|
107 /** |
|
108 * Sets the current focus. |
|
109 * Step 4 of construction of grid data. |
|
110 */ |
|
111 void SetFocusL(); |
|
112 |
|
113 /** |
|
114 * Sets the current focus. |
|
115 * Step 5 of construction of grid data. |
|
116 */ |
|
117 void CompletePopulationL(); |
|
118 |
|
119 /** |
|
120 * Get the available info bar rect for this container |
|
121 */ |
|
122 TRect InfoBarRectL( TBool aToolbarAvailable ); |
|
123 |
|
124 |
|
125 /** |
|
126 * Handle navigation decorator event |
|
127 * @param left or right |
|
128 */ |
|
129 void HandleNaviDecoratorEventL(TInt aDirection); |
|
130 |
|
131 void HandleLongTapEventL( const TPoint& aPenEventLocation, |
|
132 const TPoint& aPenEventScreenLocation ); |
|
133 |
|
134 /**From MGestureObserver |
|
135 * Handle the gesture event |
|
136 * @param aEvent event describing the gesture |
|
137 */ |
|
138 virtual void HandleGestureL( const GestureHelper::MGestureEvent& aEvent ); |
|
139 |
|
140 void HidePopup(); |
|
141 |
|
142 void RedrawPreviewPane(); |
|
143 |
|
144 /** |
|
145 * returns previewpane pointer |
|
146 */ |
|
147 const MCalenPreview* PreviewPane(); |
|
148 |
|
149 |
|
150 private: // New function |
|
151 /** |
|
152 * Set iActiveDay to argument's aDay, |
|
153 * and also set context's active day too. |
|
154 * And re-calculate first day of grid. |
|
155 * @param aDay New active day |
|
156 */ |
|
157 void SetActiveDayL( TTime aDay ); |
|
158 |
|
159 /** |
|
160 * Return a day from Grid index |
|
161 * @param aIndex Grid index |
|
162 * @return Real day |
|
163 */ |
|
164 TTime DayOfIndex( TInt aIndex ); |
|
165 |
|
166 /** |
|
167 * Sets cursor to Active day |
|
168 */ |
|
169 void SetCursorToActiveDay(); |
|
170 |
|
171 /** |
|
172 * Month grid cells setup method |
|
173 * @param aListBox CAknGrid |
|
174 */ |
|
175 void ApplySelGridGraphicStyleL( CAknGrid& aListBox ); |
|
176 |
|
177 /** |
|
178 * Change Active Day and Data. |
|
179 */ |
|
180 void ChangeMonthL(); |
|
181 |
|
182 void HandleDayChangeL(TTime aNewActiveDay); |
|
183 |
|
184 /** |
|
185 * Icon column setting for CAknGrid |
|
186 * @param aListBox Set a Grid |
|
187 * @param aIndex Cell index |
|
188 * @param aP1 Cell top-left |
|
189 * @param aSize Cell size |
|
190 */ |
|
191 void SetupSelgridFormBitmapCellL(CAknGrid& aListBox, TInt aIndex, |
|
192 TPoint aP1, TSize aSize); |
|
193 /** |
|
194 * Drawing days of the week. |
|
195 * @param aGc Graphic context |
|
196 */ |
|
197 void DrawColLabel(CWindowGc& aGc, TBool aUseWeeks = ETrue) const; |
|
198 /** |
|
199 * Drawing week numbers. |
|
200 * @param aGc Graphic context |
|
201 */ |
|
202 void DrawRowLabel(CWindowGc& aGc) const; |
|
203 /** |
|
204 * Set Date(1-28,29,30,31) to iData. |
|
205 * Part of step 1 of construction of grid data |
|
206 */ |
|
207 void SetDateL(); |
|
208 |
|
209 TInt GridIndex() const; |
|
210 |
|
211 CCalenMonthView& MonthView() const; |
|
212 |
|
213 static TInt EntryTimeCompare(const CCalInstance& aInstance_1, |
|
214 const CCalInstance& aInstance_2); |
|
215 |
|
216 |
|
217 void HandleWeekNumberTapL(const TPoint &aPosition); |
|
218 |
|
219 |
|
220 TBool UseWeeks() const; |
|
221 |
|
222 TBool UseWeeksL() const; |
|
223 public: |
|
224 |
|
225 enum TMonthLayoutVariant |
|
226 { |
|
227 ENoLayoutVariantSet = 0, |
|
228 EMainCaleMonthPane, |
|
229 EBgCalePaneCp02, |
|
230 ECaleMonthDayHeadingPane, |
|
231 ECaleMonthWeekPane, |
|
232 EGridCaleMonthPane, |
|
233 ECaleMonthPaneG, |
|
234 ECaleMonthPaneG1, |
|
235 ECaleMonthPaneG2, |
|
236 ECaleMonthPaneG3, |
|
237 ECaleMonthPaneG9, |
|
238 EBgCaleHeadingPaneCp01, |
|
239 ECaleMonthPaneT1, |
|
240 ECaleMonthDayHeadingPaneT, |
|
241 ECaleMonthWeekPaneT, |
|
242 EBgCaleSidePaneCp01, |
|
243 ECellCaleMonthPane, |
|
244 ECellCaleMonthPaneG1, |
|
245 ECellCaleMonthPaneT1 |
|
246 }; |
|
247 |
|
248 /** |
|
249 * Container can request current variant layout index |
|
250 */ |
|
251 TInt LayoutVariantIndex(TMonthLayoutVariant aLayout) const; |
|
252 |
|
253 private: // From CCalenContainer |
|
254 /** |
|
255 * From CCalenContainer Date cahnge operation notification handler. |
|
256 * (i.e. GotoDate). |
|
257 */ |
|
258 void NotifyChangeDateL(); |
|
259 |
|
260 private: // From CCoeControl |
|
261 /** |
|
262 * From CCoeControl return number of components |
|
263 */ |
|
264 TInt CountComponentControls() const; |
|
265 /** |
|
266 * From CCoeControl retrun the component specified by aIndex |
|
267 */ |
|
268 CCoeControl* ComponentControl(TInt aIndex) const; |
|
269 /** |
|
270 * From CCoeControl processing of a key event |
|
271 */ |
|
272 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, |
|
273 TEventCode aType); |
|
274 |
|
275 /** |
|
276 * From CCoeControl Handle pointer event |
|
277 */ |
|
278 void HandlePointerEventL(const TPointerEvent& aPointerEvent); |
|
279 |
|
280 |
|
281 /** |
|
282 * From CCoeControl drawing month view |
|
283 */ |
|
284 void Draw(const TRect& /*aRect*/) const; |
|
285 |
|
286 /** |
|
287 * Pass skin information if needed. |
|
288 */ |
|
289 TTypeUid::Ptr MopSupplyObject(TTypeUid aId); |
|
290 |
|
291 /** |
|
292 * From CCoeControl Gets help context |
|
293 * @param aContext Help context |
|
294 */ |
|
295 void GetHelpContext(TCoeHelpContext& aContext) const; |
|
296 |
|
297 /** |
|
298 * From CCoeControl Resizes child controls |
|
299 */ |
|
300 void SizeChanged(); |
|
301 void FocusChanged( TDrawNow aDrawNow ); |
|
302 |
|
303 /** |
|
304 * From CCoeControl Handles a resource relative event |
|
305 */ |
|
306 void HandleResourceChange(TInt aType); |
|
307 |
|
308 private: // From CCalenContainer |
|
309 /** |
|
310 * From CCalenContainer Third phase constructor. |
|
311 * This function was called CCalenView::ConstructL(). |
|
312 */ |
|
313 void ConstructImplL(); |
|
314 |
|
315 /* |
|
316 Constructs heading/side/background skin context if enabled |
|
317 */ |
|
318 void ConstructBackgroundContextL(); |
|
319 |
|
320 /** |
|
321 * From CCalenContainer. |
|
322 * This methods is called after calendar settings have changed. |
|
323 * Implementation for month view without week numbers. |
|
324 */ |
|
325 void UpdateSize(); |
|
326 |
|
327 /** |
|
328 * Handles list box events. |
|
329 * |
|
330 * This function is invoked by CEikListBox to |
|
331 * notify the observer of list box events. |
|
332 * |
|
333 * @param aListBox The originating list box. |
|
334 * @param aEventType A code for the event. Further information |
|
335 * may be obtained by accessing the list box itself. |
|
336 */ |
|
337 void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType ); |
|
338 |
|
339 |
|
340 private: // own methods |
|
341 |
|
342 // just a wrapper for leaves |
|
343 void DoSizeChangedL(); |
|
344 |
|
345 // just a wrapper for leaves |
|
346 static TInt DoEntryTimeCompareL( const CCalInstance& aInstance_1, |
|
347 const CCalInstance& aInstance_2 ); |
|
348 |
|
349 TKeyResponse HandleAttemptToMoveL( TUint aKeyCode ); |
|
350 |
|
351 private: // New variables |
|
352 |
|
353 /* |
|
354 * This enumeration index should match |
|
355 */ |
|
356 enum TIconIndex |
|
357 { |
|
358 EIconNull = -1, // ENoEvent |
|
359 EIconMany, // EManyEvents |
|
360 EIconGrayed |
|
361 }; |
|
362 |
|
363 enum TCompareResult |
|
364 { |
|
365 EEqual = 0, // 1. == 2. |
|
366 ELessThan = -1, // 1. < 2. |
|
367 EGreaterThan = 1 // 1. > 2. |
|
368 }; |
|
369 |
|
370 |
|
371 CCalenMonthGrid* iGrid; // date's grid |
|
372 |
|
373 CMonthDataArray* iMonthDataArray; |
|
374 TTime iFirstDayOfGrid; |
|
375 TInt iTempMonth; // for short cut to go to a month |
|
376 TBuf<16> iDayFormat; |
|
377 |
|
378 CAknsFrameBackgroundControlContext* iBackgroundSkinContext; |
|
379 |
|
380 MCalenPreview* iPreview; |
|
381 |
|
382 // View specific data, references to views data |
|
383 TTime& iDate; |
|
384 TTime iOldFirstDayOfGrid; |
|
385 TBool iChangeMonth; |
|
386 TBool iChangeDay; |
|
387 |
|
388 // Own: Gesture helper |
|
389 GestureHelper::CGestureHelper* iGestureControl; |
|
390 // Own: this variable indicates that gesture event was handled. |
|
391 TBool iGestureHandled; |
|
392 }; |
|
393 |
|
394 #endif //CALENMONTHCONT_H |
|
395 |
|
396 // End of File |