phoneuis/easydialing/src/easydialinglistbox.cpp
branchRCL_3
changeset 62 5266b1f337bd
child 81 c26cc2a7c548
equal deleted inserted replaced
61:41a7f70b3818 62:5266b1f337bd
       
     1 /*
       
     2 * Copyright (c) 2010 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:  Easy dialing list box.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 
       
    21 #include "easydialinglistbox.h"
       
    22 #include "easydialinglistboxview.h"
       
    23 #include "easydialinglistboxitemdrawer.h"
       
    24 #include "easydialinglistboxdata.h"
       
    25 #include "easydialingpanics.h"
       
    26 #include "easydialingcontactdatamanager.h"
       
    27 #include "easydialingcrkeys.h"
       
    28 
       
    29 #include <easydialingpluginresources.rsg>
       
    30 
       
    31 #include <phoneappcommands.hrh>
       
    32 #include <phonebook2.mbg>
       
    33 #include <phonebook2ece.mbg>
       
    34 
       
    35 #include <ccappcommlauncherpluginrsc.rsg>
       
    36 
       
    37 #include <aknlongtapdetector.h> // Required for touch
       
    38 #include <AknsFrameBackgroundControlContext.h>
       
    39 
       
    40 #include <aknlayoutscalable_apps.cdl.h>
       
    41 #include <layoutmetadata.cdl.h>
       
    42 #include <gulicon.h>
       
    43 #include <centralrepository.h>
       
    44 #include <bautils.h>    // for BaflUtils
       
    45 
       
    46 #include <aknlistloadertfx.h>
       
    47 #include <aknlistboxtfxinternal.h>
       
    48 #include <aknlistboxtfx.h>
       
    49 
       
    50 // EXTERNAL DATA STRUCTURES
       
    51 
       
    52 // EXTERNAL FUNCTION PROTOTYPES  
       
    53 
       
    54 extern TRect ContactImageBoundingBox( const TRect& aItemRect );
       
    55 extern TRect ActionMenuIconBoundingBox(const TRect& aItemRect);
       
    56 
       
    57 // CONSTANTS
       
    58 static const TInt KListBoxMarginWidth = 2;
       
    59 
       
    60 // MACROS
       
    61 
       
    62 // LOCAL CONSTANTS AND MACROS
       
    63 
       
    64 // MODULE DATA STRUCTURES
       
    65 
       
    66 // LOCAL FUNCTION PROTOTYPES
       
    67 
       
    68 // FORWARD DECLARATIONS
       
    69 
       
    70 
       
    71 /*
       
    72  * ==============================================================================
       
    73  * 
       
    74  * 
       
    75  * class CEasyDialingListBox
       
    76  * 
       
    77  * 
       
    78  * ==============================================================================
       
    79  */
       
    80 
       
    81 
       
    82 // -----------------------------------------------------------------------------
       
    83 // CEasyDialingListBox
       
    84 // 
       
    85 // -----------------------------------------------------------------------------
       
    86 //
       
    87 CEasyDialingListBox::CEasyDialingListBox() :
       
    88     CEikFormattedCellListBox()
       
    89     {
       
    90     }
       
    91 
       
    92 // -----------------------------------------------------------------------------
       
    93 // ~CEasyDialingListBox
       
    94 // 
       
    95 // -----------------------------------------------------------------------------
       
    96 //
       
    97 CEasyDialingListBox::~CEasyDialingListBox()
       
    98     {
       
    99     delete iBGContext;
       
   100     delete iLongTapDetector;
       
   101     }
       
   102 
       
   103 // -----------------------------------------------------------------------------
       
   104 // ConstructL
       
   105 // 
       
   106 // -----------------------------------------------------------------------------
       
   107 //
       
   108 void CEasyDialingListBox::ConstructL( TInt aFlags, 
       
   109         CEasyDialingContactDataManager* aContactDataManager )
       
   110     {
       
   111     CEikFormattedCellListBox::ConstructL( NULL, aFlags );
       
   112     
       
   113     iLongTapDetector = CAknLongTapDetector::NewL( this );
       
   114  
       
   115     CEasyDialingListBoxItemDrawer* drawer = static_cast<CEasyDialingListBoxItemDrawer*> (iItemDrawer);
       
   116     CEasyDialingListBoxData* data = drawer->EasyDialingCellData();
       
   117     data->SetContactDataManager(aContactDataManager);
       
   118     data->SetEDLBXControl(this);
       
   119     
       
   120     iBGContext = CAknsFrameBackgroundControlContext::NewL( KAknsIIDQsnFrPopupSub,
       
   121             Rect(), Rect(), EFalse );
       
   122     
       
   123     // ContactDataManager is accessed from SizeChanged. If list item size
       
   124     // changes -> thumbnail size changes
       
   125     iContactDataManager = aContactDataManager;
       
   126     
       
   127     drawer->SetColors();
       
   128 
       
   129     CreateScrollBarFrameL( ETrue );
       
   130     ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
       
   131     }
       
   132 
       
   133 
       
   134 // -----------------------------------------------------------------------------
       
   135 // MakeViewClassInstanceL
       
   136 // 
       
   137 // -----------------------------------------------------------------------------
       
   138 //
       
   139 CListBoxView* CEasyDialingListBox::MakeViewClassInstanceL()
       
   140     {
       
   141     return (new ( ELeave ) CEasyDialingListBoxView);
       
   142     }
       
   143 
       
   144 
       
   145 // -----------------------------------------------------------------------------
       
   146 // ItemDrawer
       
   147 // 
       
   148 // -----------------------------------------------------------------------------
       
   149 //
       
   150 CEasyDialingListBoxItemDrawer* CEasyDialingListBox::ItemDrawer() const
       
   151     {
       
   152     return (CEasyDialingListBoxItemDrawer*) iItemDrawer;
       
   153     }
       
   154 
       
   155 
       
   156 // -----------------------------------------------------------------------------
       
   157 // FocusChanged
       
   158 // 
       
   159 // -----------------------------------------------------------------------------
       
   160 //
       
   161 void CEasyDialingListBox::FocusChanged( TDrawNow aDrawNow )
       
   162     {
       
   163     if ( !IsFocused() )
       
   164         {
       
   165         CEasyDialingListBoxView* view = static_cast<CEasyDialingListBoxView*>( iView );
       
   166         view->SetCurrentItemIndexToNone();
       
   167         }
       
   168     CEikFormattedCellListBox::FocusChanged( aDrawNow );
       
   169     }
       
   170 
       
   171 
       
   172 // -----------------------------------------------------------------------------
       
   173 // CreateItemDrawerL
       
   174 // 
       
   175 // -----------------------------------------------------------------------------
       
   176 //
       
   177 void CEasyDialingListBox::CreateItemDrawerL()
       
   178     {
       
   179     CEasyDialingListBoxData* celldata = CEasyDialingListBoxData::NewL( *iEikonEnv );
       
   180     CleanupStack::PushL( celldata );
       
   181     iItemDrawer = new(ELeave) CEasyDialingListBoxItemDrawer(Model(), iEikonEnv->NormalFont(), celldata);
       
   182     CleanupStack::Pop( celldata );  
       
   183     }
       
   184 
       
   185 
       
   186 // -----------------------------------------------------------------------------
       
   187 // Draw
       
   188 // 
       
   189 // -----------------------------------------------------------------------------
       
   190 //
       
   191 void CEasyDialingListBox::Draw(const TRect& aRect) const
       
   192     {
       
   193     MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( iItemDrawer->Gc() );
       
   194     if ( transApi )
       
   195         {
       
   196         transApi->SetListType( MAknListBoxTfxInternal::EListBoxTypeMainPane );
       
   197         transApi->BeginRedraw( MAknListBoxTfxInternal::EListView, this->Rect() );
       
   198         }
       
   199     
       
   200     if (!iView->RedrawDisabled() )
       
   201         {
       
   202         TRect clientRect( Rect() );
       
   203         TRect viewRect = iView->ViewRect();
       
   204         
       
   205         if ( transApi )
       
   206             {
       
   207             transApi->StartDrawing( MAknListBoxTfxInternal::EListView );
       
   208             }
       
   209 
       
   210         AknsDrawUtils::BackgroundBetweenRects( 
       
   211             AknsUtils::SkinInstance(), 
       
   212             iBGContext, 
       
   213             this, 
       
   214             *iItemDrawer->Gc(), 
       
   215             clientRect, 
       
   216             viewRect );
       
   217         
       
   218         if ( transApi )
       
   219             {
       
   220             transApi->StopDrawing();
       
   221             }
       
   222         }
       
   223     
       
   224     if ( iModel->NumberOfItems() )
       
   225         {
       
   226         // Draw the actual list
       
   227         iView->Draw(&aRect);
       
   228         }
       
   229     if ( transApi )
       
   230         {
       
   231         transApi->EndViewRedraw( aRect );
       
   232         }
       
   233     }
       
   234 
       
   235 
       
   236 // -----------------------------------------------------------------------------
       
   237 // HandleResourceChange
       
   238 // 
       
   239 // -----------------------------------------------------------------------------
       
   240 //
       
   241 void CEasyDialingListBox::HandleResourceChange(TInt aType)
       
   242     {
       
   243     CEikFormattedCellListBox::HandleResourceChange( aType );
       
   244     iSBFrame->VerticalScrollBar()->HandleResourceChange( aType );
       
   245     iSBFrame->DrawScrollBarsNow();
       
   246     ItemDrawer()->SetColors();
       
   247     
       
   248     // Base call to HandleResourceChange justifies the list to even items
       
   249     // on the top. This causes problems when listbox height is not a multiple of
       
   250     // listitem heights. Fix scrolling manually for these cases.
       
   251     TRAP_IGNORE( HandleItemAdditionL() ); // needed to prevent drawing problems
       
   252     TInt scrollIndex = ( IsFocused() ? CurrentItemIndex() : iNumberOfNames - 1 );
       
   253     ScrollToMakeItemVisible( scrollIndex );
       
   254     
       
   255     DrawDeferred();
       
   256     }
       
   257 
       
   258 
       
   259 // -----------------------------------------------------------------------------
       
   260 // SizeChanged
       
   261 // 
       
   262 // -----------------------------------------------------------------------------
       
   263 //
       
   264 void CEasyDialingListBox::SizeChanged()
       
   265     {
       
   266 	// Note that within this call view rect is adjusted to fit into TGulBorder
       
   267     // that could have been given in construction. It's not used by ED listbox.
       
   268     // The view rect is not correct for ED after this call but it's
       
   269     // calculated and set below.
       
   270     CEikFormattedCellListBox::SizeChanged();
       
   271     
       
   272     TRect parentRect = Rect();
       
   273     
       
   274     // Set the listbox colors.
       
   275     // For some reason, calling this in HandleResourceChange is not enough, it does
       
   276     // not get called in situation it should.
       
   277     ItemDrawer()->SetColors();
       
   278     
       
   279     // Get all the layout rects
       
   280     TAknLayoutRect rect;
       
   281     TInt variety = ( Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0 );
       
   282 
       
   283     TAknWindowComponentLayout viewLayout( AknLayoutScalable_Apps::dia3_list_pane( variety ) );
       
   284     rect.LayoutRect(parentRect, viewLayout );
       
   285     TRect viewRect( rect.Rect() );
       
   286     // Add a bit of margin around the view as layout doesn't define any
       
   287     viewRect.Shrink( KListBoxMarginWidth, KListBoxMarginWidth );
       
   288     
       
   289     TAknWindowComponentLayout scrollBarLayout( AknLayoutScalable_Apps::scroll_pane_cp12() );
       
   290     rect.LayoutRect( parentRect, scrollBarLayout );
       
   291     TRect scrollBarRect( rect.Rect() );
       
   292 
       
   293     TRect viewAndScrollBarRect( viewRect );
       
   294     if ( AknLayoutUtils::LayoutMirrored() )
       
   295         {
       
   296         viewAndScrollBarRect.iTl.iX = scrollBarRect.iTl.iX + KListBoxMarginWidth;
       
   297         }
       
   298     else
       
   299         {
       
   300         viewAndScrollBarRect.iBr.iX = scrollBarRect.iBr.iX - KListBoxMarginWidth;
       
   301         }
       
   302 
       
   303     // If scrollbar is not needed, then we can use all the space for the list view
       
   304     if ( GetHeightBasedOnNumberOfItems( iNumberOfNames ) <= parentRect.Height() )
       
   305         {
       
   306         viewRect = viewAndScrollBarRect;
       
   307         scrollBarRect.SetWidth( 0 );
       
   308         }
       
   309 
       
   310     // Must use this method so that all eiklistbox's internal variables are 
       
   311     // set and updated according to this viewRect. This call would
       
   312     // add list margins but no such are defined in layouts so view's rect is
       
   313     // set to viewRect calculated here.
       
   314     SetViewRectFromClientRect( viewRect );
       
   315     
       
   316     // Set scroll bar rect
       
   317     if ( iSBFrame )
       
   318         {
       
   319         CAknDoubleSpanScrollBar* scrollbar = static_cast <CAknDoubleSpanScrollBar*>( iSBFrame->VerticalScrollBar() );
       
   320         scrollbar->SetFixedLayoutRect( scrollBarRect );
       
   321         scrollbar->SetRect( scrollBarRect );
       
   322         scrollbar->MakeVisible( scrollBarRect.Width() != 0 );
       
   323         }
       
   324 
       
   325     iBGContext->SetFrameRects( parentRect, viewAndScrollBarRect );
       
   326     
       
   327     TRAP_IGNORE( CEikFormattedCellListBox::HandleViewRectSizeChangeL() );
       
   328     }
       
   329 
       
   330 
       
   331 // -----------------------------------------------------------------------------
       
   332 // MopSupplyObject
       
   333 // 
       
   334 // -----------------------------------------------------------------------------
       
   335 //
       
   336 TTypeUid::Ptr CEasyDialingListBox::MopSupplyObject( TTypeUid aId )
       
   337     {
       
   338     if ( aId.iUid == MAknsControlContext::ETypeId && iBGContext )
       
   339         {
       
   340         return MAknsControlContext::SupplyMopObject( aId, iBGContext );
       
   341         }
       
   342     return CEikFormattedCellListBox::MopSupplyObject( aId );    
       
   343     }
       
   344 
       
   345 // -----------------------------------------------------------------------------
       
   346 // MakeVisible
       
   347 // 
       
   348 // -----------------------------------------------------------------------------
       
   349 //
       
   350 void CEasyDialingListBox::MakeVisible( TBool aVisible )
       
   351     {
       
   352     if ( aVisible != IsVisible() )
       
   353         {
       
   354         CEikFormattedCellListBox::MakeVisible( aVisible );
       
   355         if ( iSBFrame )
       
   356             {
       
   357             CEikScrollBar* sb = iSBFrame->GetScrollBarHandle( CEikScrollBar::EVertical );
       
   358             if ( sb )
       
   359                 {
       
   360                 sb->MakeVisible( aVisible );
       
   361                 if ( aVisible )
       
   362                     {
       
   363                     UpdateScrollBarThumbs();
       
   364                     }
       
   365                 }
       
   366             }
       
   367         }
       
   368     }
       
   369 
       
   370 // -----------------------------------------------------------------------------
       
   371 // SetMaxRect
       
   372 //
       
   373 // -----------------------------------------------------------------------------
       
   374 //
       
   375 void CEasyDialingListBox::SetMaxRect( TRect aMaxRect )
       
   376     {
       
   377     iMaxRect = aMaxRect;
       
   378 
       
   379     // Update the list item size according the maximum view rect size
       
   380     TInt variety = ( Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0 );
       
   381     TAknLayoutRect maxViewLayout;
       
   382     maxViewLayout.LayoutRect( aMaxRect, AknLayoutScalable_Apps::dia3_list_pane( variety ) );
       
   383     TRect maxViewRect( maxViewLayout.Rect() );
       
   384     maxViewRect.Shrink( KListBoxMarginWidth, KListBoxMarginWidth ); // layout data doens't include any margins but we have added some
       
   385 
       
   386     // Read list item size aid from layout data. Use it to determine how many
       
   387     // items to show in listbox.
       
   388     TAknLayoutRect listSizeAid;
       
   389     listSizeAid.LayoutRect( aMaxRect, AknLayoutScalable_Apps::aid_size_list_single_double() );
       
   390     TInt itemHeightAid = listSizeAid.Rect().Height();
       
   391     
       
   392     TInt maxItemsShown = maxViewRect.Height() / itemHeightAid;
       
   393     if ( maxViewRect.Height() % itemHeightAid > itemHeightAid / 2 )
       
   394         {
       
   395         maxItemsShown++;
       
   396         }
       
   397     
       
   398     TInt itemHeight = maxViewRect.Height() / maxItemsShown;
       
   399     TRAP_IGNORE( SetItemHeightL( itemHeight ) );
       
   400 
       
   401     // Calculate new thumbnail rect from item size
       
   402     TSize itemSize( maxViewRect.Width(), itemHeight );
       
   403     TRect thumbnailRect = ContactImageBoundingBox( itemSize );
       
   404     iContactDataManager->SetThumbnailSize( thumbnailRect.Size() ); // reloads thumbnails if the new size is different from old one
       
   405 
       
   406     // Inform listbox data class about changed list item size
       
   407     ItemDrawer()->EasyDialingCellData()->HandleItemSizeChange();
       
   408     }
       
   409 
       
   410 // -----------------------------------------------------------------------------
       
   411 // SetRectToNumberOfItems
       
   412 // -----------------------------------------------------------------------------
       
   413 //
       
   414 void CEasyDialingListBox::SetRectToNumberOfItems( TInt aNumberOfNames ) 
       
   415     {
       
   416     iNumberOfNames = aNumberOfNames;
       
   417 
       
   418     TRect listboxRect( iMaxRect );
       
   419     
       
   420     // Make listbox smaller if maximum size is not needed to show
       
   421     // all list items.
       
   422     TInt requiredHeight = GetHeightBasedOnNumberOfItems( iNumberOfNames );
       
   423     if ( requiredHeight < listboxRect.Height() )
       
   424         {
       
   425         // Shrink rect height so that bottom of the rect doesn't move
       
   426         listboxRect.iTl.iY += ( listboxRect.Height() - requiredHeight );
       
   427         }
       
   428     
       
   429     SetRect( listboxRect );
       
   430     }
       
   431 
       
   432 
       
   433 // -----------------------------------------------------------------------------
       
   434 // SetFocusedWithKeyEventL
       
   435 // -----------------------------------------------------------------------------
       
   436 //
       
   437 TKeyResponse CEasyDialingListBox::SetFocusedWithKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType )
       
   438     {
       
   439     TKeyResponse keyResponse = EKeyWasNotConsumed;
       
   440     TInt keyCode = aKeyEvent.iCode;
       
   441             
       
   442     // Disable redrawing temporarily.
       
   443     // This is because OfferKeyEventL puts the focus to the wrong item,
       
   444     // and we don't want to show it flashing there.
       
   445     // Make sure that no leave happens before redraw is enabled again.
       
   446     iView->SetDisableRedraw( ETrue );
       
   447         
       
   448     TRAP_IGNORE( keyResponse = OfferKeyEventL( aKeyEvent, aType ) );
       
   449     
       
   450     TInt itemToFocus = ( keyCode == EKeyUpArrow ? iNumberOfNames - 1 : 0 );
       
   451     ScrollToMakeItemVisible( itemToFocus );
       
   452     SetCurrentItemIndex( itemToFocus );
       
   453         
       
   454     iView->SetDisableRedraw( EFalse );
       
   455     
       
   456     DrawDeferred();
       
   457     
       
   458     return keyResponse;
       
   459     }
       
   460 
       
   461 
       
   462 // -----------------------------------------------------------------------------
       
   463 // GetHeightBasedOnNumberOfItems
       
   464 // 
       
   465 // -----------------------------------------------------------------------------
       
   466 //
       
   467 TInt CEasyDialingListBox::GetHeightBasedOnNumberOfItems( TInt aNum ) const
       
   468     {
       
   469     return ( ItemHeight()*aNum + KListBoxMarginWidth*2 ); 
       
   470     }
       
   471 
       
   472 
       
   473 // -----------------------------------------------------------------------------
       
   474 // CurrentContactDataIndex
       
   475 // 
       
   476 // -----------------------------------------------------------------------------
       
   477 //
       
   478 TInt CEasyDialingListBox::CurrentContactDataIndex()
       
   479     {
       
   480     if ( CurrentItemIndex() >= 0 ) 
       
   481         {
       
   482         TPtrC itemText = Model()->ItemText( CurrentItemIndex() );
       
   483         TPtrC indexText;
       
   484         
       
   485         TInt error = TextUtils::ColumnText( indexText , 0, &itemText );
       
   486         __ASSERT_DEBUG( error == KErrNone, EasyDialingPanic( EEasyDialingPanicInvalidListBoxModelString ) );
       
   487 
       
   488         TUint id( 0 );
       
   489         TLex lex( indexText );
       
   490         error = lex.Val( id, EHex );
       
   491         __ASSERT_DEBUG( error == KErrNone, EasyDialingPanic( EEasyDialingPanicInvalidListBoxModelString ) );
       
   492         
       
   493         return id;
       
   494         }
       
   495     else 
       
   496         {
       
   497         return KErrNotFound;
       
   498         }
       
   499     }
       
   500 
       
   501 
       
   502 // -----------------------------------------------------------------------------
       
   503 // CurrentContactLinkL
       
   504 // 
       
   505 // -----------------------------------------------------------------------------
       
   506 //
       
   507 HBufC8* CEasyDialingListBox::CurrentContactLinkL()
       
   508     {
       
   509     TInt index = CurrentContactDataIndex();
       
   510     if ( index >= 0 )
       
   511         {
       
   512         HBufC8* packedContact = iContactDataManager->ContactLinkLC( index );
       
   513         CleanupStack::Pop( packedContact );
       
   514         return packedContact;
       
   515         }
       
   516     else
       
   517         {
       
   518         return NULL;
       
   519         }
       
   520     }
       
   521 
       
   522 
       
   523 // -----------------------------------------------------------------------------
       
   524 // HandleLongTapEventL
       
   525 // Callback from CAknLongTapDetector.
       
   526 // -----------------------------------------------------------------------------
       
   527 //
       
   528 void CEasyDialingListBox::HandleLongTapEventL( const TPoint& /*aPenEventLocation*/, 
       
   529                                                const TPoint& /*aPenEventScreenLocation*/ )
       
   530     {
       
   531     ReportListBoxEventL( static_cast<MEikListBoxObserver::TListBoxEvent>
       
   532             ( KEasyDialingContactLongTapped ) );
       
   533     iPointerLongPressHandled = ETrue;
       
   534     
       
   535     TPointerEvent simulatedButtonUpEvent( TPointerEvent::EButton1Up, 0,
       
   536                                           TPoint(), TPoint() );
       
   537     TRAP_IGNORE( CEikFormattedCellListBox::HandlePointerEventL( simulatedButtonUpEvent ) );
       
   538     }
       
   539 
       
   540 
       
   541 // -----------------------------------------------------------------------------
       
   542 // HandlePointerEventL
       
   543 // Pointer event handling within the EasyDialingListBox.
       
   544 // -----------------------------------------------------------------------------
       
   545 //
       
   546 void CEasyDialingListBox::HandlePointerEventL(const TPointerEvent& aPointerEvent)
       
   547     {
       
   548     // Button down event starts new pointer press. Reset flags at this point.
       
   549     if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
       
   550         {
       
   551         iPointerLongPressHandled = EFalse;
       
   552         }
       
   553     
       
   554     // check if pointer event is over item
       
   555     TInt itemIndex( KErrNotFound );
       
   556     TPoint pointerPos( aPointerEvent.iPosition );
       
   557     TBool pointerIsOverAnItem = iView->XYPosToItemIndex( pointerPos, itemIndex );
       
   558     
       
   559     // long tap is started only if pointer is over an actual item
       
   560     // (not over margin or other empty listbox area)
       
   561     if ( pointerIsOverAnItem || aPointerEvent.iType != TPointerEvent::EButton1Down )
       
   562         {
       
   563         iLongTapDetector->PointerEventL(aPointerEvent);
       
   564         }
       
   565     
       
   566     if ( iPointerLongPressHandled )
       
   567         {
       
   568         // No further handling is made after long tap on list item
       
   569         // has been detected.
       
   570         return;
       
   571         }
       
   572 
       
   573     CEikFormattedCellListBox::HandlePointerEventL( aPointerEvent );
       
   574     }
       
   575 
       
   576 
       
   577 // -----------------------------------------------------------------------------
       
   578 // HandleScrollEventL
       
   579 // If the EasyDialingListBox is scrolled by dragging the Scroll bar, this
       
   580 // observer function is called
       
   581 // -----------------------------------------------------------------------------
       
   582 //
       
   583 void CEasyDialingListBox::HandleScrollEventL( CEikScrollBar* aScrollBar, TEikScrollEvent aEventType )
       
   584     {
       
   585     // Report scrolling to the listbox observer
       
   586     TInt scrollEvent( KErrNotFound );
       
   587     switch ( aEventType )
       
   588         {
       
   589         case EEikScrollThumbDragVert:
       
   590             scrollEvent = KEasyDialingScrollingStarted;
       
   591             break;
       
   592 
       
   593         case EEikScrollThumbReleaseVert:
       
   594         case EEikScrollUp:
       
   595         case EEikScrollDown:
       
   596         case EEikScrollPageUp:
       
   597         case EEikScrollPageDown:
       
   598             scrollEvent = KEasyDialingScrollingStopped;
       
   599             break;
       
   600             
       
   601         default:
       
   602             break;
       
   603         }
       
   604     
       
   605     if ( scrollEvent != KErrNotFound )
       
   606         {
       
   607         ReportListBoxEventL( static_cast<MEikListBoxObserver::TListBoxEvent>( scrollEvent ) );
       
   608         }
       
   609     
       
   610     // Base class(es) might be also interested about the scrollbar events
       
   611     CEikFormattedCellListBox::HandleScrollEventL( aScrollBar, aEventType );
       
   612     }
       
   613 
       
   614 // end of file
       
   615