equal
deleted
inserted
replaced
524 ( aKeyEvent.iCode == EKeyEnter || |
524 ( aKeyEvent.iCode == EKeyEnter || |
525 aKeyEvent.iScanCode == EStdKeyEnter) ) |
525 aKeyEvent.iScanCode == EStdKeyEnter) ) |
526 { |
526 { |
527 FindFocused()->OfferKeyEventL( aKeyEvent, aType ); |
527 FindFocused()->OfferKeyEventL( aKeyEvent, aType ); |
528 ret = EKeyWasConsumed; |
528 ret = EKeyWasConsumed; |
529 doScroll = ETrue; |
|
530 } |
529 } |
531 } |
530 } |
532 } |
531 } |
533 if ( ret == EKeyWasNotConsumed ) |
532 if ( ret == EKeyWasNotConsumed ) |
534 { |
533 { |
541 } |
540 } |
542 } |
541 } |
543 |
542 |
544 if( doScroll ) |
543 if( doScroll ) |
545 { |
544 { |
546 // scroll the screen if the cursor goes beyond the screen |
545 DoScrollL(); |
547 CNcsComposeViewContainer& parent = |
|
548 static_cast<CNcsComposeViewContainer&>( iParent ); |
|
549 |
|
550 TInt screenPos( -Position().iY ); |
|
551 TInt cursorPos( CursorPosition() ); |
|
552 TInt lineHeight( Rect().Height() / LineCount() ); |
|
553 TInt screenHeight( parent.Rect().Height() ); |
|
554 |
|
555 if( cursorPos - lineHeight < screenPos ) |
|
556 { |
|
557 screenPos = cursorPos - lineHeight; |
|
558 } |
|
559 else |
|
560 if( cursorPos + lineHeight > screenPos + screenHeight ) |
|
561 { |
|
562 screenPos = cursorPos + lineHeight - screenHeight; |
|
563 } |
|
564 |
|
565 parent.ScrollL( screenPos ); |
|
566 PositionChanged(); |
|
567 } |
546 } |
568 |
547 |
569 return ret; |
548 return ret; |
570 } |
549 } |
571 |
550 |
655 |
634 |
656 // if focus was changed, update scroll bar |
635 // if focus was changed, update scroll bar |
657 if ( ret == EKeyWasConsumed ) |
636 if ( ret == EKeyWasConsumed ) |
658 { |
637 { |
659 container->UpdateScrollBarL(); |
638 container->UpdateScrollBarL(); |
|
639 DoScrollL(); |
660 } |
640 } |
661 |
641 |
662 // NOTE: If we're leaving the header (down was pushed on last control) |
642 // NOTE: If we're leaving the header (down was pushed on last control) |
663 // then we return EKeyWasNotConsumed to make sure the |
643 // then we return EKeyWasNotConsumed to make sure the |
664 // parent moves the focus to the control below this container |
644 // parent moves the focus to the control below this container |
1977 container->CommitL( ESubjectField ); |
1957 container->CommitL( ESubjectField ); |
1978 } |
1958 } |
1979 } |
1959 } |
1980 } |
1960 } |
1981 |
1961 |
|
1962 // ----------------------------------------------------------------------------- |
|
1963 // CNcsHeaderContainer::DoScrollL |
|
1964 // |
|
1965 // ----------------------------------------------------------------------------- |
|
1966 void CNcsHeaderContainer::DoScrollL() |
|
1967 { |
|
1968 // scroll the screen if the cursor goes beyond the screen |
|
1969 CNcsComposeViewContainer& parent = static_cast<CNcsComposeViewContainer&>( iParent ); |
|
1970 |
|
1971 TInt screenPos( -Position().iY ); |
|
1972 TInt cursorPos( CursorPosition() ); |
|
1973 TInt lineHeight( Rect().Height() / LineCount() ); |
|
1974 TInt screenHeight( parent.Rect().Height() ); |
|
1975 |
|
1976 if( cursorPos - lineHeight < screenPos ) |
|
1977 { |
|
1978 screenPos = cursorPos - lineHeight; |
|
1979 } |
|
1980 else |
|
1981 if( cursorPos + lineHeight > screenPos + screenHeight ) |
|
1982 { |
|
1983 screenPos = cursorPos + lineHeight - screenHeight; |
|
1984 } |
|
1985 |
|
1986 parent.ScrollL( screenPos ); |
|
1987 PositionChanged(); |
|
1988 } |