branch | RCL_3 |
changeset 19 | aecbbf00d063 |
parent 18 | fcdfafb36fe7 |
child 20 | d48ab3b357f1 |
18:fcdfafb36fe7 | 19:aecbbf00d063 |
---|---|
47 #include <eikdialg.h> |
47 #include <eikdialg.h> |
48 #include <eikdialogext.h> |
48 #include <eikdialogext.h> |
49 #include <touchfeedback.h> |
49 #include <touchfeedback.h> |
50 |
50 |
51 #include <AknTasHook.h> // for testability hooks |
51 #include <AknTasHook.h> // for testability hooks |
52 |
|
53 #include "akntrace.h" |
|
54 const TInt KRate = 95; // 95% similar rate |
52 const TInt KRate = 95; // 95% similar rate |
55 const TInt KFullColor = 255; |
53 const TInt KFullColor = 255; |
56 |
54 |
57 // --------------------------------------------- |
55 // --------------------------------------------- |
58 // CONSTRUCTION - DESTRUCTION |
56 // CONSTRUCTION - DESTRUCTION |
73 * |
71 * |
74 * |
72 * |
75 */ |
73 */ |
76 EXPORT_C CAknNoteControl::~CAknNoteControl() |
74 EXPORT_C CAknNoteControl::~CAknNoteControl() |
77 { |
75 { |
78 _AKNTRACE_FUNC_ENTER; |
|
79 AKNTASHOOK_REMOVE(); |
76 AKNTASHOOK_REMOVE(); |
80 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
77 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
81 if ( feedback ) |
78 if ( feedback ) |
82 { |
79 { |
83 feedback->RemoveFeedbackForControl( this ); |
80 feedback->RemoveFeedbackForControl( this ); |
84 } |
81 } |
85 |
82 |
86 delete iAttributes; |
83 delete iAttributes; |
87 delete iLineWidths; |
84 delete iLineWidths; |
88 _AKNTRACE_FUNC_EXIT; |
|
89 } |
85 } |
90 |
86 |
91 void CAknNoteControl::ConstructFromResourceL(TResourceReader &aRes) |
87 void CAknNoteControl::ConstructFromResourceL(TResourceReader &aRes) |
92 { |
88 { |
93 |
89 |
130 |
126 |
131 // ----------------------------------------- |
127 // ----------------------------------------- |
132 // CCOECONTROL METHODS |
128 // CCOECONTROL METHODS |
133 // ----------------------------------------- |
129 // ----------------------------------------- |
134 void CAknNoteControl::Draw(const TRect& /*aRect*/) const |
130 void CAknNoteControl::Draw(const TRect& /*aRect*/) const |
135 { |
131 { |
136 _AKNTRACE_FUNC_ENTER; |
|
137 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
132 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
138 |
133 |
139 MAknsControlContext* cc = iAttributes->iBgContext; |
134 MAknsControlContext* cc = iAttributes->iBgContext; |
140 |
135 |
141 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
136 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
190 } |
185 } |
191 if (iImageHasShadow) |
186 if (iImageHasShadow) |
192 { |
187 { |
193 iShadowRect.DrawRect( gc ); |
188 iShadowRect.DrawRect( gc ); |
194 } |
189 } |
195 _AKNTRACE_FUNC_EXIT; |
|
196 } |
190 } |
197 |
191 |
198 EXPORT_C void CAknNoteControl::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
192 EXPORT_C void CAknNoteControl::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
199 { |
193 { |
200 CAknControl::HandlePointerEventL(aPointerEvent); |
194 CAknControl::HandlePointerEventL(aPointerEvent); |
281 * Do not call this method when you need to do layout for reasons |
275 * Do not call this method when you need to do layout for reasons |
282 * different than the size or position of the control changing. |
276 * different than the size or position of the control changing. |
283 * Call Layout instead. |
277 * Call Layout instead. |
284 */ |
278 */ |
285 void CAknNoteControl::SizeChanged() |
279 void CAknNoteControl::SizeChanged() |
286 { |
280 { |
287 _AKNTRACE_FUNC_ENTER; |
|
288 DoLayout(); |
281 DoLayout(); |
289 _AKNTRACE_FUNC_EXIT; |
|
290 } |
282 } |
291 |
283 |
292 /** |
284 /** |
293 * Code shared between SizeChanged() and Layout(). |
285 * Code shared between SizeChanged() and Layout(). |
294 * |
286 * |
295 */ |
287 */ |
296 void CAknNoteControl::DoLayout() |
288 void CAknNoteControl::DoLayout() |
297 { |
289 { |
298 _AKNTRACE_FUNC_ENTER; |
|
299 _AKNTRACE("iNoteLayout = %d", iNoteLayout); |
|
300 TextControl()->SetRect(LayoutRect()); |
290 TextControl()->SetRect(LayoutRect()); |
301 switch(iNoteLayout) |
291 switch(iNoteLayout) |
302 { |
292 { |
303 case EGeneralLayout: |
293 case EGeneralLayout: |
304 GeneralNoteLayout(); |
294 GeneralNoteLayout(); |
341 ETouchFeedbackVibra ); |
331 ETouchFeedbackVibra ); |
342 feedback->SetFeedbackArea( this, 0, Rect(), spec ); |
332 feedback->SetFeedbackArea( this, 0, Rect(), spec ); |
343 delete spec; |
333 delete spec; |
344 } |
334 } |
345 } |
335 } |
346 _AKNTRACE_FUNC_EXIT; |
|
347 } |
336 } |
348 |
337 |
349 /** |
338 /** |
350 * |
339 * |
351 * This is used by a dialog to layout the control correctly. |
340 * This is used by a dialog to layout the control correctly. |
352 * |
341 * |
353 */ |
342 */ |
354 void CAknNoteControl::WindowLayout( TAknWindowLineLayout& aLayout ) const |
343 void CAknNoteControl::WindowLayout( TAknWindowLineLayout& aLayout ) const |
355 { |
344 { |
356 _AKNTRACE_FUNC_ENTER; |
|
357 _AKNTRACE("iNoteLayout = %d", iNoteLayout); |
|
358 TIndex laf(NumberOfLines()); |
345 TIndex laf(NumberOfLines()); |
359 AknLayoutUtils::TAknCbaLocation cbaLocation( AknLayoutUtils::CbaLocation() ); |
346 AknLayoutUtils::TAknCbaLocation cbaLocation( AknLayoutUtils::CbaLocation() ); |
360 TInt variety( 0 ); |
347 TInt variety( 0 ); |
361 |
348 |
362 switch(iNoteLayout) |
349 switch(iNoteLayout) |
447 |
434 |
448 aLayout = AknLayoutScalable_Avkon::popup_note_window( variety + |
435 aLayout = AknLayoutScalable_Avkon::popup_note_window( variety + |
449 laf.PopupNoteWindow() ); |
436 laf.PopupNoteWindow() ); |
450 break; |
437 break; |
451 } |
438 } |
452 _AKNTRACE_FUNC_EXIT; |
|
453 } |
439 } |
454 |
440 |
455 /** |
441 /** |
456 * Return the note height |
442 * Return the note height |
457 * |
443 * |
669 for (TInt i=0; i < nLines; i++) |
655 for (TInt i=0; i < nLines; i++) |
670 { |
656 { |
671 |
657 |
672 AknLayoutUtils::LayoutLabel(TextControl()->Line(i),LayoutRect(), |
658 AknLayoutUtils::LayoutLabel(TextControl()->Line(i),LayoutRect(), |
673 AKN_LAYOUT_TEXT_Note_with_an_image_pop_up_window_texts_Line_1( |
659 AKN_LAYOUT_TEXT_Note_with_an_image_pop_up_window_texts_Line_1( |
674 lafIndex.NWIPWindowTextsLine1Left(i),lafIndex.NWIPWindowTextsLine1Right(i), |
660 lafIndex.NWIPWindowTextsLine1L(i),lafIndex.NWIPWindowTextsLine1R(i), |
675 lafIndex.NWIPWindowTextsLine1B(i),lafIndex.NWIPWindowTextsLine1W(i))); |
661 lafIndex.NWIPWindowTextsLine1B(i),lafIndex.NWIPWindowTextsLine1W(i))); |
676 |
662 |
677 if (!error) |
663 if (!error) |
678 { |
664 { |
679 // Ignore error |
665 // Ignore error |
914 TIndex lafIndex(KINMaxNumLines,Icon()!=NULL,imageSize); |
900 TIndex lafIndex(KINMaxNumLines,Icon()!=NULL,imageSize); |
915 |
901 |
916 for (TInt i=0; i < KINMaxNumLines; i++) |
902 for (TInt i=0; i < KINMaxNumLines; i++) |
917 { |
903 { |
918 TAknTextLineLayout lay = AKN_LAYOUT_TEXT_Note_with_an_image_pop_up_window_texts_Line_1( |
904 TAknTextLineLayout lay = AKN_LAYOUT_TEXT_Note_with_an_image_pop_up_window_texts_Line_1( |
919 lafIndex.NWIPWindowTextsLine1Left(i),lafIndex.NWIPWindowTextsLine1Right(i), |
905 lafIndex.NWIPWindowTextsLine1L(i),lafIndex.NWIPWindowTextsLine1R(i), |
920 lafIndex.NWIPWindowTextsLine1B(i),lafIndex.NWIPWindowTextsLine1W(i)); |
906 lafIndex.NWIPWindowTextsLine1B(i),lafIndex.NWIPWindowTextsLine1W(i)); |
921 text.LayoutText(LayoutRect(), lay); |
907 text.LayoutText(LayoutRect(), lay); |
922 TInt width = text.TextRect().Width(); |
908 TInt width = text.TextRect().Width(); |
923 |
909 |
924 iLineWidths->AppendL(width,1); |
910 iLineWidths->AppendL(width,1); |
1159 * @see CAknTextControl |
1145 * @see CAknTextControl |
1160 */ |
1146 */ |
1161 EXPORT_C void CAknNoteControl::ResetText() |
1147 EXPORT_C void CAknNoteControl::ResetText() |
1162 { |
1148 { |
1163 // This can not Leave so no need to use TRAP |
1149 // This can not Leave so no need to use TRAP |
1164 TRAP_IGNORE(Attributes()->SetTextL(KNullDesC)); |
1150 Attributes()->SetTextL(KNullDesC); |
1165 Layout(); |
1151 Layout(); |
1166 } |
1152 } |
1167 |
1153 |
1168 /** |
1154 /** |
1169 * Set whole text for the note control. |
1155 * Set whole text for the note control. |
1194 * The dialog will not be resized. |
1180 * The dialog will not be resized. |
1195 * |
1181 * |
1196 */ |
1182 */ |
1197 EXPORT_C void CAknNoteControl::SetTextL(const TDesC& aText, TInt aLineNum) |
1183 EXPORT_C void CAknNoteControl::SetTextL(const TDesC& aText, TInt aLineNum) |
1198 { |
1184 { |
1199 _AKNTRACE_FUNC_ENTER; |
|
1200 TAknLayoutText textRect; |
1185 TAknLayoutText textRect; |
1201 _AKNTRACE(_L("SetTextL = %S"), &aText); |
1186 |
1202 if ( iNoteLayout == ENotificationWithGraphicsLayout || iNoteLayout == ETextualNotificationLayout ) |
1187 if ( iNoteLayout == ENotificationWithGraphicsLayout || iNoteLayout == ETextualNotificationLayout ) |
1203 { |
1188 { |
1204 textRect.LayoutText(LayoutRect(), AKN_LAYOUT_TEXT_Notification_pop_up_window_texts__text__Line_1(1)); |
1189 textRect.LayoutText(LayoutRect(), AKN_LAYOUT_TEXT_Notification_pop_up_window_texts__text__Line_1(1)); |
1205 } |
1190 } |
1206 else |
1191 else |
1210 |
1195 |
1211 const CFont *font = textRect.Font(); |
1196 const CFont *font = textRect.Font(); |
1212 |
1197 |
1213 Attributes()->SetTextL(aText, aLineNum, font, iLineWidths); |
1198 Attributes()->SetTextL(aText, aLineNum, font, iLineWidths); |
1214 Layout(); |
1199 Layout(); |
1215 _AKNTRACE_FUNC_EXIT; |
|
1216 } |
1200 } |
1217 |
1201 |
1218 /** |
1202 /** |
1219 * Set the number inside the note text. The text must have been |
1203 * Set the number inside the note text. The text must have been |
1220 * previously set via resource or via SetTextL and must have a |
1204 * previously set via resource or via SetTextL and must have a |
1477 * Return Left index into table "Note With Image Popup Window Texts Line 1" |
1461 * Return Left index into table "Note With Image Popup Window Texts Line 1" |
1478 * Index depends on number of text lines, whether or not there is a |
1462 * Index depends on number of text lines, whether or not there is a |
1479 * number type indication (NTI). See table in *.lay and |
1463 * number type indication (NTI). See table in *.lay and |
1480 * LAF specs for working out indexes. |
1464 * LAF specs for working out indexes. |
1481 */ |
1465 */ |
1482 TInt CAknNoteControl::TIndex::NWIPWindowTextsLine1Left(TInt aLineNum) const |
1466 TInt CAknNoteControl::TIndex::NWIPWindowTextsLine1L(TInt aLineNum) const |
1483 { |
1467 { |
1484 SelfTest(); |
1468 SelfTest(); |
1485 static const TInt KNWIPWindowTextsLine1IndexLeft[2][3] = |
1469 static const TInt KNWIPWindowTextsLine1IndexL[2][3] = |
1486 { |
1470 { |
1487 {0, 0, 0}, //NO NTI |
1471 {0, 0, 0}, //NO NTI |
1488 {0, 0, 2} //NTI |
1472 {0, 0, 2} //NTI |
1489 }; |
1473 }; |
1490 |
1474 |
1491 return KNWIPWindowTextsLine1IndexLeft[HasNtiIndex()][aLineNum]; |
1475 return KNWIPWindowTextsLine1IndexL[HasNtiIndex()][aLineNum]; |
1492 } |
1476 } |
1493 |
1477 |
1494 /** |
1478 /** |
1495 * Return Right index into table "Note With Image Popup Window Texts Line 1" |
1479 * Return Right index into table "Note With Image Popup Window Texts Line 1" |
1496 * Index depends on number of text lines and image size. |
1480 * Index depends on number of text lines and image size. |
1499 * Table has 3 dimensions:- |
1483 * Table has 3 dimensions:- |
1500 * - Dimension 1 is the line number |
1484 * - Dimension 1 is the line number |
1501 * - Dimension 2 is the image width |
1485 * - Dimension 2 is the image width |
1502 * - Dimension 3 is the image height |
1486 * - Dimension 3 is the image height |
1503 */ |
1487 */ |
1504 TInt CAknNoteControl::TIndex::NWIPWindowTextsLine1Right(TInt aLineNum) const |
1488 TInt CAknNoteControl::TIndex::NWIPWindowTextsLine1R(TInt aLineNum) const |
1505 { |
1489 { |
1506 SelfTest(); |
1490 SelfTest(); |
1507 |
1491 |
1508 static const TInt KNWIPWindowTextsLine1IndexRight[3][5][5] = |
1492 static const TInt KNWIPWindowTextsLine1IndexR[3][5][5] = |
1509 { |
1493 { |
1510 {{0, 0, 0, 0, 0}, {0, 3, 3, 3, 3}, {0, 5, 5, 5, 5}, {0, 7, 7, 7, 7}, {0, 9, 9, 9, 9} }, //FIRST LINE |
1494 {{0, 0, 0, 0, 0}, {0, 3, 3, 3, 3}, {0, 5, 5, 5, 5}, {0, 7, 7, 7, 7}, {0, 9, 9, 9, 9} }, //FIRST LINE |
1511 {{0, 0, 0, 0, 0}, {0, 3, 3, 3, 3}, {0, 5, 5, 5, 5}, {0, 7, 7, 7, 7}, {0, 9, 9, 9, 9} }, //SECOND LINE |
1495 {{0, 0, 0, 0, 0}, {0, 3, 3, 3, 3}, {0, 5, 5, 5, 5}, {0, 7, 7, 7, 7}, {0, 9, 9, 9, 9} }, //SECOND LINE |
1512 {{0, 0, 0, 0, 0}, {0, 0, 0, 3, 3}, {0, 0, 0, 5, 5}, {0, 0, 0, 7, 7}, {0, 0, 0, 9, 9} } //THIRD LINE |
1496 {{0, 0, 0, 0, 0}, {0, 0, 0, 3, 3}, {0, 0, 0, 5, 5}, {0, 0, 0, 7, 7}, {0, 0, 0, 9, 9} } //THIRD LINE |
1513 }; |
1497 }; |
1514 |
1498 |
1515 return KNWIPWindowTextsLine1IndexRight[aLineNum][ImageWidthIndex()][ImageHeightIndex()]; |
1499 return KNWIPWindowTextsLine1IndexR[aLineNum][ImageWidthIndex()][ImageHeightIndex()]; |
1516 |
1500 |
1517 } |
1501 } |
1518 |
1502 |
1519 /** |
1503 /** |
1520 * Return Bottom index into table "Note With Image Popup Window Texts Line 1" |
1504 * Return Bottom index into table "Note With Image Popup Window Texts Line 1" |