92 NONSHARABLE_CLASS(CDialogPageExtension) : public CBase |
92 NONSHARABLE_CLASS(CDialogPageExtension) : public CBase |
93 { |
93 { |
94 public: |
94 public: |
95 enum TFlags |
95 enum TFlags |
96 { |
96 { |
97 ELineHandlerCalled |
97 ELineHandlerCalled, |
|
98 EDragEventsAllowed // turned on when dragging is allowed |
98 }; |
99 }; |
99 static CDialogPageExtension* NewL(); |
100 static CDialogPageExtension* NewL(); |
100 ~CDialogPageExtension(); |
101 ~CDialogPageExtension(); |
101 |
102 |
102 void Feedback( const CEikDialogPage& aControl, |
103 void Feedback( const CEikDialogPage& aControl, |
129 public: |
130 public: |
130 TInt iPopFieldEvents; |
131 TInt iPopFieldEvents; |
131 TBool iExternalScrollbar; |
132 TBool iExternalScrollbar; |
132 TBool iIsDoubleQuery; |
133 TBool iIsDoubleQuery; |
133 TBool iFocusedClicked; |
134 TBool iFocusedClicked; |
134 TInt iPreviousThumbPosition; |
|
135 TBool iPreviousThumbDirection; |
135 TBool iPreviousThumbDirection; |
136 MTouchFeedback* iFeedback; |
136 MTouchFeedback* iFeedback; |
137 TBitFlags iFlags; |
137 TBitFlags iFlags; |
138 /** |
138 /** |
139 * @c iDestroyedPtr is used for the object destruction check. |
139 * @c iDestroyedPtr is used for the object destruction check. |
493 iLines->AppendL(thisLine); |
493 iLines->AppendL(thisLine); |
494 CleanupStack::Pop(); // thisLine |
494 CleanupStack::Pop(); // thisLine |
495 thisLine->iIsFormControl = aFormControl ; |
495 thisLine->iIsFormControl = aFormControl ; |
496 if ( aFormControl ) |
496 if ( aFormControl ) |
497 { |
497 { |
498 thisLine->GetAknLayoutValuesL() ; // should cause the control to have size. |
|
499 if ( iFormFlags ) |
498 if ( iFormFlags ) |
500 thisLine->SetFormFlags( iFormFlags ) ; |
499 thisLine->SetFormFlags( iFormFlags ) ; |
501 } |
500 } |
502 // allow the caption to know the one above itself |
501 // allow the caption to know the one above itself |
503 AfterAddingNewLinesL(iLines->LineIndexFromId(thisLine->iId)); |
502 AfterAddingNewLinesL(iLines->LineIndexFromId(thisLine->iId)); |
1327 } |
1326 } |
1328 |
1327 |
1329 return KErrNotFound; |
1328 return KErrNotFound; |
1330 } |
1329 } |
1331 |
1330 |
1332 TInt CEikDialogPage::YPosToLine2(TInt aYPos) const |
|
1333 { |
|
1334 return iLines->YPosToLine( Rect(), iScroll->Top(), iScroll->Middle(), iScroll->Bottom(), aYPos ); |
|
1335 } |
|
1336 |
|
1337 TInt CEikDialogPage::LineToYPos(TInt& aLine) const |
|
1338 // |
|
1339 // Calcs YPos of line relative to the ViewWin and adjusts aLine if its out of bounds |
|
1340 { |
|
1341 _AKNTRACE_FUNC_ENTER; |
|
1342 ASSERT(iLines); |
|
1343 const TInt numLines=iLines->Count(); |
|
1344 ASSERT(numLines>0); |
|
1345 if (aLine<0) |
|
1346 aLine=0; |
|
1347 else if (aLine>=numLines) |
|
1348 aLine=numLines-1; |
|
1349 _AKNTRACE( "[%s][%s][%d]", "CEikDialogPage", __FUNCTION__, (*iLines)[aLine]->Position().iY ); |
|
1350 _AKNTRACE_FUNC_EXIT; |
|
1351 return (*iLines)[aLine]->Position().iY; // TPREMOVAL +iDataWinPos.iY; |
|
1352 } |
|
1353 |
1331 |
1354 void CEikDialogPage::ExposeLine(TInt aLine, TBool aForceResize, TBool aShowWholeLine) |
1332 void CEikDialogPage::ExposeLine(TInt aLine, TBool aForceResize, TBool aShowWholeLine) |
1355 // |
1333 // |
1356 /* Exposes the given line so that its fully visible in the ViewWin |
1334 /* Exposes the given line so that its fully visible in the ViewWin |
1357 */ { |
1335 */ { |
1521 { |
1499 { |
1522 (*iLines)[i]->HandleResourceChange( KEikDynamicLayoutVariantSwitch ); |
1500 (*iLines)[i]->HandleResourceChange( KEikDynamicLayoutVariantSwitch ); |
1523 } |
1501 } |
1524 |
1502 |
1525 iLines->SetRect( Rect(), iScroll->Top(), iScroll->Middle(), iScroll->Bottom() ); |
1503 iLines->SetRect( Rect(), iScroll->Top(), iScroll->Middle(), iScroll->Bottom() ); |
1526 |
|
1527 iExtension->iInitialLayoutDone = ETrue; |
1504 iExtension->iInitialLayoutDone = ETrue; |
1528 UpdatePhysics(); |
1505 UpdatePhysics(); |
1529 |
1506 |
1530 if ( ( count > 0 ) && ( iCurrentLine >= 0 ) ) |
1507 if ( iExtension->iScrolling |
1531 { |
1508 || iExtension->iFlags.IsSet( |
|
1509 CDialogPageExtension::EDragEventsAllowed ) ) |
|
1510 { |
|
1511 iPhysics->Stop(); |
|
1512 Synchronize(); |
|
1513 } |
|
1514 |
|
1515 if ( count > 0 && iCurrentLine != KErrNotFound ) |
|
1516 { |
|
1517 if ( iLastExposedLine != -1 ) |
|
1518 { |
|
1519 iLastExposedLineViewWinYPosition = |
|
1520 iLines->LineIndexToYPosition( iLastExposedLine, 0 ); |
|
1521 } |
|
1522 |
1532 ExposeLine( iCurrentLine, ETrue ); |
1523 ExposeLine( iCurrentLine, ETrue ); |
|
1524 |
|
1525 if ( Size() != TSize::EUninitialized ) |
|
1526 { |
|
1527 (*iLines)[iCurrentLine]->DrawDeferred(); |
|
1528 } |
1533 } |
1529 } |
1534 |
1530 |
1535 TRAP_IGNORE( UpdateScrollBarL() ); // ignore any errors. |
1531 TRAP_IGNORE( UpdateScrollBarL() ); // ignore any errors. |
1536 AknsUtils::RegisterControlPosition( this ); |
1532 AknsUtils::RegisterControlPosition( this ); |
1537 |
1533 |
1821 const TInt maxHeight=iSize.iHeight-(KSpaceFromTitle+KSpaceFromBottom); |
1811 const TInt maxHeight=iSize.iHeight-(KSpaceFromTitle+KSpaceFromBottom); |
1822 TInt height = aDesirableEdwinSize.iHeight; |
1812 TInt height = aDesirableEdwinSize.iHeight; |
1823 if (height > maxHeight) |
1813 if (height > maxHeight) |
1824 height = maxHeight; |
1814 height = maxHeight; |
1825 |
1815 |
1826 TSize size = aEdwin->Size(); |
1816 TSize size( aEdwin->Size() ); |
1827 TInt maximumEdwinHeight = aEdwin->MaximumHeight(); |
1817 TInt maximumEdwinHeight = aEdwin->MaximumHeight(); |
1828 // ensure maxheight as dynamic construction may be done whilst form is of zero height. |
1818 // ensure maxheight as dynamic construction may be done whilst form is of zero height. |
1829 if ((maximumEdwinHeight > maxHeight) && maxHeight) |
1819 if ((maximumEdwinHeight > maxHeight) && maxHeight) |
1830 aEdwin->SetMaximumHeight(maxHeight); // Can't be bigger than form itself |
1820 aEdwin->SetMaximumHeight(maxHeight); // Can't be bigger than form itself |
1831 else if ((maximumEdwinHeight == 0) && (size.iHeight == height)) |
1821 else if ((maximumEdwinHeight == 0) && (size.iHeight == height)) |
1876 } |
1866 } |
1877 return ETrue; |
1867 return ETrue; |
1878 } |
1868 } |
1879 |
1869 |
1880 |
1870 |
1881 static TInt CountNumberOfLines_Edwin(CEikEdwin *aEdwin, TRect aRect, TInt numOfLines) |
|
1882 { |
|
1883 TInt edwinLines = numOfLines; |
|
1884 TInt count = 0; |
|
1885 for(TInt i=0;i<edwinLines;i++) |
|
1886 { |
|
1887 TInt scrolledLines = aEdwin->TextLayout()->FirstLineInBand(); |
|
1888 TInt docPos = aEdwin->TextLayout()->FirstCharOnLine(scrolledLines + i+1); |
|
1889 TPoint point; |
|
1890 aEdwin->TextLayout()->PosInBand(docPos, point); |
|
1891 TInt yPos = point.iY; |
|
1892 TRect lineRect; |
|
1893 aEdwin->TextLayout()->GetLineRect(yPos, lineRect); |
|
1894 lineRect.iTl += aEdwin->Position(); |
|
1895 lineRect.iBr += aEdwin->Position(); |
|
1896 if (aRect.Contains(lineRect.iTl) && aRect.Contains(lineRect.iBr)) |
|
1897 count++; |
|
1898 } |
|
1899 return count; |
|
1900 } |
|
1901 static TInt CountNumberOfLines_Ctrl(CCoeControl *aControl, TRect aRect) |
|
1902 { |
|
1903 TRect rect = TRect(aControl->Position(), aControl->Size()); |
|
1904 TInt count = 0; |
|
1905 if (aRect.Contains(rect.iTl) && aRect.Contains(rect.iBr)) |
|
1906 count ++; |
|
1907 return count; |
|
1908 } |
|
1909 |
|
1910 static TInt CountNumberOfVisibleLines(CEikCaptionedControl *aControl, TRect aClipRect) |
|
1911 { |
|
1912 TInt count = 0; |
|
1913 if (aControl->ControlIsAnEdwin(aControl->iControlType)) |
|
1914 count += CountNumberOfLines_Edwin((CEikEdwin*)aControl->iControl, aClipRect, aControl->NumberOfLines()); |
|
1915 else |
|
1916 count += CountNumberOfLines_Ctrl(aControl->iControl, aClipRect); |
|
1917 count += CountNumberOfLines_Ctrl(aControl->iCaption, aClipRect); |
|
1918 return count; |
|
1919 } |
|
1920 |
|
1921 static TInt NumberOfTextLinesVisible(CEikCapCArray *aLines, TInt aItem, TRect aClipRect) |
|
1922 { |
|
1923 if (aItem < 0) return 0; |
|
1924 CEikCaptionedControl *control = (*aLines)[aItem]; |
|
1925 return CountNumberOfVisibleLines(control, aClipRect); |
|
1926 } |
|
1927 |
|
1928 |
|
1929 void CEikDialogPage::HandleScrollEventL(CEikScrollBar* aScrollBar,TEikScrollEvent aEventType) |
1871 void CEikDialogPage::HandleScrollEventL(CEikScrollBar* aScrollBar,TEikScrollEvent aEventType) |
1930 { |
1872 { |
1931 _AKNTRACE_FUNC_ENTER; |
1873 _AKNTRACE_FUNC_ENTER; |
1932 iExtension->iHandlingScrollEvent = ETrue; |
1874 iExtension->iHandlingScrollEvent = ETrue; |
1933 |
1875 |
1988 |
1930 |
1989 CAknScrollBar* scrollBar = STATIC_CAST(CAknScrollBar*, iPageContainer->ScrollBar()->VerticalScrollBar()); |
1931 CAknScrollBar* scrollBar = STATIC_CAST(CAknScrollBar*, iPageContainer->ScrollBar()->VerticalScrollBar()); |
1990 |
1932 |
1991 if (scrollBar) |
1933 if (scrollBar) |
1992 { |
1934 { |
1993 TInt top = iScroll->Top(); |
|
1994 TInt middle = iScroll->Middle(); |
|
1995 TInt bottom = iScroll->Bottom(); |
|
1996 TRect parent( Rect() ); |
|
1997 TBool topmostPartial = top == -1; |
|
1998 iLines->CalcItemIndexes(top, middle, bottom, parent.Size()); |
|
1999 TInt extraLines = topmostPartial ? NumberOfTextLinesVisible(iLines, top-1, parent) : 0; |
|
2000 iExtension->iPreviousThumbPosition = iLines->NumberOfTextLinesBeforeLine( top - extraLines ); |
|
2001 |
|
2002 // Using form layout, since this is used by AknForm only |
1935 // Using form layout, since this is used by AknForm only |
2003 TAknWindowComponentLayout layout = TAknWindowComponentLayout::Compose( |
1936 TAknWindowComponentLayout layout = TAknWindowComponentLayout::Compose( |
2004 AknLayoutScalable_Avkon::listscroll_form_pane(), |
1937 AknLayoutScalable_Avkon::listscroll_form_pane(), |
2005 AknLayoutScalable_Avkon::scroll_pane_cp8()); |
1938 AknLayoutScalable_Avkon::scroll_pane_cp8()); |
2006 |
1939 |
2007 TRect scrollBarParent( MainPane().Size()/*mainPaneRect.Size()*/ ); |
1940 TRect scrollBarParent( MainPane().Size() ); |
2008 |
1941 |
2009 AknLayoutUtils::LayoutVerticalScrollBar(iPageContainer->ScrollBar(), scrollBarParent, layout.LayoutLine()); |
1942 AknLayoutUtils::LayoutVerticalScrollBar(iPageContainer->ScrollBar(), scrollBarParent, layout.LayoutLine()); |
2010 if(!ScbState() && iCurrentLine!=-1 && iCurrentLine < iLines->Count() ) |
1943 if(!ScbState() && iCurrentLine!=-1 && iCurrentLine < iLines->Count() ) |
2011 { |
1944 { |
2012 CEikCaptionedControl *ctrl = (*iLines)[iCurrentLine]; |
1945 CEikCaptionedControl *ctrl = (*iLines)[iCurrentLine]; |
2045 // TODO: replace iLines->MinimumSize with world size, presumably saved in CAknFormPhysics |
1978 // TODO: replace iLines->MinimumSize with world size, presumably saved in CAknFormPhysics |
2046 vertModel.iScrollSpan = iLines->MinimumSize().iHeight; |
1979 vertModel.iScrollSpan = iLines->MinimumSize().iHeight; |
2047 vertModel.iThumbSpan = iSize.iHeight - iSize.iHeight % 2; |
1980 vertModel.iThumbSpan = iSize.iHeight - iSize.iHeight % 2; |
2048 vertModel.iThumbPosition = Max( iPhysics->ViewTopY(), 0 ); |
1981 vertModel.iThumbPosition = Max( iPhysics->ViewTopY(), 0 ); |
2049 |
1982 |
2050 iExtension->iPreviousThumbPosition = vertModel.iThumbPosition; |
|
2051 TRAP_IGNORE(scrollBar->SetModelL(&vertModel)); // won't leave now, but can't guarantee forever |
1983 TRAP_IGNORE(scrollBar->SetModelL(&vertModel)); // won't leave now, but can't guarantee forever |
2052 iPageContainer->ScrollBar()->Tile(&vertModel); |
1984 iPageContainer->ScrollBar()->Tile(&vertModel); |
2053 iPageContainer->ScrollBar()->SetVFocusPosToThumbPos(vertModel.iThumbPosition); |
1985 iPageContainer->ScrollBar()->SetVFocusPosToThumbPos(vertModel.iThumbPosition); |
2054 } |
1986 } |
2055 _AKNTRACE_FUNC_EXIT; |
1987 _AKNTRACE_FUNC_EXIT; |
2421 |
2353 |
2422 HighlightVisible( aEditable ); |
2354 HighlightVisible( aEditable ); |
2423 |
2355 |
2424 if ( iExtension->iUsesSingleClick && iExtension->iSetInitialFocusDone ) |
2356 if ( iExtension->iUsesSingleClick && iExtension->iSetInitialFocusDone ) |
2425 { |
2357 { |
2426 ShowFocus( EFalse ); |
2358 ShowFocus( EFalse, EFalse ); |
2427 } |
2359 } |
2428 |
2360 |
2429 const TInt numLines=iLines->Count() ; |
2361 const TInt numLines=iLines->Count() ; |
2430 /* if a form, no currently selected line, in edit mode, and there is a line |
2362 /* if a form, no currently selected line, in edit mode, and there is a line |
2431 available (we know this as iLines->Count()>0), then select the first line. |
2363 available (we know this as iLines->Count()>0), then select the first line. |
2543 if (!anythingToShow) |
2475 if (!anythingToShow) |
2544 { |
2476 { |
2545 // Have to call non const leaving function... Ignore the TRAP as result is cosmetic only. |
2477 // Have to call non const leaving function... Ignore the TRAP as result is cosmetic only. |
2546 TRAP_IGNORE( const_cast<CEikDialogPage*>(this)->DrawEmptyListL( windowGcRef ) ) ; |
2478 TRAP_IGNORE( const_cast<CEikDialogPage*>(this)->DrawEmptyListL( windowGcRef ) ) ; |
2547 } |
2479 } |
2548 else |
|
2549 DrawVerticalLine(); |
|
2550 |
|
2551 |
2480 |
2552 if ( IsForm() ) |
2481 if ( IsForm() ) |
2553 { |
2482 { |
2554 TInt delta = iPhysics->ViewCenter().iY; |
2483 TInt delta = iPhysics->ViewCenter().iY; |
2555 delta -= iPhysics->ViewCenterDistance(); |
2484 delta -= iPhysics->ViewCenterDistance(); |
2705 { |
2634 { |
2706 // Tell the line that it is on a form - activate it to enable it draw its highlight box |
2635 // Tell the line that it is on a form - activate it to enable it draw its highlight box |
2707 aLine->iIsFormControl = iFormControl ; |
2636 aLine->iIsFormControl = iFormControl ; |
2708 if ( iFormFlags ) |
2637 if ( iFormFlags ) |
2709 aLine->SetFormFlags( iFormFlags ) ; |
2638 aLine->SetFormFlags( iFormFlags ) ; |
2710 |
|
2711 aLine->GetAknLayoutValuesL() ; // should cause the control to have size. |
|
2712 } |
2639 } |
2713 }; |
2640 }; |
2714 |
2641 |
2715 |
2642 |
2716 void CEikDialogPage::SetPageContainer(const CEikDialogPageContainer* aPageContainer) |
2643 void CEikDialogPage::SetPageContainer(const CEikDialogPageContainer* aPageContainer) |
2820 CEikCaptionedControl* capCtrl =(*iLines)[lineIndex]; |
2747 CEikCaptionedControl* capCtrl =(*iLines)[lineIndex]; |
2821 aHeightOfControlVisibleOnPage=capCtrl->Rect().Height(); |
2748 aHeightOfControlVisibleOnPage=capCtrl->Rect().Height(); |
2822 return EFalse; |
2749 return EFalse; |
2823 } |
2750 } |
2824 |
2751 |
2825 TSize CEikDialogPage::RealDataSize() const |
|
2826 { |
|
2827 if (iLines) |
|
2828 if (iLines->Count()>0) |
|
2829 return TRect((*iLines)[0]->Rect().iTl,(*iLines)[iLines->Count()-1]->Rect().iBr).Size(); |
|
2830 return iSize; |
|
2831 } |
|
2832 |
|
2833 TInt CEikDialogPage::NumberOfLines() const |
2752 TInt CEikDialogPage::NumberOfLines() const |
2834 { |
2753 { |
2835 if (iLines) |
2754 if (iLines) |
2836 return iLines->Count(); |
2755 return iLines->Count(); |
2837 return 0; |
2756 return 0; |
2999 HighlightVisible( ETrue ); |
2918 HighlightVisible( ETrue ); |
3000 ShowFocus( ETrue, ETrue ); |
2919 ShowFocus( ETrue, ETrue ); |
3001 } |
2920 } |
3002 } |
2921 } |
3003 } |
2922 } |
|
2923 |
|
2924 iExtension->iFlags.Set( CDialogPageExtension::EDragEventsAllowed ); |
3004 } |
2925 } |
3005 |
2926 |
3006 if ( aPointerEvent.iType == TPointerEvent::EDrag ) |
2927 if ( aPointerEvent.iType == TPointerEvent::EDrag ) |
3007 { |
2928 { |
3008 _AKNTRACE( "TPointerEvent::EDrag" ); |
2929 _AKNTRACE( "TPointerEvent::EDrag" ); |
3009 TPoint drag( iExtension->iDragStartPosition - aPointerEvent.iPosition ); |
2930 TPoint drag( iExtension->iDragStartPosition - aPointerEvent.iPosition ); |
3010 |
2931 |
3011 if ( Abs( drag.iY ) > iPhysics->DragThreshold() ) |
2932 if ( Abs( drag.iY ) > iPhysics->DragThreshold() |
|
2933 && iExtension->iFlags.IsSet( |
|
2934 CDialogPageExtension::EDragEventsAllowed ) ) |
3012 { |
2935 { |
3013 iExtension->iHighlightTimer->Cancel(); |
2936 iExtension->iHighlightTimer->Cancel(); |
3014 |
2937 |
3015 if ( !iExtension->iScrolling && !textSelected ) |
2938 if ( !iExtension->iScrolling && !textSelected ) |
3016 { |
2939 { |
3072 |
2995 |
3073 TPoint drag( iExtension->iDragStartPosition - aPointerEvent.iPosition ); |
2996 TPoint drag( iExtension->iDragStartPosition - aPointerEvent.iPosition ); |
3074 |
2997 |
3075 if ( !textSelected ) |
2998 if ( !textSelected ) |
3076 { |
2999 { |
3077 if ( !iPhysics->StartFlick( drag, iExtension->iStartTime ) ) |
3000 if ( !iExtension->iFlags.IsSet( CDialogPageExtension::EDragEventsAllowed ) |
|
3001 || !iPhysics->StartFlick( drag, iExtension->iStartTime ) ) |
3078 { |
3002 { |
3079 iExtension->iScrolling = EFalse; |
3003 iExtension->iScrolling = EFalse; |
3080 |
3004 |
3081 if ( iPageObserver && GrabbingComponent() |
3005 if ( iPageObserver && GrabbingComponent() |
3082 && !iExtension->iWasScrolling |
3006 && !iExtension->iWasScrolling |
3104 iLines->MoveLineToScreen( iCurrentLine, 0, EFalse ); |
3028 iLines->MoveLineToScreen( iCurrentLine, 0, EFalse ); |
3105 RemovePressedDownHighlight(); |
3029 RemovePressedDownHighlight(); |
3106 } |
3030 } |
3107 } |
3031 } |
3108 } |
3032 } |
|
3033 |
|
3034 iExtension->iFlags.Clear( CDialogPageExtension::EDragEventsAllowed ); |
3109 } |
3035 } |
3110 |
3036 |
3111 // forward pointer event to line's observer |
3037 // forward pointer event to line's observer |
3112 if ( touchedLine == iCurrentLine && newLine && |
3038 if ( touchedLine == iCurrentLine && newLine && |
3113 ( iExtension->iFocusedClicked || |
3039 ( iExtension->iFocusedClicked || |
3184 if ( iLines->Count() > 0 ) |
3110 if ( iLines->Count() > 0 ) |
3185 { |
3111 { |
3186 viewCenter.iY = Abs( (*iLines)[0]->Rect().iTl.iY - iPosition.iY ); |
3112 viewCenter.iY = Abs( (*iLines)[0]->Rect().iTl.iY - iPosition.iY ); |
3187 } |
3113 } |
3188 |
3114 |
3189 viewCenter.iY += iPhysics->ViewCenterDistance(); |
3115 TInt viewCenterDistance = iPhysics->ViewCenterDistance(); |
|
3116 viewCenter.iY += viewCenterDistance; |
3190 |
3117 |
3191 if ( iExtension->iInitialLayoutDone ) |
3118 if ( iExtension->iInitialLayoutDone ) |
3192 { |
3119 { |
3193 TInt oldScreenHeight = iPhysics->ViewSize().iHeight; |
3120 TInt oldScreenHeight = iPhysics->ViewSize().iHeight; |
3194 TInt delta = ( iPhysics->ViewCenterDistance() ) - |
3121 TInt delta = ( viewCenterDistance ) - ( oldScreenHeight / 2 ); |
3195 ( oldScreenHeight / 2 ); |
|
3196 |
3122 |
3197 viewCenter = iPhysics->ViewCenter(); |
3123 viewCenter = iPhysics->ViewCenter(); |
3198 viewCenter.iY += delta; |
3124 viewCenter.iY += delta; |
3199 } |
3125 } |
3200 |
3126 |
3201 TSize worldSize( iLines->MinimumSize() ); |
3127 TSize worldSize( iLines->MinimumSize() ); |
3202 worldSize.iHeight = Max( worldSize.iHeight, iSize.iHeight ); |
3128 worldSize.iHeight = Max( worldSize.iHeight, iSize.iHeight ); |
3203 |
3129 |
|
3130 // align to borders if those are crossed |
|
3131 if ( viewCenter.iY < viewCenterDistance ) |
|
3132 { |
|
3133 viewCenter.iY = viewCenterDistance; |
|
3134 } |
|
3135 else if ( viewCenter.iY > ( worldSize.iHeight - viewCenterDistance ) ) |
|
3136 { |
|
3137 viewCenter.iY = worldSize.iHeight - viewCenterDistance; |
|
3138 } |
|
3139 |
3204 TRAP_IGNORE( iPhysics->InitPhysicsL( worldSize, iSize, viewCenter ) ); |
3140 TRAP_IGNORE( iPhysics->InitPhysicsL( worldSize, iSize, viewCenter ) ); |
3205 TRAP_IGNORE( UpdateScrollBarL() ); |
3141 TRAP_IGNORE( UpdateScrollBarL() ); |
3206 } |
3142 } |
3207 _AKNTRACE_FUNC_EXIT; |
3143 _AKNTRACE_FUNC_EXIT; |
3208 } |
3144 } |
3265 // --------------------------------------------------------------------------- |
3201 // --------------------------------------------------------------------------- |
3266 // CEikDialogPage::ScrollCacheByPixels |
3202 // CEikDialogPage::ScrollCacheByPixels |
3267 // --------------------------------------------------------------------------- |
3203 // --------------------------------------------------------------------------- |
3268 // |
3204 // |
3269 void CEikDialogPage::ScrollCacheByPixels( |
3205 void CEikDialogPage::ScrollCacheByPixels( |
3270 TInt /*aDelta*/, const TDesC& /*aDebugMsg*/, TBool aDrawNow ) |
3206 TInt /*aDelta*/, TBool aDrawNow ) |
3271 { |
3207 { |
3272 if ( iLines->Count() <= 0 ) |
3208 if ( iLines->Count() <= 0 ) |
3273 return; |
3209 return; |
3274 TInt bottomItem, upperItem; |
3210 TInt bottomItem, upperItem; |
3275 TInt bottom = iPhysics->ViewCenter().iY + iSize.iHeight - iSize.iHeight / 2; |
3211 TInt bottom = iPhysics->ViewCenter().iY + iSize.iHeight - iSize.iHeight / 2; |
3300 } |
3236 } |
3301 if ( upperItem == -1 || bottomItem == iLines->Count() ) |
3237 if ( upperItem == -1 || bottomItem == iLines->Count() ) |
3302 { |
3238 { |
3303 if ( upperItem != iExtension->iTopItem || bottomItem != iExtension->iBottomItem ) |
3239 if ( upperItem != iExtension->iTopItem || bottomItem != iExtension->iBottomItem ) |
3304 { |
3240 { |
3305 if( iPhysics->OngoingPhysicsAction() == CAknPhysics::EAknPhysicsActionDragging ) |
3241 switch(iPhysics->OngoingPhysicsAction()) |
3306 { |
3242 { |
3307 iExtension->Feedback( *this, ETouchFeedbackSensitiveList ); |
3243 case CAknPhysics::EAknPhysicsActionBouncing: |
3308 } |
3244 case CAknPhysics::EAknPhysicsActionDragging: |
3309 else if( iPhysics->OngoingPhysicsAction() == CAknPhysics::EAknPhysicsActionFlicking ) |
3245 case CAknPhysics::EAknPhysicsActionFlicking: |
3310 { |
3246 iExtension->SilentFeedback( *this, |
3311 iExtension->SilentFeedback( *this, ETouchFeedbackSensitiveList, TPointerEvent() ); |
3247 ETouchFeedbackSensitiveList, TPointerEvent() ); |
3312 } |
3248 break; |
3313 else if( iPhysics->OngoingPhysicsAction() == CAknPhysics::EAknPhysicsActionBouncing ) |
3249 default: |
3314 { |
3250 break; |
3315 iExtension->SilentFeedback( *this, ETouchFeedbackSensitiveList, TPointerEvent() ); |
|
3316 } |
3251 } |
3317 } |
3252 } |
3318 } |
3253 } |
3319 else if ( upperItem >= 0 || bottomItem < iLines->Count() ) |
3254 else if ( upperItem >= 0 || bottomItem < iLines->Count() ) |
3320 { |
3255 { |
3321 if ( upperItem < iExtension->iTopItem || bottomItem > iExtension->iBottomItem ) |
3256 if ( upperItem < iExtension->iTopItem || bottomItem > iExtension->iBottomItem ) |
3322 { |
3257 { |
3323 if( iPhysics->OngoingPhysicsAction() == CAknPhysics::EAknPhysicsActionDragging ) |
3258 switch(iPhysics->OngoingPhysicsAction()) |
3324 { |
3259 { |
3325 iExtension->Feedback( *this, ETouchFeedbackSensitiveList ); |
3260 case CAknPhysics::EAknPhysicsActionBouncing: |
3326 } |
3261 case CAknPhysics::EAknPhysicsActionDragging: |
3327 else if( iPhysics->OngoingPhysicsAction() == CAknPhysics::EAknPhysicsActionFlicking ) |
3262 case CAknPhysics::EAknPhysicsActionFlicking: |
3328 { |
3263 iExtension->SilentFeedback( *this, |
3329 iExtension->SilentFeedback( *this, ETouchFeedbackSensitiveList, TPointerEvent() ); |
3264 ETouchFeedbackSensitiveList, TPointerEvent() ); |
3330 } |
3265 break; |
3331 else if( iPhysics->OngoingPhysicsAction() == CAknPhysics::EAknPhysicsActionBouncing ) |
3266 default: |
3332 { |
3267 break; |
3333 iExtension->SilentFeedback( *this, ETouchFeedbackSensitiveList, TPointerEvent() ); |
|
3334 } |
3268 } |
3335 } |
3269 } |
3336 } |
3270 } |
3337 iExtension->iBottomItem = bottomItem; |
3271 iExtension->iBottomItem = bottomItem; |
3338 iExtension->iTopItem = upperItem; |
3272 iExtension->iTopItem = upperItem; |
3393 // --------------------------------------------------------------------------- |
3327 // --------------------------------------------------------------------------- |
3394 // |
3328 // |
3395 void CEikDialogPage::Synchronize() |
3329 void CEikDialogPage::Synchronize() |
3396 { |
3330 { |
3397 iExtension->iScrolling = EFalse; |
3331 iExtension->iScrolling = EFalse; |
|
3332 iExtension->iFlags.Clear( CDialogPageExtension::EDragEventsAllowed ); |
3398 iLines->MoveLineToScreen( iCurrentLine, iPhysics->ViewTopY(), ETrue ); |
3333 iLines->MoveLineToScreen( iCurrentLine, iPhysics->ViewTopY(), ETrue ); |
3399 } |
3334 } |
3400 |
3335 |
3401 |
3336 |
3402 // --------------------------------------------------------------------------- |
3337 // --------------------------------------------------------------------------- |
3471 DrawControl( line ); |
3406 DrawControl( line ); |
3472 } |
3407 } |
3473 |
3408 |
3474 Parent()->Parent()->Parent()->SetCustomGc( NULL ); |
3409 Parent()->Parent()->Parent()->SetCustomGc( NULL ); |
3475 _AKNTRACE_FUNC_EXIT; |
3410 _AKNTRACE_FUNC_EXIT; |
3476 } |
|
3477 |
|
3478 |
|
3479 // --------------------------------------------------------------------------- |
|
3480 // CEikDialogPage::ScrollByPixels |
|
3481 // --------------------------------------------------------------------------- |
|
3482 // |
|
3483 void CEikDialogPage::ScrollByPixels( TInt aDelta ) |
|
3484 { |
|
3485 if ( aDelta != 0 ) |
|
3486 { |
|
3487 iLines->ScrollByPixels( aDelta ); |
|
3488 TRAP_IGNORE( UpdateScrollBarL() ); |
|
3489 DrawNow(); |
|
3490 TRAP_IGNORE( RecordLinesL() ); |
|
3491 } |
|
3492 } |
3411 } |
3493 |
3412 |
3494 |
3413 |
3495 // --------------------------------------------------------------------------- |
3414 // --------------------------------------------------------------------------- |
3496 // CEikDialogPage::RemovePressedDownHighlight |
3415 // CEikDialogPage::RemovePressedDownHighlight |
3590 } |
3509 } |
3591 |
3510 |
3592 CCoeControl* grabbingComponent = GrabbingComponent(); |
3511 CCoeControl* grabbingComponent = GrabbingComponent(); |
3593 TBool callDefaultImplementation = ETrue; |
3512 TBool callDefaultImplementation = ETrue; |
3594 TBool focusItem = EFalse; |
3513 TBool focusItem = EFalse; |
3595 // YPosToLine is scaled to iDataWinPos, so add it to pointer Y position |
3514 TInt touchedLineIndex = iLines->YPositionToLineIndex( aPointerEvent.iPosition.iY ); |
3596 TInt yPosition = aPointerEvent.iPosition.iY; // + iDataWinPos.iY; |
3515 |
3597 TInt touchedLineIndex = YPosToLine2( yPosition ); |
|
3598 // If the stylus is down and the touched line is already the current one, |
3516 // If the stylus is down and the touched line is already the current one, |
3599 // mark this fact in iExtension->iFocusedClicked to be used later when the stylus is up. |
3517 // mark this fact in iExtension->iFocusedClicked to be used later when the stylus is up. |
3600 |
|
3601 if ( touchedLineIndex != KErrNotFound && |
3518 if ( touchedLineIndex != KErrNotFound && |
3602 iExtension->iCapturingItem != KErrNotFound && |
3519 iExtension->iCapturingItem != KErrNotFound && |
3603 touchedLineIndex != iExtension->iCapturingItem ) |
3520 touchedLineIndex != iExtension->iCapturingItem ) |
3604 { |
3521 { |
3605 iExtension->iCapturingItem = KErrNotFound; |
3522 iExtension->iCapturingItem = KErrNotFound; |