uifw/EikStd/coctlsrc/EIKLBX.CPP
branchRCL_3
changeset 59 978afdc0236f
parent 56 d48ab3b357f1
child 72 a5e7a4f63858
equal deleted inserted replaced
56:d48ab3b357f1 59:978afdc0236f
    73 #include <akncollection.h>
    73 #include <akncollection.h>
    74 #include <aknitemactionmenu.h>
    74 #include <aknitemactionmenu.h>
    75 #include <aknlongtapdetector.h>
    75 #include <aknlongtapdetector.h>
    76 #include <AknPriv.hrh>
    76 #include <AknPriv.hrh>
    77 #include <aknmarkingmodeobserver.h>
    77 #include <aknmarkingmodeobserver.h>
       
    78 #include <aknmarkingmode.h>
    78 #include "akntrace.h"
    79 #include "akntrace.h"
    79 
    80 
    80 // timeout for long keypress used in markable lists
    81 // timeout for long keypress used in markable lists
    81 const TInt KLongPressInterval = 600000; // 0,6 seconds
    82 const TInt KLongPressInterval = 600000; // 0,6 seconds
    82 const TInt KEikListBoxPointerRepeatInterval = 100000;  // in micro conds (= 0.1 secod)
    83 const TInt KEikListBoxPointerRepeatInterval = 100000;  // in micro conds (= 0.1 secod)
  1058 // -----------------------------------------------------------------------------
  1059 // -----------------------------------------------------------------------------
  1059 //
  1060 //
  1060 void CListBoxExt::SetMultipleMarkingState( TBool aActive )
  1061 void CListBoxExt::SetMultipleMarkingState( TBool aActive )
  1061     {
  1062     {
  1062     _AKNTRACE_FUNC_ENTER;
  1063     _AKNTRACE_FUNC_ENTER;
  1063     iListBox.SetMarkingMode( aActive );
  1064     if ( iMarkingModeInUse != aActive ) 
       
  1065         {
       
  1066         if ( aActive )
       
  1067             {
       
  1068             iListBox.iView->ItemDrawer()->SetFlags( 
       
  1069                     CListItemDrawer::EMarkingModeEnabled );
       
  1070             }
       
  1071         else
       
  1072             {
       
  1073             iListBox.iView->ItemDrawer()->ClearFlags( 
       
  1074                     CListItemDrawer::EMarkingModeEnabled );        
       
  1075 
       
  1076             if ( iListBox.iView->SelectionIndexes()->Count() > 0 )
       
  1077                 {
       
  1078                 iListBox.iView->ClearSelection( EFalse );
       
  1079                 }
       
  1080             } 
       
  1081 
       
  1082         iMarkingModeInUse = aActive;
       
  1083         iListBox.DrawDeferred();
       
  1084         } 
       
  1085 
       
  1086     if ( iListBox.MarkingModeObserver() )
       
  1087         {
       
  1088         iListBox.MarkingModeObserver()->MarkingModeStatusChanged( aActive );
       
  1089         }
       
  1090     
  1064     _AKNTRACE_FUNC_EXIT;
  1091     _AKNTRACE_FUNC_EXIT;
  1065     }
  1092     }
  1066 
  1093 
  1067 // -----------------------------------------------------------------------------
  1094 // -----------------------------------------------------------------------------
  1068 // CListBoxExt::ExitMarkingMode
  1095 // CListBoxExt::ExitMarkingMode
  1183                                        const TPoint& aPenEventScreenLocation )
  1210                                        const TPoint& aPenEventScreenLocation )
  1184     {
  1211     {
  1185     _AKNTRACE_FUNC_ENTER;
  1212     _AKNTRACE_FUNC_ENTER;
  1186     iLongTappedItem = iLastDownTappedItem;
  1213     iLongTappedItem = iLastDownTappedItem;
  1187     iLastDownTappedItem = KErrNotFound;
  1214     iLastDownTappedItem = KErrNotFound;
       
  1215     iListBox.ReportListBoxEventL( MEikListBoxObserver::EEventItemLongTapped );
  1188     iItemActionMenu->ShowMenuL( aPenEventScreenLocation, 0 );
  1216     iItemActionMenu->ShowMenuL( aPenEventScreenLocation, 0 );
  1189     iOldWinPos = iListBox.DrawableWindow()->OrdinalPosition();
  1217     iOldWinPos = iListBox.DrawableWindow()->OrdinalPosition();
  1190     _AKNTRACE_FUNC_EXIT;
  1218     _AKNTRACE_FUNC_EXIT;
  1191     }
  1219     }
  1192 
  1220 
  6720 // CEikListBox::SetMarkingMode
  6748 // CEikListBox::SetMarkingMode
  6721 // ---------------------------------------------------------------------------
  6749 // ---------------------------------------------------------------------------
  6722 //
  6750 //
  6723 EXPORT_C void CEikListBox::SetMarkingMode( TBool aEnable )
  6751 EXPORT_C void CEikListBox::SetMarkingMode( TBool aEnable )
  6724     {
  6752     {
  6725     if ( iListBoxExt && iListBoxExt->iSingleClickEnabled && 
  6753     _AKNTRACE_FUNC_ENTER;
  6726             ( iListBoxFlags & CEikListBox::ES60StyleMarkable ) )
  6754     if ( iListBoxExt 
  6727         {
  6755              && iListBoxExt->iSingleClickEnabled 
  6728         if ( iListBoxExt->iMarkingModeInUse != aEnable ) 
  6756              && ( iListBoxFlags & CEikListBox::ES60StyleMarkable ) 
  6729             {
  6757              && iListBoxExt->iItemActionMenu
  6730             if ( aEnable )
  6758              && iListBoxExt->iMarkingModeInUse != aEnable )
  6731                 {
  6759         {
  6732                 iView->ItemDrawer()->SetFlags( 
  6760         CAknMarkingMode& markingMode = iListBoxExt->iItemActionMenu->MarkingMode();
  6733                         CListItemDrawer::EMarkingModeEnabled );
  6761         // Multiple marking state will be set, navi pane will be updated
  6734                 }
  6762         // and softkeys will be updated when entering and exiting marking mode.       
  6735             else
  6763         markingMode.SetCollectionMultipleMarkingState( aEnable );
  6736                 {
  6764         }
  6737                 iView->ItemDrawer()->ClearFlags( 
  6765     _AKNTRACE_FUNC_EXIT;
  6738                         CListItemDrawer::EMarkingModeEnabled );
       
  6739             
       
  6740                 if ( iView->SelectionIndexes()->Count() > 0 )
       
  6741                     {
       
  6742                     iView->ClearSelection( EFalse );
       
  6743                     }
       
  6744                 }
       
  6745 
       
  6746             iListBoxExt->iMarkingModeInUse = aEnable;
       
  6747             DrawDeferred();
       
  6748             }
       
  6749 
       
  6750         if ( MarkingModeObserver() )
       
  6751             {
       
  6752             MarkingModeObserver()->MarkingModeStatusChanged( aEnable );
       
  6753             }
       
  6754         }
       
  6755     }
  6766     }
  6756 
  6767 
  6757 
  6768 
  6758 // ---------------------------------------------------------------------------
  6769 // ---------------------------------------------------------------------------
  6759 // CEikListBox::SetMarkingModeObserver
  6770 // CEikListBox::SetMarkingModeObserver
  6760 // ---------------------------------------------------------------------------
  6771 // ---------------------------------------------------------------------------
  6761 //
  6772 //
  6762 EXPORT_C void CEikListBox::SetMarkingModeObserver( 
  6773 EXPORT_C void CEikListBox::SetMarkingModeObserver( 
  6763         MAknMarkingModeObserver* aObserver )
  6774         MAknMarkingModeObserver* aObserver )
  6764     {
  6775     {
       
  6776     _AKNTRACE_FUNC_ENTER;
  6765     if ( iListBoxExt )
  6777     if ( iListBoxExt )
  6766         {
  6778         {
  6767         iListBoxExt->iMarkingModeObserver = aObserver;
  6779         iListBoxExt->iMarkingModeObserver = aObserver;
  6768         }
  6780         }
       
  6781     _AKNTRACE_FUNC_EXIT;
  6769     }
  6782     }
  6770 
  6783 
  6771 
  6784 
  6772 void CEikListBox::ScrollView( const TInt aOffset, TBool aDrawNow )
  6785 void CEikListBox::ScrollView( const TInt aOffset, TBool aDrawNow )
  6773 	{
  6786 	{
  6896             }
  6909             }
  6897         }
  6910         }
  6898 
  6911 
  6899     TBool blockEvent = EFalse;
  6912     TBool blockEvent = EFalse;
  6900     
  6913     
  6901     // If tap down in listbox area, kinetic scrolling is enabled and style popup menu is not shown,
  6914     // If touch down in listbox area, kinetic scrolling is enabled, and single
  6902     // drag event is sent to listbox.
  6915     // click is disabled or style popup menu is not shown when single click is
       
  6916     // enabled, events of kinetic scrolling are sent to listbox.
  6903     TBool allowDragEvent( ( iListBoxFlags & ELeftDownInViewRect ) 
  6917     TBool allowDragEvent( ( iListBoxFlags & ELeftDownInViewRect ) 
  6904             && !iListBoxExt->iScrollingDisabled 
  6918         && !iListBoxExt->iScrollingDisabled 
  6905             && ( iListBoxExt->iSingleClickEnabled 
  6919         && ( !iListBoxExt->iSingleClickEnabled
  6906                     && iListBoxExt->iLongTappedItem == KErrNotFound ) );
  6920             || iListBoxExt->iLongTappedItem == KErrNotFound ) );
  6907     
  6921     
  6908     switch ( aPointerEvent.iType )
  6922     switch ( aPointerEvent.iType )
  6909         {
  6923         {
  6910         case TPointerEvent::EButton1Down:
  6924         case TPointerEvent::EButton1Down:
  6911             {
  6925             {