|
1 /* |
|
2 * Copyright (c) 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: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include <avkon.hrh> |
|
21 |
|
22 #include <alf/alftextvisual.h> |
|
23 #include <alf/alfimagevisual.h> |
|
24 #include <alf/alfgridlayout.h> |
|
25 #include <alf/alfdecklayout.h> |
|
26 #include <alf/alfflowlayout.h> |
|
27 #include <alf/alfcurvepathlayout.h> |
|
28 #include <alf/alfcurvepath.h> |
|
29 #include <alf/alfevent.h> |
|
30 #include <alf/alfenv.h> |
|
31 #include <alf/alfdisplay.h> |
|
32 #include <alf/alfborderbrush.h> |
|
33 #include <alf/alfimagebrush.h> |
|
34 #include <alf/alfbrusharray.h> |
|
35 #include <alf/alfgradientbrush.h> |
|
36 #include <alf/alfshadowborderBrush.h> |
|
37 #include <alf/alftransformation.h> |
|
38 #include <alf/alftextstylemanager.h> |
|
39 #include <alf/alftextstyle.h> |
|
40 #include <alf/alfimageloaderutil.h> |
|
41 |
|
42 #include "alfexcalendarmonth.h" |
|
43 #include "alfexcalendardeckcontrol.h" |
|
44 #include "alfexcalendarengine.h" |
|
45 |
|
46 _LIT( KWkNo, "Wk" ); |
|
47 _LIT( KMonday, "Mo" ); |
|
48 _LIT( KTuesday, "Tu" ); |
|
49 _LIT( KWednesday, "We" ); |
|
50 _LIT( KThursday, "Th" ); |
|
51 _LIT( KFriday, "Fr" ); |
|
52 _LIT( KSaturday, "Sa" ); |
|
53 _LIT( KSunday, "Su" ); |
|
54 |
|
55 _LIT( KMonth1, "January" ); |
|
56 _LIT( KMonth2, "February" ); |
|
57 _LIT( KMonth3, "March" ); |
|
58 _LIT( KMonth4, "April" ); |
|
59 _LIT( KMonth5, "May" ); |
|
60 _LIT( KMonth6, "June" ); |
|
61 _LIT( KMonth7, "July" ); |
|
62 _LIT( KMonth8, "August" ); |
|
63 _LIT( KMonth9, "September" ); |
|
64 _LIT( KMonth10, "October" ); |
|
65 _LIT( KMonth11, "November" ); |
|
66 _LIT( KMonth12, "December" ); |
|
67 |
|
68 // svg files need full path in 3.2 |
|
69 _LIT( KMonthSVGBg, "c:\\data\\Images\\background.svg" ); |
|
70 _LIT( KNormalDayBg, "c:\\data\\Images\\normaldaybutton.svg" ); |
|
71 _LIT( KEventsDayBg, "c:\\data\\Images\\eventsdaybutton.svg" ); |
|
72 _LIT( KTitleBg, "c:\\data\\Images\\title.svg" ); |
|
73 _LIT( KSelectedDayBg, "c:\\data\\Images\\selectedday.svg" ); |
|
74 |
|
75 _LIT( KImagePath, "c:\\data\\Images\\" ); |
|
76 |
|
77 // Custom events |
|
78 enum |
|
79 { |
|
80 EShowCaledarEvents = 1, |
|
81 |
|
82 }; |
|
83 |
|
84 // Constant declarations |
|
85 // Month names |
|
86 const TDesC* KMonths[12] = { &KMonth1, &KMonth2, &KMonth3, &KMonth4, |
|
87 &KMonth5, &KMonth6, &KMonth7, &KMonth8, |
|
88 &KMonth9, &KMonth10, &KMonth11, &KMonth12 }; |
|
89 |
|
90 const TInt KXPaddingLen = 3; // padding between visuals in layout |
|
91 const TInt KYPaddingLen = 3; |
|
92 const TInt KNoOfRows = 7; |
|
93 const TInt KNoOfCols = 8; // including week numbers |
|
94 |
|
95 const TReal KDayViewSizeXChange = 60.0; |
|
96 const TReal KDayViewSizeYChange = 60.0; |
|
97 const TInt KDayViewTransitionTime = 800; |
|
98 const TInt KDayFocusTime = 1000; |
|
99 |
|
100 const TReal KUnitSize = 1.0f; |
|
101 const TReal KXSf = 1.32f; |
|
102 const TReal KYSf = 1.50f; |
|
103 const TReal KDayViewXSf = 15.0f; |
|
104 const TReal KDayViewYSf = 15.0f; |
|
105 |
|
106 |
|
107 // -------------------------------------------------------------------------- |
|
108 // CAlfExCalendarMonth::CAlfExCalendarMonth |
|
109 // -------------------------------------------------------------------------- |
|
110 // |
|
111 CAlfExCalendarMonth::CAlfExCalendarMonth( |
|
112 CAlfExCalendarDeckControl& aCalendarControl, |
|
113 CAlfEnv& aEnv, |
|
114 TDateTime aDateTime ) |
|
115 :iMonthNumber(0), iDayNoInWeek(0), iFocusedDay(0), iDayView( EFalse ), |
|
116 iCalendarControl( aCalendarControl ), iEnv( aEnv ), |
|
117 iIsDayFocused( EFalse ), iDateTime( aDateTime ) |
|
118 { |
|
119 } |
|
120 |
|
121 // -------------------------------------------------------------------------- |
|
122 // CAlfExCalendarMonth::~CAlfExCalendarMonth |
|
123 // -------------------------------------------------------------------------- |
|
124 // |
|
125 CAlfExCalendarMonth::~CAlfExCalendarMonth() |
|
126 { |
|
127 delete iEventTimer; |
|
128 delete iFocusedDayBrush; |
|
129 delete iNormalDayBrush; |
|
130 delete iEventsDayBrush; |
|
131 delete iImageLoaderUtil; |
|
132 } |
|
133 |
|
134 // -------------------------------------------------------------------------- |
|
135 // CAlfExCalendarMonth::NewLC |
|
136 // -------------------------------------------------------------------------- |
|
137 // |
|
138 CAlfExCalendarMonth* CAlfExCalendarMonth::NewLC( CAlfLayout* aParentLayout, |
|
139 TDateTime aDateTime, |
|
140 CAlfEnv& aEnv, |
|
141 CAlfExCalendarDeckControl& aCalendarControl ) |
|
142 { |
|
143 CAlfExCalendarMonth* self = |
|
144 new (ELeave) CAlfExCalendarMonth( aCalendarControl, aEnv, aDateTime ); |
|
145 CleanupStack::PushL( self ); |
|
146 |
|
147 self->ConstructL( aParentLayout ); |
|
148 return self; |
|
149 } |
|
150 |
|
151 // -------------------------------------------------------------------------- |
|
152 // CAlfExCalendarMonth::ConstructL |
|
153 // -------------------------------------------------------------------------- |
|
154 // |
|
155 void CAlfExCalendarMonth::ConstructL( CAlfLayout* aParentLayout ) |
|
156 { |
|
157 CAlfControl::ConstructL( iEnv ); |
|
158 |
|
159 iMonthNumber = iDateTime.Month(); |
|
160 iDateTime.SetDay(0); |
|
161 iTime = TTime( iDateTime ); |
|
162 iDayNoInWeek = iTime.DayNoInWeek(); |
|
163 iDaysInMonth = iTime.DaysInMonth(); |
|
164 |
|
165 iBottomGrid = CAlfGridLayout::AddNewL( *this, 1, 2, aParentLayout ); |
|
166 iBottomGrid->SetOpacity( TAlfTimedValue(1.0f) ); |
|
167 |
|
168 RArray<TInt> weights; |
|
169 weights.Append( 3 ); |
|
170 weights.Append( 12 ); |
|
171 iBottomGrid->SetRowsL( weights ); |
|
172 weights.Reset(); |
|
173 |
|
174 Env().TextureManager().SetImagePathL( KImagePath ); |
|
175 |
|
176 TRect displayRect = iEnv.PrimaryDisplay().VisibleArea(); |
|
177 |
|
178 iImageLoaderUtil = new(ELeave)CAlfImageLoaderUtil(); |
|
179 //iImageLoaderUtil->SetSize( TSize( displayRect.Width(), displayRect.Height() ) ); |
|
180 iImageLoaderUtil->SetSize( TSize(240, 320) ); // This is very important |
|
181 |
|
182 // set background to month view |
|
183 SetMonthBackgroundL( iBottomGrid ); |
|
184 |
|
185 // Add text visual for "month name and year" |
|
186 iMonthText = CAlfTextVisual::AddNewL( *this, iBottomGrid ); |
|
187 |
|
188 // sets title text for month ("Date Month name Year") |
|
189 SetMonthTitleTextL(); |
|
190 |
|
191 iMonthText->SetColor( KRgbYellow ); |
|
192 iMonthText->SetAlign( EAlfAlignHCenter, EAlfAlignVCenter ); |
|
193 |
|
194 // create font style and set to iMonthText |
|
195 TInt fontStyleId = KErrNotFound; |
|
196 fontStyleId = iEnv.TextStyleManager().CreatePlatformTextStyleL( |
|
197 EAknLogicalFontPrimarySmallFont, |
|
198 EAlfTextStyleSmall ); |
|
199 CAlfTextStyle* style = iEnv.TextStyleManager().TextStyle( fontStyleId ); |
|
200 style->SetTextSizeInPixels( 25, ETrue ); |
|
201 iMonthText->SetTextStyle( style->Id() ); |
|
202 |
|
203 // set svg graphics as Image brush to iMonthText visual |
|
204 SetSVGImageTextureL( iMonthText, KTitleBg ); |
|
205 |
|
206 // create dates grid and add dates |
|
207 iDatesGrid = CAlfGridLayout::AddNewL( |
|
208 *this, |
|
209 KNoOfCols, |
|
210 KNoOfRows, |
|
211 iBottomGrid ); |
|
212 AddDateVisualsL( iDatesGrid ); |
|
213 |
|
214 // set week names in iDatesGrid |
|
215 SetWeekDayNameL( KWkNo(), iDatesGrid, 0, KWeekNumberColor ); |
|
216 SetWeekDayNameL( KMonday(), iDatesGrid, 1 ); |
|
217 SetWeekDayNameL( KTuesday(), iDatesGrid, 2 ); |
|
218 SetWeekDayNameL( KWednesday(), iDatesGrid, 3 ); |
|
219 SetWeekDayNameL( KThursday(), iDatesGrid, 4 ); |
|
220 SetWeekDayNameL( KFriday(), iDatesGrid, 5 ); |
|
221 SetWeekDayNameL( KSaturday(), iDatesGrid, 6, KWeekendDayColor ); |
|
222 SetWeekDayNameL( KSunday(), iDatesGrid, 7, KWeekendDayColor ); |
|
223 |
|
224 // create CalendarEngine EventTimer |
|
225 iEventTimer = CAlfExCalendarEngineEventTimer::NewL( *this ); |
|
226 |
|
227 // Create all brushes here |
|
228 MAlfBitmapProvider* provider = iImageLoaderUtil->CreateSVGImageLoaderL( KNormalDayBg ); |
|
229 CAlfTexture& texture1 = Env().TextureManager().CreateTextureL( |
|
230 KAlfAutoGeneratedTextureId, |
|
231 provider, |
|
232 EAlfTextureFlagRetainResolution ); |
|
233 iNormalDayBrush = CAlfImageBrush::NewL( Env(), TAlfImage( texture1 ) ); |
|
234 iNormalDayBrush->SetLayer( EAlfBrushLayerBackground ); |
|
235 |
|
236 provider = iImageLoaderUtil->CreateSVGImageLoaderL( KEventsDayBg ); |
|
237 CAlfTexture& texture2 = Env().TextureManager().CreateTextureL( |
|
238 KAlfAutoGeneratedTextureId, |
|
239 provider, |
|
240 EAlfTextureFlagRetainResolution ); |
|
241 iEventsDayBrush = CAlfImageBrush::NewL( Env(), TAlfImage( texture2 ) ); |
|
242 iEventsDayBrush->SetLayer( EAlfBrushLayerBackground ); |
|
243 |
|
244 provider = iImageLoaderUtil->CreateSVGImageLoaderL( KSelectedDayBg ); |
|
245 CAlfTexture& texture3 = Env().TextureManager().CreateTextureL( |
|
246 KAlfAutoGeneratedTextureId, |
|
247 provider, |
|
248 EAlfTextureFlagRetainResolution ); |
|
249 iFocusedDayBrush = CAlfImageBrush::NewL( Env(), TAlfImage( texture3 ) ); |
|
250 iFocusedDayBrush->SetLayer( EAlfBrushLayerForeground ); |
|
251 |
|
252 // end of brushes creation |
|
253 |
|
254 // set the dates in iDatesGrid according to the iTime |
|
255 SetDatesL( iDatesGrid, iTime ); // TODO - refactor - API can be changed |
|
256 |
|
257 iDatesGrid->SetInnerPadding( TPoint( KXPaddingLen, KYPaddingLen ) ); |
|
258 } |
|
259 |
|
260 // -------------------------------------------------------------------------- |
|
261 // CAlfExCalendarMonth::SetMonthTitleTextL |
|
262 // -------------------------------------------------------------------------- |
|
263 // |
|
264 void CAlfExCalendarMonth::SetMonthTitleTextL() |
|
265 { |
|
266 // this fuction sets month title as "date month year" |
|
267 TBuf<4> yearBuf; |
|
268 yearBuf.Num( iDateTime.Year() ); |
|
269 TBuf<2> dayBuf; |
|
270 dayBuf.Num( iFocusedDay+1 ); // iFocusedDay starts from 0 |
|
271 |
|
272 TBuf<16> buf; |
|
273 buf.Append( dayBuf ); |
|
274 buf.Append( _L(" ")); |
|
275 buf.Append( *(KMonths[iDateTime.Month()]) ); |
|
276 buf.Append( _L(" ")); |
|
277 buf.Append( yearBuf ); |
|
278 iMonthText->SetTextL( buf ); |
|
279 } |
|
280 |
|
281 |
|
282 // -------------------------------------------------------------------------- |
|
283 // CAlfExCalendarMonth::SetMonthBackgroundL |
|
284 // -------------------------------------------------------------------------- |
|
285 // |
|
286 void CAlfExCalendarMonth::SetMonthBackgroundL( CAlfVisual* aVisual, TRgb /* aColor */ ) |
|
287 { |
|
288 // IMPORTANT: first enable the brushes for the visual |
|
289 aVisual->EnableBrushesL(); |
|
290 |
|
291 // now set brush |
|
292 SetSVGImageTextureL( aVisual, KMonthSVGBg ); |
|
293 } |
|
294 |
|
295 // -------------------------------------------------------------------------- |
|
296 // CAlfExCalendarMonth::SetBgImgL |
|
297 // -------------------------------------------------------------------------- |
|
298 // |
|
299 void CAlfExCalendarMonth::SetBgImgL( CAlfVisual* /* aVisual */ ) |
|
300 { |
|
301 // This method is not used currently |
|
302 /* |
|
303 // Set background image |
|
304 TRAP_IGNORE( |
|
305 CAlfTexture& texture = |
|
306 Env().TextureManager().LoadTextureL( |
|
307 *(KMonthBackgrounds[iMonthNumber]), |
|
308 EAlfTextureFlagDefault, //EAlfTextureFlagDoNotRetainResolution, |
|
309 KAlfAutoGeneratedTextureId ); |
|
310 |
|
311 CAlfImageBrush* imgBrush = CAlfImageBrush::NewLC( Env(), TAlfImage( texture ) ); |
|
312 imgBrush->SetLayer( EAlfBrushLayerBackground ); |
|
313 aVisual->Brushes()->AppendL( imgBrush, EAlfHasOwnership ); |
|
314 CleanupStack::Pop( imgBrush ); |
|
315 ); |
|
316 */ |
|
317 } |
|
318 |
|
319 // -------------------------------------------------------------------------- |
|
320 // CAlfExCalendarMonth::SetSVGImageTextureL |
|
321 // -------------------------------------------------------------------------- |
|
322 // |
|
323 void CAlfExCalendarMonth::SetSVGImageTextureL( |
|
324 CAlfVisual* aVisual, |
|
325 const TDesC& aSvgFileName ) |
|
326 { |
|
327 // IMPORTANT: first enable the brushes for the visual |
|
328 aVisual->EnableBrushesL(); // incase, it has not been enabled |
|
329 |
|
330 // SVG graphics loading |
|
331 MAlfBitmapProvider* provider = iImageLoaderUtil->CreateSVGImageLoaderL( aSvgFileName ); |
|
332 CAlfTexture& texture = Env().TextureManager().CreateTextureL( |
|
333 KAlfAutoGeneratedTextureId, |
|
334 provider, |
|
335 EAlfTextureFlagRetainResolution ); |
|
336 |
|
337 // create Image brush |
|
338 CAlfImageBrush* imgBrush = CAlfImageBrush::NewLC( Env(), TAlfImage( texture ) ); |
|
339 imgBrush->SetLayer( EAlfBrushLayerBackground ); |
|
340 aVisual->Brushes()->AppendL( imgBrush, EAlfHasOwnership ); |
|
341 CleanupStack::Pop( imgBrush ); |
|
342 } |
|
343 |
|
344 // -------------------------------------------------------------------------- |
|
345 // CAlfExCalendarMonth::SetWeekDayNameL |
|
346 // -------------------------------------------------------------------------- |
|
347 // |
|
348 void CAlfExCalendarMonth::SetWeekDayNameL( |
|
349 const TDesC& aDayName, |
|
350 CAlfGridLayout* aGrid, |
|
351 TInt aDayIndex, |
|
352 TRgb aColor ) |
|
353 { |
|
354 CAlfVisual& cell = aGrid->Visual( aDayIndex ); |
|
355 CAlfTextVisual& textVisual = static_cast<CAlfTextVisual&>( cell ); |
|
356 |
|
357 textVisual.SetTextL( aDayName ); |
|
358 textVisual.SetColor( aColor ); |
|
359 |
|
360 TInt fontStyleId = KErrNotFound; |
|
361 fontStyleId = iEnv.TextStyleManager().CreatePlatformTextStyleL( |
|
362 EAknLogicalFontPrimarySmallFont, |
|
363 EAlfTextStyleSmall ); |
|
364 |
|
365 CAlfTextStyle* style = iEnv.TextStyleManager().TextStyle( fontStyleId ); |
|
366 style->SetTextSizeInPixels( 20, ETrue ); |
|
367 style->SetBold( ETrue ); |
|
368 textVisual.SetTextStyle( style->Id() ); |
|
369 } |
|
370 |
|
371 // -------------------------------------------------------------------------- |
|
372 // CAlfExCalendarMonth::AddDateVisualsL |
|
373 // -------------------------------------------------------------------------- |
|
374 // |
|
375 void CAlfExCalendarMonth::AddDateVisualsL( CAlfGridLayout* aGrid ) |
|
376 { |
|
377 // adds text visuals i Grid |
|
378 for (TInt i = 0 ; i < KNoOfRows * KNoOfCols ; i ++ ) |
|
379 { |
|
380 CAlfTextVisual* text = CAlfTextVisual::AddNewL( *this, aGrid ); |
|
381 text->EnableBrushesL( ETrue ); |
|
382 } |
|
383 } |
|
384 |
|
385 // -------------------------------------------------------------------------- |
|
386 // CAlfExCalendarMonth::SetDatesL |
|
387 // -------------------------------------------------------------------------- |
|
388 // |
|
389 TInt CAlfExCalendarMonth::SetDatesL( |
|
390 CAlfGridLayout* aGrid, |
|
391 TTime aTime ) |
|
392 { |
|
393 // logic to arrange dates and week numbers in correct positions |
|
394 // TODO - there is problem of showing weeke numbers in some months. |
|
395 // look into TTime API/implementation and fix. |
|
396 |
|
397 iDaysInMonth = aTime.DaysInMonth(); |
|
398 TInt emptyDays = aTime.DayNoInWeek(); |
|
399 TInt dateTextStyle = DateTextStyleL(); |
|
400 TInt weekTextStyle = dateTextStyle; |
|
401 |
|
402 // 1st row of dates |
|
403 // set week number at 1st column |
|
404 TInt dayIdx = 1; |
|
405 TInt visualIdx = 8; |
|
406 SetWeekNumberL( aGrid, visualIdx, dayIdx, weekTextStyle ); |
|
407 |
|
408 // move to 1st day in month |
|
409 visualIdx++; |
|
410 // clear text visuals in the grid for first empty days |
|
411 for( TInt idx = 1; idx <= emptyDays; idx++, visualIdx++ ) |
|
412 { |
|
413 ClearDayVisualL( aGrid, visualIdx ); |
|
414 } |
|
415 |
|
416 // set date numbers from correct week (after the empty days) |
|
417 for( TInt colIdx = emptyDays+1; colIdx < KNoOfCols; colIdx++, visualIdx++, dayIdx++ ) |
|
418 { |
|
419 if( colIdx > KNoOfCols-3 ) // weekend days |
|
420 { |
|
421 SetDateNumberL( aGrid, visualIdx, dayIdx, dateTextStyle, KWeekendDayColor ); |
|
422 } |
|
423 else |
|
424 { |
|
425 SetDateNumberL( aGrid, visualIdx, dayIdx, dateTextStyle ); |
|
426 } |
|
427 } |
|
428 |
|
429 // fill week and date numbers from 2nd row |
|
430 for( TInt rowIdx = 2; rowIdx < KNoOfRows && dayIdx <= iDaysInMonth; rowIdx++ ) |
|
431 { |
|
432 // set week number at 1st column |
|
433 SetWeekNumberL( aGrid, visualIdx, dayIdx, weekTextStyle ); |
|
434 visualIdx++; |
|
435 |
|
436 // set dates in next columns |
|
437 for( TInt colIdx = 1; |
|
438 colIdx < KNoOfCols && dayIdx <= iDaysInMonth; /* only week days */ |
|
439 colIdx++, visualIdx++, dayIdx++ ) |
|
440 { |
|
441 if( colIdx > KNoOfCols-3 ) // weekend days |
|
442 { |
|
443 SetDateNumberL( aGrid, visualIdx, dayIdx, dateTextStyle, KWeekendDayColor ); |
|
444 } |
|
445 else // week days |
|
446 { |
|
447 SetDateNumberL( aGrid, visualIdx, dayIdx, dateTextStyle ); |
|
448 } |
|
449 } |
|
450 } |
|
451 |
|
452 // clear remaining text visuals in the grid |
|
453 for( ; visualIdx < KNoOfRows * KNoOfCols; visualIdx++ ) |
|
454 { |
|
455 ClearDayVisualL( aGrid, visualIdx ); |
|
456 } |
|
457 |
|
458 return 1; |
|
459 } |
|
460 |
|
461 // -------------------------------------------------------------------------- |
|
462 // CAlfExCalendarMonth::SetDateNumberL |
|
463 // -------------------------------------------------------------------------- |
|
464 // |
|
465 void CAlfExCalendarMonth::SetDateNumberL( |
|
466 CAlfGridLayout* aGrid, |
|
467 TInt aVisualIndex, |
|
468 TInt aDayNumber, |
|
469 TInt aDateTextStyle, |
|
470 TRgb aColor ) |
|
471 { |
|
472 // get text visual from grid |
|
473 CAlfVisual& cell = aGrid->Visual( aVisualIndex ); |
|
474 CAlfTextVisual& textVisual = static_cast<CAlfTextVisual&>( cell ); |
|
475 textVisual.SetTextStyle( aDateTextStyle ); |
|
476 textVisual.SetColor( aColor ); |
|
477 textVisual.SetAlign( EAlfAlignHCenter, EAlfAlignVCenter ); |
|
478 |
|
479 // set the text |
|
480 TBuf<3> buf; |
|
481 buf.Num( aDayNumber ); |
|
482 textVisual.SetTextL( buf ); |
|
483 |
|
484 // append brush |
|
485 textVisual.Brushes()->AppendL( iNormalDayBrush, EAlfDoesNotHaveOwnership ); |
|
486 } |
|
487 |
|
488 // -------------------------------------------------------------------------- |
|
489 // CAlfExCalendarMonth::SetWeekNumberL |
|
490 // -------------------------------------------------------------------------- |
|
491 // |
|
492 void CAlfExCalendarMonth::SetWeekNumberL( |
|
493 CAlfGridLayout* aGrid, |
|
494 TInt aVisualIndex, |
|
495 TInt aDayNumber, |
|
496 TInt aWeekTextStyle ) |
|
497 { |
|
498 // get text visual from grid |
|
499 CAlfVisual& cell = aGrid->Visual( aVisualIndex ); |
|
500 CAlfTextVisual& textVisual = static_cast<CAlfTextVisual&>( cell ); |
|
501 textVisual.SetColor( KWeekNumberColor ); |
|
502 textVisual.SetAlign( EAlfAlignHCenter, EAlfAlignVCenter ); |
|
503 textVisual.SetTextStyle( aWeekTextStyle ); |
|
504 |
|
505 // use aDayNumber to get the correct week number |
|
506 TDateTime tempDateTime = iDateTime; |
|
507 tempDateTime.SetDay( aDayNumber ); |
|
508 TTime tempTime = TTime( tempDateTime ); |
|
509 |
|
510 TBuf<3> buf; |
|
511 buf.Num( tempTime.WeekNoInYear() ); |
|
512 textVisual.SetTextL( buf ); |
|
513 } |
|
514 |
|
515 // -------------------------------------------------------------------------- |
|
516 // CAlfExCalendarMonth::ClearDayVisualL |
|
517 // -------------------------------------------------------------------------- |
|
518 // |
|
519 void CAlfExCalendarMonth::ClearDayVisualL( |
|
520 CAlfGridLayout* aGrid, |
|
521 TInt aVisualIndex ) |
|
522 { |
|
523 CAlfVisual& cell = aGrid->Visual( aVisualIndex ); |
|
524 CAlfTextVisual& textVisual = static_cast<CAlfTextVisual&>( cell ); |
|
525 |
|
526 TBuf<3> buf; |
|
527 textVisual.SetTextL( buf ); // set empty string |
|
528 |
|
529 // remove all brushes |
|
530 if( textVisual.Brushes() ) |
|
531 { |
|
532 TInt count = textVisual.Brushes()->Count(); |
|
533 for( TInt i = 0; i < count; ++i ) |
|
534 { |
|
535 textVisual.Brushes()->Remove( 0 ); |
|
536 } |
|
537 } |
|
538 } |
|
539 |
|
540 // -------------------------------------------------------------------------- |
|
541 // CAlfExCalendarMonth::DateTextStyleL |
|
542 // -------------------------------------------------------------------------- |
|
543 // |
|
544 TInt CAlfExCalendarMonth::DateTextStyleL() |
|
545 { |
|
546 // creates font style id and returns |
|
547 TInt fontStyleId = KErrNotFound; |
|
548 fontStyleId = iEnv.TextStyleManager().CreatePlatformTextStyleL( |
|
549 EAknLogicalFontPrimarySmallFont, |
|
550 EAlfTextStyleSmall ); |
|
551 CAlfTextStyle* style = iEnv.TextStyleManager().TextStyle( fontStyleId ); |
|
552 style->SetTextSizeInPixels( 20, ETrue ); |
|
553 return style->Id(); |
|
554 } |
|
555 |
|
556 // -------------------------------------------------------------------------- |
|
557 // CAlfExCalendarMonth::UpdateMonthL |
|
558 // -------------------------------------------------------------------------- |
|
559 // |
|
560 void CAlfExCalendarMonth::UpdateMonthL( TDateTime aDateTime ) |
|
561 { |
|
562 // updates month acording to received aDateTime |
|
563 |
|
564 iDateTime = aDateTime; |
|
565 iDateTime.SetDay(0); |
|
566 |
|
567 iTime = TTime( iDateTime ); |
|
568 iDaysInMonth = iTime.DaysInMonth(); |
|
569 iDayNoInWeek = iTime.DayNoInWeek(); |
|
570 iMonthNumber = iDateTime.Month(); |
|
571 |
|
572 SetDatesL( iDatesGrid, iTime ); |
|
573 |
|
574 TBuf<4> yearBuf; |
|
575 yearBuf.Num( iDateTime.Year() ); |
|
576 TBuf<16> buf; |
|
577 buf.Append( *(KMonths[iMonthNumber]) ); |
|
578 buf.Append( _L(" ")); |
|
579 buf.Append( yearBuf ); |
|
580 |
|
581 iMonthText->SetTextL( buf ); |
|
582 } |
|
583 |
|
584 // -------------------------------------------------------------------------- |
|
585 // CAlfExCalendarMonth::MonthFocusedL |
|
586 // -------------------------------------------------------------------------- |
|
587 // |
|
588 void CAlfExCalendarMonth::MonthFocusedL() |
|
589 { |
|
590 // update(some kind of selection) all the days which have calendar events |
|
591 UpdateDaysWithCalEventsL(); |
|
592 |
|
593 // focus the 1st day |
|
594 iFocusedDay = 0; |
|
595 iDayVisualIndex = (9 + iDayNoInWeek + iFocusedDay); |
|
596 CAlfVisual& startDay = iDatesGrid->Visual( iDayVisualIndex ); |
|
597 FocusDayL( static_cast<CAlfTextVisual&>( startDay ) ); |
|
598 } |
|
599 |
|
600 // -------------------------------------------------------------------------- |
|
601 // CAlfExCalendarMonth::UpdateDaysWithCalEventsL |
|
602 // -------------------------------------------------------------------------- |
|
603 // |
|
604 void CAlfExCalendarMonth::UpdateDaysWithCalEventsL() |
|
605 { |
|
606 iDaysInMonth = iTime.DaysInMonth(); |
|
607 iDayNoInWeek = iTime.DayNoInWeek(); |
|
608 |
|
609 CAlfExCalendarEngine& calendarEngine = iCalendarControl.CalendarEngine(); |
|
610 calendarEngine.LoadCalendarEventsL( iTime ); |
|
611 |
|
612 TInt dayVisualIndex = (9 + iDayNoInWeek); // 1st day visual in the month |
|
613 for( TInt i = 0; i < iDaysInMonth; i++, dayVisualIndex++ ) |
|
614 { |
|
615 if( dayVisualIndex%8 == 0 ) // Visual index is at week number column (i.e., at column 0) |
|
616 { |
|
617 dayVisualIndex++; |
|
618 } |
|
619 if( calendarEngine.EventsAvailable( iTime + (TTimeIntervalDays)i ) ) |
|
620 { |
|
621 CAlfVisual& cell = iDatesGrid->Visual( dayVisualIndex ); |
|
622 |
|
623 // add shadow border brush to the day visual |
|
624 cell.Brushes()->AppendL( iEventsDayBrush, EAlfDoesNotHaveOwnership ); |
|
625 } |
|
626 } |
|
627 } |
|
628 |
|
629 // -------------------------------------------------------------------------- |
|
630 // CAlfExCalendarMonth::RemoveAllDayBrushesL |
|
631 // -------------------------------------------------------------------------- |
|
632 // |
|
633 void CAlfExCalendarMonth::RemoveAllDayBrushesL() |
|
634 { |
|
635 // remove all brushes of day visuals in grid |
|
636 for( TInt i = 0 ; i < KNoOfRows * KNoOfCols ; i++ ) |
|
637 { |
|
638 CAlfVisual& day = iDatesGrid->Visual( i ); |
|
639 |
|
640 if( day.Brushes() ) |
|
641 { |
|
642 TInt count = day.Brushes()->Count(); |
|
643 for( TInt i = 0; i < count; ++i ) |
|
644 { |
|
645 day.Brushes()->Remove( 0 ); |
|
646 } |
|
647 } |
|
648 } |
|
649 } |
|
650 |
|
651 // -------------------------------------------------------------------------- |
|
652 // CAlfExCalendarMonth::MoveDayFocusL |
|
653 // -------------------------------------------------------------------------- |
|
654 // |
|
655 void CAlfExCalendarMonth::MoveDayFocusL( TInt aChange ) |
|
656 { |
|
657 CAlfVisual& day1 = iDatesGrid->Visual( iDayVisualIndex ); |
|
658 UnFocusDayL( static_cast<CAlfTextVisual&>( day1 ) ); |
|
659 |
|
660 iFocusedDay += aChange; |
|
661 if ( iFocusedDay < 0 ) |
|
662 { |
|
663 RemoveAllDayBrushesL(); |
|
664 iCalendarControl.SetMonthView( EFalse ); |
|
665 return; |
|
666 } |
|
667 if (iFocusedDay > iDaysInMonth -1 ) |
|
668 { |
|
669 RemoveAllDayBrushesL(); |
|
670 iCalendarControl.SetMonthView( EFalse ); |
|
671 return; |
|
672 } |
|
673 |
|
674 if( aChange == 7 ) |
|
675 { |
|
676 iDayVisualIndex += 8; |
|
677 } |
|
678 else if( aChange == -7 ) |
|
679 { |
|
680 iDayVisualIndex -= 8; |
|
681 } |
|
682 else |
|
683 { |
|
684 iDayVisualIndex += aChange; |
|
685 if( iDayVisualIndex%8 == 0 ) // Visual index is at week number column (column 0) |
|
686 { |
|
687 if( aChange > 0 ) // change is +1. move to next visual position |
|
688 { |
|
689 iDayVisualIndex++; |
|
690 } |
|
691 else // change is -1. Move to previous visual position |
|
692 { |
|
693 iDayVisualIndex--; |
|
694 } |
|
695 } |
|
696 } |
|
697 |
|
698 CAlfVisual& day2 = iDatesGrid->Visual( iDayVisualIndex ); |
|
699 FocusDayL( static_cast<CAlfTextVisual&>( day2 ) ); |
|
700 } |
|
701 |
|
702 // -------------------------------------------------------------------------- |
|
703 // CAlfExCalendarMonth::UnFocusDayL |
|
704 // -------------------------------------------------------------------------- |
|
705 // |
|
706 void CAlfExCalendarMonth::UnFocusDayL( CAlfTextVisual& aTextVisual ) |
|
707 { |
|
708 if( !iIsDayFocused ) // if day is not focued, dont do unfocus |
|
709 { |
|
710 return; |
|
711 } |
|
712 iIsDayFocused = EFalse; |
|
713 |
|
714 iEventTimer->Cancel(); |
|
715 |
|
716 // IMPORTANT: Remove brushes applied ONLY in FocusDayL() |
|
717 if( aTextVisual.Brushes() ) |
|
718 { |
|
719 aTextVisual.Brushes()->Remove( aTextVisual.Brushes()->Count()-1 ); // 1st Brush |
|
720 } |
|
721 |
|
722 // must scale back to original size |
|
723 ScaleVisualL( aTextVisual, (KUnitSize/KXSf), (KUnitSize/KYSf), KDayFocusTime ); |
|
724 } |
|
725 |
|
726 // -------------------------------------------------------------------------- |
|
727 // CAlfExCalendarMonth::FocusDayL |
|
728 // -------------------------------------------------------------------------- |
|
729 // |
|
730 void CAlfExCalendarMonth::FocusDayL( CAlfTextVisual& aTextVisual ) |
|
731 { |
|
732 if( iIsDayFocused ) // if day is already focused |
|
733 { |
|
734 return; |
|
735 } |
|
736 SetMonthTitleTextL(); |
|
737 |
|
738 iIsDayFocused = ETrue; |
|
739 |
|
740 // Append brush 1 |
|
741 aTextVisual.Brushes()->AppendL( iFocusedDayBrush, EAlfDoesNotHaveOwnership ); |
|
742 |
|
743 ScaleVisualL( aTextVisual, KXSf, KYSf, KDayFocusTime ); |
|
744 |
|
745 TTimeIntervalMicroSeconds32 dayOpenTime( 6000000 ); // EVENT TIMER |
|
746 iEventTimer->StartTimer( dayOpenTime ); |
|
747 } |
|
748 |
|
749 // -------------------------------------------------------------------------- |
|
750 // CAlfExCalendarMonth::OpenDayViewL |
|
751 // -------------------------------------------------------------------------- |
|
752 // |
|
753 void CAlfExCalendarMonth::OpenDayViewL() |
|
754 { |
|
755 // check if calendar events available for the day |
|
756 CAlfExCalendarEngine& calendarEngine = iCalendarControl.CalendarEngine(); |
|
757 if( !calendarEngine.EventsAvailable( iTime + (TTimeIntervalDays)iFocusedDay ) ) |
|
758 { |
|
759 return; // return if no calendar events for the day |
|
760 } |
|
761 // get calendar events |
|
762 calendarEngine.GetEventInformation( |
|
763 iTime + (TTimeIntervalDays)iFocusedDay, |
|
764 0, |
|
765 iCalendarEventTextBuffer ); |
|
766 |
|
767 TAlfTimedValue opacity; |
|
768 opacity.SetValueNow( 1 ); |
|
769 opacity.SetTarget( 0, KDayViewTransitionTime ); // in milliseconds |
|
770 // Set opacity of all visuals to 0 |
|
771 for (TInt i = 0 ; i < KNoOfRows * KNoOfCols ; i ++ ) |
|
772 { |
|
773 CAlfTextVisual& day = static_cast<CAlfTextVisual&>( iDatesGrid->Visual( i ) ); |
|
774 day.SetOpacity( opacity ); |
|
775 } |
|
776 |
|
777 // store the original day visual position to be used in UnFocusL() |
|
778 // to move it back to original position |
|
779 iOriginalDayPos = iDatesGrid->Visual(iDayVisualIndex).Pos(); |
|
780 |
|
781 // now move the day visual to center on display |
|
782 TRect displayRect = iEnv.PrimaryDisplay().VisibleArea(); |
|
783 TAlfRealPoint pos = TAlfRealPoint(displayRect.Width()/2, displayRect.Height()/3 ); |
|
784 |
|
785 CAlfTextVisual& day = static_cast<CAlfTextVisual&>( iDatesGrid->Visual( iDayVisualIndex ) ); |
|
786 day.SetPos( pos, KDayViewTransitionTime ); |
|
787 |
|
788 // Scale the day to fit entire display |
|
789 ScaleVisualL( day, KDayViewXSf, KDayViewYSf, KDayViewTransitionTime ); |
|
790 |
|
791 // send custom event to show calendar events after KDayViewTransitionTime |
|
792 iEnv.Send( TAlfCustomEventCommand( EShowCaledarEvents, this ), KDayViewTransitionTime ); |
|
793 |
|
794 iDayView = ETrue; |
|
795 } |
|
796 |
|
797 // -------------------------------------------------------------------------- |
|
798 // CAlfExCalendarMonth::CloseDayViewL |
|
799 // -------------------------------------------------------------------------- |
|
800 // |
|
801 void CAlfExCalendarMonth::CloseDayViewL() |
|
802 { |
|
803 // cancel event timer |
|
804 iEventTimer->Cancel(); |
|
805 |
|
806 CAlfTextVisual& dayEventsVisual = |
|
807 static_cast<CAlfTextVisual&>( iDatesGrid->Visual( (KNoOfRows*KNoOfCols)-1 ) ); |
|
808 // no need to put dayEventsVisual visual back to original size/position. |
|
809 // this can be used dedicatedly to show calendar events |
|
810 |
|
811 // just empty the text and hide it using opacity setting |
|
812 TBuf<1> empty; |
|
813 dayEventsVisual.SetTextL( empty ); |
|
814 dayEventsVisual.SetOpacity(0); |
|
815 |
|
816 // scale the opened day in OpenDayViewL() back to oroginal size |
|
817 CAlfTextVisual& day = static_cast<CAlfTextVisual&>( iDatesGrid->Visual( iDayVisualIndex ) ); |
|
818 ScaleVisualL( day, (KUnitSize/KDayViewXSf), (KUnitSize/KDayViewYSf), KDayViewTransitionTime ); |
|
819 |
|
820 // set position of opened day in OpenDayViewL() back to oroginal position |
|
821 day.SetPos( iOriginalDayPos.ValueNow(), KDayViewTransitionTime ); |
|
822 |
|
823 //set all visuals opacity to 1 |
|
824 TAlfTimedValue opacity; |
|
825 opacity.SetValueNow( 0.0 ); |
|
826 opacity.SetTarget( 1.0, KDayViewTransitionTime ); // in milliseconds |
|
827 for (TInt i = 0 ; i < KNoOfRows * KNoOfCols ; i ++ ) |
|
828 { |
|
829 CAlfTextVisual& day = static_cast<CAlfTextVisual&>( iDatesGrid->Visual( i ) ); |
|
830 day.SetOpacity( opacity ); |
|
831 } |
|
832 dayEventsVisual.SetOpacity(0); // hide the dedicated dayEventsVisual |
|
833 } |
|
834 |
|
835 // -------------------------------------------------------------------------- |
|
836 // CAlfExCalendarMonth::ScaleVisualL |
|
837 // -------------------------------------------------------------------------- |
|
838 // |
|
839 void CAlfExCalendarMonth::ScaleVisualL( |
|
840 CAlfVisual& aVisual, |
|
841 TReal aXSf, |
|
842 TReal aYSf, |
|
843 TInt aTime ) |
|
844 { |
|
845 aVisual.EnableTransformationL(); |
|
846 |
|
847 TAlfTimedValue xSc( KUnitSize ); |
|
848 xSc.SetTarget( aXSf, aTime ); |
|
849 TAlfTimedValue ySc( KUnitSize ); |
|
850 ySc.SetTarget( aYSf, aTime ); |
|
851 aVisual.Transformation().Scale( xSc, ySc ); |
|
852 } |
|
853 |
|
854 // -------------------------------------------------------------------------- |
|
855 // CAlfExCalendarMonth::RotateVisualL |
|
856 // -------------------------------------------------------------------------- |
|
857 // |
|
858 void CAlfExCalendarMonth::RotateVisualL( |
|
859 CAlfVisual& aVisual, |
|
860 TReal aInitAngle, |
|
861 TReal aTargetAngle, |
|
862 TInt aTime ) |
|
863 { |
|
864 aVisual.EnableTransformationL(); |
|
865 |
|
866 TAlfTimedValue angle( aInitAngle ); |
|
867 angle.SetTarget( aTargetAngle, aTime ); |
|
868 aVisual.Transformation().Rotate( angle , 1.0, 0.0, 0.0 ); |
|
869 } |
|
870 |
|
871 // -------------------------------------------------------------------------- |
|
872 // CAlfExCalendarMonth::SetTextStylesL |
|
873 // -------------------------------------------------------------------------- |
|
874 // |
|
875 void CAlfExCalendarMonth::SetTextStylesL( |
|
876 CAlfTextVisual& aTextVisual, |
|
877 const TDesC &aText, |
|
878 TRgb aColor, |
|
879 CAlfTextVisual::TLineWrap aLineWrap, |
|
880 TAlfAlignHorizontal /*aAlignH*/, |
|
881 TAlfAlignVertical /*aAlignV*/, |
|
882 TPoint /*aPoint*/ ) |
|
883 { |
|
884 aTextVisual.SetTextL( aText ); |
|
885 aTextVisual.SetColor( aColor ); |
|
886 aTextVisual.SetWrapping( aLineWrap ); |
|
887 aTextVisual.SetAlign( EAlfAlignHLeft, EAlfAlignVTop ); |
|
888 aTextVisual.SetPadding( TPoint(5,5) ); |
|
889 |
|
890 // S60 Font IDs: |
|
891 // EAknLogicalFontPrimaryFont, EAknLogicalFontSecondaryFont, EAknLogicalFontTitleFont, |
|
892 // EAknLogicalFontDigitalFont, EAknHighestLogicalFont, EAknLogicalFontPrimarySmallFont |
|
893 TInt fontStyleId = KErrNotFound; |
|
894 fontStyleId = iEnv.TextStyleManager().CreatePlatformTextStyleL( |
|
895 EAknLogicalFontPrimarySmallFont, |
|
896 EAlfTextStyleSmall ); |
|
897 |
|
898 CAlfTextStyle* style = iEnv.TextStyleManager().TextStyle( fontStyleId ); |
|
899 TInt sizeInPixels = style->TextSizeInPixels(); |
|
900 style->SetTextSizeInPixels( 20, ETrue ); |
|
901 style->SetBold( EFalse ); |
|
902 style->SetItalic( EFalse ); |
|
903 style->SetUnderline( ETrue ); |
|
904 style->SetStrikeThrough( EFalse ); |
|
905 aTextVisual.SetTextStyle( style->Id() ); |
|
906 } |
|
907 |
|
908 // -------------------------------------------------------------------------- |
|
909 // CAlfExCalendarMonth::ShowCalendarEventsL |
|
910 // -------------------------------------------------------------------------- |
|
911 // |
|
912 void CAlfExCalendarMonth::ShowCalendarEventsL() |
|
913 { |
|
914 // use last text visual in the grid to show the calendar events |
|
915 CAlfTextVisual& dayEventsVisual = |
|
916 static_cast<CAlfTextVisual&>( iDatesGrid->Visual( (KNoOfRows*KNoOfCols)-1 ) ); |
|
917 |
|
918 // set dayEventsVisual position at 1st text visual of grid. |
|
919 // to align the day events from below the month name |
|
920 dayEventsVisual.SetPos( iDatesGrid->Visual(0).Pos() ); |
|
921 |
|
922 // set the size to fit to bottom right corner of display. |
|
923 TAlfRealRect visualArea = dayEventsVisual.DisplayRectTarget(); |
|
924 TAlfRealPoint sizeChange( 200, 200 ); // width, height |
|
925 TAlfRealPoint newSize = TAlfRealPoint( visualArea.Size().iWidth, visualArea.Size().iHeight) + sizeChange; |
|
926 dayEventsVisual.SetSize( newSize, 0 ); |
|
927 |
|
928 // now set the calendar events text |
|
929 SetTextStylesL( dayEventsVisual, iCalendarEventTextBuffer ); |
|
930 |
|
931 // set opacity to 1 to make it visible |
|
932 TAlfTimedValue opacity; |
|
933 opacity.SetValueNow( 0 ); |
|
934 opacity.SetTarget( 1, 500 ); // in milliseconds |
|
935 dayEventsVisual.SetOpacity( opacity ); |
|
936 } |
|
937 |
|
938 // -------------------------------------------------------------------------- |
|
939 // CAlfExCalendarMonth::OfferEventL |
|
940 // -------------------------------------------------------------------------- |
|
941 // |
|
942 TBool CAlfExCalendarMonth::OfferEventL(const TAlfEvent& aEvent ) |
|
943 { |
|
944 // handle custome vents if any |
|
945 if( aEvent.IsCustomEvent() ) |
|
946 { |
|
947 if( iDayView ) |
|
948 { |
|
949 switch( aEvent.CustomParameter() ) |
|
950 { |
|
951 case EShowCaledarEvents: |
|
952 ShowCalendarEventsL(); |
|
953 return ETrue; |
|
954 |
|
955 default: |
|
956 break; |
|
957 } |
|
958 } |
|
959 else |
|
960 return ETrue; |
|
961 } |
|
962 |
|
963 // handle key events |
|
964 if ( aEvent.Code() == EEventKey ) |
|
965 { |
|
966 TInt code = aEvent.KeyEvent().iCode; |
|
967 switch( code ) |
|
968 { |
|
969 case EKeyBackspace: // TODO - use "Back" softkey |
|
970 if( iDayView ) |
|
971 { |
|
972 // close day view and return to month view |
|
973 iDayView = EFalse; |
|
974 CloseDayViewL(); |
|
975 } |
|
976 return ETrue; |
|
977 |
|
978 case 63557: // TODO - replace with key code |
|
979 if( !iDayView ) |
|
980 { |
|
981 OpenDayViewL(); |
|
982 } |
|
983 return ETrue; |
|
984 |
|
985 case EKeyLeftArrow: |
|
986 if( iDayView ) |
|
987 { |
|
988 iDayView = EFalse; |
|
989 CloseDayViewL(); |
|
990 } |
|
991 MoveDayFocusL( -1 ); |
|
992 return ETrue; |
|
993 |
|
994 case EKeyRightArrow: |
|
995 if( iDayView ) |
|
996 { |
|
997 iDayView = EFalse; |
|
998 CloseDayViewL(); |
|
999 } |
|
1000 MoveDayFocusL( 1 ); |
|
1001 return ETrue; |
|
1002 |
|
1003 case EKeyUpArrow: |
|
1004 if( iDayView ) |
|
1005 { |
|
1006 iDayView = EFalse; |
|
1007 CloseDayViewL(); |
|
1008 } |
|
1009 MoveDayFocusL( -7 ); |
|
1010 return ETrue; |
|
1011 |
|
1012 case EKeyDownArrow: |
|
1013 if( iDayView ) |
|
1014 { |
|
1015 iDayView = EFalse; |
|
1016 CloseDayViewL(); |
|
1017 } |
|
1018 MoveDayFocusL( +7 ); |
|
1019 return ETrue; |
|
1020 |
|
1021 default:;break; |
|
1022 } |
|
1023 |
|
1024 } |
|
1025 return EFalse; |
|
1026 } |
|
1027 |
|
1028 // -------------------------------------------------------------------------- |
|
1029 // CAlfExCalendarMonth::SetDateGridWeightsL |
|
1030 // -------------------------------------------------------------------------- |
|
1031 // |
|
1032 void CAlfExCalendarMonth::SetDateGridWeightsL( |
|
1033 CAlfGridLayout* aDatesGrid, |
|
1034 TInt aRowIndex, |
|
1035 TInt aWeight ) |
|
1036 { |
|
1037 RArray<TInt> weights; |
|
1038 CleanupClosePushL( weights ); |
|
1039 |
|
1040 for( TInt i = 1; i <= KNoOfRows; ++i ) |
|
1041 { |
|
1042 User::LeaveIfError( weights.Append( 1 ) ); |
|
1043 } |
|
1044 if( aRowIndex != -1 ) |
|
1045 { |
|
1046 weights.Insert( aRowIndex, aWeight ); |
|
1047 } |
|
1048 |
|
1049 aDatesGrid->SetRowsL( weights ); |
|
1050 CleanupStack::PopAndDestroy( &weights ); |
|
1051 } |
|
1052 |
|
1053 // -------------------------------------------------------------------------- |
|
1054 // CAlfExCalendarMonth::HandleTimerEventL |
|
1055 // -------------------------------------------------------------------------- |
|
1056 // |
|
1057 void CAlfExCalendarMonth::HandleTimerEventL() |
|
1058 { |
|
1059 CAlfExCalendarEngine& calendarEngine = iCalendarControl.CalendarEngine(); |
|
1060 if( calendarEngine.EventsAvailable( iTime + (TTimeIntervalDays)iFocusedDay ) && |
|
1061 !iDayView ) // AND if day has not been opend already |
|
1062 { |
|
1063 OpenDayViewL(); |
|
1064 } |
|
1065 } |
|
1066 |
|
1067 // end of file |
|
1068 |