216 const TPointerEvent& aPointerEvent, |
216 const TPointerEvent& aPointerEvent, |
217 TInt aTouchedLineIndex, |
217 TInt aTouchedLineIndex, |
218 TInt aCurrentLine ) |
218 TInt aCurrentLine ) |
219 { |
219 { |
220 CEikCaptionedControl* firstLine( aDPage.LineOnPageOrNull( 0 ) ); |
220 CEikCaptionedControl* firstLine( aDPage.LineOnPageOrNull( 0 ) ); |
221 TBool viewMode( !aDPage.IsEditable() ); |
221 |
222 |
222 if( aDPage.IsEditable() ) |
223 // note, that iFormControl is checked in Feedback() |
223 { |
224 if ( aPointerEvent.iType == TPointerEvent::EButton1Down && |
224 // note, that iFormControl is checked in Feedback() |
225 aCurrentLine != aTouchedLineIndex && |
|
226 firstLine ) |
|
227 { |
|
228 // feedback for edit/view mode form, when non-focused line is clicked |
|
229 // feedback for focused item is responsibility of the item |
|
230 // no feedback with focus change when single click is enabled |
|
231 if ( !iUsesSingleClick ) |
|
232 { |
|
233 Feedback( aDPage, ETouchFeedbackSensitiveList ); |
|
234 } |
|
235 iFocusItemChanged = ETrue; |
|
236 } |
|
237 else if ( viewMode && firstLine ) |
|
238 { |
|
239 if ( aPointerEvent.iType == TPointerEvent::EButton1Down && |
225 if ( aPointerEvent.iType == TPointerEvent::EButton1Down && |
240 aTouchedLineIndex == aCurrentLine ) |
226 aCurrentLine != aTouchedLineIndex && |
241 { |
227 firstLine ) |
242 // Feedback for view mode form, when focused item is |
228 { |
243 // clicked. Basically same case as for msk simulation later on |
229 // feedback for edit mode form, when non-focused line is clicked |
244 // the function, but on pointer |
230 // feedback for focused item is responsibility of the item |
245 // down. iExtension->iFocusedClicked is not valid here, since |
231 // no feedback with focus change when single click is enabled |
246 // it can't be known in this phase whether user drags pointer |
232 if ( !iUsesSingleClick ) |
247 // away. |
233 { |
248 Feedback( aDPage, ETouchFeedbackList ); |
234 Feedback( aDPage, ETouchFeedbackSensitiveList ); |
249 iFocusItemChanged = EFalse; |
235 } |
250 } |
236 iFocusItemChanged = ETrue; |
251 else if ( aPointerEvent.iType == TPointerEvent::EButton1Up ) |
237 } |
252 { |
238 else if ( firstLine ) |
253 // When focus changed, it should not send feedback on up event. |
239 { |
254 // When up event comes, aTouchedLineIndex always equal to |
240 if ( aPointerEvent.iType == TPointerEvent::EButton1Down && |
255 // aCurrentLine. |
241 aTouchedLineIndex == aCurrentLine ) |
256 if ( !iFocusItemChanged ) |
242 { |
257 { |
243 // Feedback for edit mode form, when focused item is |
258 SilentFeedback( aDPage, ETouchFeedbackList, aPointerEvent ); |
244 // clicked. Basically same case as for msk simulation later on |
|
245 // the function, but on pointer |
|
246 // down. iExtension->iFocusedClicked is not valid here, since |
|
247 // it can't be known in this phase whether user drags pointer |
|
248 // away. |
|
249 Feedback( aDPage, ETouchFeedbackList ); |
|
250 iFocusItemChanged = EFalse; |
|
251 } |
|
252 else if ( aPointerEvent.iType == TPointerEvent::EButton1Up ) |
|
253 { |
|
254 // When focus changed, it should not send feedback on up event. |
|
255 // When up event comes, aTouchedLineIndex always equal to |
|
256 // aCurrentLine. |
|
257 if ( !iFocusItemChanged ) |
|
258 { |
|
259 SilentFeedback( aDPage, ETouchFeedbackList, aPointerEvent ); |
|
260 } |
259 } |
261 } |
260 } |
262 } |
261 } |
263 } |
262 } |
264 } |
263 |
265 |
683 AknsUtils::RegisterControlPosition(capCtrl->iCaption); |
683 AknsUtils::RegisterControlPosition(capCtrl->iCaption); |
684 AknsUtils::RegisterControlPosition(capCtrl->iControl); |
684 AknsUtils::RegisterControlPosition(capCtrl->iControl); |
685 AknsUtils::RegisterControlPosition(capCtrl->iTrailer); |
685 AknsUtils::RegisterControlPosition(capCtrl->iTrailer); |
686 AknsUtils::RegisterControlPosition(capCtrl->iBitmap); |
686 AknsUtils::RegisterControlPosition(capCtrl->iBitmap); |
687 |
687 |
688 if ( capCtrl->iIsFormControl && iCurrentLine != i) |
688 if ( capCtrl->iIsFormControl && iCurrentLine != i) |
689 { |
689 { |
690 |
690 if (capCtrl->ControlIsAnEdwin(capCtrl->iControlType)) |
691 if (capCtrl->ControlIsAnEdwin(capCtrl->iControlType)) |
691 { |
692 { |
692 CEikEdwin *edwin = (CEikEdwin*)capCtrl->iControl; |
693 CEikEdwin *edwin = (CEikEdwin*)capCtrl->iControl; |
693 TRAP_IGNORE( edwin->TextView()->SetDocPosL( 0 ) ); |
694 TRAP_IGNORE(edwin->TextView()->SetDocPosL(0) |
694 } |
695 ); |
695 } |
696 } |
696 } |
697 } |
697 |
698 |
|
699 } |
|
700 _AKNTRACE_FUNC_EXIT; |
698 _AKNTRACE_FUNC_EXIT; |
701 } |
699 } |
702 |
700 |
703 void CEikDialogPage::SetActiveAndFocusL() |
701 void CEikDialogPage::SetActiveAndFocusL() |
704 { |
702 { |
1514 } |
1506 } |
1515 |
1507 |
1516 void CEikDialogPage::SizeChanged() |
1508 void CEikDialogPage::SizeChanged() |
1517 { |
1509 { |
1518 _AKNTRACE_FUNC_ENTER; |
1510 _AKNTRACE_FUNC_ENTER; |
|
1511 if ( IsForm() ) |
|
1512 { |
|
1513 iExtension->iInitialLayoutDone = EFalse; |
|
1514 |
|
1515 iScroll->SetOutsideRect( Rect() ); |
|
1516 |
|
1517 // force each line to resize |
|
1518 TInt count = iLines->Count(); |
|
1519 |
|
1520 for ( TInt i = 0; i < count; ++i ) |
|
1521 { |
|
1522 (*iLines)[i]->HandleResourceChange( KEikDynamicLayoutVariantSwitch ); |
|
1523 } |
|
1524 |
|
1525 iLines->SetRect( Rect(), iScroll->Top(), iScroll->Middle(), iScroll->Bottom() ); |
|
1526 |
|
1527 iExtension->iInitialLayoutDone = ETrue; |
|
1528 UpdatePhysics(); |
|
1529 |
|
1530 if ( ( count > 0 ) && ( iCurrentLine >= 0 ) ) |
|
1531 { |
|
1532 ExposeLine( iCurrentLine, ETrue ); |
|
1533 } |
|
1534 |
|
1535 TRAP_IGNORE( UpdateScrollBarL() ); // ignore any errors. |
|
1536 AknsUtils::RegisterControlPosition( this ); |
|
1537 |
|
1538 _AKNTRACE_FUNC_EXIT; |
|
1539 return; |
|
1540 } |
|
1541 |
1519 // update form area's size to scroll control |
1542 // update form area's size to scroll control |
1520 iScroll->SetOutsideRect( Rect() ); |
1543 iScroll->SetOutsideRect( Rect() ); |
1521 iLines->SetRect( Rect(), iScroll->Top(), iScroll->Middle(), iScroll->Bottom() ); |
1544 iLines->SetRect( Rect(), iScroll->Top(), iScroll->Middle(), iScroll->Bottom() ); |
1522 |
1545 |
1523 if ( (iLines->Count() > 0 ) && ( iCurrentLine >= 0 ) ) |
1546 if ( (iLines->Count() > 0 ) && ( iCurrentLine >= 0 ) ) |
1812 if ( (maximumEdwinHeight > 0) && (height > maximumEdwinHeight)) |
1834 if ( (maximumEdwinHeight > 0) && (height > maximumEdwinHeight)) |
1813 height=maximumEdwinHeight; // Can't be bigger than edwin itself |
1835 height=maximumEdwinHeight; // Can't be bigger than edwin itself |
1814 size.iHeight = height; |
1836 size.iHeight = height; |
1815 |
1837 |
1816 // Must force a size change on current captioned contrl even if control doesn't change size (so that edwin is resized by aknutils) |
1838 // Must force a size change on current captioned contrl even if control doesn't change size (so that edwin is resized by aknutils) |
1817 aEdwin->SetSize(size); |
1839 aEdwin->SetSize(size); |
1818 ReconsiderPageSize(); |
1840 |
1819 ExposeLine(iCurrentLine, ETrue); |
1841 if ( IsForm() ) |
|
1842 { |
|
1843 (*iLines)[iCurrentLine]->SetRect( (*iLines)[iCurrentLine]->Rect() ); |
|
1844 ExposeLine( iCurrentLine, ETrue ); |
|
1845 } |
|
1846 else |
|
1847 { |
|
1848 ReconsiderPageSize(); |
|
1849 ExposeLine(iCurrentLine, ETrue); |
|
1850 } |
|
1851 |
1820 PrepareToDrawVerticalLine(); // do flushes here. |
1852 PrepareToDrawVerticalLine(); // do flushes here. |
1821 |
1853 |
1822 /* improved redraw code |
1854 /* improved redraw code |
1823 Due to some unpleasantness about dialogs, forms and requirements, to get caption controls |
1855 Due to some unpleasantness about dialogs, forms and requirements, to get caption controls |
1824 to draw properly requires a call to draw now. A system initiated draw does not work correctly |
1856 to draw properly requires a call to draw now. A system initiated draw does not work correctly |
2144 ShowFocus(ETrue, EFalse ); |
2176 ShowFocus(ETrue, EFalse ); |
2145 |
2177 |
2146 if ( ( oldLine != iCurrentLine && IsForm() ) && |
2178 if ( ( oldLine != iCurrentLine && IsForm() ) && |
2147 iExtension->iInitialLayoutDone ) |
2179 iExtension->iInitialLayoutDone ) |
2148 { |
2180 { |
|
2181 // Set temporarily for EFalse to prevent one extra physics update |
|
2182 // because of two calls to iLines->MoveLineToScreen |
|
2183 iExtension->iInitialLayoutDone = EFalse; |
|
2184 |
2149 if ( oldLine != -1 ) |
2185 if ( oldLine != -1 ) |
2150 { |
2186 { |
2151 iLines->MoveLineToScreen( oldLine, 0, EFalse ); |
2187 iLines->MoveLineToScreen( oldLine, 0, EFalse ); |
2152 TRAP_IGNORE( RecordLineL( oldLine ) ); |
2188 TRAP_IGNORE( RecordLineL( oldLine ) ); |
2153 } |
2189 } |
|
2190 |
|
2191 // set back to correct value |
|
2192 iExtension->iInitialLayoutDone = ETrue; |
2154 |
2193 |
2155 TRAP_IGNORE( RecordLineL( iCurrentLine ) ); |
2194 TRAP_IGNORE( RecordLineL( iCurrentLine ) ); |
2156 iLines->MoveLineToScreen( iCurrentLine, iPhysics->ViewTopY(), ETrue ); |
2195 iLines->MoveLineToScreen( iCurrentLine, iPhysics->ViewTopY(), ETrue ); |
2157 } |
2196 } |
2158 _AKNTRACE_FUNC_EXIT; |
2197 _AKNTRACE_FUNC_EXIT; |
2180 * which are shared across the environment, e.g. colors or fonts. |
2219 * which are shared across the environment, e.g. colors or fonts. |
2181 */ |
2220 */ |
2182 void CEikDialogPage::HandleResourceChange(TInt aType) |
2221 void CEikDialogPage::HandleResourceChange(TInt aType) |
2183 { |
2222 { |
2184 _AKNTRACE_FUNC_ENTER; |
2223 _AKNTRACE_FUNC_ENTER; |
2185 if ( aType==KEikDynamicLayoutVariantSwitch ) |
2224 if ( aType==KEikDynamicLayoutVariantSwitch && !IsForm() ) |
2186 { |
2225 { |
2187 const TInt numLines=iLines->Count(); |
2226 const TInt numLines=iLines->Count(); |
2188 for ( TInt i=0; i < numLines; i++ ) |
2227 for ( TInt i=0; i < numLines; i++ ) |
2189 { |
2228 { |
2190 CEikCaptionedControl* thisLine=(*iLines)[i]; |
2229 CEikCaptionedControl* thisLine=(*iLines)[i]; |
2375 // Tell each of the controls on the page (which are part of a form) of their editable state. |
2414 // Tell each of the controls on the page (which are part of a form) of their editable state. |
2376 _AKNTRACE_FUNC_ENTER; |
2415 _AKNTRACE_FUNC_ENTER; |
2377 _AKNTRACE( "CEikDialogPage::SetEditableL() aEditable: [%d]", aEditable ); |
2416 _AKNTRACE( "CEikDialogPage::SetEditableL() aEditable: [%d]", aEditable ); |
2378 iIsEditable = aEditable; |
2417 iIsEditable = aEditable; |
2379 |
2418 |
|
2419 TBool initialLayoutDone = iExtension->iInitialLayoutDone; |
|
2420 iExtension->iInitialLayoutDone = EFalse; |
|
2421 |
2380 HighlightVisible( aEditable ); |
2422 HighlightVisible( aEditable ); |
2381 |
2423 |
2382 if ( iExtension->iUsesSingleClick && iExtension->iSetInitialFocusDone ) |
2424 if ( iExtension->iUsesSingleClick && iExtension->iSetInitialFocusDone ) |
2383 { |
2425 { |
2384 ShowFocus( EFalse ); |
2426 ShowFocus( EFalse ); |
2895 aPointerEvent, |
2945 aPointerEvent, |
2896 touchedLine, |
2946 touchedLine, |
2897 iCurrentLine ); |
2947 iCurrentLine ); |
2898 |
2948 |
2899 iExtension->iWasScrolling = ( iPhysics->OngoingPhysicsAction() != |
2949 iExtension->iWasScrolling = ( iPhysics->OngoingPhysicsAction() != |
2900 CAknPhysics::EAknPhysicsActionNone ); |
2950 CAknPhysics::EAknPhysicsActionNone ); |
2901 iPhysics->Stop(); |
2951 if(iExtension->iWasScrolling) |
|
2952 { |
|
2953 iPhysics->Stop(); |
|
2954 iExtension->Feedback( *this, ETouchFeedbackList ); |
|
2955 } |
2902 iExtension->iLastTouchedLine = touchedLine; |
2956 iExtension->iLastTouchedLine = touchedLine; |
2903 iExtension->iDragStartPosition = aPointerEvent.iPosition; |
2957 iExtension->iDragStartPosition = aPointerEvent.iPosition; |
2904 iExtension->iLastPointerPos = aPointerEvent.iPosition; |
2958 iExtension->iLastPointerPos = aPointerEvent.iPosition; |
2905 iExtension->iStartTime.HomeTime(); |
2959 iExtension->iStartTime.HomeTime(); |
2906 |
2960 |
3077 aPointerEvent.iType == TPointerEvent::EButton1Up && |
3131 aPointerEvent.iType == TPointerEvent::EButton1Up && |
3078 touchedLine == iCurrentLine && |
3132 touchedLine == iCurrentLine && |
3079 ( iExtension->iFocusedClicked || iExtension->iUsesSingleClick ) && |
3133 ( iExtension->iFocusedClicked || iExtension->iUsesSingleClick ) && |
3080 !iExtension->iScrolling ) |
3134 !iExtension->iScrolling ) |
3081 { |
3135 { |
3082 // Not need to sent key event when focus lost. |
3136 mskPress = ETrue; |
3083 CEikCaptionedControl* currentLine = (*iLines)[iCurrentLine]; |
|
3084 if ( currentLine->IsFocused() ) |
|
3085 { |
|
3086 mskPress = ETrue; |
|
3087 } |
|
3088 |
|
3089 callDefaultImplementation = EFalse; |
3137 callDefaultImplementation = EFalse; |
3090 } |
3138 } |
3091 if ( callDefaultImplementation && ( iExtension->iFocusedClicked || |
3139 if ( callDefaultImplementation && ( iExtension->iFocusedClicked || |
3092 iExtension->iUsesSingleClick ) && newLine && |
3140 iExtension->iUsesSingleClick ) && newLine && |
3093 !iExtension->iWasScrolling ) |
3141 !iExtension->iWasScrolling ) |
3301 // --------------------------------------------------------------------------- |
3349 // --------------------------------------------------------------------------- |
3302 // |
3350 // |
3303 void CEikDialogPage::UpdateLineInCache( CEikCaptionedControl* aLine ) |
3351 void CEikDialogPage::UpdateLineInCache( CEikCaptionedControl* aLine ) |
3304 { |
3352 { |
3305 _AKNTRACE_FUNC_ENTER; |
3353 _AKNTRACE_FUNC_ENTER; |
|
3354 |
|
3355 if ( !IsActivated() ) |
|
3356 { |
|
3357 _AKNTRACE_FUNC_EXIT; |
|
3358 return; |
|
3359 } |
|
3360 |
3306 TInt lineIndex = iLines->FindLineIndex( aLine ); |
3361 TInt lineIndex = iLines->FindLineIndex( aLine ); |
3307 |
3362 |
3308 if ( lineIndex != KErrNotFound ) |
3363 if ( lineIndex != KErrNotFound ) |
3309 { |
3364 { |
3310 if ( aLine->Position() != TPoint( 1000, 0 ) ) |
3365 if ( aLine->Position() != TPoint( 1000, 0 ) ) |