author | Pat Downey <patd@symbian.org> |
Wed, 01 Sep 2010 12:32:31 +0100 | |
branch | RCL_3 |
changeset 30 | bd7edf625bdd |
parent 29 | 12af337248b1 |
permissions | -rw-r--r-- |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/* |
30 | 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: Grid of the MonthView. |
|
29
12af337248b1
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
15 |
* |
30 | 16 |
*/ |
29
12af337248b1
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
17 |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
18 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
19 |
|
30 | 20 |
//debug |
21 |
#include "calendarui_debug.h" |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
22 |
|
30 | 23 |
// INCLUDE FILES |
24 |
#include "calenmonthgrid.h" |
|
25 |
#include "calenmonthcontainer.h" |
|
26 |
#include "calenmonthcelllistboxdata.h" |
|
27 |
#include "calenmonthcelllistboxitemdrawer.h" |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
28 |
|
30 | 29 |
#include <aknlayoutscalable_apps.cdl.h> |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
30 |
|
30 | 31 |
// New line color groups in enhanced skinning |
32 |
static void DrawLAFLine(CWindowGc& aGc, const TAknLayoutRect& aArea, |
|
33 |
const TAknsItemID& aSkinComponent, TInt aColorGroup) |
|
34 |
{ |
|
35 |
TRACE_ENTRY_POINT; |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
36 |
|
30 | 37 |
TRgb lineColor = aArea.Color(); |
38 |
AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), lineColor, |
|
39 |
aSkinComponent, aColorGroup); |
|
40 |
aGc.SetBrushColor( lineColor ); |
|
41 |
aGc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
42 |
aGc.Clear( aArea.Rect() ); |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
43 |
|
30 | 44 |
TRACE_EXIT_POINT; |
45 |
} |
|
46 |
||
47 |
static void DrawSecondaryLine(CWindowGc& aGc, const TAknLayoutRect& aArea) |
|
48 |
{ |
|
49 |
TRACE_ENTRY_POINT; |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
50 |
|
30 | 51 |
DrawLAFLine(aGc, aArea, KAknsIIDQsnLineColors, EAknsCIQsnLineColorsCG2); |
52 |
||
53 |
TRACE_EXIT_POINT; |
|
54 |
} |
|
55 |
||
56 |
// ================= MEMBER FUNCTIONS ======================= |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
57 |
|
30 | 58 |
// C++ default constructor can NOT contain any code, that |
59 |
// might leave. |
|
60 |
// |
|
61 |
CCalenMonthGrid::CCalenMonthGrid |
|
62 |
(TTime aFirstDayOfGrid, CCalenMonthContainer* aMonthCont) |
|
63 |
: iFirstDayOfGrid(aFirstDayOfGrid),iMonthContainer(aMonthCont) |
|
64 |
{ |
|
65 |
TRACE_ENTRY_POINT; |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
66 |
|
30 | 67 |
SetVerticalMargin(0); |
68 |
SetHorizontalMargin(0); |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
69 |
|
30 | 70 |
TRACE_EXIT_POINT; |
71 |
} |
|
72 |
||
73 |
// Destructor |
|
74 |
CCalenMonthGrid::~CCalenMonthGrid() |
|
75 |
{ |
|
76 |
TRACE_ENTRY_POINT; |
|
77 |
TRACE_EXIT_POINT; |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
78 |
} |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
79 |
|
30 | 80 |
// --------------------------------------------------------- |
81 |
// CCalenMonthGrid::Draw |
|
82 |
// Drawing month gird |
|
83 |
// (other items were commented in a header). |
|
84 |
// --------------------------------------------------------- |
|
85 |
// |
|
86 |
void CCalenMonthGrid::Draw(const TRect& aRect)const |
|
87 |
{ |
|
88 |
TRACE_ENTRY_POINT; |
|
89 |
//const TBool useWeeks( UseWeeks() ); |
|
90 |
CAknGrid::Draw( aRect ); |
|
29
12af337248b1
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
91 |
|
30 | 92 |
// For drawing Secondary grid lines |
93 |
DrawGridLines(); |
|
29
12af337248b1
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
94 |
|
30 | 95 |
TRACE_EXIT_POINT; |
29
12af337248b1
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
96 |
|
30 | 97 |
} |
98 |
||
99 |
// --------------------------------------------------------- |
|
100 |
// CCalenMonthGrid::DrawGridLines |
|
101 |
// Draws secondary lines of the grid |
|
102 |
// (other items were commented in a header). |
|
103 |
// --------------------------------------------------------- |
|
104 |
// |
|
105 |
void CCalenMonthGrid::DrawGridLines()const |
|
106 |
{ |
|
107 |
TRACE_ENTRY_POINT; |
|
108 |
||
109 |
CWindowGc& gc = SystemGc(); |
|
110 |
TRect parentRect = iMonthContainer->Rect(); |
|
111 |
TRect main_pane(iMonthContainer->ReducePreview( parentRect ) ); |
|
112 |
||
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
113 |
|
30 | 114 |
TAknLayoutRect main_cale_month_pane; |
115 |
TInt layoutVariant = iMonthContainer->LayoutVariantIndex(CCalenMonthContainer::EMainCaleMonthPane); |
|
116 |
main_cale_month_pane.LayoutRect( main_pane, AknLayoutScalable_Apps::main_cale_month_pane(layoutVariant).LayoutLine() ); |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
117 |
|
30 | 118 |
TAknLayoutRect cale_month_pane_g; |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
119 |
|
30 | 120 |
// Get indexes for grid lines (cale_month_pane_g) |
121 |
TAknLayoutScalableTableLimits cale_month_pane_g_Limits = AknLayoutScalable_Apps::cale_month_pane_g_Limits(); |
|
122 |
TInt index( cale_month_pane_g_Limits.FirstIndex() ); |
|
123 |
TInt end( cale_month_pane_g_Limits.LastIndex() ); |
|
124 |
// First two are primary lines to separate heading and week number panes from grid |
|
125 |
// We draw them elsewhere |
|
126 |
const TInt firstGridLineIndex = 2; |
|
127 |
layoutVariant = iMonthContainer->LayoutVariantIndex(CCalenMonthContainer::ECaleMonthPaneG ); |
|
128 |
for ( index+=firstGridLineIndex; index<=end; ++index ) |
|
129 |
{ |
|
130 |
cale_month_pane_g.LayoutRect( main_cale_month_pane.Rect(), |
|
131 |
AknLayoutScalable_Apps::cale_month_pane_g( index, layoutVariant ).LayoutLine() ); |
|
132 |
DrawSecondaryLine( gc, cale_month_pane_g ); |
|
133 |
} |
|
134 |
||
135 |
TRACE_EXIT_POINT; |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
136 |
|
30 | 137 |
} |
138 |
||
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
139 |
|
30 | 140 |
// --------------------------------------------------------- |
141 |
// CCalenMonthGrid::FirstDayOfGrid |
|
142 |
// Return first day of grid |
|
143 |
// (other items were commented in a header). |
|
144 |
// --------------------------------------------------------- |
|
145 |
// |
|
146 |
TTime CCalenMonthGrid::FirstDayOfGrid() |
|
147 |
{ |
|
148 |
TRACE_ENTRY_POINT; |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
149 |
|
30 | 150 |
TRACE_EXIT_POINT; |
151 |
return iFirstDayOfGrid; |
|
152 |
} |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
153 |
|
30 | 154 |
// --------------------------------------------------------- |
155 |
// CCalenMonthGrid::SetFirstDayOfGrid |
|
156 |
// Set argument aDay to first day of Grid |
|
157 |
// (other items were commented in a header). |
|
158 |
// --------------------------------------------------------- |
|
159 |
// |
|
160 |
void CCalenMonthGrid::SetFirstDayOfGrid(TTime aDay) |
|
161 |
{ |
|
162 |
TRACE_ENTRY_POINT; |
|
163 |
||
164 |
iFirstDayOfGrid = aDay; |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
165 |
|
30 | 166 |
TRACE_EXIT_POINT; |
167 |
} |
|
168 |
||
169 |
// --------------------------------------------------------- |
|
170 |
// CCalenMonthGrid::CreateItemDrawerL |
|
171 |
// Creates CFormattedCellListBoxItemDrawer, |
|
172 |
// actually CCalenMonthCellListBoxItemDrawer. |
|
173 |
// (other items were commented in a header). |
|
174 |
// --------------------------------------------------------- |
|
175 |
// |
|
176 |
void CCalenMonthGrid::CreateItemDrawerL() |
|
177 |
{ |
|
178 |
TRACE_ENTRY_POINT; |
|
179 |
||
180 |
CCalenMonthCellListBoxData* columnData = CCalenMonthCellListBoxData::NewL(); |
|
181 |
CleanupStack::PushL( columnData ); |
|
182 |
||
183 |
iItemDrawer = new(ELeave) |
|
184 |
CCalenMonthCellListBoxItemDrawer(Model(), this, iEikonEnv->NormalFont(), columnData); |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
185 |
|
30 | 186 |
CleanupStack::Pop(); // columnData |
29
12af337248b1
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
187 |
|
30 | 188 |
TRACE_EXIT_POINT; |
189 |
} |
|
190 |
||
191 |
// --------------------------------------------------------- |
|
192 |
// |
|
193 |
// --------------------------------------------------------- |
|
194 |
// |
|
195 |
void CCalenMonthGrid::UpdateScrollBarsL() |
|
196 |
{ |
|
197 |
TRACE_ENTRY_POINT; |
|
198 |
||
199 |
// Override default implementation and just turn scrollbars off |
|
200 |
// This is needed, because CAknGrid doesn't respect scrollbar |
|
201 |
// visibility settings, but turns them on e.g. in HandleResourceChange |
|
202 |
CEikScrollBarFrame* sbf = ScrollBarFrame(); |
|
203 |
if ( sbf ) |
|
204 |
{ |
|
205 |
sbf->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, |
|
206 |
CEikScrollBarFrame::EOff); |
|
29
12af337248b1
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
207 |
} |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
208 |
|
30 | 209 |
TRACE_EXIT_POINT; |
210 |
} |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
211 |
// End of File |