|
1 /* |
|
2 * Copyright (c) 2002 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: Customized drawing of CCalenWeekLBData. |
|
15 * DrawItemText() passes extended parameters to CCalenWeekLBData. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 //debug |
|
22 #include "calendarui_debug.h" |
|
23 |
|
24 // INCLUDE FILES |
|
25 #include "calenweeklistboxitemdrawer.h" |
|
26 |
|
27 #include "calenweeklistboxdata.h" |
|
28 #include "calenweekdata.h" |
|
29 |
|
30 #include "calendar.hrh" |
|
31 |
|
32 #include <AknsDrawUtils.h> |
|
33 #include <AknUtils.h> |
|
34 #include <gulicon.h> |
|
35 |
|
36 #include <eikappui.h> |
|
37 |
|
38 |
|
39 // ================= MEMBER FUNCTIONS ======================= |
|
40 |
|
41 // C++ constructor can NOT contain any code, that |
|
42 // might leave. |
|
43 // |
|
44 CCalenWeekListBoxItemDrawer::CCalenWeekListBoxItemDrawer( |
|
45 MTextListBoxModel* aTextListBoxModel, |
|
46 const CFont* aFont, |
|
47 CFormattedCellListBoxData* aFormattedCellData) |
|
48 : CFormattedCellListBoxItemDrawer(aTextListBoxModel, aFont, aFormattedCellData) |
|
49 { |
|
50 TRACE_ENTRY_POINT; |
|
51 TRACE_EXIT_POINT; |
|
52 } |
|
53 |
|
54 // Destructor |
|
55 CCalenWeekListBoxItemDrawer::~CCalenWeekListBoxItemDrawer() |
|
56 { |
|
57 TRACE_ENTRY_POINT; |
|
58 TRACE_EXIT_POINT; |
|
59 } |
|
60 |
|
61 // --------------------------------------------------------- |
|
62 // CCalenWeekListBoxItemDrawer::DrawItemText |
|
63 // Draws grid lines of one list row of Calendar week view. |
|
64 // Calls CCalenWeekLBData to draw contents of cells |
|
65 // (other items were commented in a header). |
|
66 // --------------------------------------------------------- |
|
67 // |
|
68 |
|
69 void CCalenWeekListBoxItemDrawer::DrawItemText(TInt aItemIndex, // Item index |
|
70 const TRect& aItemTextRect, // Item rect |
|
71 TBool aItemIsCurrent, // Current Item flag |
|
72 TBool /*aViewIsEmphasized*/, // ignored. |
|
73 TBool /*aItemIsSelected*/) const // Item hilighted flag |
|
74 { |
|
75 TRACE_ENTRY_POINT; |
|
76 |
|
77 // We use custom DrawItemText, because Avkon's |
|
78 // CFormattedCellListBoxItemDrawer does a whole lotta things, |
|
79 // e.g. background drawing, separator lines etc. |
|
80 // Though it seems that it uses Enabled/Disabled functions for most |
|
81 // of them, and setting properties properly could make this override |
|
82 // unnecessary. |
|
83 // It seems safer to have override, so that Avkon changes don't break |
|
84 // Calendar. Avkon implementation of new features probably don't do |
|
85 // it for Calendar week view in any case. |
|
86 |
|
87 iGc->SetPenColor(iTextColor); |
|
88 iGc->SetBrushColor(iBackColor); |
|
89 |
|
90 SetupGc(aItemIndex); |
|
91 |
|
92 TBufC<256> target(iModel->ItemText(aItemIndex)); |
|
93 |
|
94 CFormattedCellListBoxData::TColors colors; |
|
95 colors.iText = iTextColor; |
|
96 colors.iBack = iBackColor; |
|
97 colors.iHighlightedText = iHighlightedTextColor; |
|
98 colors.iHighlightedBack = iHighlightedBackColor; |
|
99 |
|
100 CCalenWeekLBData* data = |
|
101 static_cast<CCalenWeekLBData*>( FormattedCellData() ); |
|
102 data->Draw(Properties(aItemIndex), *iGc, |
|
103 &target, aItemTextRect, aItemIsCurrent, colors); |
|
104 |
|
105 TRACE_EXIT_POINT; |
|
106 } |
|
107 |
|
108 // End of File |