javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtlistview.cpp
branchRCL_3
changeset 19 71c436fe3ce0
parent 17 0fd27995241b
child 24 6c158198356e
equal deleted inserted replaced
18:9ac0a0a7da70 19:71c436fe3ce0
   141         iNumOfRows(1),
   141         iNumOfRows(1),
   142         iNumOfColumns(1),
   142         iNumOfColumns(1),
   143         iWidthOfSpaceBetweenItems(0),
   143         iWidthOfSpaceBetweenItems(0),
   144         iHeightOfSpaceBetweenItems(0),
   144         iHeightOfSpaceBetweenItems(0),
   145         iDensity(EMediumListViewDensity),   // must match Java-side default
   145         iDensity(EMediumListViewDensity),   // must match Java-side default
   146         iIsGridCellLayoutNeeded(EFalse)
   146         iIsGridCellLayoutNeeded(EFalse),
       
   147         iFlickScrollingOngoing(EFalse)
       
   148 
   147 {
   149 {
   148     // Default to horizontal layout orientation (vertical scrollbar)
   150     // Default to horizontal layout orientation (vertical scrollbar)
   149     //if( iStyle & KSwtStyleVertical )
   151     //if( iStyle & KSwtStyleVertical )
   150     //    {
   152     //    {
   151     //    iVerticalOrientation = ETrue;
   153     //    iVerticalOrientation = ETrue;
  1618 // From class CCoeControl.
  1620 // From class CCoeControl.
  1619 // ---------------------------------------------------------------------------
  1621 // ---------------------------------------------------------------------------
  1620 //
  1622 //
  1621 void CSwtListView::FocusChanged(TDrawNow aDrawNow)
  1623 void CSwtListView::FocusChanged(TDrawNow aDrawNow)
  1622 {
  1624 {
  1623     TBool focused = IsFocused();
  1625     TBool isFocused = IsFocused();
  1624     iGrid->SetFocus(focused);
  1626 #ifdef RD_JAVA_S60_RELEASE_9_2
       
  1627     EnableFocusHighlight(isFocused);
       
  1628 #endif //RD_JAVA_S60_RELEASE_9_2
       
  1629     iGrid->SetFocus(isFocused);
  1625     HandleFocusChanged(aDrawNow);
  1630     HandleFocusChanged(aDrawNow);
  1626 }
  1631 }
  1627 
  1632 
  1628 // ---------------------------------------------------------------------------
  1633 // ---------------------------------------------------------------------------
  1629 // From class CCoeControl.
  1634 // From class CCoeControl.
  2651 // From class MSwtControl.
  2656 // From class MSwtControl.
  2652 // ---------------------------------------------------------------------------
  2657 // ---------------------------------------------------------------------------
  2653 //
  2658 //
  2654 void CSwtListView::ProcessKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
  2659 void CSwtListView::ProcessKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
  2655 {
  2660 {
       
  2661 #ifdef RD_JAVA_S60_RELEASE_9_2
       
  2662     if (aType == EEventKeyDown)
       
  2663     {
       
  2664         // After panning focus highlight was disabled, so enabling again
       
  2665         EnableFocusHighlight(ETrue);
       
  2666     }
       
  2667 #endif //RD_JAVA_S60_RELEASE_9_2
       
  2668 
  2656     if (GetItemCount() == 0)
  2669     if (GetItemCount() == 0)
  2657     {
  2670     {
  2658         iGrid->OfferKeyEventL(aKeyEvent, aType);
  2671         iGrid->OfferKeyEventL(aKeyEvent, aType);
  2659         return;
  2672         return;
  2660     }
  2673     }
  3037 {
  3050 {
  3038     if (aListBox != iGrid)
  3051     if (aListBox != iGrid)
  3039     {
  3052     {
  3040         return;
  3053         return;
  3041     }
  3054     }
       
  3055 
       
  3056     UpdateFlickScrollingState(aEventType);
  3042 
  3057 
  3043     switch (aEventType)
  3058     switch (aEventType)
  3044     {
  3059     {
  3045         // On 5.0, drawing trough Java gives simply a better fps.
  3060         // On 5.0, drawing trough Java gives simply a better fps.
  3046 #ifdef RD_JAVA_S60_RELEASE_9_2
  3061 #ifdef RD_JAVA_S60_RELEASE_9_2
  3490     }
  3505     }
  3491 
  3506 
  3492     // Deliver event to scrollbar
  3507     // Deliver event to scrollbar
  3493     if (iVScrollBarGrabsPointerEvents && vsb)
  3508     if (iVScrollBarGrabsPointerEvents && vsb)
  3494     {
  3509     {
  3495         vsb->HandlePointerEventL(aPointerEvent);
  3510         if (!iFlickScrollingOngoing
       
  3511                 && aPointerEvent.iType == TPointerEvent::EButton1Down)
       
  3512         {
       
  3513             // Scrollbar was tapped after scrolling stopped
       
  3514             // by itself, so no need to redirect events
       
  3515             iScrollbarPointerEventToListbox = EFalse;
       
  3516         }
       
  3517 
       
  3518         if (iScrollbarPointerEventToListbox)
       
  3519         {
       
  3520             // Stops kinetic scrolling when scrollbar is tapped
       
  3521             iGrid->ForwardPointerEventL(aPointerEvent);
       
  3522             // Continue delivering events until button up appears to prevent
       
  3523             // some unexpected behavior in both scrollbar and listbox
       
  3524             switch (aPointerEvent.iType)
       
  3525             {
       
  3526             case TPointerEvent::EButton1Up:
       
  3527                 iScrollbarPointerEventToListbox = EFalse;
       
  3528                 break;
       
  3529             }
       
  3530         }
       
  3531         else
       
  3532         {
       
  3533             // Handles scrollbar behavior
       
  3534             vsb->HandlePointerEventL(aPointerEvent);
       
  3535         }
  3496     }
  3536     }
  3497 
  3537 
  3498     // Deliver event to list
  3538     // Deliver event to list
  3499     if (!iVScrollBarGrabsPointerEvents)
  3539     if (!iVScrollBarGrabsPointerEvents)
  3500     {
  3540     {
  3572     if (iVScrollBarGrabsPointerEvents
  3612     if (iVScrollBarGrabsPointerEvents
  3573             && aPointerEvent.iType == TPointerEvent::EButton1Up)
  3613             && aPointerEvent.iType == TPointerEvent::EButton1Up)
  3574     {
  3614     {
  3575         iVScrollBarGrabsPointerEvents = EFalse;
  3615         iVScrollBarGrabsPointerEvents = EFalse;
  3576     }
  3616     }
       
  3617 
       
  3618     PostMouseEventL(aPointerEvent);
  3577 }
  3619 }
  3578 
  3620 
  3579 // ---------------------------------------------------------------------------
  3621 // ---------------------------------------------------------------------------
  3580 // CSwtListView::GetStylusPopupControlMenu()
  3622 // CSwtListView::GetStylusPopupControlMenu()
  3581 // From MSwtControl
  3623 // From MSwtControl
  3584 const MSwtMenu* CSwtListView::GetStylusPopupControlMenu() const
  3626 const MSwtMenu* CSwtListView::GetStylusPopupControlMenu() const
  3585 {
  3627 {
  3586     return iStylusPopupMenu;
  3628     return iStylusPopupMenu;
  3587 }
  3629 }
  3588 #endif // RD_SCALABLE_UI_V2
  3630 #endif // RD_SCALABLE_UI_V2
       
  3631 
       
  3632 
       
  3633 #ifdef RD_JAVA_S60_RELEASE_9_2
       
  3634 // ---------------------------------------------------------------------------
       
  3635 // CSwtListView::EnableFocusHighlight
       
  3636 // From MSwtControl
       
  3637 // ---------------------------------------------------------------------------
       
  3638 //
       
  3639 void CSwtListView::EnableFocusHighlight(TBool aEnable)
       
  3640 {
       
  3641     ASSERT(iGrid);
       
  3642     ASSERT(iGrid->View());
       
  3643 
       
  3644     CListItemDrawer* itemDrawer = iGrid->View()->ItemDrawer();
       
  3645     if (itemDrawer)
       
  3646     {
       
  3647         TInt disabledHighlight =
       
  3648             itemDrawer->Flags() & CListItemDrawer::EDisableHighlight;
       
  3649 
       
  3650         if (aEnable && disabledHighlight)
       
  3651         {
       
  3652             itemDrawer->ClearFlags(CListItemDrawer::EDisableHighlight);
       
  3653         }
       
  3654         else if (!aEnable && !disabledHighlight)
       
  3655         {
       
  3656             itemDrawer->SetFlags(CListItemDrawer::EDisableHighlight);
       
  3657         }
       
  3658     }
       
  3659 }
       
  3660 #endif //RD_JAVA_S60_RELEASE_9_2
  3589 
  3661 
  3590 #ifdef RD_JAVA_ADVANCED_TACTILE_FEEDBACK
  3662 #ifdef RD_JAVA_ADVANCED_TACTILE_FEEDBACK
  3591 void CSwtListView::DoControlSpecificFeedback(
  3663 void CSwtListView::DoControlSpecificFeedback(
  3592     const TBool& aFirstTap,
  3664     const TBool& aFirstTap,
  3593     const TBool& aTappedToChildRect,
  3665     const TBool& aTappedToChildRect,
  3607         }
  3679         }
  3608     }
  3680     }
  3609 }
  3681 }
  3610 #endif //RD_JAVA_ADVANCED_TACTILE_FEEDBACK
  3682 #endif //RD_JAVA_ADVANCED_TACTILE_FEEDBACK
  3611 
  3683 
       
  3684 // ---------------------------------------------------------------------------
       
  3685 // CSwtTableListBox::UpdateFlickScrollingState
       
  3686 // Updates flick scrolling status based on received listbox event.
       
  3687 // ---------------------------------------------------------------------------
       
  3688 //
       
  3689 void CSwtListView::UpdateFlickScrollingState(TListBoxEvent aEventType)
       
  3690 {
       
  3691     switch (aEventType)
       
  3692     {
       
  3693     case EEventFlickStarted:
       
  3694         iFlickScrollingOngoing = ETrue;
       
  3695         iScrollbarPointerEventToListbox = ETrue;
       
  3696         break;
       
  3697     case EEventFlickStopped:
       
  3698         iFlickScrollingOngoing = EFalse;
       
  3699         break;
       
  3700     }
       
  3701 }