58
|
1 |
/*
|
|
2 |
* Copyright (c) 2006 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: Implementation of CCmDestinationIconMap
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include <eikenv.h>
|
|
19 |
#include <eiksbfrm.h>
|
|
20 |
#include <eikscrlb.h>
|
|
21 |
#include <bidivisual.h>
|
|
22 |
#include <avkon.rsg>
|
|
23 |
#include <AknPanic.h>
|
|
24 |
#include <avkon.hrh>
|
|
25 |
#include <AknUtils.h>
|
|
26 |
#include <aknlayoutscalable_avkon.cdl.h>
|
|
27 |
#include <layoutmetadata.cdl.h>
|
|
28 |
#include <AknLayout.lag>
|
|
29 |
#include <data_caging_path_literals.hrh>
|
|
30 |
#include <aknappui.h>
|
|
31 |
#include <aknconsts.h>
|
|
32 |
#include <AknDef.h>
|
|
33 |
#include <PUAcodes.hrh>
|
|
34 |
#include <s32file.h>
|
|
35 |
#include <eikscrlb.h> // TEikScrollBarModelType
|
|
36 |
#include <AknsDrawUtils.h>
|
|
37 |
#include <featmgr.h>
|
|
38 |
#include <AknsFrameBackgroundControlContext.h>
|
|
39 |
#include <cmmanager.mbg>
|
|
40 |
#include <cmcommonconstants.h>
|
|
41 |
#include <touchfeedback.h>
|
|
42 |
#include "cmdesticonmap.h"
|
|
43 |
#include "cmmanagerimpl.h"
|
|
44 |
|
|
45 |
// The offset because of CEikDialogPage
|
|
46 |
const TInt KHorizontalDialogMargin = 0;
|
|
47 |
const TInt KVerticalDialogMargin = 0;
|
|
48 |
const TInt KAknSctCBaButtonDirections = 3; // bottom, right and left
|
|
49 |
|
|
50 |
/**
|
|
51 |
* Extension class to CCmDestinationIconMap
|
|
52 |
*
|
|
53 |
* @since S60 v3.2
|
|
54 |
*/
|
|
55 |
NONSHARABLE_CLASS( CCmDestinationIconMapExtension ) : public CBase,
|
|
56 |
public MObjectProvider
|
|
57 |
{
|
|
58 |
public:
|
|
59 |
|
|
60 |
CCmDestinationIconMapExtension();
|
|
61 |
~CCmDestinationIconMapExtension();
|
|
62 |
|
|
63 |
protected:
|
|
64 |
|
|
65 |
TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
|
|
66 |
MObjectProvider* MopNext();
|
|
67 |
|
|
68 |
public: // data
|
|
69 |
|
|
70 |
MCoeControlObserver *iObserver;
|
|
71 |
|
|
72 |
TUint iFlags;
|
|
73 |
MObjectProvider* iIconMap;
|
|
74 |
TInt iMaxVisibleRows;
|
|
75 |
CAknsFrameBackgroundControlContext* iBgContext;
|
|
76 |
};
|
|
77 |
|
|
78 |
// -----------------------------------------------------------------------------
|
|
79 |
// CCmDestinationIconMapExtension::CCmDestinationIconMapExtension
|
|
80 |
// C++ default constructor can NOT contain any code, that
|
|
81 |
// might leave.
|
|
82 |
// -----------------------------------------------------------------------------
|
|
83 |
//
|
|
84 |
CCmDestinationIconMapExtension::CCmDestinationIconMapExtension()
|
|
85 |
: iMaxVisibleRows( 0 )
|
|
86 |
{
|
|
87 |
iObserver = NULL;
|
|
88 |
}
|
|
89 |
|
|
90 |
// -----------------------------------------------------------------------------
|
|
91 |
// CCmDestinationIconMapExtension::MopSupplyObject()
|
|
92 |
// -----------------------------------------------------------------------------
|
|
93 |
//
|
|
94 |
TTypeUid::Ptr CCmDestinationIconMapExtension::MopSupplyObject( TTypeUid aId )
|
|
95 |
{
|
|
96 |
return MAknsControlContext::SupplyMopObject( aId, iBgContext );
|
|
97 |
}
|
|
98 |
|
|
99 |
// -----------------------------------------------------------------------------
|
|
100 |
// CCmDestinationIconMapExtension::MopNext()
|
|
101 |
// -----------------------------------------------------------------------------
|
|
102 |
//
|
|
103 |
MObjectProvider* CCmDestinationIconMapExtension::MopNext()
|
|
104 |
{
|
|
105 |
return iIconMap;
|
|
106 |
}
|
|
107 |
|
|
108 |
// -----------------------------------------------------------------------------
|
|
109 |
// CCmDestinationIconMapExtension::~CCmDestinationIconMapExtension()
|
|
110 |
// -----------------------------------------------------------------------------
|
|
111 |
//
|
|
112 |
CCmDestinationIconMapExtension::~CCmDestinationIconMapExtension()
|
|
113 |
{
|
|
114 |
delete iBgContext;
|
|
115 |
iBgContext = NULL;
|
|
116 |
}
|
|
117 |
|
|
118 |
// -----------------------------------------------------------------------------
|
|
119 |
// CCmDestinationIconMap::CCmDestinationIconMap
|
|
120 |
// C++ default constructor can NOT contain any code, that
|
|
121 |
// might leave.
|
|
122 |
// -----------------------------------------------------------------------------
|
|
123 |
//
|
|
124 |
CCmDestinationIconMap::CCmDestinationIconMap()
|
|
125 |
: iCursorPos( TPoint( 0,0 ) )
|
|
126 |
, iOldCursorPos( TPoint( 0,0 ) )
|
|
127 |
, iMaxColumns( -1 )
|
|
128 |
, iDragAlreadyActive( EFalse )
|
|
129 |
{
|
|
130 |
}
|
|
131 |
|
|
132 |
// -----------------------------------------------------------------------------
|
|
133 |
// CCmDestinationIconMap::NewL
|
|
134 |
// Two-phased constructor.
|
|
135 |
// -----------------------------------------------------------------------------
|
|
136 |
//
|
|
137 |
CCmDestinationIconMap* CCmDestinationIconMap::NewL()
|
|
138 |
{
|
|
139 |
CCmDestinationIconMap* self = new( ELeave ) CCmDestinationIconMap();
|
|
140 |
|
|
141 |
CleanupStack::PushL( self );
|
|
142 |
self->ConstructL();
|
|
143 |
CleanupStack::Pop( self ); //self
|
|
144 |
return self;
|
|
145 |
}
|
|
146 |
|
|
147 |
// -----------------------------------------------------------------------------
|
|
148 |
// CCmDestinationIconMap::ConstructL
|
|
149 |
// Symbian 2nd phase constructor can leave.
|
|
150 |
// -----------------------------------------------------------------------------
|
|
151 |
//
|
|
152 |
void CCmDestinationIconMap::ConstructL()
|
|
153 |
{
|
|
154 |
// Must be created here to get the member variables available
|
|
155 |
iExtension = new ( ELeave ) CCmDestinationIconMapExtension;
|
|
156 |
iExtension->iIconMap = this;
|
|
157 |
|
|
158 |
iConsArray = new( ELeave ) CAknIconArray( KNumOfIcons );
|
|
159 |
|
|
160 |
iExtension->iFlags = 0x00;
|
|
161 |
|
|
162 |
DoLayout();
|
|
163 |
}
|
|
164 |
|
|
165 |
// -----------------------------------------------------------------------------
|
|
166 |
// CCmDestinationIconMap::~CCmDestinationIconMap()
|
|
167 |
// -----------------------------------------------------------------------------
|
|
168 |
//
|
|
169 |
CCmDestinationIconMap::~CCmDestinationIconMap()
|
|
170 |
{
|
|
171 |
delete iSBFrame; iSBFrame = NULL;
|
|
172 |
|
|
173 |
delete iOffscreenBg;
|
|
174 |
delete iBitmapDevice;
|
|
175 |
delete iBitmapGc;
|
|
176 |
|
|
177 |
delete iExtension;
|
|
178 |
iExtension = ( CCmDestinationIconMapExtension* )NULL;
|
|
179 |
|
|
180 |
if ( iConsArray )
|
|
181 |
{
|
|
182 |
iConsArray->ResetAndDestroy();
|
|
183 |
delete iConsArray;
|
|
184 |
iConsArray = NULL;
|
|
185 |
}
|
|
186 |
}
|
|
187 |
|
|
188 |
// -----------------------------------------------------------------------------
|
|
189 |
// CCmDestinationIconMap::DoLayout()
|
|
190 |
// -----------------------------------------------------------------------------
|
|
191 |
//
|
|
192 |
void CCmDestinationIconMap::DoLayout()
|
|
193 |
{
|
|
194 |
TRAPD( err,LoadIconL() );
|
|
195 |
if ( err )
|
|
196 |
{
|
|
197 |
return;
|
|
198 |
}
|
|
199 |
|
|
200 |
iIsMirrored = AknLayoutUtils::LayoutMirrored();
|
|
201 |
iDrawnBefore = EFalse;
|
|
202 |
CountMaxColumnsAndCellSizes();
|
|
203 |
SizeChanged();
|
|
204 |
}
|
|
205 |
|
|
206 |
// -----------------------------------------------------------------------------
|
|
207 |
// CCmDestinationIconMap::ConstructFromResourceL()
|
|
208 |
// -----------------------------------------------------------------------------
|
|
209 |
//
|
|
210 |
void CCmDestinationIconMap::ConstructFromResourceL(
|
|
211 |
TResourceReader& /*aReader*/ )
|
|
212 |
{
|
|
213 |
LoadIconL();
|
|
214 |
CreateScrollBarAndIconRowL();
|
|
215 |
|
|
216 |
iExtension->iBgContext = CAknsFrameBackgroundControlContext::NewL(
|
|
217 |
KAknsIIDQsnFrPopup,
|
|
218 |
TRect( 0, 0, 1, 1 ),
|
|
219 |
TRect( 0, 0, 1, 1 ),
|
|
220 |
EFalse );
|
|
221 |
|
|
222 |
if ( DrawableWindow() && AknLayoutUtils::PenEnabled() )
|
|
223 |
{
|
|
224 |
EnableDragEvents();
|
|
225 |
SetGloballyCapturing( ETrue );
|
|
226 |
SetPointerCapture( ETrue );
|
|
227 |
}
|
|
228 |
}
|
|
229 |
|
|
230 |
// -----------------------------------------------------------------------------
|
|
231 |
// CCmDestinationIconMap::LoadIcons()
|
|
232 |
// This actually load the all icons to be shown on dialog from icon file
|
|
233 |
// -----------------------------------------------------------------------------
|
|
234 |
//
|
|
235 |
void CCmDestinationIconMap::LoadIconL()
|
|
236 |
{
|
|
237 |
iConsArray->ResetAndDestroy();
|
|
238 |
// Draw all the Icons.
|
|
239 |
TParse mbmFile;
|
|
240 |
User::LeaveIfError( mbmFile.Set( KManagerIconFilename,
|
|
241 |
&KDC_APP_BITMAP_DIR, NULL ) );
|
|
242 |
|
|
243 |
// Create icon bitmap and mask.
|
|
244 |
for ( TInt i( 0 ); i < ( KNumOfIcons * 2 ); i++ )
|
|
245 |
{
|
|
246 |
CFbsBitmap* bitmap = NULL;
|
|
247 |
CFbsBitmap* bitmapMask = NULL;
|
|
248 |
AknIconUtils::CreateIconLC(
|
|
249 |
bitmap,
|
|
250 |
bitmapMask, mbmFile.FullName(),
|
|
251 |
EMbmCmmanagerQgn_prop_set_conn_dest_internet_small + i,
|
|
252 |
EMbmCmmanagerQgn_prop_set_conn_dest_internet_small + i + 1 );
|
|
253 |
i++;
|
|
254 |
AknIconUtils::SetSize( bitmap,
|
|
255 |
TSize( iGridItemWidth, iGridItemHeight ) );
|
|
256 |
AknIconUtils::SetSize( bitmapMask,
|
|
257 |
TSize( iGridItemWidth, iGridItemHeight ) );
|
|
258 |
CGulIcon* icon = CGulIcon::NewL( bitmap, bitmapMask );
|
|
259 |
CleanupStack::PushL( icon );
|
|
260 |
iConsArray->AppendL( icon );
|
|
261 |
CleanupStack::Pop( 3, bitmap );
|
|
262 |
}
|
|
263 |
}
|
|
264 |
|
|
265 |
// -----------------------------------------------------------------------------
|
|
266 |
// CCmDestinationIconMap::HeightInRows()
|
|
267 |
// This actually returns the no of rows to be shown on a page
|
|
268 |
// Depends upon the Layout size
|
|
269 |
// -----------------------------------------------------------------------------
|
|
270 |
//
|
|
271 |
TInt CCmDestinationIconMap::HeightInRows()
|
|
272 |
{
|
|
273 |
return ( iRows );
|
|
274 |
}
|
|
275 |
|
|
276 |
// -----------------------------------------------------------------------------
|
|
277 |
// CCmDestinationIconMap::CreateScrollBarAndIconRowL()
|
|
278 |
// This actually creates the scroll bar sets the number of
|
|
279 |
// pages and rows on a page to be shown
|
|
280 |
// -----------------------------------------------------------------------------
|
|
281 |
//
|
|
282 |
void CCmDestinationIconMap::CreateScrollBarAndIconRowL()
|
|
283 |
{
|
|
284 |
iRows = ( ( iConsArray->Count() - 1 ) / iMaxColumns ) + 1 ;
|
|
285 |
iFirstVisibleRow = 0;
|
|
286 |
iAnimated = EFalse;
|
|
287 |
iCursorPos = TPoint( 0, 0 );
|
|
288 |
|
|
289 |
// Create and set the scb visible even though there is nothing to scroll
|
|
290 |
delete iSBFrame; iSBFrame=NULL;
|
|
291 |
|
|
292 |
if ( AknLayoutUtils::PenEnabled() )
|
|
293 |
{
|
|
294 |
iSBFrame=new( ELeave ) CEikScrollBarFrame( this, this, ETrue );
|
|
295 |
}
|
|
296 |
else
|
|
297 |
{
|
|
298 |
iSBFrame=new( ELeave ) CEikScrollBarFrame( this, NULL, ETrue );
|
|
299 |
}
|
|
300 |
// Decide which type of scrollbar is shown
|
|
301 |
CAknAppUi* appUi = iAvkonAppUi;
|
|
302 |
if ( AknLayoutUtils::DefaultScrollBarType( appUi ) ==
|
|
303 |
CEikScrollBarFrame::EDoubleSpan )
|
|
304 |
{
|
|
305 |
// For EDoubleSpan type scrollbar
|
|
306 |
if ( AknLayoutUtils::PenEnabled() )
|
|
307 |
{
|
|
308 |
// window owning scrollbar
|
|
309 |
iSBFrame->CreateDoubleSpanScrollBarsL( ETrue,
|
|
310 |
EFalse,
|
|
311 |
ETrue,
|
|
312 |
EFalse );
|
|
313 |
}
|
|
314 |
else
|
|
315 |
{
|
|
316 |
// non-window owning scrollbar
|
|
317 |
iSBFrame->CreateDoubleSpanScrollBarsL( EFalse,
|
|
318 |
EFalse,
|
|
319 |
ETrue,
|
|
320 |
EFalse );
|
|
321 |
}
|
|
322 |
iSBFrame->SetTypeOfVScrollBar( CEikScrollBarFrame::EDoubleSpan );
|
|
323 |
}
|
|
324 |
else
|
|
325 |
{
|
|
326 |
// For EArrowHead type scrollbar
|
|
327 |
iSBFrame->SetTypeOfVScrollBar( CEikScrollBarFrame::EArrowHead );
|
|
328 |
}
|
|
329 |
|
|
330 |
iSBFrame->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff,
|
|
331 |
CEikScrollBarFrame::EAuto );
|
|
332 |
iSBFrame->VerticalScrollBar()->SetMopParent( iExtension );
|
|
333 |
UpdateScrollIndicatorL();
|
|
334 |
}
|
|
335 |
|
|
336 |
// -----------------------------------------------------------------------------
|
|
337 |
// CCmDestinationIconMap::SetIndex
|
|
338 |
// set the reference of the selected icon index from the table
|
|
339 |
// -----------------------------------------------------------------------------
|
|
340 |
//
|
|
341 |
void CCmDestinationIconMap::SetIndex( TInt& aIconIndex )
|
|
342 |
{
|
|
343 |
iIconIndex = &aIconIndex;
|
|
344 |
}
|
|
345 |
|
|
346 |
// -----------------------------------------------------------------------------
|
|
347 |
// CCmDestinationIconMap::MinimumSize
|
|
348 |
//
|
|
349 |
// -----------------------------------------------------------------------------
|
|
350 |
//
|
|
351 |
TSize CCmDestinationIconMap::MinimumSize()
|
|
352 |
{
|
|
353 |
iIsMirrored = AknLayoutUtils::LayoutMirrored();
|
|
354 |
CountMaxColumnsAndCellSizes();
|
|
355 |
|
|
356 |
TRect rect;
|
|
357 |
// Used the set rect, but resolution changes cannot be handled when it is used
|
|
358 |
|
|
359 |
TAknLayoutRect dialogLayRect;
|
|
360 |
|
|
361 |
// Main pane without softkeys
|
|
362 |
TRect mainPaneRect;
|
|
363 |
if ( !AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPaneRect ) )
|
|
364 |
{
|
|
365 |
mainPaneRect = iAvkonAppUi->ClientRect();
|
|
366 |
}
|
|
367 |
|
|
368 |
// Dialog layout, check variety first
|
|
369 |
TAknLayoutScalableParameterLimits iconMapDialogVariety =
|
|
370 |
AknLayoutScalable_Avkon::popup_grid_graphic_window_ParamLimits();
|
|
371 |
|
|
372 |
// Calc the variety
|
|
373 |
TInt maxVariety = iconMapDialogVariety.LastVariety();
|
|
374 |
|
|
375 |
// Check the CBA, if the orientation is not landscape
|
|
376 |
// there is not so much varieties
|
|
377 |
AknLayoutUtils::TAknCbaLocation location = AknLayoutUtils::CbaLocation();
|
|
378 |
// the offset for the certain cba location variety
|
|
379 |
TInt maxVarietyOffset = 0;
|
|
380 |
// the number of varieties
|
|
381 |
TInt varietyOffset = maxVariety + 1;
|
|
382 |
|
|
383 |
// landscape variety number must be calculated offset == number of varieties
|
|
384 |
// same applies to the variety number for the biggest sized layout for the
|
|
385 |
// variety
|
|
386 |
if ( Layout_Meta_Data::IsLandscapeOrientation() )
|
|
387 |
{
|
|
388 |
// the offset for one variety
|
|
389 |
varietyOffset = ( maxVariety + 1 ) / KAknSctCBaButtonDirections;
|
|
390 |
}
|
|
391 |
|
|
392 |
// for right and left cba buttons the max variety is not zero
|
|
393 |
// the varities are ordered by the location of the cba and the descending order
|
|
394 |
// e.g the biggest sized layout first, the smallest last
|
|
395 |
if ( location == AknLayoutUtils::EAknCbaLocationRight )
|
|
396 |
{
|
|
397 |
maxVarietyOffset = varietyOffset;
|
|
398 |
}
|
|
399 |
else if ( location == AknLayoutUtils::EAknCbaLocationLeft )
|
|
400 |
{
|
|
401 |
maxVarietyOffset = varietyOffset + varietyOffset; // 2*
|
|
402 |
}
|
|
403 |
|
|
404 |
TInt varietyNumber = varietyOffset - iRows - 1;
|
|
405 |
|
|
406 |
// if more lines than possible to show, use the default
|
|
407 |
// ( the biggest grid ) variety
|
|
408 |
if ( varietyNumber < 0 )
|
|
409 |
{
|
|
410 |
varietyNumber = 0;
|
|
411 |
}
|
|
412 |
// if zero rows, use the minimum
|
|
413 |
else if ( iRows<=0 )
|
|
414 |
{
|
|
415 |
varietyNumber -= 1;
|
|
416 |
}
|
|
417 |
|
|
418 |
//add the varietyoffset
|
|
419 |
varietyNumber += maxVarietyOffset;
|
|
420 |
|
|
421 |
if ( Layout_Meta_Data::IsLandscapeOrientation() &&
|
|
422 |
location == AknLayoutUtils::EAknCbaLocationRight )
|
|
423 |
{
|
|
424 |
varietyNumber = 10;
|
|
425 |
}
|
|
426 |
else
|
|
427 |
{
|
|
428 |
if( iRows == 0 )
|
|
429 |
{
|
|
430 |
varietyNumber = 5;
|
|
431 |
}
|
|
432 |
else
|
|
433 |
{
|
|
434 |
varietyNumber = 3;
|
|
435 |
}
|
|
436 |
}
|
|
437 |
// Layout the dialog size
|
|
438 |
dialogLayRect.LayoutRect( mainPaneRect,
|
|
439 |
AknLayoutScalable_Avkon::popup_grid_graphic_window( varietyNumber ) );
|
|
440 |
|
|
441 |
// Layout the grid
|
|
442 |
TAknLayoutRect gridWithScrollLayRect;
|
|
443 |
gridWithScrollLayRect.LayoutRect( dialogLayRect.Rect(),
|
|
444 |
AknLayoutScalable_Avkon::listscroll_popup_graphic_pane() );
|
|
445 |
|
|
446 |
return TSize( dialogLayRect.Rect().Width(),
|
|
447 |
gridWithScrollLayRect.Rect().Height() );
|
|
448 |
}
|
|
449 |
|
|
450 |
// -----------------------------------------------------------------------------
|
|
451 |
// CCmDestinationIconMap::ActivateL()
|
|
452 |
// This method is needed to set correct initial value to scroll indicator.
|
|
453 |
// -----------------------------------------------------------------------------
|
|
454 |
//
|
|
455 |
void CCmDestinationIconMap::ActivateL()
|
|
456 |
{
|
|
457 |
CCoeControl::ActivateL();
|
|
458 |
if ( iRows > iExtension->iMaxVisibleRows )
|
|
459 |
{
|
|
460 |
UpdateScrollIndicatorL();
|
|
461 |
}
|
|
462 |
}
|
|
463 |
|
|
464 |
// -----------------------------------------------------------------------------
|
|
465 |
// CCmDestinationIconMap::OfferKeyEventL
|
|
466 |
// Handles all the Keypad events
|
|
467 |
// -----------------------------------------------------------------------------
|
|
468 |
//
|
|
469 |
TKeyResponse CCmDestinationIconMap::OfferKeyEventL( const TKeyEvent& aKeyEvent,
|
|
470 |
TEventCode /*aModifiers*/ )
|
|
471 |
{
|
|
472 |
TUint code=aKeyEvent.iCode;
|
|
473 |
|
|
474 |
switch ( code )
|
|
475 |
{
|
|
476 |
case EKeyLeftArrow:
|
|
477 |
case '4':
|
|
478 |
MoveCursorL( -1,0 );
|
|
479 |
break;
|
|
480 |
case EKeyRightArrow:
|
|
481 |
case '6':
|
|
482 |
MoveCursorL( 1,0 );
|
|
483 |
break;
|
|
484 |
case EKeyUpArrow:
|
|
485 |
case '2':
|
|
486 |
MoveCursorL( 0,-1 );
|
|
487 |
break;
|
|
488 |
case EKeyDownArrow:
|
|
489 |
case '8':
|
|
490 |
MoveCursorL( 0,1 );
|
|
491 |
break;
|
|
492 |
case EKeyOK:
|
|
493 |
case '5':
|
|
494 |
case EKeySpace:
|
|
495 |
{
|
|
496 |
if ( iConsArray )
|
|
497 |
{
|
|
498 |
TInt ret = iMaxColumns *
|
|
499 |
( iFirstVisibleRow + iCursorPos.iY ) +
|
|
500 |
iCursorPos.iX;
|
|
501 |
if ( ret <= iConsArray->Count() )
|
|
502 |
{
|
|
503 |
*iIconIndex = ret;
|
|
504 |
}
|
|
505 |
else
|
|
506 |
{
|
|
507 |
*iIconIndex = -1;
|
|
508 |
}
|
|
509 |
}
|
|
510 |
|
|
511 |
}
|
|
512 |
break;
|
|
513 |
default:
|
|
514 |
return EKeyWasNotConsumed;
|
|
515 |
|
|
516 |
}
|
|
517 |
return EKeyWasConsumed;
|
|
518 |
}
|
|
519 |
|
|
520 |
#ifdef RD_SCALABLE_UI_V2
|
|
521 |
|
|
522 |
// -----------------------------------------------------------------------------
|
|
523 |
// CCmDestinationIconMap::HandlePointerEventL
|
|
524 |
// Handles all the Keypad events
|
|
525 |
// -----------------------------------------------------------------------------
|
|
526 |
//
|
|
527 |
void CCmDestinationIconMap::HandlePointerEventL(
|
|
528 |
const TPointerEvent& aPointerEvent )
|
|
529 |
{
|
|
530 |
if ( AknLayoutUtils::PenEnabled() )
|
|
531 |
{
|
|
532 |
TInt xInPixels = aPointerEvent.iPosition.iX - iGridTopLeft.iX;
|
|
533 |
TInt yInPixels = aPointerEvent.iPosition.iY - iGridTopLeft.iY;
|
|
534 |
TInt newGridX = xInPixels / iGridItemWidth;
|
|
535 |
TInt newGridY = yInPixels / iGridItemHeight;
|
|
536 |
TInt globalY = newGridY + iFirstVisibleRow;
|
|
537 |
|
|
538 |
// The pointer has been set down or dragged into the area of the grid.
|
|
539 |
// Also, it may NOT be in the "empty slots" at the end of the grid.
|
|
540 |
if ( xInPixels >= 0 &&
|
|
541 |
yInPixels >= 0 &&
|
|
542 |
newGridX < iMaxColumns &&
|
|
543 |
yInPixels < iGridItemHeight * iExtension->iMaxVisibleRows &&
|
|
544 |
globalY * iMaxColumns + newGridX + 1 <= iConsArray->Count() )
|
|
545 |
{
|
|
546 |
// For any action to be taken, the pointer event must either be a
|
|
547 |
// Button1Down or a drag event which has originated from a
|
|
548 |
// Button1Down in to the grid.
|
|
549 |
if ( aPointerEvent.iType == TPointerEvent::EButton1Down ||
|
|
550 |
aPointerEvent.iType == TPointerEvent::EDrag )
|
|
551 |
{
|
|
552 |
if ( aPointerEvent.iType == TPointerEvent::EDrag )
|
|
553 |
{
|
|
554 |
iDragAlreadyActive = ETrue;
|
|
555 |
}
|
|
556 |
|
|
557 |
// The user tapps a cell which has no icon. it is ignored.
|
|
558 |
if ( iConsArray->Count() > globalY * iMaxColumns + newGridX )
|
|
559 |
{
|
|
560 |
// If icon is already selected then on single tap it
|
|
561 |
// should select the icon.
|
|
562 |
if( iCursorPos.iY == newGridY &&
|
|
563 |
iCursorPos.iX == newGridX &&
|
|
564 |
aPointerEvent.iType != TPointerEvent::EDrag )
|
|
565 |
{
|
|
566 |
if ( iExtension->iObserver )
|
|
567 |
{
|
|
568 |
iExtension->iObserver->HandleControlEventL(
|
|
569 |
this,
|
|
570 |
MCoeControlObserver::EEventStateChanged );
|
|
571 |
}
|
|
572 |
}
|
|
573 |
else if ( iCursorPos.iX + ( iCursorPos.iY +
|
|
574 |
iFirstVisibleRow ) * iMaxColumns <
|
|
575 |
iConsArray->Count() )
|
|
576 |
{
|
|
577 |
iOldCursorPos = iCursorPos;
|
|
578 |
iCursorPos.iY = newGridY;
|
|
579 |
iCursorPos.iX = newGridX;
|
|
580 |
DrawCursor();
|
|
581 |
}
|
|
582 |
else
|
|
583 |
{
|
|
584 |
iOldCursorPos.iX = 0;
|
|
585 |
iOldCursorPos.iY = 0;
|
|
586 |
}
|
|
587 |
}
|
|
588 |
}
|
|
589 |
else if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
|
|
590 |
{
|
|
591 |
// The pointer has been set and dragged into the area of
|
|
592 |
// the grid.
|
|
593 |
if ( yInPixels >= 0 && yInPixels < iGridItemHeight *
|
|
594 |
iExtension->iMaxVisibleRows &&
|
|
595 |
iDragAlreadyActive &&
|
|
596 |
iOldCursorPos == iCursorPos &&
|
|
597 |
(iConsArray->Count() > (globalY * iMaxColumns + newGridX)))
|
|
598 |
{
|
|
599 |
if ( iExtension->iObserver )
|
|
600 |
{
|
|
601 |
iExtension->iObserver->HandleControlEventL(
|
|
602 |
this,
|
|
603 |
MCoeControlObserver::EEventStateChanged );
|
|
604 |
}
|
|
605 |
iDragAlreadyActive = EFalse;
|
|
606 |
}
|
|
607 |
}
|
|
608 |
|
|
609 |
MTouchFeedback* feedback = MTouchFeedback::Instance();
|
|
610 |
|
|
611 |
if ( feedback )
|
|
612 |
{
|
|
613 |
if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
|
|
614 |
{
|
|
615 |
feedback->InstantFeedback( this, ETouchFeedbackBasic );
|
|
616 |
}
|
|
617 |
else if ( aPointerEvent.iType == TPointerEvent::EDrag && iCursorPos != iOldCursorPos )
|
|
618 |
{
|
|
619 |
feedback->InstantFeedback( this, ETouchFeedbackSensitive );
|
|
620 |
}
|
|
621 |
}
|
|
622 |
}
|
|
623 |
else // For a non window owning scrollbar.
|
|
624 |
{
|
|
625 |
if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
|
|
626 |
{
|
|
627 |
iDragAlreadyActive = EFalse;
|
|
628 |
}
|
|
629 |
}
|
|
630 |
|
|
631 |
CCoeControl::HandlePointerEventL( aPointerEvent );
|
|
632 |
}
|
|
633 |
}
|
|
634 |
|
|
635 |
// -----------------------------------------------------------------------------
|
|
636 |
// CCmDestinationIconMap::SetObserver
|
|
637 |
// Sets the observer.
|
|
638 |
// -----------------------------------------------------------------------------
|
|
639 |
//
|
|
640 |
void CCmDestinationIconMap::SetObserver( MCoeControlObserver* aObserver )
|
|
641 |
{
|
|
642 |
if ( iExtension )
|
|
643 |
{
|
|
644 |
iExtension->iObserver = aObserver;
|
|
645 |
}
|
|
646 |
}
|
|
647 |
|
|
648 |
#endif //RD_SCALABLE_UI_V2
|
|
649 |
|
|
650 |
// -----------------------------------------------------------------------------
|
|
651 |
// CCmDestinationIconMap::InputCapabilities()
|
|
652 |
//
|
|
653 |
// -----------------------------------------------------------------------------
|
|
654 |
//
|
|
655 |
TCoeInputCapabilities CCmDestinationIconMap::InputCapabilities() const
|
|
656 |
{
|
|
657 |
return TCoeInputCapabilities( TCoeInputCapabilities::EAllText );
|
|
658 |
}
|
|
659 |
|
|
660 |
// -----------------------------------------------------------------------------
|
|
661 |
// CCmDestinationIconMap::SizeChanged()
|
|
662 |
// Control position of this control is registered for skin library when
|
|
663 |
// necessary in CEikDialogPage::SetDataPosition, so we do not do that in this
|
|
664 |
// method.
|
|
665 |
// -----------------------------------------------------------------------------
|
|
666 |
//
|
|
667 |
void CCmDestinationIconMap::SizeChanged()
|
|
668 |
{
|
|
669 |
// Get the layout
|
|
670 |
|
|
671 |
// Main pane without softkeys
|
|
672 |
TRect mainPaneRect;
|
|
673 |
|
|
674 |
if ( !AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane,
|
|
675 |
mainPaneRect ) )
|
|
676 |
{
|
|
677 |
mainPaneRect = iAvkonAppUi->ClientRect();
|
|
678 |
}
|
|
679 |
|
|
680 |
// Dialog layout, check variety first
|
|
681 |
TAknLayoutScalableParameterLimits iconMapDialogVariety =
|
|
682 |
AknLayoutScalable_Avkon::popup_grid_graphic_window_ParamLimits();
|
|
683 |
|
|
684 |
TInt maxVariety = iconMapDialogVariety.LastVariety();
|
|
685 |
|
|
686 |
// Check the CBA, if the orientation is not landscape
|
|
687 |
// there is not so much varieties
|
|
688 |
AknLayoutUtils::TAknCbaLocation location = AknLayoutUtils::CbaLocation();
|
|
689 |
// the offset for the certain cba location variety
|
|
690 |
TInt maxVarietyOffset = 0;
|
|
691 |
TInt varietyOffset = maxVariety + 1;
|
|
692 |
|
|
693 |
// landscape variety number must be calculated offset == number of varieties
|
|
694 |
// same applies to the variety number for the biggest sized layout for the
|
|
695 |
// variety
|
|
696 |
if ( Layout_Meta_Data::IsLandscapeOrientation() )
|
|
697 |
{
|
|
698 |
// the offset for one variety
|
|
699 |
varietyOffset = ( maxVariety + 1 ) / KAknSctCBaButtonDirections;
|
|
700 |
}
|
|
701 |
|
|
702 |
// for right and left cba buttons the max variety is not zero
|
|
703 |
// the varities are ordered by the location of the cba and the descending
|
|
704 |
// order e.g the biggest sized layout first, the smallest last
|
|
705 |
if ( location == AknLayoutUtils::EAknCbaLocationRight )
|
|
706 |
{
|
|
707 |
maxVarietyOffset = varietyOffset;
|
|
708 |
}
|
|
709 |
else if ( location == AknLayoutUtils::EAknCbaLocationLeft )
|
|
710 |
{
|
|
711 |
maxVarietyOffset = varietyOffset + varietyOffset; // 2*
|
|
712 |
}
|
|
713 |
|
|
714 |
TInt varietyNumber = varietyOffset - iRows - 1;
|
|
715 |
|
|
716 |
// if more lines than possible to show, use the default
|
|
717 |
// ( the biggest grid ) variety
|
|
718 |
if ( varietyNumber < 0 )
|
|
719 |
{
|
|
720 |
varietyNumber = 0;
|
|
721 |
}
|
|
722 |
// if zero rows, use the minimum
|
|
723 |
else if ( iRows<=0 )
|
|
724 |
{
|
|
725 |
varietyNumber -= 1;
|
|
726 |
}
|
|
727 |
|
|
728 |
//add the varietyoffset
|
|
729 |
varietyNumber += maxVarietyOffset;
|
|
730 |
|
|
731 |
if ( Layout_Meta_Data::IsLandscapeOrientation() &&
|
|
732 |
location == AknLayoutUtils::EAknCbaLocationRight )
|
|
733 |
{
|
|
734 |
varietyNumber = 10;
|
|
735 |
}
|
|
736 |
else
|
|
737 |
{
|
|
738 |
if ( iRows == 0 )
|
|
739 |
{
|
|
740 |
varietyNumber = 5;
|
|
741 |
}
|
|
742 |
else
|
|
743 |
{
|
|
744 |
varietyNumber = 3;
|
|
745 |
}
|
|
746 |
}
|
|
747 |
|
|
748 |
TAknLayoutRect popupGridLayRect;
|
|
749 |
popupGridLayRect.LayoutRect( mainPaneRect,
|
|
750 |
AknLayoutScalable_Avkon::popup_grid_graphic_window( varietyNumber ) );
|
|
751 |
|
|
752 |
// Calculate the size relatively
|
|
753 |
TRect relativeDialog( TPoint( 0,0 ),popupGridLayRect.Rect().Size() );
|
|
754 |
|
|
755 |
// Get the layout of the actual icon grid with scrollbar
|
|
756 |
TAknLayoutRect gridWithScrollLayRect;
|
|
757 |
gridWithScrollLayRect.LayoutRect( relativeDialog,
|
|
758 |
AknLayoutScalable_Avkon::listscroll_popup_graphic_pane() );
|
|
759 |
|
|
760 |
// Then the grid area without scrollbar
|
|
761 |
// NOTE: The grid with scroll bar is used as reference
|
|
762 |
TAknLayoutRect gridLayRect;
|
|
763 |
gridLayRect.LayoutRect( gridWithScrollLayRect.Rect(),
|
|
764 |
AknLayoutScalable_Avkon::grid_graphic_popup_pane( 0 ) );
|
|
765 |
|
|
766 |
// Different parent if SCT inside editing menu.
|
|
767 |
TRect contentRect = gridLayRect.Rect();
|
|
768 |
|
|
769 |
// The x coordinate is 3 pixels to right and y coordinate 3 pixels up
|
|
770 |
// so substract from x coordinate and add to y coordinate
|
|
771 |
if ( iIsMirrored )
|
|
772 |
{
|
|
773 |
iOffset = TPoint(
|
|
774 |
contentRect.iBr.iX - KHorizontalDialogMargin - iGridItemWidth + 1,
|
|
775 |
contentRect.iTl.iY - KVerticalDialogMargin + 1 );
|
|
776 |
|
|
777 |
iGridTopLeft.iX = contentRect.iBr.iX -
|
|
778 |
KHorizontalDialogMargin -
|
|
779 |
( iMaxColumns * iGridItemWidth );
|
|
780 |
iGridTopLeft.iY = contentRect.iTl.iY - KVerticalDialogMargin;
|
|
781 |
}
|
|
782 |
else // not mirrored
|
|
783 |
{
|
|
784 |
iOffset = TPoint( contentRect.iTl.iX - KHorizontalDialogMargin + 1,
|
|
785 |
contentRect.iTl.iY - KVerticalDialogMargin + 1 );
|
|
786 |
iGridTopLeft.iX = contentRect.iTl.iX - KHorizontalDialogMargin;
|
|
787 |
iGridTopLeft.iY = contentRect.iTl.iY - KVerticalDialogMargin;
|
|
788 |
}
|
|
789 |
|
|
790 |
|
|
791 |
// The last, update background context
|
|
792 |
if ( iExtension->iBgContext )
|
|
793 |
{
|
|
794 |
TInt bgVariety = 0;
|
|
795 |
if ( Layout_Meta_Data::IsLandscapeOrientation() )
|
|
796 |
{
|
|
797 |
bgVariety = 1;
|
|
798 |
}
|
|
799 |
|
|
800 |
TAknLayoutRect innerRect;
|
|
801 |
innerRect.LayoutRect(
|
|
802 |
relativeDialog,
|
|
803 |
AknLayoutScalable_Avkon::bg_popup_window_pane_g1( bgVariety ) );
|
|
804 |
|
|
805 |
iExtension->iBgContext->SetFrameRects( relativeDialog,
|
|
806 |
innerRect.Rect() );
|
|
807 |
}
|
|
808 |
|
|
809 |
TRAPD( err,UpdateScrollIndicatorL() );
|
|
810 |
if ( err )
|
|
811 |
{
|
|
812 |
return;
|
|
813 |
}
|
|
814 |
}
|
|
815 |
|
|
816 |
|
|
817 |
// -----------------------------------------------------------------------------
|
|
818 |
// CCmDestinationIconMap::HandleResourceChange()
|
|
819 |
// -----------------------------------------------------------------------------
|
|
820 |
//
|
|
821 |
void CCmDestinationIconMap::HandleResourceChange( TInt aType )
|
|
822 |
{
|
|
823 |
if ( aType == KEikDynamicLayoutVariantSwitch )
|
|
824 |
{
|
|
825 |
// save the old info for the magnitudes of the SCT grid
|
|
826 |
TInt oldMaxColumns = iMaxColumns;
|
|
827 |
|
|
828 |
// calculate the new magnitudes
|
|
829 |
DoLayout();
|
|
830 |
|
|
831 |
// then calculate the index position of the cursor in the icon table
|
|
832 |
// and update the x and y positions for the new grid with it
|
|
833 |
|
|
834 |
TInt oldCursorPosition = ( iFirstVisibleRow + iOldCursorPos.iY ) *
|
|
835 |
oldMaxColumns +
|
|
836 |
iOldCursorPos.iX;
|
|
837 |
|
|
838 |
TInt currentCursorPosition = ( iFirstVisibleRow + iCursorPos.iY ) *
|
|
839 |
oldMaxColumns +
|
|
840 |
iCursorPos.iX;
|
|
841 |
|
|
842 |
// the new first row is the top row on the page where the new focus is
|
|
843 |
iFirstVisibleRow = iExtension->iMaxVisibleRows *
|
|
844 |
( currentCursorPosition /
|
|
845 |
( iMaxColumns * iExtension->iMaxVisibleRows ) );
|
|
846 |
|
|
847 |
// the cursor positions are relative to current page
|
|
848 |
iCursorPos.iY = ( currentCursorPosition -
|
|
849 |
( iMaxColumns * iFirstVisibleRow ) ) /
|
|
850 |
iMaxColumns;
|
|
851 |
iCursorPos.iX = currentCursorPosition -
|
|
852 |
( iMaxColumns * iFirstVisibleRow ) -
|
|
853 |
( iMaxColumns * iCursorPos.iY );
|
|
854 |
|
|
855 |
iOldCursorPos.iY = ( oldCursorPosition -
|
|
856 |
( iMaxColumns * iFirstVisibleRow ) ) /
|
|
857 |
iMaxColumns;
|
|
858 |
iOldCursorPos.iX = oldCursorPosition -
|
|
859 |
( iMaxColumns * iFirstVisibleRow ) -
|
|
860 |
( iMaxColumns * iOldCursorPos.iY );
|
|
861 |
}
|
|
862 |
|
|
863 |
if ( aType == KAknsMessageSkinChange )
|
|
864 |
{
|
|
865 |
iOffscreenBgDrawn = EFalse;
|
|
866 |
}
|
|
867 |
|
|
868 |
CCoeControl::HandleResourceChange( aType );
|
|
869 |
}
|
|
870 |
|
|
871 |
// -----------------------------------------------------------------------------
|
|
872 |
// CCmDestinationIconMap::Draw()
|
|
873 |
// -----------------------------------------------------------------------------
|
|
874 |
//
|
|
875 |
void CCmDestinationIconMap::Draw( const TRect& /*aRect*/ ) const
|
|
876 |
{
|
|
877 |
TInt cursorPos = 0;
|
|
878 |
CWindowGc& gc=SystemGc();
|
|
879 |
|
|
880 |
MAknsSkinInstance* skin = AknsUtils::SkinInstance();
|
|
881 |
MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
|
|
882 |
|
|
883 |
TRect rect = Rect();
|
|
884 |
|
|
885 |
// Main pane without softkeys
|
|
886 |
TRect mainPaneRect;
|
|
887 |
if ( !AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane,
|
|
888 |
mainPaneRect ) )
|
|
889 |
{
|
|
890 |
mainPaneRect = iAvkonAppUi->ClientRect();
|
|
891 |
}
|
|
892 |
|
|
893 |
// Dialog layout, check variety first
|
|
894 |
TAknLayoutScalableParameterLimits iconMapDialogVariety =
|
|
895 |
AknLayoutScalable_Avkon::popup_grid_graphic_window_ParamLimits();
|
|
896 |
|
|
897 |
// The variety starts from 0 so add +1
|
|
898 |
TInt maxVariety = iconMapDialogVariety.LastVariety();
|
|
899 |
|
|
900 |
// Check the CBA, if the orientation is not landscape
|
|
901 |
// there is not so much varieties
|
|
902 |
AknLayoutUtils::TAknCbaLocation location = AknLayoutUtils::CbaLocation();
|
|
903 |
// the offset for the certain cba location variety
|
|
904 |
TInt maxVarietyOffset = 0;
|
|
905 |
TInt varietyOffset = maxVariety + 1;
|
|
906 |
|
|
907 |
// landscape variety number must be calculated offset == number of varieties
|
|
908 |
// same applies to the variety number for the biggest sized layout for the
|
|
909 |
// variety
|
|
910 |
if ( Layout_Meta_Data::IsLandscapeOrientation() )
|
|
911 |
{
|
|
912 |
// the offset for one variety
|
|
913 |
varietyOffset = ( maxVariety + 1 )/KAknSctCBaButtonDirections;
|
|
914 |
}
|
|
915 |
|
|
916 |
// for right and left cba buttons the max variety is not zero
|
|
917 |
// the varities are ordered by the location of the cba and the descending
|
|
918 |
// order e.g the biggest sized layout first, the smallest last
|
|
919 |
if ( location == AknLayoutUtils::EAknCbaLocationRight )
|
|
920 |
{
|
|
921 |
maxVarietyOffset = varietyOffset;
|
|
922 |
}
|
|
923 |
else if ( location == AknLayoutUtils::EAknCbaLocationLeft )
|
|
924 |
{
|
|
925 |
maxVarietyOffset = varietyOffset + varietyOffset; // 2*
|
|
926 |
}
|
|
927 |
|
|
928 |
TInt varietyNumber = varietyOffset - iRows - 1;
|
|
929 |
|
|
930 |
// if more lines than possible to show, use the default
|
|
931 |
// ( the biggest grid ) variety
|
|
932 |
if ( varietyNumber < 0 )
|
|
933 |
{
|
|
934 |
varietyNumber = 0;
|
|
935 |
}
|
|
936 |
// if zero rows, use the minimum
|
|
937 |
else if ( iRows<=0 )
|
|
938 |
{
|
|
939 |
varietyNumber -= 1;
|
|
940 |
}
|
|
941 |
|
|
942 |
//add the varietyoffset
|
|
943 |
varietyNumber += maxVarietyOffset;
|
|
944 |
|
|
945 |
if ( Layout_Meta_Data::IsLandscapeOrientation() &&
|
|
946 |
location == AknLayoutUtils::EAknCbaLocationRight )
|
|
947 |
{
|
|
948 |
varietyNumber = 10;
|
|
949 |
}
|
|
950 |
else
|
|
951 |
{
|
|
952 |
varietyNumber = 3;
|
|
953 |
}
|
|
954 |
// Layout the dialog size
|
|
955 |
TAknLayoutRect dialogLayRect;
|
|
956 |
dialogLayRect.LayoutRect(
|
|
957 |
mainPaneRect,
|
|
958 |
AknLayoutScalable_Avkon::popup_grid_graphic_window( varietyNumber ) );
|
|
959 |
|
|
960 |
// Get the missing height for the background
|
|
961 |
TInt backgroundHeightOffset = dialogLayRect.Rect().Height() - rect.iBr.iY;
|
|
962 |
|
|
963 |
rect.iBr.iY += backgroundHeightOffset;
|
|
964 |
|
|
965 |
// Check if we got an offscreen bitmap allocated for skin background and
|
|
966 |
// there is bitmap background in the current skin.
|
|
967 |
if ( iOffscreenBg && iHasBitmapBackground )
|
|
968 |
{
|
|
969 |
DrawOffscreenBackgroundIfRequired();
|
|
970 |
gc.BitBlt( rect.iTl, iOffscreenBg );
|
|
971 |
}
|
|
972 |
else
|
|
973 |
{
|
|
974 |
AknsDrawUtils::Background( skin, cc, this, gc, rect );
|
|
975 |
}
|
|
976 |
|
|
977 |
TInt numberOfIconsToBeDrawn = iConsArray->Count();
|
|
978 |
numberOfIconsToBeDrawn -= ( iFirstVisibleRow * iMaxColumns );
|
|
979 |
if ( numberOfIconsToBeDrawn > 0 )
|
|
980 |
{
|
|
981 |
if ( numberOfIconsToBeDrawn >
|
|
982 |
( iExtension->iMaxVisibleRows * iMaxColumns ) )
|
|
983 |
{
|
|
984 |
numberOfIconsToBeDrawn = iExtension->iMaxVisibleRows * iMaxColumns;
|
|
985 |
}
|
|
986 |
|
|
987 |
gc.SetPenStyle( CGraphicsContext::ESolidPen );
|
|
988 |
gc.SetBrushStyle( CGraphicsContext::ENullBrush );
|
|
989 |
gc.SetPenSize( TSize( 1,1 ) );
|
|
990 |
|
|
991 |
// 2 ) Draw the grid
|
|
992 |
const TSize gridItemRectSize( iGridItemWidth + 1, iGridItemHeight + 1 );
|
|
993 |
|
|
994 |
TInt numberOfGridCellsToBeDrawn = numberOfIconsToBeDrawn;
|
|
995 |
|
|
996 |
TRgb colorLine = AKN_LAF_COLOR( 219 );
|
|
997 |
AknsUtils::GetCachedColor( skin,
|
|
998 |
colorLine,
|
|
999 |
KAknsIIDQsnLineColors,
|
|
1000 |
EAknsCIQsnLineColorsCG5 );
|
|
1001 |
TRgb colorRecentLine = AKN_LAF_COLOR( 215 );
|
|
1002 |
AknsUtils::GetCachedColor( skin,
|
|
1003 |
colorRecentLine,
|
|
1004 |
KAknsIIDQsnLineColors,
|
|
1005 |
EAknsCIQsnLineColorsCG7 );
|
|
1006 |
|
|
1007 |
// default pen color
|
|
1008 |
gc.SetPenColor( colorLine );
|
|
1009 |
|
|
1010 |
TInt fullRows = numberOfGridCellsToBeDrawn / iMaxColumns;
|
|
1011 |
|
|
1012 |
// how many left after the full rows
|
|
1013 |
numberOfGridCellsToBeDrawn -= fullRows * iMaxColumns;
|
|
1014 |
|
|
1015 |
TPoint pos = iGridTopLeft;
|
|
1016 |
|
|
1017 |
TInt endX = pos.iX + iGridItemWidth * iMaxColumns;
|
|
1018 |
TInt endY = pos.iY + iGridItemHeight * fullRows;
|
|
1019 |
|
|
1020 |
TInt ii = 0;
|
|
1021 |
|
|
1022 |
if ( fullRows )
|
|
1023 |
{
|
|
1024 |
// Draw full vertical lines
|
|
1025 |
for ( ii = 0 ; ii <= iMaxColumns ; ii++ )
|
|
1026 |
{
|
|
1027 |
gc.SetPenColor( colorLine );
|
|
1028 |
gc.SetPenSize( TSize( 1,1 ) );
|
|
1029 |
gc.DrawLine( pos, TPoint( pos.iX, endY ) );
|
|
1030 |
pos.iX += iGridItemWidth;
|
|
1031 |
}
|
|
1032 |
|
|
1033 |
pos = iGridTopLeft;
|
|
1034 |
|
|
1035 |
// Draw full horizontal lines
|
|
1036 |
for ( ii = 0 ; ii <= fullRows ; ii++ )
|
|
1037 |
{
|
|
1038 |
gc.SetPenSize( TSize( 1,1 ) );
|
|
1039 |
gc.SetPenColor( colorLine );
|
|
1040 |
gc.DrawLine( pos, TPoint( endX, pos.iY ) );
|
|
1041 |
pos.iY += iGridItemHeight;
|
|
1042 |
}
|
|
1043 |
gc.SetPenColor( colorLine );
|
|
1044 |
gc.SetPenSize( TSize( 1,1 ) );
|
|
1045 |
}
|
|
1046 |
|
|
1047 |
if ( numberOfGridCellsToBeDrawn )
|
|
1048 |
{
|
|
1049 |
// Remaining cells in the last, non-full row
|
|
1050 |
pos = iOffset;
|
|
1051 |
// iOffset is cell area topLeft, grid is not included in it
|
|
1052 |
pos.iX--;
|
|
1053 |
pos.iY--;
|
|
1054 |
|
|
1055 |
pos.iY += iGridItemHeight * fullRows;
|
|
1056 |
|
|
1057 |
for ( ii = 0 ; ii < numberOfGridCellsToBeDrawn ; ii++ )
|
|
1058 |
{
|
|
1059 |
gc.DrawRect( TRect( pos, gridItemRectSize ) );
|
|
1060 |
|
|
1061 |
if ( iIsMirrored )
|
|
1062 |
pos.iX -= iGridItemWidth;
|
|
1063 |
else // not mirrored
|
|
1064 |
pos.iX += iGridItemWidth;
|
|
1065 |
}
|
|
1066 |
}
|
|
1067 |
|
|
1068 |
TInt iconIndex = iFirstVisibleRow * iMaxColumns;
|
|
1069 |
TInt lCnt = iConsArray->Count();
|
|
1070 |
cursorPos = iCursorPos.iX + iCursorPos.iY * iMaxColumns;
|
|
1071 |
if ( lCnt > 0 )
|
|
1072 |
{
|
|
1073 |
TRect cellRect( TPoint( 0,0 ),
|
|
1074 |
TSize( iGridItemWidth - 1, iGridItemHeight - 1 ) );
|
|
1075 |
for ( TInt j = iconIndex, i = 0;
|
|
1076 |
j < lCnt && i < numberOfIconsToBeDrawn;
|
|
1077 |
j++, i++ )
|
|
1078 |
{
|
|
1079 |
DrawItem( gc, i, j, cursorPos == i, EFalse );
|
|
1080 |
}
|
|
1081 |
}
|
|
1082 |
|
|
1083 |
}
|
|
1084 |
iDrawnBefore = ETrue;
|
|
1085 |
gc.DiscardFont();
|
|
1086 |
}
|
|
1087 |
|
|
1088 |
// -----------------------------------------------------------------------------
|
|
1089 |
// CCmDestinationIconMap::DrawItem()
|
|
1090 |
// -----------------------------------------------------------------------------
|
|
1091 |
//
|
|
1092 |
void CCmDestinationIconMap::DrawItem(
|
|
1093 |
CWindowGc& aGc,
|
|
1094 |
TInt index,
|
|
1095 |
TInt aIconIndex,
|
|
1096 |
TBool aHighlighted,
|
|
1097 |
TBool aDrawBackground ) const
|
|
1098 |
{
|
|
1099 |
TRect sctPosition = CursorRect( index );
|
|
1100 |
MAknsSkinInstance* skin = AknsUtils::SkinInstance();
|
|
1101 |
MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
|
|
1102 |
|
|
1103 |
TBool skins = AknsDrawUtils::Background( skin,cc,aGc, sctPosition );
|
|
1104 |
TRgb color;
|
|
1105 |
if ( !skins )
|
|
1106 |
{
|
|
1107 |
aGc.SetBrushStyle( CGraphicsContext::ESolidBrush );
|
|
1108 |
}
|
|
1109 |
|
|
1110 |
if ( aHighlighted )
|
|
1111 |
{
|
|
1112 |
TRgb colorHightLightRect = AKN_LAF_COLOR( 215 );
|
|
1113 |
AknsUtils::GetCachedColor( skin,
|
|
1114 |
colorHightLightRect,
|
|
1115 |
KAknsIIDQsnLineColors,
|
|
1116 |
EAknsCIQsnLineColorsCG7 );
|
|
1117 |
aGc.SetPenColor( colorHightLightRect );
|
|
1118 |
aGc.DrawRect( sctPosition );
|
|
1119 |
|
|
1120 |
// Shrink by one pixel in all directions.
|
|
1121 |
TRect innerRect = sctPosition;
|
|
1122 |
innerRect.Shrink( 1,1 );
|
|
1123 |
|
|
1124 |
color = AKN_LAF_COLOR( 210 );
|
|
1125 |
AknsUtils::GetCachedColor( skin,
|
|
1126 |
color,
|
|
1127 |
KAknsIIDQsnHighlightColors,
|
|
1128 |
EAknsCIQsnHighlightColorsCG1 );
|
|
1129 |
aGc.SetBrushColor( color );
|
|
1130 |
aGc.Clear( innerRect );
|
|
1131 |
}
|
|
1132 |
else if ( aDrawBackground )
|
|
1133 |
{
|
|
1134 |
TRect innerRect = sctPosition;
|
|
1135 |
aGc.SetBrushColor( AKN_LAF_COLOR( 0 ) );
|
|
1136 |
if ( !skins )
|
|
1137 |
{
|
|
1138 |
aGc.Clear( innerRect );
|
|
1139 |
}
|
|
1140 |
else
|
|
1141 |
{
|
|
1142 |
AknsDrawUtils::Background( skin, cc, this, aGc, innerRect );
|
|
1143 |
}
|
|
1144 |
}
|
|
1145 |
|
|
1146 |
if ( iConsArray )
|
|
1147 |
{
|
|
1148 |
TInt lCnt = iConsArray->Count();
|
|
1149 |
if ( lCnt > 0 && aIconIndex < lCnt && aIconIndex >= 0 )
|
|
1150 |
{
|
|
1151 |
TRect cellRect( TPoint( 0,0 ),
|
|
1152 |
TSize( iGridItemWidth - 1, iGridItemHeight - 1 ) );
|
|
1153 |
|
|
1154 |
CGulIcon* bitmap = NULL;
|
|
1155 |
bitmap = iConsArray->At( aIconIndex );
|
|
1156 |
|
|
1157 |
aGc.BitBltMasked( CursorPoint( index ),
|
|
1158 |
bitmap->Bitmap(),
|
|
1159 |
cellRect,
|
|
1160 |
bitmap->Mask(),
|
|
1161 |
EFalse );
|
|
1162 |
}
|
|
1163 |
}
|
|
1164 |
}
|
|
1165 |
|
|
1166 |
// -----------------------------------------------------------------------------
|
|
1167 |
// CCmDestinationIconMap::DrawCursor()
|
|
1168 |
// Optimizes drawing. Only cursor is drawn.
|
|
1169 |
// -----------------------------------------------------------------------------
|
|
1170 |
void CCmDestinationIconMap::DrawCursor() const
|
|
1171 |
{
|
|
1172 |
// Whole Icon Map has to be drawn at least once.
|
|
1173 |
// If the user presses arrow key before Icon Map has been drawn,
|
|
1174 |
// only cursor position is drawn without this check.
|
|
1175 |
if ( !iDrawnBefore )
|
|
1176 |
{
|
|
1177 |
DrawNow();
|
|
1178 |
}
|
|
1179 |
// Only redraw old and new cursor position cells
|
|
1180 |
ActivateGc();
|
|
1181 |
CWindowGc& gc = SystemGc();
|
|
1182 |
|
|
1183 |
TInt cursorPos = iOldCursorPos.iX + iOldCursorPos.iY * iMaxColumns;
|
|
1184 |
DrawCell( cursorPos, EFalse );
|
|
1185 |
|
|
1186 |
cursorPos = iCursorPos.iX + iCursorPos.iY * iMaxColumns;
|
|
1187 |
DrawCell( cursorPos, ETrue );
|
|
1188 |
|
|
1189 |
gc.DiscardFont();
|
|
1190 |
DeactivateGc();
|
|
1191 |
}
|
|
1192 |
|
|
1193 |
// -----------------------------------------------------------------------------
|
|
1194 |
// CCmDestinationIconMap::DrawCell
|
|
1195 |
// -----------------------------------------------------------------------------
|
|
1196 |
//
|
|
1197 |
void CCmDestinationIconMap::DrawCell(
|
|
1198 |
TInt aCursorPos,
|
|
1199 |
TBool aHighlighted ) const
|
|
1200 |
{
|
|
1201 |
// calculate icon index
|
|
1202 |
TInt iconIndex = aCursorPos + iFirstVisibleRow * iMaxColumns;
|
|
1203 |
|
|
1204 |
// If we are only redrawing for animations, no need to draw non-animated
|
|
1205 |
// items.
|
|
1206 |
TRect rect = CursorRect( aCursorPos );
|
|
1207 |
|
|
1208 |
Window().Invalidate( rect );
|
|
1209 |
Window().BeginRedraw( rect );
|
|
1210 |
DrawItem( SystemGc(), aCursorPos, iconIndex, aHighlighted, ETrue );
|
|
1211 |
Window().EndRedraw();
|
|
1212 |
SystemGc().DiscardFont();
|
|
1213 |
}
|
|
1214 |
|
|
1215 |
// -----------------------------------------------------------------------------
|
|
1216 |
// CCmDestinationIconMap::CursorRect
|
|
1217 |
// -----------------------------------------------------------------------------
|
|
1218 |
//
|
|
1219 |
TRect CCmDestinationIconMap::CursorRect( TInt aCursorPos ) const
|
|
1220 |
{
|
|
1221 |
TPoint pos = iOffset;
|
|
1222 |
|
|
1223 |
if ( iIsMirrored )
|
|
1224 |
{
|
|
1225 |
pos.iX -= ( aCursorPos % iMaxColumns ) * iGridItemWidth;
|
|
1226 |
}
|
|
1227 |
else // Not mirrored
|
|
1228 |
{
|
|
1229 |
pos.iX += ( aCursorPos % iMaxColumns ) * iGridItemWidth;
|
|
1230 |
}
|
|
1231 |
|
|
1232 |
pos.iY += ( aCursorPos / iMaxColumns ) * iGridItemHeight;
|
|
1233 |
return TRect( pos, TSize( iGridItemWidth - 1, iGridItemHeight - 1 ) );
|
|
1234 |
}
|
|
1235 |
|
|
1236 |
// -----------------------------------------------------------------------------
|
|
1237 |
// CCmDestinationIconMap::CursorPoint
|
|
1238 |
// -----------------------------------------------------------------------------
|
|
1239 |
//
|
|
1240 |
TPoint CCmDestinationIconMap::CursorPoint( TInt aCursorPos ) const
|
|
1241 |
{
|
|
1242 |
TPoint pos = iOffset;
|
|
1243 |
|
|
1244 |
if ( iIsMirrored )
|
|
1245 |
{
|
|
1246 |
pos.iX -= ( aCursorPos % iMaxColumns ) * iGridItemWidth;
|
|
1247 |
}
|
|
1248 |
else // Not mirrored
|
|
1249 |
{
|
|
1250 |
pos.iX += ( aCursorPos % iMaxColumns ) * iGridItemWidth;
|
|
1251 |
}
|
|
1252 |
|
|
1253 |
pos.iY += ( aCursorPos / iMaxColumns ) * iGridItemHeight;
|
|
1254 |
return pos;
|
|
1255 |
}
|
|
1256 |
|
|
1257 |
// -----------------------------------------------------------------------------
|
|
1258 |
// CCmDestinationIconMap::MoveCursorL
|
|
1259 |
// -----------------------------------------------------------------------------
|
|
1260 |
//
|
|
1261 |
void CCmDestinationIconMap::MoveCursorL( TInt aDeltaX, TInt aDeltaY )
|
|
1262 |
{
|
|
1263 |
if ( iIsMirrored )
|
|
1264 |
{
|
|
1265 |
aDeltaX = -aDeltaX;
|
|
1266 |
}
|
|
1267 |
|
|
1268 |
if ( ( iConsArray->Count() < 8 ) )
|
|
1269 |
{
|
|
1270 |
return;
|
|
1271 |
}
|
|
1272 |
|
|
1273 |
iOldCursorPos = iCursorPos;
|
|
1274 |
TInt oldFirstVisibleRow = iFirstVisibleRow;
|
|
1275 |
|
|
1276 |
TInt globalYPos = iCursorPos.iY + iFirstVisibleRow;
|
|
1277 |
TInt lastColumnOnLastRow = ( ( iConsArray->Count() - 1 ) % iMaxColumns );
|
|
1278 |
|
|
1279 |
TInt skipicon = aDeltaX != 0 ? 1: 0;
|
|
1280 |
|
|
1281 |
if ( aDeltaX < 0 )
|
|
1282 |
{
|
|
1283 |
// Cursor was moved to left.
|
|
1284 |
if ( iCursorPos.iX > skipicon - 1 )
|
|
1285 |
{
|
|
1286 |
iCursorPos.iX -= skipicon;
|
|
1287 |
}
|
|
1288 |
else
|
|
1289 |
{
|
|
1290 |
if ( skipicon > iMaxColumns )
|
|
1291 |
{
|
|
1292 |
globalYPos--;
|
|
1293 |
iCursorPos.iX = iMaxColumns;
|
|
1294 |
}
|
|
1295 |
// Go to previous line
|
|
1296 |
globalYPos--;
|
|
1297 |
if ( globalYPos < 0 )
|
|
1298 |
{
|
|
1299 |
// Cursor was on the first line - go to last line.
|
|
1300 |
globalYPos = iRows - 1;
|
|
1301 |
// x - position to the last item on the last row.
|
|
1302 |
iCursorPos.iX = lastColumnOnLastRow;
|
|
1303 |
}
|
|
1304 |
else
|
|
1305 |
{
|
|
1306 |
// x - position to last column.
|
|
1307 |
iCursorPos.iX = iMaxColumns - skipicon;
|
|
1308 |
}
|
|
1309 |
}
|
|
1310 |
}
|
|
1311 |
|
|
1312 |
if ( aDeltaX > 0 )
|
|
1313 |
{
|
|
1314 |
// Cursor was moved to right.
|
|
1315 |
if ( globalYPos < iRows - 1 )
|
|
1316 |
{
|
|
1317 |
// Not in the last row.
|
|
1318 |
if ( iCursorPos.iX < iMaxColumns - skipicon )
|
|
1319 |
{
|
|
1320 |
// If not on the last columns, move cursor to next column.
|
|
1321 |
iCursorPos.iX += skipicon;
|
|
1322 |
}
|
|
1323 |
else
|
|
1324 |
{
|
|
1325 |
// Cursor was on last column,
|
|
1326 |
// move to first column of the next line.
|
|
1327 |
iCursorPos.iX = 0;
|
|
1328 |
globalYPos++;
|
|
1329 |
}
|
|
1330 |
}
|
|
1331 |
else
|
|
1332 |
{
|
|
1333 |
// Currently on the last row.
|
|
1334 |
if ( iCursorPos.iX < lastColumnOnLastRow )
|
|
1335 |
{
|
|
1336 |
// If there are more items on this row, move cursor to next item.
|
|
1337 |
iCursorPos.iX++;
|
|
1338 |
}
|
|
1339 |
else
|
|
1340 |
{
|
|
1341 |
// No more item on the current row.
|
|
1342 |
// Move to first item on the first row.
|
|
1343 |
iCursorPos.iX = 0;
|
|
1344 |
globalYPos = 0;
|
|
1345 |
}
|
|
1346 |
}
|
|
1347 |
}
|
|
1348 |
|
|
1349 |
if ( aDeltaY < 0 )
|
|
1350 |
{
|
|
1351 |
iCursorPos.iX -= skipicon;
|
|
1352 |
if ( iCursorPos.iX < 0 )
|
|
1353 |
{
|
|
1354 |
iCursorPos.iX += ( iMaxColumns - 1 );
|
|
1355 |
globalYPos--;
|
|
1356 |
}
|
|
1357 |
// Cursor was moved to up.
|
|
1358 |
if ( globalYPos > 0 )
|
|
1359 |
{
|
|
1360 |
// Cursor was not on the first line - move it to previous row.
|
|
1361 |
globalYPos--;
|
|
1362 |
}
|
|
1363 |
else
|
|
1364 |
{
|
|
1365 |
// Move cursot to last to row.
|
|
1366 |
globalYPos = iRows - 1;
|
|
1367 |
if ( iCursorPos.iX > lastColumnOnLastRow )
|
|
1368 |
{
|
|
1369 |
// No items in the current column on the last row -
|
|
1370 |
// move cursor to last item on the row.
|
|
1371 |
iCursorPos.iX = lastColumnOnLastRow;
|
|
1372 |
}
|
|
1373 |
}
|
|
1374 |
}
|
|
1375 |
|
|
1376 |
if ( aDeltaY > 0 )
|
|
1377 |
{
|
|
1378 |
iCursorPos.iX = ( iCursorPos.iX + skipicon ) % iMaxColumns;
|
|
1379 |
globalYPos += ( iCursorPos.iX + skipicon ) / iMaxColumns;
|
|
1380 |
// Cursor was moved to down.
|
|
1381 |
if ( globalYPos < iRows - 1 )
|
|
1382 |
{
|
|
1383 |
// Cursor is not on the last row. Move cursor to next row.
|
|
1384 |
globalYPos++;
|
|
1385 |
if ( globalYPos == iRows - 1 &&
|
|
1386 |
iCursorPos.iX > lastColumnOnLastRow )
|
|
1387 |
{
|
|
1388 |
// No items in the current column on the last row -
|
|
1389 |
// move cursor to last item on the row.
|
|
1390 |
iCursorPos.iX = lastColumnOnLastRow;
|
|
1391 |
}
|
|
1392 |
}
|
|
1393 |
else
|
|
1394 |
{
|
|
1395 |
// Cursor was at the last row - move it to the first row.
|
|
1396 |
globalYPos = 0;
|
|
1397 |
}
|
|
1398 |
}
|
|
1399 |
iCursorPos.iY = globalYPos - iFirstVisibleRow;
|
|
1400 |
|
|
1401 |
if ( globalYPos < iFirstVisibleRow )
|
|
1402 |
{
|
|
1403 |
// Cursor was moved from the top row.
|
|
1404 |
if ( globalYPos <= 0 )
|
|
1405 |
{
|
|
1406 |
iFirstVisibleRow = 0;
|
|
1407 |
iCursorPos = TPoint( iCursorPos.iX, 0 );
|
|
1408 |
}
|
|
1409 |
else
|
|
1410 |
{
|
|
1411 |
// If cursor was moved up out of the visible area - show it again.
|
|
1412 |
iFirstVisibleRow -= iExtension->iMaxVisibleRows;
|
|
1413 |
iCursorPos = TPoint( iCursorPos.iX,
|
|
1414 |
iExtension->iMaxVisibleRows - 1 );
|
|
1415 |
}
|
|
1416 |
}
|
|
1417 |
|
|
1418 |
if ( globalYPos > iFirstVisibleRow + iExtension->iMaxVisibleRows - 1 )
|
|
1419 |
{
|
|
1420 |
if ( globalYPos == iRows - 1 )
|
|
1421 |
{
|
|
1422 |
// When cursor has moved from the top line,
|
|
1423 |
// it is adjusted to a page boundary.
|
|
1424 |
iCursorPos = TPoint(
|
|
1425 |
iCursorPos.iX,
|
|
1426 |
( iRows - 1 ) % iExtension->iMaxVisibleRows
|
|
1427 |
);
|
|
1428 |
iFirstVisibleRow = ( ( iRows - 1 ) / iExtension->iMaxVisibleRows ) *
|
|
1429 |
iExtension->iMaxVisibleRows;
|
|
1430 |
}
|
|
1431 |
else
|
|
1432 |
{
|
|
1433 |
// If cursor was moved down out of the visible area - show it again.
|
|
1434 |
iFirstVisibleRow += iExtension->iMaxVisibleRows;
|
|
1435 |
iCursorPos = TPoint( iCursorPos.iX, 0 );
|
|
1436 |
}
|
|
1437 |
}
|
|
1438 |
|
|
1439 |
if ( iRows > iExtension->iMaxVisibleRows &&
|
|
1440 |
( iOldCursorPos.iY + oldFirstVisibleRow !=
|
|
1441 |
iCursorPos.iY + iFirstVisibleRow ) )
|
|
1442 |
{
|
|
1443 |
UpdateScrollIndicatorL();
|
|
1444 |
}
|
|
1445 |
|
|
1446 |
if ( oldFirstVisibleRow == iFirstVisibleRow )
|
|
1447 |
{
|
|
1448 |
// Draw only cursor if the view to the content was not scrolled.
|
|
1449 |
DrawCursor();
|
|
1450 |
}
|
|
1451 |
else
|
|
1452 |
{
|
|
1453 |
DrawNow();
|
|
1454 |
}
|
|
1455 |
|
|
1456 |
}
|
|
1457 |
|
|
1458 |
// -----------------------------------------------------------------------------
|
|
1459 |
// CCmDestinationIconMap::UpdateScrollIndicatorL()
|
|
1460 |
// -----------------------------------------------------------------------------
|
|
1461 |
//
|
|
1462 |
void CCmDestinationIconMap::UpdateScrollIndicatorL()
|
|
1463 |
{
|
|
1464 |
if ( !iSBFrame )
|
|
1465 |
{
|
|
1466 |
return;
|
|
1467 |
}
|
|
1468 |
TEikScrollBarModel hSbarModel;
|
|
1469 |
TEikScrollBarModel vSbarModel;
|
|
1470 |
|
|
1471 |
TEikScrollBarFrameLayout layout;
|
|
1472 |
|
|
1473 |
// Main pane without softkeys
|
|
1474 |
TRect mainPaneRect;
|
|
1475 |
if ( !AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane,
|
|
1476 |
mainPaneRect ) )
|
|
1477 |
{
|
|
1478 |
mainPaneRect = iAvkonAppUi->ClientRect();
|
|
1479 |
}
|
|
1480 |
|
|
1481 |
// Dialog layout, check variety first
|
|
1482 |
TAknLayoutScalableParameterLimits iconMapDialogVariety =
|
|
1483 |
AknLayoutScalable_Avkon::popup_grid_graphic_window_ParamLimits();
|
|
1484 |
|
|
1485 |
TInt maxVariety = iconMapDialogVariety.LastVariety();
|
|
1486 |
|
|
1487 |
// Check the CBA, if the orientation is not landscape
|
|
1488 |
// there is not so much varieties
|
|
1489 |
AknLayoutUtils::TAknCbaLocation location = AknLayoutUtils::CbaLocation();
|
|
1490 |
// the offset for the certain cba location variety
|
|
1491 |
TInt maxVarietyOffset = 0;
|
|
1492 |
TInt varietyOffset = maxVariety + 1;
|
|
1493 |
|
|
1494 |
// landscape variety number must be calculated offset == number of varieties
|
|
1495 |
// same applies to the variety number for the biggest sized layout for the
|
|
1496 |
// variety
|
|
1497 |
if ( Layout_Meta_Data::IsLandscapeOrientation() )
|
|
1498 |
{
|
|
1499 |
// the offset for one variety
|
|
1500 |
varietyOffset = ( maxVariety + 1 )/KAknSctCBaButtonDirections;
|
|
1501 |
}
|
|
1502 |
|
|
1503 |
// for right and left cba buttons the max variety is not zero
|
|
1504 |
// the varities are ordered by the location of the cba and the descending
|
|
1505 |
// order e.g the biggest sized layout first, the smallest last
|
|
1506 |
if ( location == AknLayoutUtils::EAknCbaLocationRight )
|
|
1507 |
{
|
|
1508 |
maxVarietyOffset = varietyOffset;
|
|
1509 |
}
|
|
1510 |
else if ( location == AknLayoutUtils::EAknCbaLocationLeft )
|
|
1511 |
{
|
|
1512 |
maxVarietyOffset = varietyOffset + varietyOffset; // 2*
|
|
1513 |
}
|
|
1514 |
|
|
1515 |
TInt varietyNumber = varietyOffset - iRows - 1;
|
|
1516 |
|
|
1517 |
// if more lines than possible to show, use the default
|
|
1518 |
// ( the biggest grid ) variety
|
|
1519 |
if ( varietyNumber < 0 )
|
|
1520 |
{
|
|
1521 |
varietyNumber = 0;
|
|
1522 |
}
|
|
1523 |
// if zero rows, use the minimum
|
|
1524 |
else if ( iRows <= 0 )
|
|
1525 |
{
|
|
1526 |
varietyNumber -= 1;
|
|
1527 |
}
|
|
1528 |
|
|
1529 |
//add the varietyoffset
|
|
1530 |
varietyNumber += maxVarietyOffset;
|
|
1531 |
|
|
1532 |
if ( Layout_Meta_Data::IsLandscapeOrientation() &&
|
|
1533 |
location == AknLayoutUtils::EAknCbaLocationRight )
|
|
1534 |
{
|
|
1535 |
varietyNumber = 10;
|
|
1536 |
}
|
|
1537 |
else
|
|
1538 |
{
|
|
1539 |
varietyNumber = 3;
|
|
1540 |
}
|
|
1541 |
// Layout the dialog size
|
|
1542 |
TAknLayoutRect dialogLayRect;
|
|
1543 |
dialogLayRect.LayoutRect( mainPaneRect,
|
|
1544 |
AknLayoutScalable_Avkon::popup_grid_graphic_window( varietyNumber ) );
|
|
1545 |
|
|
1546 |
TRect dialogRect = dialogLayRect.Rect();
|
|
1547 |
|
|
1548 |
// Get the layout of the actual icon grid with scrollbar
|
|
1549 |
TAknLayoutRect gridWithScrollLayRect;
|
|
1550 |
|
|
1551 |
gridWithScrollLayRect.LayoutRect(
|
|
1552 |
TRect( TPoint( 0,0 ),
|
|
1553 |
TSize( dialogRect.Size() ) ),
|
|
1554 |
AknLayoutScalable_Avkon::listscroll_popup_graphic_pane() );
|
|
1555 |
|
|
1556 |
// Calculate the relative rect for the grid
|
|
1557 |
TRect parent = gridWithScrollLayRect.Rect();
|
|
1558 |
|
|
1559 |
TAknWindowComponentLayout scrollbarLayout =
|
|
1560 |
AknLayoutScalable_Avkon::scroll_pane_cp5();
|
|
1561 |
|
|
1562 |
vSbarModel.iScrollSpan = iRows;
|
|
1563 |
vSbarModel.iThumbSpan = iExtension->iMaxVisibleRows;
|
|
1564 |
|
|
1565 |
if ( iSBFrame->TypeOfVScrollBar() == CEikScrollBarFrame::EDoubleSpan )
|
|
1566 |
{
|
|
1567 |
// For EDoubleSpan type scrollbar
|
|
1568 |
vSbarModel.iThumbPosition = iFirstVisibleRow;
|
|
1569 |
TAknDoubleSpanScrollBarModel hDsSbarModel( hSbarModel );
|
|
1570 |
TAknDoubleSpanScrollBarModel vDsSbarModel( vSbarModel );
|
|
1571 |
|
|
1572 |
// The y coordinate must be sifted 3 pixels up and x 3 to left
|
|
1573 |
parent.iTl.iY -= KVerticalDialogMargin;
|
|
1574 |
parent.iBr.iY -= KVerticalDialogMargin;
|
|
1575 |
parent.iTl.iX -= KHorizontalDialogMargin;
|
|
1576 |
parent.iBr.iX -= KHorizontalDialogMargin;
|
|
1577 |
|
|
1578 |
layout.iTilingMode = TEikScrollBarFrameLayout::EInclusiveRectConstant;
|
|
1579 |
iSBFrame->Tile( &vDsSbarModel );
|
|
1580 |
AknLayoutUtils::LayoutVerticalScrollBar( iSBFrame,
|
|
1581 |
parent,
|
|
1582 |
scrollbarLayout );
|
|
1583 |
iSBFrame->SetVFocusPosToThumbPos( vDsSbarModel.FocusPosition() );
|
|
1584 |
}
|
|
1585 |
else
|
|
1586 |
{
|
|
1587 |
// For EArrowHead type scrollbar
|
|
1588 |
vSbarModel.iThumbPosition = iCursorPos.iY + iFirstVisibleRow;
|
|
1589 |
iSBFrame->TileL( &hSbarModel,&vSbarModel,parent,parent,layout );
|
|
1590 |
iSBFrame->SetVFocusPosToThumbPos( vSbarModel.iThumbPosition );
|
|
1591 |
}
|
|
1592 |
}
|
|
1593 |
|
|
1594 |
|
|
1595 |
// -----------------------------------------------------------------------------
|
|
1596 |
// CCmDestinationIconMap::Reserved_1()
|
|
1597 |
// -----------------------------------------------------------------------------
|
|
1598 |
//
|
|
1599 |
void CCmDestinationIconMap::Reserved_1()
|
|
1600 |
{
|
|
1601 |
}
|
|
1602 |
|
|
1603 |
// -----------------------------------------------------------------------------
|
|
1604 |
// CCmDestinationIconMap::Reserved_2()
|
|
1605 |
// -----------------------------------------------------------------------------
|
|
1606 |
//
|
|
1607 |
void CCmDestinationIconMap::Reserved_2()
|
|
1608 |
{
|
|
1609 |
}
|
|
1610 |
|
|
1611 |
// -----------------------------------------------------------------------------
|
|
1612 |
// CCmDestinationIconMap::DrawOffscreenBackgroundIfRequired
|
|
1613 |
//
|
|
1614 |
// -----------------------------------------------------------------------------
|
|
1615 |
//
|
|
1616 |
void CCmDestinationIconMap::DrawOffscreenBackgroundIfRequired() const
|
|
1617 |
{
|
|
1618 |
if ( iOffscreenBg && iHasBitmapBackground )
|
|
1619 |
{
|
|
1620 |
if ( !iOffscreenBgDrawn )
|
|
1621 |
{
|
|
1622 |
TRect mainPaneRect;
|
|
1623 |
if ( !AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane,
|
|
1624 |
mainPaneRect ) )
|
|
1625 |
{
|
|
1626 |
mainPaneRect = iAvkonAppUi->ClientRect();
|
|
1627 |
}
|
|
1628 |
|
|
1629 |
// Dialog layout, check variety first
|
|
1630 |
TAknLayoutScalableParameterLimits iconMapDialogVariety =
|
|
1631 |
AknLayoutScalable_Avkon::popup_grid_graphic_window_ParamLimits();
|
|
1632 |
|
|
1633 |
TInt maxVariety = iconMapDialogVariety.LastVariety();
|
|
1634 |
|
|
1635 |
// Check the CBA, if the orientation is not landscape
|
|
1636 |
// there is not so much varieties
|
|
1637 |
AknLayoutUtils::TAknCbaLocation location =
|
|
1638 |
AknLayoutUtils::CbaLocation();
|
|
1639 |
// the offset for the certain cba location variety
|
|
1640 |
TInt maxVarietyOffset = 0;
|
|
1641 |
TInt varietyOffset = maxVariety + 1;
|
|
1642 |
|
|
1643 |
// landscape variety number must be calculated offset == number of
|
|
1644 |
// varieties same applies to the variety number for the biggest
|
|
1645 |
// sized layout for the variety
|
|
1646 |
if ( Layout_Meta_Data::IsLandscapeOrientation() )
|
|
1647 |
{
|
|
1648 |
// the offset for one variety
|
|
1649 |
varietyOffset = ( maxVariety + 1 )/KAknSctCBaButtonDirections;
|
|
1650 |
}
|
|
1651 |
|
|
1652 |
// for right and left cba buttons the max variety is not zero
|
|
1653 |
// the varities are ordered by the location of the cba and the
|
|
1654 |
// descending order e.g the biggest sized layout first, the smallest last
|
|
1655 |
if ( location == AknLayoutUtils::EAknCbaLocationRight )
|
|
1656 |
{
|
|
1657 |
maxVarietyOffset = varietyOffset;
|
|
1658 |
}
|
|
1659 |
else if ( location == AknLayoutUtils::EAknCbaLocationLeft )
|
|
1660 |
{
|
|
1661 |
maxVarietyOffset = varietyOffset + varietyOffset; // 2*
|
|
1662 |
}
|
|
1663 |
|
|
1664 |
TInt varietyNumber = varietyOffset - iRows - 1;
|
|
1665 |
|
|
1666 |
// if more lines than possible to show, use the default
|
|
1667 |
// ( the biggest grid ) variety
|
|
1668 |
if ( varietyNumber < 0 )
|
|
1669 |
{
|
|
1670 |
varietyNumber = 0;
|
|
1671 |
}
|
|
1672 |
// if zero rows, use the minimum
|
|
1673 |
else if ( iRows<=0 )
|
|
1674 |
{
|
|
1675 |
varietyNumber -= 1;
|
|
1676 |
}
|
|
1677 |
|
|
1678 |
//add the varietyoffset
|
|
1679 |
varietyNumber += maxVarietyOffset;
|
|
1680 |
|
|
1681 |
TAknLayoutRect popupGridLayRect;
|
|
1682 |
popupGridLayRect.LayoutRect( mainPaneRect,
|
|
1683 |
AknLayoutScalable_Avkon::popup_grid_graphic_window( 5 ) );
|
|
1684 |
|
|
1685 |
TRect popupGridRect = popupGridLayRect.Rect();
|
|
1686 |
|
|
1687 |
// set the top left height as the control starting point
|
|
1688 |
popupGridRect.iTl.iY = Rect().iTl.iY;
|
|
1689 |
|
|
1690 |
//if ( popupGridRect.iBr.iY < mainPaneRect.iBr.iY )
|
|
1691 |
// popupGridRect.iBr.iY = mainPaneRect.iBr.iY
|
|
1692 |
MAknsSkinInstance* skin = AknsUtils::SkinInstance();
|
|
1693 |
MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
|
|
1694 |
|
|
1695 |
// draw to upper left corner, and normalize the retangle to
|
|
1696 |
// fact that the dialog starts from coordinates ( 0,0 ),
|
|
1697 |
// so the y-coordinate is correct ( heading pane )
|
|
1698 |
// but x must be set to zero
|
|
1699 |
TPoint point = TPoint( 0, 0 );
|
|
1700 |
popupGridRect.Move( -popupGridRect.iTl.iX,0 );
|
|
1701 |
|
|
1702 |
AknsDrawUtils::DrawBackground( skin,
|
|
1703 |
cc,
|
|
1704 |
this,
|
|
1705 |
*iBitmapGc,
|
|
1706 |
point,
|
|
1707 |
popupGridRect,
|
|
1708 |
KAknsDrawParamDefault );
|
|
1709 |
|
|
1710 |
iOffscreenBgDrawn = ETrue;
|
|
1711 |
}
|
|
1712 |
}
|
|
1713 |
}
|
|
1714 |
|
|
1715 |
// -----------------------------------------------------------------------------
|
|
1716 |
// CCmDestinationIconMap::ComponentControl( TInt aIndex ) const
|
|
1717 |
// Return the controll pointer
|
|
1718 |
// -----------------------------------------------------------------------------
|
|
1719 |
//
|
|
1720 |
CCoeControl* CCmDestinationIconMap::ComponentControl( TInt aIndex ) const
|
|
1721 |
{
|
|
1722 |
if ( aIndex == 0 &&
|
|
1723 |
iSBFrame &&
|
|
1724 |
iSBFrame->TypeOfVScrollBar() == CEikScrollBarFrame::EDoubleSpan )
|
|
1725 |
{
|
|
1726 |
return iSBFrame->VerticalScrollBar();
|
|
1727 |
}
|
|
1728 |
else
|
|
1729 |
{
|
|
1730 |
return NULL;
|
|
1731 |
}
|
|
1732 |
}
|
|
1733 |
|
|
1734 |
// -----------------------------------------------------------------------------
|
|
1735 |
// CCmDestinationIconMap::CountComponentControls()
|
|
1736 |
// Return no of controll to be placed on the container control
|
|
1737 |
// -----------------------------------------------------------------------------
|
|
1738 |
//
|
|
1739 |
TInt CCmDestinationIconMap::CountComponentControls() const
|
|
1740 |
{
|
|
1741 |
if ( iSBFrame &&
|
|
1742 |
iSBFrame->TypeOfVScrollBar() == CEikScrollBarFrame::EDoubleSpan )
|
|
1743 |
{
|
|
1744 |
return 1;
|
|
1745 |
}
|
|
1746 |
else
|
|
1747 |
{
|
|
1748 |
return 0;
|
|
1749 |
}
|
|
1750 |
}
|
|
1751 |
|
|
1752 |
// -----------------------------------------------------------------------------
|
|
1753 |
// CCmDestinationIconMap::CountMaxColumnsAndCellSizes
|
|
1754 |
// Counts no of columns and the cell size will be displayed in the icon table
|
|
1755 |
// -----------------------------------------------------------------------------
|
|
1756 |
//
|
|
1757 |
void CCmDestinationIconMap::CountMaxColumnsAndCellSizes()
|
|
1758 |
{
|
|
1759 |
TRect cellRect; // retangle of one item in grid
|
|
1760 |
TRect gridRect; // retangle of the grid contaning the items
|
|
1761 |
|
|
1762 |
// 1. Get the layout
|
|
1763 |
|
|
1764 |
// Get the parent rect
|
|
1765 |
TRect mainPaneRect;
|
|
1766 |
if ( !AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane,
|
|
1767 |
mainPaneRect ) )
|
|
1768 |
{
|
|
1769 |
mainPaneRect = iAvkonAppUi->ClientRect();
|
|
1770 |
}
|
|
1771 |
|
|
1772 |
// Calculate the layout of the whole popup with the biggest possible -> 0
|
|
1773 |
// Dialog layout, check variety first
|
|
1774 |
|
|
1775 |
// Get the layout rect of the dialog
|
|
1776 |
|
|
1777 |
// Check variety first
|
|
1778 |
TAknLayoutScalableParameterLimits iconMapDialogVariety =
|
|
1779 |
AknLayoutScalable_Avkon::popup_grid_graphic_window_ParamLimits();
|
|
1780 |
|
|
1781 |
TInt maxVariety = iconMapDialogVariety.LastVariety();
|
|
1782 |
|
|
1783 |
// Check the CBA, if the orientation is not landscape
|
|
1784 |
// there is not so much varieties
|
|
1785 |
AknLayoutUtils::TAknCbaLocation location = AknLayoutUtils::CbaLocation();
|
|
1786 |
// the offset for the certain cba location variety
|
|
1787 |
TInt maxVarietyOffset = 0;
|
|
1788 |
TInt varietyOffset = maxVariety + 1; // the number of varieties
|
|
1789 |
|
|
1790 |
// landscape variety number must be calculated offset == number of varieties
|
|
1791 |
// same applies to the variety number for the biggest sized layout for the
|
|
1792 |
// variety
|
|
1793 |
if ( Layout_Meta_Data::IsLandscapeOrientation() )
|
|
1794 |
{
|
|
1795 |
// the offset for one variety
|
|
1796 |
varietyOffset = ( maxVariety + 1 ) / KAknSctCBaButtonDirections;
|
|
1797 |
}
|
|
1798 |
|
|
1799 |
if ( location == AknLayoutUtils::EAknCbaLocationRight )
|
|
1800 |
{
|
|
1801 |
maxVarietyOffset = varietyOffset;
|
|
1802 |
}
|
|
1803 |
else if ( location == AknLayoutUtils::EAknCbaLocationLeft )
|
|
1804 |
{
|
|
1805 |
maxVarietyOffset = varietyOffset + varietyOffset; // 2*
|
|
1806 |
}
|
|
1807 |
|
|
1808 |
TAknLayoutRect popupGridLayRect;
|
|
1809 |
popupGridLayRect.LayoutRect( mainPaneRect,
|
|
1810 |
AknLayoutScalable_Avkon::popup_grid_graphic_window( maxVarietyOffset ) );
|
|
1811 |
|
|
1812 |
// Get the layout of the actual icon grid with scrollbar
|
|
1813 |
TAknLayoutRect gridWithScrollLayRect;
|
|
1814 |
gridWithScrollLayRect.LayoutRect( popupGridLayRect.Rect(),
|
|
1815 |
AknLayoutScalable_Avkon::listscroll_popup_graphic_pane() );
|
|
1816 |
|
|
1817 |
// Then the grid area without scrollbar
|
|
1818 |
// NOTE: The grid with scroll bar is used as reference
|
|
1819 |
TAknLayoutRect gridLayRect;
|
|
1820 |
gridLayRect.LayoutRect( gridWithScrollLayRect.Rect(),
|
|
1821 |
AknLayoutScalable_Avkon::grid_graphic_popup_pane( 0 ) );
|
|
1822 |
|
|
1823 |
// Different parent if SCT inside editing menu.
|
|
1824 |
TRect rect = Rect();
|
|
1825 |
gridRect = gridLayRect.Rect();
|
|
1826 |
// cell size, AGAIN 7 item
|
|
1827 |
TAknLayoutRect cellLayRect;
|
|
1828 |
cellLayRect.LayoutRect(
|
|
1829 |
gridRect,
|
|
1830 |
AknLayoutScalable_Avkon::cell_graphic_popup_pane( 0,0,0 ) );
|
|
1831 |
|
|
1832 |
cellRect = cellLayRect.Rect();
|
|
1833 |
|
|
1834 |
// 2. Calculate width related
|
|
1835 |
// - item width
|
|
1836 |
// - max number of columns
|
|
1837 |
|
|
1838 |
// Width of the items area
|
|
1839 |
TInt gridWidth = gridRect.Width();
|
|
1840 |
|
|
1841 |
// Width of one item
|
|
1842 |
TInt cellWidth = cellRect.Width();
|
|
1843 |
|
|
1844 |
// ensure the item width and store it
|
|
1845 |
TAknLayoutRect secondCellLayRect;
|
|
1846 |
secondCellLayRect.LayoutRect( gridRect,
|
|
1847 |
AknLayoutScalable_Avkon::cell_graphic_popup_pane( 0,1,0 ) );
|
|
1848 |
|
|
1849 |
iGridItemWidth = secondCellLayRect.Rect().iTl.iX -
|
|
1850 |
cellLayRect.Rect().iTl.iX;
|
|
1851 |
|
|
1852 |
if ( iGridItemWidth < 0 )
|
|
1853 |
{
|
|
1854 |
// The result is negative with lay file data if the layout is mirrored.
|
|
1855 |
iGridItemWidth = -iGridItemWidth;
|
|
1856 |
}
|
|
1857 |
|
|
1858 |
// Calculate the amount of columns
|
|
1859 |
iMaxColumns = gridWidth / cellWidth;
|
|
1860 |
|
|
1861 |
|
|
1862 |
// 2. Calculate height related
|
|
1863 |
// - item height
|
|
1864 |
// - max number of rows
|
|
1865 |
|
|
1866 |
// Get the grid height
|
|
1867 |
// NOTE: in landscape the LAF is wrong so use the main panes height
|
|
1868 |
TInt gridHeight = gridRect.Height();
|
|
1869 |
|
|
1870 |
// get the item height
|
|
1871 |
TInt cellHeight = cellRect.Height();
|
|
1872 |
|
|
1873 |
// calculate the number of items fitting to grid
|
|
1874 |
iExtension->iMaxVisibleRows = 3; //gridHeight / cellHeight;
|
|
1875 |
|
|
1876 |
// Store the item height
|
|
1877 |
TAknLayoutRect secondRowLayRect;
|
|
1878 |
secondRowLayRect.LayoutRect( gridLayRect.Rect(),
|
|
1879 |
AknLayoutScalable_Avkon::cell_graphic_popup_pane( 0,0,1 ) );
|
|
1880 |
|
|
1881 |
iGridItemHeight = secondRowLayRect.Rect().iTl.iY -
|
|
1882 |
cellLayRect.Rect().iTl.iY;
|
|
1883 |
}
|
|
1884 |
|
|
1885 |
// -----------------------------------------------------------------------------
|
|
1886 |
// CCmDestinationIconMap::HandleScrollEventL
|
|
1887 |
// Handles the different scroll events so that the map reacts accordingly.
|
|
1888 |
// -----------------------------------------------------------------------------
|
|
1889 |
//
|
|
1890 |
void CCmDestinationIconMap::HandleScrollEventL( CEikScrollBar* aScrollBar,
|
|
1891 |
TEikScrollEvent aEventType )
|
|
1892 |
{
|
|
1893 |
TBool update = EFalse;
|
|
1894 |
|
|
1895 |
switch ( aEventType )
|
|
1896 |
{
|
|
1897 |
case EEikScrollUp:
|
|
1898 |
case EEikScrollPageUp:
|
|
1899 |
{
|
|
1900 |
// nothing done if we are already on the first page.
|
|
1901 |
if ( iFirstVisibleRow > 0 )
|
|
1902 |
{
|
|
1903 |
iFirstVisibleRow -= iExtension->iMaxVisibleRows;
|
|
1904 |
if ( iFirstVisibleRow < 0 )
|
|
1905 |
{
|
|
1906 |
iFirstVisibleRow = 0;
|
|
1907 |
}
|
|
1908 |
update = ETrue;
|
|
1909 |
}
|
|
1910 |
UpdateScrollIndicatorL();
|
|
1911 |
}
|
|
1912 |
break;
|
|
1913 |
|
|
1914 |
case EEikScrollDown:
|
|
1915 |
case EEikScrollPageDown:
|
|
1916 |
{
|
|
1917 |
// nothing done if we are already on the last page.
|
|
1918 |
if ( iFirstVisibleRow < iRows - iExtension->iMaxVisibleRows )
|
|
1919 |
{
|
|
1920 |
iFirstVisibleRow += iExtension->iMaxVisibleRows;
|
|
1921 |
if ( iFirstVisibleRow > iRows - iExtension->iMaxVisibleRows )
|
|
1922 |
{
|
|
1923 |
iFirstVisibleRow = iRows - iExtension->iMaxVisibleRows;
|
|
1924 |
}
|
|
1925 |
update = ETrue;
|
|
1926 |
}
|
|
1927 |
UpdateScrollIndicatorL();
|
|
1928 |
}
|
|
1929 |
break;
|
|
1930 |
|
|
1931 |
case EEikScrollThumbDragVert:
|
|
1932 |
{
|
|
1933 |
// Ask which type of scrollbar is shown
|
|
1934 |
TInt thumbPosition;
|
|
1935 |
TBool isDoubleSpan = ( CEikScrollBarFrame::EDoubleSpan == iSBFrame->TypeOfVScrollBar() );
|
|
1936 |
if ( isDoubleSpan )
|
|
1937 |
{
|
|
1938 |
thumbPosition = static_cast <const TAknDoubleSpanScrollBarModel*>(
|
|
1939 |
aScrollBar->Model() )->FocusPosition();
|
|
1940 |
}
|
|
1941 |
else
|
|
1942 |
{
|
|
1943 |
thumbPosition = aScrollBar->Model()->iThumbPosition;
|
|
1944 |
}
|
|
1945 |
|
|
1946 |
if ( thumbPosition != iFirstVisibleRow )
|
|
1947 |
{
|
|
1948 |
iFirstVisibleRow = thumbPosition;
|
|
1949 |
update = ETrue;
|
|
1950 |
}
|
|
1951 |
}
|
|
1952 |
break;
|
|
1953 |
|
|
1954 |
case EEikScrollThumbReleaseVert:
|
|
1955 |
{
|
|
1956 |
// Ask which type of scrollbar is shown
|
|
1957 |
TBool isDoubleSpan =
|
|
1958 |
CEikScrollBarFrame::EDoubleSpan == iSBFrame->TypeOfVScrollBar();
|
|
1959 |
if ( isDoubleSpan )
|
|
1960 |
{
|
|
1961 |
iFirstVisibleRow = static_cast <const TAknDoubleSpanScrollBarModel*>(
|
|
1962 |
aScrollBar->Model() )->FocusPosition();
|
|
1963 |
}
|
|
1964 |
else
|
|
1965 |
{
|
|
1966 |
iFirstVisibleRow = aScrollBar->Model()->iThumbPosition;
|
|
1967 |
}
|
|
1968 |
update = ETrue;
|
|
1969 |
UpdateScrollIndicatorL();
|
|
1970 |
}
|
|
1971 |
break;
|
|
1972 |
|
|
1973 |
case EEikScrollLeft: // flow through
|
|
1974 |
case EEikScrollRight: // flow through
|
|
1975 |
case EEikScrollPageLeft: // flow through
|
|
1976 |
case EEikScrollPageRight: // flow through
|
|
1977 |
case EEikScrollThumbDragHoriz: // flow through
|
|
1978 |
case EEikScrollThumbReleaseHoriz: // flow through
|
|
1979 |
default:
|
|
1980 |
// do nothing
|
|
1981 |
break;
|
|
1982 |
}
|
|
1983 |
|
|
1984 |
// to avoid flicker we draw only if there really was something new to draw.
|
|
1985 |
if ( update )
|
|
1986 |
{
|
|
1987 |
if ( iExtension->iObserver )
|
|
1988 |
{
|
|
1989 |
iExtension->iObserver->HandleControlEventL(
|
|
1990 |
this,
|
|
1991 |
MCoeControlObserver::EEventRequestFocus );
|
|
1992 |
}
|
|
1993 |
DrawDeferred();
|
|
1994 |
}
|
|
1995 |
}
|
|
1996 |
|
|
1997 |
// -----------------------------------------------------------------------------
|
|
1998 |
// CCmDestinationIconMap::Extension
|
|
1999 |
// -----------------------------------------------------------------------------
|
|
2000 |
//
|
|
2001 |
CCmDestinationIconMapExtension* CCmDestinationIconMap::Extension() const
|
|
2002 |
{
|
|
2003 |
return iExtension;
|
|
2004 |
}
|