author | Simon Howkins <simonh@symbian.org> |
Wed, 03 Nov 2010 14:43:42 +0000 | |
branch | RCL_3 |
changeset 74 | 6b4d16c5c577 |
parent 72 | a5e7a4f63858 |
permissions | -rw-r--r-- |
56 | 1 |
/* |
2 |
* Copyright (c) 2009 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: |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
#include <ganes/HgSingleTextList.h> |
|
19 |
#include <ganes/HgItem.h> |
|
20 |
#include "HgMarquee.h" |
|
21 |
#include "HgLayoutData.h" |
|
22 |
#include "HgIndicatorManager.h" |
|
23 |
#include "HgDrawUtils.h" |
|
24 |
#include "HgScrollbar.h" |
|
25 |
||
26 |
#include <AknsUtils.h> |
|
27 |
#include <AknUtils.h> |
|
28 |
#include <AknsDrawUtils.h> |
|
29 |
||
30 |
#include <layoutmetadata.cdl.h> |
|
31 |
#include <aknlayoutscalable_avkon.cdl.h> |
|
32 |
#include <gulicon.h> |
|
33 |
||
34 |
using namespace AknLayoutScalable_Avkon; |
|
35 |
||
36 |
// ----------------------------------------------------------------------------- |
|
37 |
// CHgSingleTextList::NewL() |
|
38 |
// ----------------------------------------------------------------------------- |
|
39 |
// |
|
40 |
EXPORT_C CHgSingleTextList* CHgSingleTextList::NewL( |
|
41 |
const TRect& aRect, |
|
42 |
TInt aItemCount, |
|
43 |
CGulIcon* aDefaultIcon, |
|
44 |
RWsSession* aSession) |
|
45 |
{ |
|
46 |
CHgSingleTextList* self = new ( ELeave ) CHgSingleTextList( |
|
47 |
aItemCount, |
|
48 |
aDefaultIcon ); |
|
49 |
||
50 |
CleanupStack::PushL (self ); |
|
51 |
self->ConstructL( aRect, aSession ); |
|
52 |
CleanupStack::Pop (self ); |
|
53 |
return self; |
|
54 |
} |
|
55 |
||
56 |
// ----------------------------------------------------------------------------- |
|
57 |
// CHgSingleTextList::~CHgSingleTextList() |
|
58 |
// ----------------------------------------------------------------------------- |
|
59 |
// |
|
60 |
EXPORT_C CHgSingleTextList::~CHgSingleTextList( ) |
|
61 |
{ |
|
62 |
} |
|
63 |
||
64 |
// ----------------------------------------------------------------------------- |
|
65 |
// CHgSingleTextList::HandleSizeChanged() |
|
66 |
// ----------------------------------------------------------------------------- |
|
67 |
// |
|
68 |
void CHgSingleTextList::HandleSizeChanged() |
|
69 |
{ |
|
70 |
// Call base implementation |
|
71 |
CHgList::HandleSizeChanged(); |
|
72 |
||
73 |
iLayoutData->SetItemLayout(list_single_pane( 0 )); |
|
74 |
for(TInt i = 0; i <= KMaxNumberOfTitleIndicators; ++i) |
|
75 |
iLayoutData->SetTitleLayout( i, list_single_pane_t1( i ) ); |
|
76 |
iLayoutData->SetFirstIndicatorLayout(list_single_pane_g2(0)); |
|
77 |
TInt variety = iScrollbar && !iScrollbar->IsStatic() ? 1 : 0; |
|
78 |
iLayoutData->SetSecondIndicatorLayout(list_single_pane_g1(variety)); |
|
79 |
||
80 |
// Get the Row rect. |
|
81 |
TAknLayoutRect layout; |
|
82 |
layout.LayoutRect(ListRect(), iLayoutData->ItemLayout()); |
|
83 |
iRowHeight = layout.Rect().Height(); |
|
84 |
||
85 |
// This list type doesn't really visualize any icons. |
|
86 |
iImageSize = TSize(0,0); |
|
87 |
||
88 |
// Indicator Rect. |
|
89 |
TAknLayoutRect indicator; |
|
90 |
indicator.LayoutRect(layout.Rect(), iLayoutData->FirstIndicatorLayout()); |
|
91 |
iIndicatorSize = indicator.Rect().Size(); |
|
92 |
||
93 |
// Calculate the items on the screen. |
|
94 |
iItemsOnScreen = iHeight / iRowHeight; |
|
95 |
iHeight = iItemsOnScreen * iRowHeight; |
|
96 |
||
97 |
if( iCurrentRow != KErrNotFound ) |
|
98 |
FitTopItemToView( iCurrentRow ); |
|
99 |
} |
|
100 |
||
101 |
// ----------------------------------------------------------------------------- |
|
102 |
// CHgSingleTextList::DrawItem() |
|
103 |
// ----------------------------------------------------------------------------- |
|
104 |
// |
|
105 |
void CHgSingleTextList::DrawItem( TInt aIndex, const TRect& aRect ) const |
|
106 |
{ |
|
107 |
// Get the Icon |
|
108 |
CHgItem* item = iItems[aIndex]; |
|
109 |
// Highlight the row if it's selected |
|
110 |
TInt indicators = CHgIndicatorManager::CountIndicators(item->Flags()); |
|
111 |
||
112 |
CWindowGc& gc = SystemGc(); |
|
113 |
||
114 |
TRgb color = iColor; |
|
115 |
if( aIndex == iSelectedIndex ) |
|
116 |
{ |
|
117 |
DrawHighlight( aRect, color ); |
|
118 |
||
119 |
// Draw first line text |
|
120 |
iDrawUtils->DrawTextMarquee( |
|
121 |
gc, |
|
122 |
aRect, |
|
123 |
iLayoutData->TitleLayout(indicators), |
|
124 |
item->Title(), |
|
125 |
color, 0); |
|
126 |
||
127 |
ResetClippingRect( gc ); |
|
128 |
} |
|
129 |
else |
|
130 |
{ |
|
131 |
// Draw first line text |
|
132 |
iDrawUtils->DrawText( |
|
133 |
gc, |
|
134 |
aRect, |
|
135 |
iLayoutData->TitleLayout(indicators), |
|
136 |
item->Title(), |
|
137 |
color); |
|
138 |
} |
|
139 |
||
140 |
// Draw the indicators. |
|
141 |
iIndicatorManager->DrawIndicators( |
|
142 |
gc, |
|
143 |
aRect, |
|
144 |
item->Flags(), |
|
145 |
iLayoutData->FirstIndicatorLayout(), |
|
72
a5e7a4f63858
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
59
diff
changeset
|
146 |
iLayoutData->SecondIndicatorLayout() ); |
56 | 147 |
} |
148 |
||
149 |
// ----------------------------------------------------------------------------- |
|
150 |
// CHgSingleTextList::CHgSingleTextList() |
|
151 |
// ----------------------------------------------------------------------------- |
|
152 |
// |
|
153 |
CHgSingleTextList::CHgSingleTextList( TInt aItemCount, |
|
154 |
CGulIcon* aDefaultIcon ) |
|
155 |
: CHgList( aItemCount, aDefaultIcon ) |
|
156 |
{ |
|
157 |
||
158 |
} |
|
159 |
||
160 |
// ----------------------------------------------------------------------------- |
|
161 |
// CHgSingleTextList::HandleScrollbarVisibilityChange() |
|
162 |
// ----------------------------------------------------------------------------- |
|
163 |
// |
|
164 |
void CHgSingleTextList::HandleScrollbarVisibilityChange( TBool aVisible ) |
|
165 |
{ |
|
166 |
TInt variety = aVisible ? 1 : 0; |
|
167 |
iLayoutData->SetSecondIndicatorLayout(list_single_pane_g1(variety)); |
|
168 |
} |
|
169 |
||
170 |
// End of file |