63 // --------------------------------------------------------------------------- |
63 // --------------------------------------------------------------------------- |
64 // CMRListPane::CMRListPane |
64 // CMRListPane::CMRListPane |
65 // --------------------------------------------------------------------------- |
65 // --------------------------------------------------------------------------- |
66 // |
66 // |
67 CMRListPane::CMRListPane( MESMRFieldStorage& aFactory, |
67 CMRListPane::CMRListPane( MESMRFieldStorage& aFactory, |
68 TAknDoubleSpanScrollBarModel& aScrollModel, |
68 TAknDoubleSpanScrollBarModel& aScrollModel, |
69 CAknDoubleSpanScrollBar& aScroll, |
69 CAknDoubleSpanScrollBar& aScroll, |
70 MMRScrollBarObserver& aScrollBarObserver ) |
70 MMRScrollBarObserver& aScrollBarObserver ) |
71 : iFactory( aFactory ), |
71 : iFactory( aFactory ), |
72 iScrollModel( aScrollModel ), |
72 iScrollModel( aScrollModel ), |
73 iScroll( aScroll ), |
73 iScroll( aScroll ), |
92 // CMRListPane::NewL |
92 // CMRListPane::NewL |
93 // --------------------------------------------------------------------------- |
93 // --------------------------------------------------------------------------- |
94 // |
94 // |
95 CMRListPane* CMRListPane::NewL( const CCoeControl& aParent, |
95 CMRListPane* CMRListPane::NewL( const CCoeControl& aParent, |
96 MESMRFieldStorage& aFactory, |
96 MESMRFieldStorage& aFactory, |
97 TAknDoubleSpanScrollBarModel& aScrollModel, |
97 TAknDoubleSpanScrollBarModel& aScrollModel, |
98 CAknDoubleSpanScrollBar& aScroll, |
98 CAknDoubleSpanScrollBar& aScroll, |
99 MMRScrollBarObserver& aScrollBarObserver ) |
99 MMRScrollBarObserver& aScrollBarObserver ) |
100 { |
100 { |
101 FUNC_LOG; |
101 FUNC_LOG; |
102 CMRListPane* self = new( ELeave )CMRListPane( |
102 CMRListPane* self = new( ELeave )CMRListPane( |
103 aFactory, |
103 aFactory, |
104 aScrollModel, |
104 aScrollModel, |
105 aScroll, |
105 aScroll, |
106 aScrollBarObserver ); |
106 aScrollBarObserver ); |
107 CleanupStack::PushL( self ); |
107 CleanupStack::PushL( self ); |
108 self->ConstructL( aParent ); |
108 self->ConstructL( aParent ); |
109 CleanupStack::Pop( self ); |
109 CleanupStack::Pop( self ); |
121 SetContainerWindowL( aParent ); |
121 SetContainerWindowL( aParent ); |
122 |
122 |
123 iLongtapDetector = CAknLongTapDetector::NewL( this ); |
123 iLongtapDetector = CAknLongTapDetector::NewL( this ); |
124 iLongtapDetector->SetLongTapDelay( KLongTapDelay ); |
124 iLongtapDetector->SetLongTapDelay( KLongTapDelay ); |
125 iLongtapDetector->SetTimeDelayBeforeAnimation( KLongTapAnimationDelay ); |
125 iLongtapDetector->SetTimeDelayBeforeAnimation( KLongTapAnimationDelay ); |
126 |
126 |
127 iFieldContainer = CMRFieldContainer::NewL( iFactory, *this ); |
127 iFieldContainer = CMRFieldContainer::NewL( iFactory, *this ); |
128 iFieldContainer->SetFieldContainerObserver( this ); |
128 iFieldContainer->SetFieldContainerObserver( this ); |
129 |
129 |
130 // Physics: Create physics |
130 // Physics: Create physics |
131 // Give pointer to control that should be able to flick/drag |
131 // Give pointer to control that should be able to flick/drag |
212 // --------------------------------------------------------------------------- |
212 // --------------------------------------------------------------------------- |
213 // |
213 // |
214 void CMRListPane::InitialScrollL() |
214 void CMRListPane::InitialScrollL() |
215 { |
215 { |
216 FUNC_LOG; |
216 FUNC_LOG; |
217 // TODO: Fix or remove! L-Function called in non-leaving function! |
217 |
218 // Suggestion: Move functionality to viewerdialog and use existing |
|
219 // functions in listpane to do the required actions. |
|
220 |
|
221 // Check if the ResponseArea exist |
218 // Check if the ResponseArea exist |
222 TESMREntryFieldId id = GetResponseFieldsFieldId(); |
219 TESMREntryFieldId id = GetResponseFieldsFieldId(); |
223 |
220 |
224 if( id == EESMRFieldResponseArea ) |
221 if( id == EESMRFieldResponseArea ) |
225 { |
222 { |
294 FUNC_LOG; |
291 FUNC_LOG; |
295 if ( iDisableSizeChanged || Rect() == TRect( 0, 0, 0, 0 ) ) |
292 if ( iDisableSizeChanged || Rect() == TRect( 0, 0, 0, 0 ) ) |
296 { |
293 { |
297 return; |
294 return; |
298 } |
295 } |
299 |
296 |
300 TSize containerSize( iFieldContainer->MinimumSize() ); |
297 TSize containerSize( iFieldContainer->MinimumSize() ); |
301 iFieldContainer->SetSize( containerSize ); |
298 iFieldContainer->SetSize( containerSize ); |
302 |
299 |
303 // Physics: |
300 // Physics: |
304 iPhysics->InitPhysics(); |
301 iPhysics->InitPhysics(); |
305 |
302 |
306 DoUpdateScrollBar(); |
303 DoUpdateScrollBar(); |
307 } |
304 } |
308 |
305 |
309 // --------------------------------------------------------------------------- |
306 // --------------------------------------------------------------------------- |
310 // CMRListPane::OfferKeyEventL |
307 // CMRListPane::OfferKeyEventL |
316 FUNC_LOG; |
313 FUNC_LOG; |
317 TKeyResponse response( EKeyWasNotConsumed ); |
314 TKeyResponse response( EKeyWasNotConsumed ); |
318 |
315 |
319 // First check if the focused item needs the key event |
316 // First check if the focused item needs the key event |
320 response = FocusedField()->OfferKeyEventL( aKeyEvent, aType ); |
317 response = FocusedField()->OfferKeyEventL( aKeyEvent, aType ); |
321 |
318 |
322 if ( aType == EEventKey |
319 if ( aType == EEventKey |
323 && response == EKeyWasNotConsumed ) |
320 && response == EKeyWasNotConsumed ) |
324 { |
321 { |
325 // Check if the focus should be changed |
322 // Check if the focus should be changed |
326 switch ( aKeyEvent.iScanCode ) |
323 switch ( aKeyEvent.iScanCode ) |
327 { |
324 { |
328 case EStdKeyUpArrow: |
325 case EStdKeyUpArrow: |
329 { |
326 { |
330 response = iFieldContainer->MoveFocusUpL( HiddenFocus() ); |
327 response = iFieldContainer->MoveFocusUpL( HiddenFocus() ); |
331 |
328 |
332 // Focus changed via keyboard, iClickedItem is no |
329 // Focus changed via keyboard, iClickedItem is no |
333 // longer valid |
330 // longer valid |
334 iClickedField = NULL; |
331 iClickedField = NULL; |
335 break; |
332 break; |
336 } |
333 } |
337 case EStdKeyDownArrow: |
334 case EStdKeyDownArrow: |
338 { |
335 { |
339 response = iFieldContainer->MoveFocusDownL( HiddenFocus() ); |
336 response = iFieldContainer->MoveFocusDownL( HiddenFocus() ); |
340 |
337 |
341 // Focus changed via keyboard, iClickedItem is no |
338 // Focus changed via keyboard, iClickedItem is no |
342 // longer valid |
339 // longer valid |
343 iClickedField = NULL; |
340 iClickedField = NULL; |
344 break; |
341 break; |
345 } |
342 } |
360 void CMRListPane::HandleLongTapEventL( |
357 void CMRListPane::HandleLongTapEventL( |
361 const TPoint& aPenEventLocation, |
358 const TPoint& aPenEventLocation, |
362 const TPoint& /* aPenEventScreenLocation */ ) |
359 const TPoint& /* aPenEventScreenLocation */ ) |
363 { |
360 { |
364 FUNC_LOG; |
361 FUNC_LOG; |
365 iLongTapEventConsumed = EFalse; |
362 iLongTapEventInProgess = EFalse; |
366 // Long tap functionality may vary between fields |
363 // Long tap functionality may vary between fields |
367 // ==> Command field to execute action related to long tap |
364 // ==> Command field to execute action related to long tap |
368 TInt count( iFactory.Count() ); |
365 TInt count( iFactory.Count() ); |
369 |
366 |
370 for ( TInt i = 0; i < count; ++i ) |
367 for ( TInt i = 0; i < count; ++i ) |
386 // --------------------------------------------------------------------------- |
383 // --------------------------------------------------------------------------- |
387 // |
384 // |
388 void CMRListPane::DoUpdateScrollBar( TInt aFocusPosition ) |
385 void CMRListPane::DoUpdateScrollBar( TInt aFocusPosition ) |
389 { |
386 { |
390 FUNC_LOG; |
387 FUNC_LOG; |
391 // Set this lispane's size as scroll bar's window size |
388 // Set this lispane's size as scroll bar's window size |
392 iScrollModel.SetWindowSize( iSize.iHeight ); |
389 iScrollModel.SetWindowSize( iSize.iHeight ); |
393 // Set fieldcontainer's height as scrolbar's scroll span |
390 // Set fieldcontainer's height as scrolbar's scroll span |
394 iScrollModel.SetScrollSpan( iFieldContainer->MinimumSize().iHeight ); |
391 iScrollModel.SetScrollSpan( iFieldContainer->MinimumSize().iHeight ); |
395 |
392 |
396 // Update scrollbar focus position. |
393 // Update scrollbar focus position. |
397 if( aFocusPosition == KErrNotFound ) |
394 if( aFocusPosition == KErrNotFound ) |
398 { |
395 { |
399 iScrollModel.SetFocusPosition( iPhysics->VerticalScrollIndex() ); |
396 iScrollModel.SetFocusPosition( iPhysics->VerticalScrollIndex() ); |
400 } |
397 } |
405 |
402 |
406 iScroll.SetModel( &iScrollModel ); |
403 iScroll.SetModel( &iScrollModel ); |
407 |
404 |
408 // finally update the new thumb position to view's |
405 // finally update the new thumb position to view's |
409 // iScrollBarThumbPosition member. |
406 // iScrollBarThumbPosition member. |
410 iScrollBarObserver.ScrollBarPositionChanged( |
407 iScrollBarObserver.ScrollBarPositionChanged( |
411 iScroll.ThumbPosition() ); |
408 iScroll.ThumbPosition() ); |
412 } |
409 } |
413 |
410 |
414 // --------------------------------------------------------------------------- |
411 // --------------------------------------------------------------------------- |
415 // CMRListPane::UpdatedFocusPosition |
412 // CMRListPane::UpdatedFocusPosition |
458 void CMRListPane::ScrollFieldsUp( TInt aPx ) |
455 void CMRListPane::ScrollFieldsUp( TInt aPx ) |
459 { |
456 { |
460 FUNC_LOG; |
457 FUNC_LOG; |
461 TPoint point = iFieldContainer->Position(); |
458 TPoint point = iFieldContainer->Position(); |
462 point.iY -= aPx; |
459 point.iY -= aPx; |
463 |
460 |
464 // This initializes Draw also |
461 // This initializes Draw also |
465 iFieldContainer->SetPosition( point ); |
462 iFieldContainer->SetPosition( point ); |
466 |
463 |
467 // Non-kinetic scrolling executed. Update |
464 // Non-kinetic scrolling executed. Update |
468 // new position to physics. |
465 // new position to physics. |
469 iPhysics->UpdateVerticalScrollIndex( UpdatedFocusPosition() ); |
466 iPhysics->UpdateVerticalScrollIndex( UpdatedFocusPosition() ); |
470 |
467 |
471 DoUpdateScrollBar( UpdatedFocusPosition() ); |
468 DoUpdateScrollBar( UpdatedFocusPosition() ); |
478 void CMRListPane::ScrollFieldsDown( TInt aPx ) |
475 void CMRListPane::ScrollFieldsDown( TInt aPx ) |
479 { |
476 { |
480 FUNC_LOG; |
477 FUNC_LOG; |
481 TPoint point = iFieldContainer->Position(); |
478 TPoint point = iFieldContainer->Position(); |
482 point.iY += aPx; |
479 point.iY += aPx; |
483 |
480 |
484 // This initializes Draw also |
481 // This initializes Draw also |
485 iFieldContainer->SetPosition( point ); |
482 iFieldContainer->SetPosition( point ); |
486 // Non-kinetic scrolling executed. Update |
483 // Non-kinetic scrolling executed. Update |
487 // new position to physics. |
484 // new position to physics. |
488 iPhysics->UpdateVerticalScrollIndex( UpdatedFocusPosition() ); |
485 iPhysics->UpdateVerticalScrollIndex( UpdatedFocusPosition() ); |
526 // CMRListPane::GetResponseFieldsFieldId |
523 // CMRListPane::GetResponseFieldsFieldId |
527 // --------------------------------------------------------------------------- |
524 // --------------------------------------------------------------------------- |
528 // |
525 // |
529 TESMREntryFieldId CMRListPane::GetResponseFieldsFieldId() |
526 TESMREntryFieldId CMRListPane::GetResponseFieldsFieldId() |
530 { |
527 { |
531 // TODO: Should be removed. This shouldn't be even a public function! |
|
532 CESMRField* rfield = iFactory.FieldById( EESMRFieldResponseArea ); |
528 CESMRField* rfield = iFactory.FieldById( EESMRFieldResponseArea ); |
533 |
529 |
534 if ( rfield && rfield->IsVisible() && !rfield->IsNonFocusing() ) |
530 if ( rfield && rfield->IsVisible() && !rfield->IsNonFocusing() ) |
535 { |
531 { |
536 return EESMRFieldResponseArea; |
532 return EESMRFieldResponseArea; |
537 } |
533 } |
538 else |
534 else |
558 { |
554 { |
559 field->SetContainerWindowL( *iFieldContainer ); |
555 field->SetContainerWindowL( *iFieldContainer ); |
560 field->SetListObserver( iFieldContainer ); |
556 field->SetListObserver( iFieldContainer ); |
561 } |
557 } |
562 } |
558 } |
563 |
559 |
564 // This "for" circle can not be mixed with the above one, since the |
560 // This "for" circle can not be mixed with the above one, since the |
565 // field->ActivateL() will call some functions which will traverse |
561 // field->ActivateL() will call some functions which will traverse |
566 // all the fields, but that time, not all the fields have set the |
562 // all the fields, but that time, not all the fields have set the |
567 // container window. |
563 // container window. |
568 for ( TInt i = 0; i < count; ++i ) |
564 for ( TInt i = 0; i < count; ++i ) |
569 { |
565 { |
570 CESMRField* field = iFactory.Field( i ); |
566 CESMRField* field = iFactory.Field( i ); |
571 if ( !field->IsFieldActivated() ) |
567 if ( !field->IsFieldActivated() ) |
584 // Check if touch is enabled or not |
580 // Check if touch is enabled or not |
585 if( !AknLayoutUtils::PenEnabled() ) |
581 if( !AknLayoutUtils::PenEnabled() ) |
586 { |
582 { |
587 return; |
583 return; |
588 } |
584 } |
589 |
585 |
|
586 // If new down event is received, and |
|
587 // iLongTapEventInProgess flag is still ETrue, we need to |
|
588 // set it back to EFalse -> Long tap event cannot be in progress |
|
589 // in this case anymore. |
|
590 if( aPointerEvent.iType == TPointerEvent::EButton1Down && |
|
591 iLongTapEventInProgess ) |
|
592 { |
|
593 iLongTapEventInProgess = EFalse; |
|
594 } |
|
595 |
590 // Forward all listpane related events to physics api first. |
596 // Forward all listpane related events to physics api first. |
591 if ( iPhysics->HandlePointerEventL( aPointerEvent, iPhysicsActionOngoing ) ) |
597 if ( iPhysics->HandlePointerEventL( aPointerEvent, iPhysicsActionOngoing ) ) |
592 { |
598 { |
593 DoUpdateScrollBar(); |
599 DoUpdateScrollBar(); |
594 // Physics in action. If long tap detection is active, |
600 // Physics in action. If long tap detection is active, |
595 // it should be cancelled. |
601 // it should be cancelled. |
596 if( iLongtapDetector->IsActive() ) |
602 if( iLongtapDetector->IsActive() ) |
597 { |
603 { |
598 iLongtapDetector->Cancel(); |
604 iLongtapDetector->Cancel(); |
599 } |
605 } |
600 } |
606 } |
601 |
607 |
602 if( !iPhysicsActionOngoing ) |
608 if( !iPhysicsActionOngoing ) |
603 { |
609 { |
604 // Offer pointer event to long tap detector if event occures within fields |
610 UpdateClickedField( aPointerEvent ); |
605 if( iFieldContainer->Rect().Contains( aPointerEvent.iPosition ) ) |
611 |
|
612 // Offer pointer event to long tap detector if field supports long tap |
|
613 // functionality |
|
614 if( ClickedField()->SupportsLongTapFunctionalityL( aPointerEvent ) ) |
606 { |
615 { |
607 iLongtapDetector->PointerEventL( aPointerEvent ); |
616 iLongtapDetector->PointerEventL( aPointerEvent ); |
608 } |
617 } |
609 |
618 |
610 SetFocusAfterPointerEventL( aPointerEvent ); |
619 SetFocusAfterPointerEventL( aPointerEvent ); |
611 |
620 |
612 // If longtap event has been handled, then do not handle signal event anymore. |
621 // If longtap event is in progress, do not pass events to coecontrol |
613 if( !iLongTapEventConsumed ) |
622 if( !iLongTapEventInProgess ) |
614 { |
623 { |
615 CCoeControl::HandlePointerEventL( aPointerEvent ); |
624 CCoeControl::HandlePointerEventL( aPointerEvent ); |
616 } |
625 } |
617 else |
626 // Longtap event executed after up event -> |
618 { |
627 // Let's set iLongTapEventInProgess to EFalse |
619 iLongTapEventConsumed = EFalse; |
628 else if( aPointerEvent.iType == TPointerEvent::EButton1Up ) |
620 } |
629 { |
621 |
630 iLongTapEventInProgess = EFalse; |
622 UpdateClickedField( aPointerEvent ); |
631 } |
623 } |
632 } |
624 } |
633 } |
625 |
634 |
626 // --------------------------------------------------------------------------- |
635 // --------------------------------------------------------------------------- |
627 // CMRListPane::ActivateL |
636 // CMRListPane::ActivateL |
631 { |
640 { |
632 FUNC_LOG; |
641 FUNC_LOG; |
633 // This ActiveteL is required only for setting the initial position |
642 // This ActiveteL is required only for setting the initial position |
634 // of the field container. After setting the position, physics is |
643 // of the field container. After setting the position, physics is |
635 // initialized with new values also. |
644 // initialized with new values also. |
636 |
645 |
637 CCoeControl::ActivateL(); |
646 CCoeControl::ActivateL(); |
638 iFieldContainer->SetPosition( Position() ); |
647 iFieldContainer->SetPosition( Position() ); |
639 |
648 |
640 // Physics: |
649 // Physics: |
641 iPhysics->InitPhysics(); |
650 iPhysics->InitPhysics(); |
642 } |
651 } |
643 |
652 |
644 // --------------------------------------------------------------------------- |
653 // --------------------------------------------------------------------------- |
665 |
674 |
666 iScroll.SetModel( &iScrollModel ); |
675 iScroll.SetModel( &iScrollModel ); |
667 |
676 |
668 // Update the new thumb position to view's |
677 // Update the new thumb position to view's |
669 // iScrollBarThumbPosition member. |
678 // iScrollBarThumbPosition member. |
670 iScrollBarObserver.ScrollBarPositionChanged( |
679 iScrollBarObserver.ScrollBarPositionChanged( |
671 iScroll.ThumbPosition() ); |
680 iScroll.ThumbPosition() ); |
672 |
681 |
673 iScroll.DrawDeferred(); |
682 iScroll.DrawDeferred(); |
674 |
683 |
675 if( FeedbackScrollMarginExceeded( |
684 if( FeedbackScrollMarginExceeded( |
676 Abs( verticalScrollIndex - iPreviousVerticalScrollIndex ) ) ) |
685 Abs( verticalScrollIndex - iPreviousVerticalScrollIndex ) ) ) |
677 { |
686 { |
678 HandleTactileFeedback( ETouchFeedbackSlider ); |
687 HandleTactileFeedback( ETouchFeedbackSlider ); |
679 |
688 |
680 iPreviousVerticalScrollIndex = verticalScrollIndex; |
689 iPreviousVerticalScrollIndex = verticalScrollIndex; |
681 } |
690 } |
682 } |
691 } |
683 |
692 |
684 // --------------------------------------------------------------------------- |
693 // --------------------------------------------------------------------------- |
685 // CESMRField::HandleTactileFeedback |
694 // CESMRField::HandleTactileFeedback |
686 // --------------------------------------------------------------------------- |
695 // --------------------------------------------------------------------------- |
687 // |
696 // |
688 void CMRListPane::HandleTactileFeedback( |
697 void CMRListPane::HandleTactileFeedback( |
689 const TTouchLogicalFeedback& aType ) |
698 const TTouchLogicalFeedback& aType ) |
690 { |
699 { |
691 FUNC_LOG; |
700 FUNC_LOG; |
692 |
701 |
693 if( !iTactileFeedback ) |
702 if( !iTactileFeedback ) |
694 { |
703 { |
695 // Aquire tactile feedback pointer from TLS |
704 // Aquire tactile feedback pointer from TLS |
696 iTactileFeedback = MTouchFeedback::Instance(); |
705 iTactileFeedback = MTouchFeedback::Instance(); |
697 } |
706 } |
698 |
707 |
699 if ( iTactileFeedback && iTactileFeedback->FeedbackEnabledForThisApp() ) |
708 if ( iTactileFeedback && iTactileFeedback->FeedbackEnabledForThisApp() ) |
700 { |
709 { |
701 iTactileFeedback->InstantFeedback( aType ); |
710 iTactileFeedback->InstantFeedback( aType ); |
702 } |
711 } |
703 } |
712 } |
704 |
713 |
705 // --------------------------------------------------------------------------- |
714 // --------------------------------------------------------------------------- |
706 // CMRListPane::SetFocusAfterPointerEventL |
715 // CMRListPane::SetFocusAfterPointerEventL |
707 // --------------------------------------------------------------------------- |
716 // --------------------------------------------------------------------------- |
708 // |
717 // |
709 void CMRListPane::SetFocusAfterPointerEventL( |
718 void CMRListPane::SetFocusAfterPointerEventL( |
710 const TPointerEvent &aPointerEvent ) |
719 const TPointerEvent &aPointerEvent ) |
711 { |
720 { |
712 FUNC_LOG; |
721 FUNC_LOG; |
713 |
722 |
714 if( aPointerEvent.iType == TPointerEvent::EButton1Down ) |
723 if( aPointerEvent.iType == TPointerEvent::EButton1Down ) |
719 CESMRField* field = iFactory.Field( i ); |
728 CESMRField* field = iFactory.Field( i ); |
720 if ( field->IsVisible() && |
729 if ( field->IsVisible() && |
721 field->Rect().Contains( aPointerEvent.iPosition ) ) |
730 field->Rect().Contains( aPointerEvent.iPosition ) ) |
722 { |
731 { |
723 CESMRField* focusedField = iFieldContainer->FocusedField(); |
732 CESMRField* focusedField = iFieldContainer->FocusedField(); |
724 |
733 |
725 if ( field != focusedField ) |
734 if ( field != focusedField ) |
726 { |
735 { |
727 TBool canLoseFocus( |
736 TBool canLoseFocus( |
728 focusedField->OkToLoseFocusL( field->FieldId() ) ); |
737 focusedField->OkToLoseFocusL( field->FieldId() ) ); |
729 |
738 |
730 if ( canLoseFocus ) |
739 if ( canLoseFocus ) |
731 { |
740 { |
732 iFieldContainer->SetControlFocusedL( field->FieldId() ); |
741 iFieldContainer->SetControlFocusedL( field->FieldId() ); |
733 } |
742 } |
734 } |
743 } |
735 |
744 |
736 break; |
745 break; |
737 } |
746 } |
738 } |
747 } |
739 } |
748 } |
740 } |
749 } |
748 FUNC_LOG; |
757 FUNC_LOG; |
749 TInt fieldCount( iFactory.Count() ); |
758 TInt fieldCount( iFactory.Count() ); |
750 |
759 |
751 for( TInt i = 0; i < fieldCount; ++i ) |
760 for( TInt i = 0; i < fieldCount; ++i ) |
752 { |
761 { |
753 if( iFactory.Field( i )->Rect().Contains( |
762 if( iFactory.Field( i )->Rect().Contains( |
754 aPointerEvent.iPosition ) ) |
763 aPointerEvent.iPosition ) ) |
755 { |
764 { |
756 if( aPointerEvent.iType == TPointerEvent::EButton1Down ) |
765 if( aPointerEvent.iType == TPointerEvent::EButton1Down ) |
757 { |
766 { |
758 iClickedField = iFactory.Field( i ); |
767 iClickedField = iFactory.Field( i ); |
767 // |
776 // |
768 TBool CMRListPane::HiddenFocus() |
777 TBool CMRListPane::HiddenFocus() |
769 { |
778 { |
770 FUNC_LOG; |
779 FUNC_LOG; |
771 TBool hiddenFocus( EFalse ); |
780 TBool hiddenFocus( EFalse ); |
772 |
781 |
773 CESMRField* focusedField( iFieldContainer->FocusedField() ); |
782 CESMRField* focusedField( iFieldContainer->FocusedField() ); |
774 TInt focusedFieldIndex( IndexByFieldId( |
783 TInt focusedFieldIndex( IndexByFieldId( |
775 iFactory, focusedField->FieldId() ) ); |
784 iFactory, focusedField->FieldId() ) ); |
776 |
785 |
777 if ( focusedFieldIndex < iFactory.Count() ) |
786 if ( focusedFieldIndex < iFactory.Count() ) |
778 { |
787 { |
779 TRect focusedFieldRect( focusedField->Rect() ); |
788 TRect focusedFieldRect( focusedField->Rect() ); |
780 TRect listPaneRect( Rect() ); |
789 TRect listPaneRect( Rect() ); |
781 |
790 |
782 TInt fieldTopY( focusedFieldRect.iTl.iY ); |
791 TInt fieldTopY( focusedFieldRect.iTl.iY ); |
783 TInt fieldBottomY( focusedFieldRect.iBr.iY ); |
792 TInt fieldBottomY( focusedFieldRect.iBr.iY ); |
784 |
793 |
785 TInt listTopY( listPaneRect.iTl.iY ); |
794 TInt listTopY( listPaneRect.iTl.iY ); |
786 TInt listBottomY( listPaneRect.iBr.iY ); |
795 TInt listBottomY( listPaneRect.iBr.iY ); |
787 |
796 |
788 if ( ( fieldBottomY > listBottomY || |
797 if ( ( fieldBottomY > listBottomY || |
789 fieldTopY < listTopY ) && |
798 fieldTopY < listTopY ) && |
790 focusedFieldRect.Height() < listPaneRect.Height() ) |
799 focusedFieldRect.Height() < listPaneRect.Height() ) |
791 { |
800 { |
792 hiddenFocus = ETrue; |
801 hiddenFocus = ETrue; |
793 } |
802 } |
794 } |
803 } |
795 return hiddenFocus; |
804 return hiddenFocus; |
799 // CMRListPane::FeedbackScrollMarginExceeded |
808 // CMRListPane::FeedbackScrollMarginExceeded |
800 // --------------------------------------------------------------------------- |
809 // --------------------------------------------------------------------------- |
801 // |
810 // |
802 TBool CMRListPane::FeedbackScrollMarginExceeded( TInt aMargin ) |
811 TBool CMRListPane::FeedbackScrollMarginExceeded( TInt aMargin ) |
803 { |
812 { |
|
813 FUNC_LOG; |
804 /* |
814 /* |
805 * This compares given margin to default one row |
815 * This compares given margin to default one row |
806 * field height, and returns ETrue if margin is exceeded. |
816 * field height, and returns ETrue if margin is exceeded. |
807 * Otherwise EFalse. |
817 * Otherwise EFalse. |
808 */ |
818 */ |
809 TBool ret( EFalse ); |
819 TBool ret( EFalse ); |
810 |
820 |
811 if( !iDefaultFieldHeight ) |
821 if( !iDefaultFieldHeight ) |
812 { |
822 { |
813 TAknLayoutRect fieldLayoutRect( |
823 TAknLayoutRect fieldLayoutRect( |
814 NMRLayoutManager::GetFieldLayoutRect( |
824 NMRLayoutManager::GetFieldLayoutRect( |
815 iFieldContainer->Rect(), 1 ) ); |
825 iFieldContainer->Rect(), 1 ) ); |
816 |
826 |
817 iDefaultFieldHeight = fieldLayoutRect.Rect().Height(); |
827 iDefaultFieldHeight = fieldLayoutRect.Rect().Height(); |
818 } |
828 } |
819 |
829 |
820 if( aMargin > iDefaultFieldHeight ) |
830 if( aMargin > iDefaultFieldHeight ) |
821 { |
831 { |
822 ret = ETrue; |
832 ret = ETrue; |
823 } |
833 } |
824 |
834 |
825 return ret; |
835 return ret; |
826 } |
836 } |
827 |
837 |
828 // End of file |
838 // End of file |