63
|
1 |
/*
|
|
2 |
* Copyright (c) 2007 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: Definition of the class CPbkxRclSearchResultListBox.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#include "emailtrace.h"
|
|
20 |
#include <AknsUtils.h>
|
|
21 |
#include <eikclbd.h>
|
|
22 |
|
|
23 |
#include <skinlayout.cdl.h>
|
|
24 |
#include <aknlayoutscalable_apps.cdl.h>
|
|
25 |
// ---------------------
|
|
26 |
|
|
27 |
#include "cpbkxrclsearchresultlistbox.h"
|
|
28 |
|
|
29 |
////////////////////////////////////////////////////////////////////////////
|
|
30 |
// CPbkxRclSearchResultListBox
|
|
31 |
////////////////////////////////////////////////////////////////////////////
|
|
32 |
|
|
33 |
|
|
34 |
// ======== MEMBER FUNCTIONS ========
|
|
35 |
|
|
36 |
// ---------------------------------------------------------------------------
|
|
37 |
// CPbkxRclSearchResultListBox::CPbkxRclSearchResultListBox
|
|
38 |
// ---------------------------------------------------------------------------
|
|
39 |
//
|
|
40 |
CPbkxRclSearchResultListBox::CPbkxRclSearchResultListBox() :
|
|
41 |
CAknSingleStyleListBox()
|
|
42 |
{
|
|
43 |
FUNC_LOG;
|
|
44 |
}
|
|
45 |
|
|
46 |
// ---------------------------------------------------------------------------
|
|
47 |
// CPbkxRclSearchResultListBox::~CPbkxRclSearchResultListBox
|
|
48 |
// ---------------------------------------------------------------------------
|
|
49 |
//
|
|
50 |
CPbkxRclSearchResultListBox::~CPbkxRclSearchResultListBox()
|
|
51 |
{
|
|
52 |
FUNC_LOG;
|
|
53 |
}
|
|
54 |
|
|
55 |
// --------------------------------------------------------------------------
|
|
56 |
// CPbkxRclSearchResultListBox::HandleScrollEventL
|
|
57 |
// --------------------------------------------------------------------------
|
|
58 |
//
|
|
59 |
void CPbkxRclSearchResultListBox::HandleScrollEventL(CEikScrollBar* aScrollBar, TEikScrollEvent aEventType)
|
|
60 |
{
|
|
61 |
// Handle showing of popupcharacter when user scrolls list using using scroll bar
|
|
62 |
TBool prevState = iShowPopupChar;
|
|
63 |
iShowPopupChar = (aEventType == EEikScrollThumbDragHoriz || aEventType == EEikScrollThumbDragVert);
|
|
64 |
if( prevState != iShowPopupChar )
|
|
65 |
{
|
|
66 |
DrawDeferred();
|
|
67 |
}
|
|
68 |
|
|
69 |
CAknSingleStyleListBox::HandleScrollEventL( aScrollBar, aEventType );
|
|
70 |
}
|
|
71 |
|
|
72 |
// --------------------------------------------------------------------------
|
|
73 |
// CPbkxRclSearchResultListBox::Draw
|
|
74 |
// --------------------------------------------------------------------------
|
|
75 |
//
|
|
76 |
void CPbkxRclSearchResultListBox::Draw(const TRect& aRect ) const
|
|
77 |
{
|
|
78 |
CAknSingleStyleListBox::Draw(aRect);
|
|
79 |
|
|
80 |
// Handle showing of popupcharacter when user scrolls list using using scroll bar
|
|
81 |
if( iShowPopupChar )
|
|
82 |
{
|
|
83 |
CWindowGc& gc = SystemGc();
|
|
84 |
|
|
85 |
TRgb normal;
|
|
86 |
AknsUtils::GetCachedColor(AknsUtils::SkinInstance(),
|
|
87 |
normal,
|
|
88 |
KAknsIIDQsnTextColors,
|
|
89 |
EAknsCIQsnTextColorsCG6 );
|
|
90 |
|
|
91 |
TAknLayoutRect layout;
|
|
92 |
layout.LayoutRect(Rect(), AknLayoutScalable_Apps::popup_navstr_preview_pane(0));
|
|
93 |
|
|
94 |
TAknLayoutRect cornerRect;
|
|
95 |
// skinned draw uses submenu popup window skin (skinned border)
|
|
96 |
cornerRect.LayoutRect(
|
|
97 |
layout.Rect(),
|
|
98 |
SkinLayout::Submenu_skin_placing_Line_2() );
|
|
99 |
|
|
100 |
TRect innerRect( layout.Rect() );
|
|
101 |
innerRect.Shrink( cornerRect.Rect().Width(), cornerRect.Rect().Height() );
|
|
102 |
|
|
103 |
if ( !AknsDrawUtils::DrawFrame(
|
|
104 |
AknsUtils::SkinInstance(),
|
|
105 |
gc,
|
|
106 |
layout.Rect(),
|
|
107 |
innerRect,
|
|
108 |
KAknsIIDQsnFrPopupSub,
|
|
109 |
KAknsIIDQsnFrPopupCenterSubmenu ) )
|
|
110 |
{
|
|
111 |
// skinned border failed -> black border
|
|
112 |
gc.SetPenStyle( CGraphicsContext::ESolidPen );
|
|
113 |
gc.SetBrushColor( KRgbBlack );
|
|
114 |
gc.DrawRect( layout.Rect() );
|
|
115 |
}
|
|
116 |
|
|
117 |
TAknLayoutText textLayout;
|
|
118 |
textLayout.LayoutText(layout.Rect(), AknLayoutScalable_Apps::popup_navstr_preview_pane_t1(0).LayoutLine());
|
|
119 |
|
|
120 |
TPtrC desc(Model()->ItemTextArray()->MdcaPoint(View()->TopItemIndex()));
|
|
121 |
textLayout.DrawText(gc, desc.Mid(desc.Find(_L("\t")) + 1, 1), ETrue, normal );
|
|
122 |
}
|
|
123 |
}
|
|
124 |
|
|
125 |
// ---------------------------------------------------------------------------
|
|
126 |
// CPbkxRclSearchResultListBox::CreateItemDrawerL
|
|
127 |
// ---------------------------------------------------------------------------
|
|
128 |
//
|
|
129 |
void CPbkxRclSearchResultListBox::CreateItemDrawerL()
|
|
130 |
{
|
|
131 |
FUNC_LOG;
|
|
132 |
CColumnListBoxData* data = CColumnListBoxData::NewL();
|
|
133 |
CleanupStack::PushL( data );
|
|
134 |
iItemDrawer = new ( ELeave ) CPbkxRclSearchResultItemDrawer(
|
|
135 |
Model(),
|
|
136 |
iEikonEnv->NormalFont(),
|
|
137 |
data );
|
|
138 |
data->SetSkinEnabledL( ETrue );
|
|
139 |
CleanupStack::Pop( data );
|
|
140 |
}
|
|
141 |
|
|
142 |
// ---------------------------------------------------------------------------
|
|
143 |
// CPbkxRclSearchResultListBox::MakeViewClassInstanceL
|
|
144 |
// ---------------------------------------------------------------------------
|
|
145 |
//
|
|
146 |
CListBoxView* CPbkxRclSearchResultListBox::MakeViewClassInstanceL()
|
|
147 |
{
|
|
148 |
|
|
149 |
//This strange old override below (returning class CPbkxRclSearchResultListView) causes on hardware empty
|
|
150 |
//list text not to draw. Most likely no need for this kind override at all.
|
|
151 |
//To fix draw this override is not used (however is part of pbk2rclengine api
|
|
152 |
//and therefore not removed completely)
|
|
153 |
// return ( new (ELeave) CPbkxRclSearchResultListView() );
|
|
154 |
|
|
155 |
return ( new (ELeave) CAknColumnListBoxView() );
|
|
156 |
}
|
|
157 |
|
|
158 |
////////////////////////////////////////////////////////////////////////////
|
|
159 |
// CPbkxRclSearchResultItemDrawer
|
|
160 |
////////////////////////////////////////////////////////////////////////////
|
|
161 |
|
|
162 |
|
|
163 |
// ---------------------------------------------------------------------------
|
|
164 |
// CPbkxRclSearchResultItemDrawer::CPbkxRclSearchResultItemDrawer
|
|
165 |
// ---------------------------------------------------------------------------
|
|
166 |
//
|
|
167 |
CPbkxRclSearchResultItemDrawer::CPbkxRclSearchResultItemDrawer(
|
|
168 |
MTextListBoxModel* aTextListBoxModel,
|
|
169 |
const CFont* aFont,
|
|
170 |
CColumnListBoxData* aColumnData ) :
|
|
171 |
CColumnListBoxItemDrawer( aTextListBoxModel, aFont, aColumnData )
|
|
172 |
{
|
|
173 |
FUNC_LOG;
|
|
174 |
}
|
|
175 |
|
|
176 |
// ---------------------------------------------------------------------------
|
|
177 |
// CPbkxRclSearchResultItemDrawer::~CPbkxRclSearchResultItemDrawer
|
|
178 |
// ---------------------------------------------------------------------------
|
|
179 |
//
|
|
180 |
CPbkxRclSearchResultItemDrawer::~CPbkxRclSearchResultItemDrawer()
|
|
181 |
{
|
|
182 |
FUNC_LOG;
|
|
183 |
}
|
|
184 |
|
|
185 |
// ---------------------------------------------------------------------------
|
|
186 |
// CPbkxRclSearchResultItemDrawer::SetHighlightColor
|
|
187 |
// ---------------------------------------------------------------------------
|
|
188 |
//
|
|
189 |
void CPbkxRclSearchResultItemDrawer::SetHighlightColor( TRgb aColor )
|
|
190 |
{
|
|
191 |
FUNC_LOG;
|
|
192 |
iHighlightColor = aColor;
|
|
193 |
iColorsSet = iColorsSet | EHighlighColorSet;
|
|
194 |
}
|
|
195 |
|
|
196 |
// ---------------------------------------------------------------------------
|
|
197 |
// CPbkxRclSearchResultItemDrawer::SetColor
|
|
198 |
// ---------------------------------------------------------------------------
|
|
199 |
//
|
|
200 |
void CPbkxRclSearchResultItemDrawer::SetColor( TRgb aColor )
|
|
201 |
{
|
|
202 |
FUNC_LOG;
|
|
203 |
iColor = aColor;
|
|
204 |
iColorsSet = iColorsSet | EColorSet;
|
|
205 |
}
|
|
206 |
|
|
207 |
// ---------------------------------------------------------------------------
|
|
208 |
// CPbkxRclSearchResultItemDrawer::ResetColors
|
|
209 |
// ---------------------------------------------------------------------------
|
|
210 |
//
|
|
211 |
void CPbkxRclSearchResultItemDrawer::ResetColors( TBool aHighlightColor )
|
|
212 |
{
|
|
213 |
FUNC_LOG;
|
|
214 |
if ( aHighlightColor )
|
|
215 |
{
|
|
216 |
iColorsSet = iColorsSet & ( ~EHighlighColorSet );
|
|
217 |
}
|
|
218 |
else
|
|
219 |
{
|
|
220 |
iColorsSet = iColorsSet & ( ~EColorSet );
|
|
221 |
}
|
|
222 |
}
|
|
223 |
|
|
224 |
// ---------------------------------------------------------------------------
|
|
225 |
// CPbkxRclSearchResultItemDrawer::DrawItemText
|
|
226 |
// ---------------------------------------------------------------------------
|
|
227 |
//
|
|
228 |
void CPbkxRclSearchResultItemDrawer::DrawItemText(
|
|
229 |
TInt aItemIndex,
|
|
230 |
const TRect& aItemTextRect,
|
|
231 |
TBool aItemIsCurrent,
|
|
232 |
TBool aViewIsEmphasized,
|
|
233 |
TBool aItemIsSelected ) const
|
|
234 |
{
|
|
235 |
FUNC_LOG;
|
|
236 |
|
|
237 |
// force our own text colors to item drawer
|
|
238 |
CPbkxRclSearchResultItemDrawer* ptr =
|
|
239 |
const_cast<CPbkxRclSearchResultItemDrawer*>( this );
|
|
240 |
if ( iColorsSet & EColorSet )
|
|
241 |
{
|
|
242 |
ptr->iTextColor = iColor;
|
|
243 |
}
|
|
244 |
|
|
245 |
if ( iColorsSet & EHighlighColorSet )
|
|
246 |
{
|
|
247 |
ptr->iHighlightedTextColor = iHighlightColor;
|
|
248 |
}
|
|
249 |
|
|
250 |
CColumnListBoxItemDrawer::DrawItemText(
|
|
251 |
aItemIndex,
|
|
252 |
aItemTextRect,
|
|
253 |
aItemIsCurrent,
|
|
254 |
aViewIsEmphasized,
|
|
255 |
aItemIsSelected );
|
|
256 |
}
|
|
257 |
|
|
258 |
|
|
259 |
|
|
260 |
//This strange old override below (CPbkxRclSearchResultListView) causes on hardware empty
|
|
261 |
//list text not to draw. Most likely no need for this kind override at all.
|
|
262 |
//To fix draw this override is not used (however is part of pbk2rclengine api
|
|
263 |
//and therefore not removed completely)
|
|
264 |
////////////////////////////////////////////////////////////////////////////
|
|
265 |
// CPbkxRclSearchResultListView
|
|
266 |
////////////////////////////////////////////////////////////////////////////
|
|
267 |
// ---------------------------------------------------------------------------
|
|
268 |
// CPbkxRclSearchResultListView::DrawEmptyList
|
|
269 |
// ---------------------------------------------------------------------------
|
|
270 |
//
|
|
271 |
void CPbkxRclSearchResultListView::DrawEmptyList(const TRect &aClientRect) const
|
|
272 |
{
|
|
273 |
// // Disable AVKON skinning so that our own color definitions apply
|
|
274 |
// TBool skinEnabled = AknsUtils::AvkonSkinEnabled();
|
|
275 |
// // Safe to ignore error
|
|
276 |
// TRAP_IGNORE( AknsUtils::SetAvkonSkinEnabledL( EFalse ) );
|
|
277 |
// CAknColumnListBoxView::DrawEmptyList( aClientRect );
|
|
278 |
// // Safe to ignore error
|
|
279 |
// TRAP_IGNORE( AknsUtils::SetAvkonSkinEnabledL( skinEnabled ) );
|
|
280 |
}
|
|
281 |
|