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( CEikDialogPage* aControl, TTouchLogicalFeedback aFeedback ) const; |
103 void Feedback( const CEikDialogPage& aControl, |
|
104 TTouchLogicalFeedback aFeedback ) const; |
|
105 |
103 /** |
106 /** |
104 * Produces vibra-only feedback. Event filtering by pointer event is used.. |
107 * Produces vibra-only feedback. |
|
108 * Event filtering by pointer event is used. |
105 */ |
109 */ |
106 void SilentFeedback( CEikDialogPage* aDPage, |
110 void SilentFeedback( const CEikDialogPage& aDPage, |
107 TTouchLogicalFeedback aFeedback, |
111 TTouchLogicalFeedback aFeedback, |
108 const TPointerEvent& aPointerEvent ) const; |
112 const TPointerEvent& aPointerEvent ) const; |
109 |
113 |
110 void HandleFormFeedback( CEikDialogPage* aControl, const TPointerEvent& aPointerEvent, TInt aTouchedLineIndex, TInt aCurrentLine ); |
114 /** |
|
115 * Produces feedback in cases where the captioned control itself |
|
116 * doesn't do it. |
|
117 */ |
|
118 void HandleFormFeedback( const CEikDialogPage& aDPage, |
|
119 const TPointerEvent& aPointerEvent, |
|
120 TInt aTouchedLineIndex, |
|
121 TInt aCurrentLine ); |
111 |
122 |
112 protected: |
123 protected: |
113 void ConstructL(); |
124 void ConstructL(); |
114 |
125 |
115 private: |
126 private: |
198 iHighlightTimer = CPeriodic::NewL( CActive::EPriorityStandard ); |
210 iHighlightTimer = CPeriodic::NewL( CActive::EPriorityStandard ); |
199 iCapturingItem = KErrNotFound; |
211 iCapturingItem = KErrNotFound; |
200 } |
212 } |
201 |
213 |
202 void CDialogPageExtension::HandleFormFeedback( |
214 void CDialogPageExtension::HandleFormFeedback( |
203 CEikDialogPage* aDPage, |
215 const CEikDialogPage& aDPage, |
204 const TPointerEvent& aPointerEvent, |
216 const TPointerEvent& aPointerEvent, |
205 TInt aTouchedLineIndex, |
217 TInt aTouchedLineIndex, |
206 TInt aCurrentLine ) |
218 TInt aCurrentLine ) |
207 { |
219 { |
208 // note, that iFormControl is checked in Feedback() |
220 CEikCaptionedControl* firstLine( aDPage.LineOnPageOrNull( 0 ) ); |
209 if ( aPointerEvent.iType == TPointerEvent::EButton1Down && |
221 |
210 aCurrentLine != aTouchedLineIndex && aDPage->LineOnPageOrNull( 0 ) ) |
222 if( aDPage.IsEditable() ) |
211 { |
223 { |
212 // feedback for edit/view mode form, when non-focused line is clicked |
224 // note, that iFormControl is checked in Feedback() |
213 // feedback for focused item is responsibility of the item |
225 if ( aPointerEvent.iType == TPointerEvent::EButton1Down && |
214 // no feedback with focus change when single click is enabled |
226 aCurrentLine != aTouchedLineIndex && |
215 if ( !iUsesSingleClick ) |
227 firstLine ) |
216 { |
228 { |
217 Feedback( aDPage, ETouchFeedbackSensitiveItem ); |
229 // feedback for edit mode form, when non-focused line is clicked |
218 } |
230 // feedback for focused item is responsibility of the item |
219 iFocusItemChanged = ETrue; |
231 // no feedback with focus change when single click is enabled |
220 } |
232 if ( !iUsesSingleClick ) |
221 |
233 { |
222 else if ( aPointerEvent.iType == TPointerEvent::EButton1Down && |
234 Feedback( aDPage, ETouchFeedbackSensitiveList ); |
223 aTouchedLineIndex == aCurrentLine && aDPage->LineOnPageOrNull( 0 ) ) |
235 } |
224 { |
236 iFocusItemChanged = ETrue; |
225 // Feedback for view mode form, when focused item is |
237 } |
226 // clicked. Basically same case as for msk simulation later on |
238 else if ( firstLine ) |
227 // the function, but on pointer |
239 { |
228 // down. iExtension->iFocusedClicked is not valid here, since |
240 if ( aPointerEvent.iType == TPointerEvent::EButton1Down && |
229 // it can't be known in this phase whether user drags pointer |
241 aTouchedLineIndex == aCurrentLine ) |
230 // away. |
242 { |
231 Feedback( aDPage, ETouchFeedbackBasicItem ); |
243 // Feedback for edit mode form, when focused item is |
232 iFocusItemChanged = EFalse; |
244 // clicked. Basically same case as for msk simulation later on |
233 } |
245 // the function, but on pointer |
234 |
246 // down. iExtension->iFocusedClicked is not valid here, since |
235 else if ( aPointerEvent.iType == TPointerEvent::EButton1Up && |
247 // it can't be known in this phase whether user drags pointer |
236 aDPage->LineOnPageOrNull( 0 ) ) |
248 // away. |
237 {// when focus changed, it should not send feedback on up event. |
249 Feedback( aDPage, ETouchFeedbackList ); |
238 //when up event comes, aTouchedLineIndex always equal to aCurrentLine |
250 iFocusItemChanged = EFalse; |
239 if ( !iFocusItemChanged ) |
251 } |
240 { |
252 else if ( aPointerEvent.iType == TPointerEvent::EButton1Up ) |
241 SilentFeedback( aDPage, ETouchFeedbackBasicItem, aPointerEvent ); |
253 { |
242 } |
254 // When focus changed, it should not send feedback on up event. |
243 } |
255 // When up event comes, aTouchedLineIndex always equal to |
244 } |
256 // aCurrentLine. |
245 |
257 if ( !iFocusItemChanged ) |
246 void CDialogPageExtension::Feedback( CEikDialogPage* aDPage, |
258 { |
|
259 SilentFeedback( aDPage, ETouchFeedbackList, aPointerEvent ); |
|
260 } |
|
261 } |
|
262 } |
|
263 } |
|
264 } |
|
265 |
|
266 |
|
267 void CDialogPageExtension::Feedback( const CEikDialogPage& aDPage, |
247 TTouchLogicalFeedback aFeedback ) const |
268 TTouchLogicalFeedback aFeedback ) const |
248 { |
269 { |
249 if ( aDPage |
270 if ( iFeedback && |
250 && aDPage->IsForm() |
271 aDPage.IsForm() && |
251 && iFeedback |
272 !aDPage.IsDimmed() && |
252 && !aDPage->IsDimmed() |
273 aDPage.IsVisible() ) |
253 && aDPage->IsVisible() ) |
|
254 { |
274 { |
255 iFeedback->InstantFeedback( aFeedback ); |
275 iFeedback->InstantFeedback( aFeedback ); |
256 } |
276 } |
257 } |
277 } |
258 |
278 |
259 void CDialogPageExtension::SilentFeedback( CEikDialogPage* aDPage, |
279 |
260 TTouchLogicalFeedback aFeedback, |
280 void CDialogPageExtension::SilentFeedback( |
261 const TPointerEvent& aPointerEvent ) const |
281 const CEikDialogPage& aDPage, |
262 { |
282 TTouchLogicalFeedback aFeedback, |
263 if ( aDPage |
283 const TPointerEvent& aPointerEvent ) const |
264 && aDPage->IsForm() |
284 { |
265 && iFeedback |
285 if ( iFeedback && |
266 && !aDPage->IsDimmed() |
286 aDPage.IsForm() && |
267 && aDPage->IsVisible() ) |
287 !aDPage.IsDimmed() && |
268 { |
288 aDPage.IsVisible() ) |
269 iFeedback->InstantFeedback( aDPage, aFeedback, ETouchFeedbackVibra, aPointerEvent ); |
289 { |
270 } |
290 iFeedback->InstantFeedback( &aDPage, |
271 } |
291 aFeedback, |
|
292 ETouchFeedbackVibra, |
|
293 aPointerEvent ); |
|
294 } |
|
295 } |
|
296 |
272 |
297 |
273 class CAknPaneScroll : public CBase |
298 class CAknPaneScroll : public CBase |
274 { |
299 { |
275 public: |
300 public: |
276 enum TScrollChangeType |
301 enum TScrollChangeType |
330 // CEikDialogPage. |
355 // CEikDialogPage. |
331 // |
356 // |
332 |
357 |
333 CEikDialogPage::~CEikDialogPage() |
358 CEikDialogPage::~CEikDialogPage() |
334 { |
359 { |
|
360 _AKNTRACE_FUNC_ENTER; |
335 AKNTASHOOK_REMOVE(); |
361 AKNTASHOOK_REMOVE(); |
336 // Page observer needs to be nulled or an already deleted instance is |
362 // Page observer needs to be nulled or an already deleted instance is |
337 // called when pointer up event is handled. This is valid only for dialogs |
363 // called when pointer up event is handled. This is valid only for dialogs |
338 // that have embedded virtual inputs. |
364 // that have embedded virtual inputs. |
339 iPageObserver = NULL; |
365 iPageObserver = NULL; |
340 delete iPhysics; |
366 delete iPhysics; |
341 delete iLines; |
367 delete iLines; |
342 delete iScroll; |
368 delete iScroll; |
343 delete iExtension; |
369 delete iExtension; |
|
370 _AKNTRACE_FUNC_EXIT; |
344 } |
371 } |
345 |
372 |
346 CEikDialogPage* CEikDialogPage::NewL(TInt aPageId,RWindow& aViewWin,CEikScrollBarFrame& aSBFrame,const CEikDialogPageContainer& aParent,MEikDialogPageObserver* aPageObserver) |
373 CEikDialogPage* CEikDialogPage::NewL(TInt aPageId,RWindow& aViewWin,CEikScrollBarFrame& aSBFrame,const CEikDialogPageContainer& aParent,MEikDialogPageObserver* aPageObserver) |
347 { |
374 { |
|
375 _AKNTRACE_FUNC_ENTER; |
348 CEikDialogPage* self=CEikDialogPage::NewLC(aPageId,aViewWin,aSBFrame,aParent,aPageObserver); |
376 CEikDialogPage* self=CEikDialogPage::NewLC(aPageId,aViewWin,aSBFrame,aParent,aPageObserver); |
349 CleanupStack::Pop(); |
377 CleanupStack::Pop(); |
|
378 _AKNTRACE_FUNC_EXIT; |
350 return self; |
379 return self; |
351 } |
380 } |
352 |
381 |
353 void CEikDialogPage::CommonConstructCodeBetweenNewL(CEikDialogPage& aDialogPage, const CEikDialogPageContainer& aParent) |
382 void CEikDialogPage::CommonConstructCodeBetweenNewL(CEikDialogPage& aDialogPage, const CEikDialogPageContainer& aParent) |
354 { |
383 { |
362 aDialogPage.CopyControlContextFrom(&aParent); |
391 aDialogPage.CopyControlContextFrom(&aParent); |
363 }; |
392 }; |
364 |
393 |
365 CEikDialogPage* CEikDialogPage::NewLC(TInt aPageId,RWindow& aViewWin,CEikScrollBarFrame& aSBFrame,const CEikDialogPageContainer& aParent,MEikDialogPageObserver* aPageObserver) |
394 CEikDialogPage* CEikDialogPage::NewLC(TInt aPageId,RWindow& aViewWin,CEikScrollBarFrame& aSBFrame,const CEikDialogPageContainer& aParent,MEikDialogPageObserver* aPageObserver) |
366 { |
395 { |
|
396 _AKNTRACE_FUNC_ENTER; |
367 CEikDialogPage* self=new(ELeave) CEikDialogPage(aPageId,aViewWin,aSBFrame,aPageObserver); |
397 CEikDialogPage* self=new(ELeave) CEikDialogPage(aPageId,aViewWin,aSBFrame,aPageObserver); |
368 CleanupStack::PushL(self); |
398 CleanupStack::PushL(self); |
369 CommonConstructCodeBetweenNewL(*self,aParent); |
399 CommonConstructCodeBetweenNewL(*self,aParent); |
370 AKNTASHOOK_ADDL( self, "CEikDialogPage" ); |
400 AKNTASHOOK_ADDL( self, "CEikDialogPage" ); |
|
401 _AKNTRACE_FUNC_EXIT; |
371 return self; |
402 return self; |
372 } |
403 } |
373 |
404 |
374 CEikDialogPage* CEikDialogPage::NewL(TInt aPageId,RWindow& aViewWin,CEikScrollBarFrame& aSBFrame,const CEikDialogPageContainer& aParent,MEikDialogPageObserver* aPageObserver,TResourceReader& aReader) |
405 CEikDialogPage* CEikDialogPage::NewL(TInt aPageId,RWindow& aViewWin,CEikScrollBarFrame& aSBFrame,const CEikDialogPageContainer& aParent,MEikDialogPageObserver* aPageObserver,TResourceReader& aReader) |
375 { |
406 { |
|
407 _AKNTRACE_FUNC_ENTER; |
376 CEikDialogPage* self=CEikDialogPage::NewLC(aPageId,aViewWin,aSBFrame,aParent,aPageObserver,aReader); |
408 CEikDialogPage* self=CEikDialogPage::NewLC(aPageId,aViewWin,aSBFrame,aParent,aPageObserver,aReader); |
377 CleanupStack::Pop(); |
409 CleanupStack::Pop(); |
|
410 _AKNTRACE_FUNC_EXIT; |
378 return self; |
411 return self; |
379 } |
412 } |
380 |
413 |
381 CEikDialogPage* CEikDialogPage::NewLC(TInt aPageId,RWindow& aViewWin,CEikScrollBarFrame& aSBFrame,const CEikDialogPageContainer& aParent,MEikDialogPageObserver* aPageObserver,TResourceReader& aReader) |
414 CEikDialogPage* CEikDialogPage::NewLC(TInt aPageId,RWindow& aViewWin,CEikScrollBarFrame& aSBFrame,const CEikDialogPageContainer& aParent,MEikDialogPageObserver* aPageObserver,TResourceReader& aReader) |
382 { |
415 { |
|
416 _AKNTRACE_FUNC_ENTER; |
383 CEikDialogPage* self=new(ELeave) CEikDialogPage(aPageId,aViewWin,aSBFrame,aPageObserver); |
417 CEikDialogPage* self=new(ELeave) CEikDialogPage(aPageId,aViewWin,aSBFrame,aPageObserver); |
384 CleanupStack::PushL(self); |
418 CleanupStack::PushL(self); |
385 CommonConstructCodeBetweenNewL(*self,aParent); |
419 CommonConstructCodeBetweenNewL(*self,aParent); |
386 self->ConstructFromResourceL(aReader); |
420 self->ConstructFromResourceL(aReader); |
387 AKNTASHOOK_ADDL( self, "CEikDialogPage" ); |
421 AKNTASHOOK_ADDL( self, "CEikDialogPage" ); |
|
422 _AKNTRACE_FUNC_EXIT; |
388 return self; |
423 return self; |
389 } |
424 } |
390 |
425 |
391 CEikDialogPage::CEikDialogPage(TInt aPageId,RWindow& /*aViewWin*/, |
426 CEikDialogPage::CEikDialogPage(TInt aPageId,RWindow& /*aViewWin*/, |
392 CEikScrollBarFrame& /*aSBFrame*/,MEikDialogPageObserver* aPageObserver) |
427 CEikScrollBarFrame& /*aSBFrame*/,MEikDialogPageObserver* aPageObserver) |
393 : iPageObserver(aPageObserver), |
428 : iPageObserver(aPageObserver), |
394 iPageId(aPageId),iCurrentLine(-1) |
429 iPageId(aPageId),iCurrentLine(-1) |
395 { |
430 { |
|
431 _AKNTRACE_FUNC_ENTER; |
396 SetBlank(); |
432 SetBlank(); |
397 SetComponentsToInheritVisibility(); |
433 SetComponentsToInheritVisibility(); |
|
434 _AKNTRACE_FUNC_EXIT; |
398 } |
435 } |
399 |
436 |
400 void CEikDialogPage::ConstructL() |
437 void CEikDialogPage::ConstructL() |
401 { |
438 { |
|
439 _AKNTRACE_FUNC_ENTER; |
402 iLines=new(ELeave)CEikCapCArray(KLineArrayGranularity); |
440 iLines=new(ELeave)CEikCapCArray(KLineArrayGranularity); |
403 SetContainerWindowL( *iPageContainer ); |
441 SetContainerWindowL( *iPageContainer ); |
404 Window().SetPointerGrab(ETrue); |
442 Window().SetPointerGrab(ETrue); |
405 Window().SetShadowDisabled(ETrue); |
443 Window().SetShadowDisabled(ETrue); |
406 Window().SetBackgroundColor(iEikonEnv->ControlColor(EColorDialogBackground,*this)); |
444 Window().SetBackgroundColor(iEikonEnv->ControlColor(EColorDialogBackground,*this)); |
407 iScroll = new(ELeave)CAknPaneScroll(this); |
445 iScroll = new(ELeave)CAknPaneScroll(this); |
408 iScroll->SetLines(iLines); |
446 iScroll->SetLines(iLines); |
409 iExtension = CDialogPageExtension::NewL(); |
447 iExtension = CDialogPageExtension::NewL(); |
|
448 _AKNTRACE_FUNC_EXIT; |
410 } |
449 } |
411 |
450 |
412 void CEikDialogPage::ConstructFromResourceL(TResourceReader& aReader, TBool aFormControl ) |
451 void CEikDialogPage::ConstructFromResourceL(TResourceReader& aReader, TBool aFormControl ) |
413 { |
452 { |
|
453 _AKNTRACE_FUNC_ENTER; |
414 iFormControl = aFormControl ; |
454 iFormControl = aFormControl ; |
415 |
455 |
416 if ( IsForm() ) |
456 if ( IsForm() ) |
417 { |
457 { |
418 if ( iAvkonAppUi ) |
458 if ( iAvkonAppUi ) |
466 if (!iScroll) |
506 if (!iScroll) |
467 { |
507 { |
468 iScroll = new(ELeave)CAknPaneScroll(this); |
508 iScroll = new(ELeave)CAknPaneScroll(this); |
469 } |
509 } |
470 iScroll->SetLines(iLines); |
510 iScroll->SetLines(iLines); |
|
511 _AKNTRACE_FUNC_EXIT; |
471 } |
512 } |
472 |
513 |
473 void CEikDialogPage::ConstructFormFromResourceL( TResourceReader& aReader ) |
514 void CEikDialogPage::ConstructFormFromResourceL( TResourceReader& aReader ) |
474 { |
515 { |
|
516 _AKNTRACE_FUNC_ENTER; |
475 iFormFlags = TInt16(aReader.ReadInt16()) ; |
517 iFormFlags = TInt16(aReader.ReadInt16()) ; |
476 iFormLayout = (iFormFlags&EEikFormUseDoubleSpacedFormat) ? EDouble : ESingle; |
518 iFormLayout = (iFormFlags&EEikFormUseDoubleSpacedFormat) ? EDouble : ESingle; |
477 ConstructFromResourceL( aReader, ETrue ) ; |
519 ConstructFromResourceL( aReader, ETrue ) ; |
|
520 _AKNTRACE_FUNC_EXIT; |
478 } |
521 } |
479 |
522 |
480 CCoeControl* CEikDialogPage::CreateLineByTypeL(const TDesC& aCaption,TInt aLineId,TInt aControlType,TAny* aReturnValue) |
523 CCoeControl* CEikDialogPage::CreateLineByTypeL(const TDesC& aCaption,TInt aLineId,TInt aControlType,TAny* aReturnValue) |
481 { |
524 { |
|
525 _AKNTRACE_FUNC_ENTER; |
482 ShowFocus( EFalse, EFalse ) ; // Turn the focus off the current line. |
526 ShowFocus( EFalse, EFalse ) ; // Turn the focus off the current line. |
483 CEikCaptionedControl* line=new(ELeave) CEikCaptionedControl; |
527 CEikCaptionedControl* line=new(ELeave) CEikCaptionedControl; |
484 CleanupStack::PushL(line); |
528 CleanupStack::PushL(line); |
485 line->SetComponentsToInheritVisibility(); |
529 line->SetComponentsToInheritVisibility(); |
486 // Try to insert line above the currently selected line. If no line is currently selected then append (TimW 22/5/00) |
530 // Try to insert line above the currently selected line. If no line is currently selected then append (TimW 22/5/00) |
512 |
556 |
513 ChangeFocusTo( targetLine ); |
557 ChangeFocusTo( targetLine ); |
514 |
558 |
515 // physics engine needs to be updated when lines are added after the initial layout |
559 // physics engine needs to be updated when lines are added after the initial layout |
516 UpdatePhysics(); |
560 UpdatePhysics(); |
517 |
561 _AKNTRACE_FUNC_EXIT; |
518 return line->iControl; |
562 return line->iControl; |
519 } |
563 } |
520 |
564 |
521 CEikCaptionedControl* CEikDialogPage::ConstructLineL(TInt aResourceId) |
565 CEikCaptionedControl* CEikDialogPage::ConstructLineL(TInt aResourceId) |
522 { |
566 { |
|
567 _AKNTRACE_FUNC_ENTER; |
523 TResourceReader resourceReader; |
568 TResourceReader resourceReader; |
524 iCoeEnv->CreateResourceReaderLC(resourceReader,aResourceId); |
569 iCoeEnv->CreateResourceReaderLC(resourceReader,aResourceId); |
525 CEikCaptionedControl* line=ConstructLineL(resourceReader); |
570 CEikCaptionedControl* line=ConstructLineL(resourceReader); |
526 CleanupStack::PopAndDestroy(); // resourceReader |
571 CleanupStack::PopAndDestroy(); // resourceReader |
|
572 _AKNTRACE_FUNC_EXIT; |
527 return line; |
573 return line; |
528 } |
574 } |
529 |
575 |
530 CEikCaptionedControl* CEikDialogPage::ConstructLineL(TResourceReader& aReader) |
576 CEikCaptionedControl* CEikDialogPage::ConstructLineL(TResourceReader& aReader) |
531 { |
577 { |
|
578 _AKNTRACE_FUNC_ENTER; |
532 CEikCaptionedControl* line=new(ELeave) CEikCaptionedControl; |
579 CEikCaptionedControl* line=new(ELeave) CEikCaptionedControl; |
533 CleanupStack::PushL(line); |
580 CleanupStack::PushL(line); |
534 line->iIsFormControl=iFormControl; |
581 line->iIsFormControl=iFormControl; |
535 line->SetComponentsToInheritVisibility(); |
582 line->SetComponentsToInheritVisibility(); |
536 TInt controlType=aReader.ReadInt16(); |
583 TInt controlType=aReader.ReadInt16(); |
548 ConstructByTypeL(controlType,line,this); |
595 ConstructByTypeL(controlType,line,this); |
549 line->ConstructFromResourceL(*reader); |
596 line->ConstructFromResourceL(*reader); |
550 if (indirectRid) |
597 if (indirectRid) |
551 CleanupStack::PopAndDestroy(); |
598 CleanupStack::PopAndDestroy(); |
552 CleanupStack::Pop(); // line |
599 CleanupStack::Pop(); // line |
|
600 _AKNTRACE_FUNC_EXIT; |
553 return line; |
601 return line; |
554 } |
602 } |
555 |
603 |
556 void CEikDialogPage::ConstructByTypeL(TInt aType,CEikCaptionedControl* aLine,CCoeControl* aContainer) |
604 void CEikDialogPage::ConstructByTypeL(TInt aType,CEikCaptionedControl* aLine,CCoeControl* aContainer) |
557 { |
605 { |
|
606 _AKNTRACE_FUNC_ENTER; |
558 SEikControlInfo controlInfo=EikControlFactory::CreateByTypeL(aType); |
607 SEikControlInfo controlInfo=EikControlFactory::CreateByTypeL(aType); |
559 if (!controlInfo.iControl) |
608 if (!controlInfo.iControl) |
560 controlInfo=CreateCustomControlL(aType); |
609 controlInfo=CreateCustomControlL(aType); |
561 aLine->iIsFormControl=iFormControl; |
610 aLine->iIsFormControl=iFormControl; |
562 aLine->iControl=controlInfo.iControl; |
611 aLine->iControl=controlInfo.iControl; |
631 AknsUtils::RegisterControlPosition(capCtrl->iCaption); |
682 AknsUtils::RegisterControlPosition(capCtrl->iCaption); |
632 AknsUtils::RegisterControlPosition(capCtrl->iControl); |
683 AknsUtils::RegisterControlPosition(capCtrl->iControl); |
633 AknsUtils::RegisterControlPosition(capCtrl->iTrailer); |
684 AknsUtils::RegisterControlPosition(capCtrl->iTrailer); |
634 AknsUtils::RegisterControlPosition(capCtrl->iBitmap); |
685 AknsUtils::RegisterControlPosition(capCtrl->iBitmap); |
635 |
686 |
636 if ( capCtrl->iIsFormControl && iCurrentLine != i) |
687 if ( capCtrl->iIsFormControl && iCurrentLine != i) |
637 { |
688 { |
638 |
689 if (capCtrl->ControlIsAnEdwin(capCtrl->iControlType)) |
639 if (capCtrl->ControlIsAnEdwin(capCtrl->iControlType)) |
690 { |
640 { |
691 CEikEdwin *edwin = (CEikEdwin*)capCtrl->iControl; |
641 CEikEdwin *edwin = (CEikEdwin*)capCtrl->iControl; |
692 TRAP_IGNORE( edwin->TextView()->SetDocPosL( 0 ) ); |
642 TRAP_IGNORE(edwin->TextView()->SetDocPosL(0) |
693 } |
643 ); |
694 } |
644 } |
695 } |
645 } |
696 |
646 |
697 _AKNTRACE_FUNC_EXIT; |
647 } |
|
648 } |
698 } |
649 |
699 |
650 void CEikDialogPage::SetActiveAndFocusL() |
700 void CEikDialogPage::SetActiveAndFocusL() |
651 { |
701 { |
|
702 _AKNTRACE_FUNC_ENTER; |
652 SetActiveL(); |
703 SetActiveL(); |
653 SetEditableL(iIsEditable, ETrue); |
704 SetEditableL(iIsEditable, ETrue); |
654 //When active a page, need to show the focus in that page. |
705 //When active a page, need to show the focus in that page. |
655 ShowFocus( ETrue, EFalse ) ; |
706 ShowFocus( ETrue, EFalse ) ; |
656 // Display the focus on the current line |
707 // Display the focus on the current line |
706 return KErrNotFound; |
762 return KErrNotFound; |
707 } |
763 } |
708 |
764 |
709 TBool CEikDialogPage::SetInitialFocus() |
765 TBool CEikDialogPage::SetInitialFocus() |
710 { |
766 { |
|
767 _AKNTRACE_FUNC_ENTER; |
711 TBool focusSet=EFalse; |
768 TBool focusSet=EFalse; |
712 |
769 |
713 const TInt numLines=iLines->Count(); |
770 const TInt numLines=iLines->Count(); |
714 for (TInt ii=0;ii<numLines;ii++) |
771 for (TInt ii=0;ii<numLines;ii++) |
715 { |
772 { |
716 CEikCaptionedControl* line=(*iLines)[ii]; |
773 CEikCaptionedControl* line=(*iLines)[ii]; |
717 if (line->IsNonFocusing() || line->IsDimmed() || !(line->IsVisible())) |
774 if (line->IsNonFocusing() || line->IsDimmed() || !(line->IsVisible())) |
718 continue; |
775 continue; |
719 ChangeFocusTo(ii); |
776 ChangeFocusTo(ii); |
720 focusSet=ETrue; |
777 focusSet=ETrue; |
721 |
|
722 if ( IsForm() ) |
|
723 { |
|
724 // move line with initial focus to the screen |
|
725 iLines->MoveLineToScreen( ii, iPhysics->ViewTopY(), ETrue ); |
|
726 } |
|
727 break; |
778 break; |
728 } |
779 } |
729 |
780 iExtension->iSetInitialFocusDone = ETrue; |
|
781 _AKNTRACE( "return focusSet;: [%d]", focusSet ); |
|
782 _AKNTRACE_FUNC_EXIT; |
730 return focusSet; |
783 return focusSet; |
731 } |
784 } |
732 |
785 |
733 TKeyResponse CEikDialogPage::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) |
786 TKeyResponse CEikDialogPage::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) |
734 { |
787 { |
|
788 _AKNTRACE_FUNC_ENTER; |
735 TKeyResponse response=EKeyWasNotConsumed; |
789 TKeyResponse response=EKeyWasNotConsumed; |
736 |
790 |
737 if (!(PageContainer()->PageSelector()->Dialg()->DialogFlags() & EEikDialogFlagDontEatUpDownEvents)) |
791 if (!(PageContainer()->PageSelector()->Dialg()->DialogFlags() & EEikDialogFlagDontEatUpDownEvents)) |
738 { |
792 { |
739 if (aType != EEventKey) |
793 if (aType != EEventKey) |
740 return response; |
794 { |
|
795 _AKNTRACE_FUNC_EXIT; |
|
796 return response; |
|
797 } |
741 } |
798 } |
742 |
799 |
743 const TInt numLines=iLines->Count(); |
800 const TInt numLines=iLines->Count(); |
744 if ((iCurrentLine>-1)&&(iCurrentLine<numLines)) |
801 if ((iCurrentLine>-1)&&(iCurrentLine<numLines)) |
745 { |
802 { |
759 || aKeyEvent.iCode==EKeyTab |
816 || aKeyEvent.iCode==EKeyTab |
760 || aKeyEvent.iCode==EKeyNext |
817 || aKeyEvent.iCode==EKeyNext |
761 || aKeyEvent.iCode==EKeyPrevious |
818 || aKeyEvent.iCode==EKeyPrevious |
762 )) |
819 )) |
763 response=OfferUpDownKeyEventL(aKeyEvent,aType,ENonCyclic); |
820 response=OfferUpDownKeyEventL(aKeyEvent,aType,ENonCyclic); |
|
821 _AKNTRACE_FUNC_EXIT; |
764 return response; |
822 return response; |
765 } |
823 } |
766 |
824 |
767 TKeyResponse CEikDialogPage::OfferUpDownKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType,TFocusNavigationMode aFocusNavigationMode) |
825 TKeyResponse CEikDialogPage::OfferUpDownKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType,TFocusNavigationMode aFocusNavigationMode) |
768 { |
826 { |
|
827 _AKNTRACE_FUNC_ENTER; |
769 TKeyResponse response=EKeyWasNotConsumed; |
828 TKeyResponse response=EKeyWasNotConsumed; |
770 if (aType==EEventKey) |
829 if (aType==EEventKey) |
771 { |
830 { |
772 const TInt numLines=iLines->Count(); |
831 const TInt numLines=iLines->Count(); |
773 if ((iCurrentLine>-1)&&(iCurrentLine<numLines)) |
832 if ((iCurrentLine>-1)&&(iCurrentLine<numLines)) |
929 return ownsLine; |
986 return ownsLine; |
930 } |
987 } |
931 |
988 |
932 void CEikDialogPage::SetDimmed(TBool aDimmed) |
989 void CEikDialogPage::SetDimmed(TBool aDimmed) |
933 { |
990 { |
|
991 _AKNTRACE_FUNC_ENTER; |
934 CCoeControl::SetDimmed(aDimmed); |
992 CCoeControl::SetDimmed(aDimmed); |
935 |
993 |
936 const TInt numLines=iLines->Count(); |
994 const TInt numLines=iLines->Count(); |
937 for (TInt ii=0;ii<numLines;ii++) |
995 for (TInt ii=0;ii<numLines;ii++) |
938 { |
996 { |
939 CEikCaptionedControl* thisLine=(*iLines)[ii]; |
997 CEikCaptionedControl* thisLine=(*iLines)[ii]; |
940 thisLine->iControl->SetDimmed(aDimmed); |
998 thisLine->iControl->SetDimmed(aDimmed); |
941 thisLine->CheckDimmedDisplayState(); |
999 thisLine->CheckDimmedDisplayState(); |
942 } |
1000 } |
|
1001 _AKNTRACE_FUNC_EXIT; |
943 } |
1002 } |
944 |
1003 |
945 TBool CEikDialogPage::RotateFocusByL(TInt aDelta) |
1004 TBool CEikDialogPage::RotateFocusByL(TInt aDelta) |
946 { |
1005 { |
|
1006 _AKNTRACE_FUNC_ENTER; |
947 TInt numLines=iLines->Count(); |
1007 TInt numLines=iLines->Count(); |
948 if (numLines == 0) |
1008 if (numLines == 0) |
|
1009 { |
|
1010 _AKNTRACE_FUNC_EXIT; |
949 return(EFalse); |
1011 return(EFalse); |
|
1012 } |
950 |
1013 |
951 // If form is in view mode and highlight is hidden then the first |
1014 // If form is in view mode and highlight is hidden then the first |
952 // navigation key press just displays the highlight. |
1015 // navigation key press just displays the highlight. |
953 if ( IsForm() && !IsEditable() && !HighlightVisible() ) |
1016 if ( IsForm() && !IsEditable() && !HighlightVisible() ) |
954 { |
1017 { |
997 continue; |
1060 continue; |
998 |
1061 |
999 ChangeFocusToAndExposeL(currentLine); |
1062 ChangeFocusToAndExposeL(currentLine); |
1000 LineChangedL((*iLines)[currentLine]->iId); |
1063 LineChangedL((*iLines)[currentLine]->iId); |
1001 iExtension->iFocusedClicked = ETrue; |
1064 iExtension->iFocusedClicked = ETrue; |
|
1065 _AKNTRACE_FUNC_EXIT; |
1002 return(ETrue); |
1066 return(ETrue); |
1003 } |
1067 } |
1004 |
1068 _AKNTRACE_FUNC_EXIT; |
1005 return EFalse; |
1069 return EFalse; |
1006 } |
1070 } |
1007 |
1071 |
1008 void CEikDialogPage::ChangeFocusToAndExposeL( TInt aLine, TBool /*aShowWholeControl*/ ) |
1072 void CEikDialogPage::ChangeFocusToAndExposeL( TInt aLine, TBool /*aShowWholeControl*/ ) |
1009 { |
1073 { |
|
1074 _AKNTRACE_FUNC_ENTER; |
|
1075 _AKNTRACE( "CEikDialogPage::ChangeFocusToAndExposeL() aLine: [%d]", aLine ); |
1010 if ( aLine < 0 || aLine == iCurrentLine ) |
1076 if ( aLine < 0 || aLine == iCurrentLine ) |
|
1077 { |
|
1078 _AKNTRACE_FUNC_EXIT; |
1011 return; |
1079 return; |
|
1080 } |
1012 |
1081 |
1013 TInt oldLine = iCurrentLine; |
1082 TInt oldLine = iCurrentLine; |
1014 |
1083 |
1015 if( aLine != iCurrentLine ) |
1084 if( aLine != iCurrentLine ) |
1016 (*iLines)[iCurrentLine]->ScrollBackEditor(); |
1085 (*iLines)[iCurrentLine]->ScrollBackEditorL(); |
1017 |
1086 |
1018 ChangeFocusTo( aLine ); |
1087 ChangeFocusTo( aLine ); |
1019 ExposeLine( iCurrentLine, EFalse ); |
1088 ExposeLine( iCurrentLine, EFalse ); |
1020 |
1089 |
1021 if ( oldLine != iCurrentLine ) |
1090 if ( oldLine != iCurrentLine ) |
1057 return KErrNotFound; |
1127 return KErrNotFound; |
1058 } |
1128 } |
1059 |
1129 |
1060 TBool CEikDialogPage::LineIsFocusable(TInt aLine) const |
1130 TBool CEikDialogPage::LineIsFocusable(TInt aLine) const |
1061 { |
1131 { |
|
1132 _AKNTRACE_FUNC_ENTER; |
1062 TBool focusable(ETrue); |
1133 TBool focusable(ETrue); |
1063 CEikCaptionedControl* line=(*iLines)[aLine]; |
1134 CEikCaptionedControl* line=(*iLines)[aLine]; |
1064 |
1135 |
1065 if (line->IsNonFocusing() || line->IsDimmed() || !(line->IsVisible())) |
1136 if (line->IsNonFocusing() || line->IsDimmed() || !(line->IsVisible())) |
1066 focusable=EFalse; |
1137 focusable=EFalse; |
1067 |
1138 _AKNTRACE( "focusable: [%d]", focusable ); |
|
1139 _AKNTRACE_FUNC_EXIT; |
1068 return focusable; |
1140 return focusable; |
1069 } |
1141 } |
1070 |
1142 |
1071 void CEikDialogPage::SetDensePacking(TBool aDensePacking) |
1143 void CEikDialogPage::SetDensePacking(TBool aDensePacking) |
1072 { |
1144 { |
1073 iLines->SetDensePacking(aDensePacking); |
1145 iLines->SetDensePacking(aDensePacking); |
1074 } |
1146 } |
1075 |
1147 |
1076 void CEikDialogPage::InsertLineL(TInt aPosition,TInt aResourceId) |
1148 void CEikDialogPage::InsertLineL(TInt aPosition,TInt aResourceId) |
1077 { |
1149 { |
|
1150 _AKNTRACE_FUNC_ENTER; |
|
1151 _AKNTRACE( "aPosition: [%d]", aPosition ); |
1078 // alteration is bloated but should not provide any side-effects. |
1152 // alteration is bloated but should not provide any side-effects. |
1079 if (!iFormControl) |
1153 if (!iFormControl) |
1080 { |
1154 { |
1081 CEikCaptionedControl* line=ConstructLineL(aResourceId); |
1155 CEikCaptionedControl* line=ConstructLineL(aResourceId); |
1082 CleanupStack::PushL(line); |
1156 CleanupStack::PushL(line); |
1096 iCurrentLine should be increased as it is relative to the lines in that page |
1170 iCurrentLine should be increased as it is relative to the lines in that page |
1097 and we have just added a new line before it in the page. |
1171 and we have just added a new line before it in the page. |
1098 */ |
1172 */ |
1099 if (iCurrentLine>=aPosition) |
1173 if (iCurrentLine>=aPosition) |
1100 iCurrentLine++; |
1174 iCurrentLine++; |
|
1175 _AKNTRACE_FUNC_EXIT; |
1101 } |
1176 } |
1102 |
1177 |
1103 void CEikDialogPage::DeleteLine(TInt aLineId, TBool aRedraw) |
1178 void CEikDialogPage::DeleteLine(TInt aLineId, TBool aRedraw) |
1104 { |
1179 { |
|
1180 _AKNTRACE_FUNC_ENTER; |
1105 TInt index( LineIndex( aLineId ) ) ; |
1181 TInt index( LineIndex( aLineId ) ) ; |
|
1182 _AKNTRACE( "Delete line index: [%d]", index ); |
1106 if ( index == iCurrentLine ) // we're deleting the current line |
1183 if ( index == iCurrentLine ) // we're deleting the current line |
1107 { |
1184 { |
1108 // If this is the last line then move the focus to the line above. (becomes -1 if last line) |
1185 // If this is the last line then move the focus to the line above. (becomes -1 if last line) |
1109 if( iCurrentLine == iLines->Count() - 1 ) |
1186 if( iCurrentLine == iLines->Count() - 1 ) |
1110 iCurrentLine-- ; |
1187 iCurrentLine-- ; |
1143 if (iCurrentLine!=-1) |
1220 if (iCurrentLine!=-1) |
1144 { |
1221 { |
1145 TInt targetLine = iCurrentLine ; |
1222 TInt targetLine = iCurrentLine ; |
1146 iCurrentLine = -1 ; |
1223 iCurrentLine = -1 ; |
1147 ChangeFocusTo( targetLine ) ; |
1224 ChangeFocusTo( targetLine ) ; |
1148 ExposeLine( targetLine, EFalse ) ; |
1225 ExposeLine( targetLine, ETrue ) ; |
1149 ShowFocus( ETrue, EFalse ) ; |
1226 ShowFocus( ETrue, EFalse ) ; |
1150 } |
1227 } |
1151 |
1228 |
1152 DrawNow(); |
1229 DrawNow(); |
1153 TRAP_IGNORE(UpdateScrollBarL()); // if OOM, scrollbar will not be updated - No great loss. |
1230 TRAP_IGNORE(UpdateScrollBarL()); // if OOM, scrollbar will not be updated - No great loss. |
1154 } |
1231 } |
|
1232 _AKNTRACE_FUNC_EXIT; |
1155 } |
1233 } |
1156 |
1234 |
1157 void CEikDialogPage::AdjustAllIds(TInt aControlIdDelta) |
1235 void CEikDialogPage::AdjustAllIds(TInt aControlIdDelta) |
1158 { |
1236 { |
1159 iLines->AdjustAllIds(aControlIdDelta); |
1237 iLines->AdjustAllIds(aControlIdDelta); |
1160 } |
1238 } |
1161 |
1239 |
1162 TInt CEikDialogPage::FocusLineL(TInt aLineId) |
1240 TInt CEikDialogPage::FocusLineL(TInt aLineId) |
1163 { |
1241 { |
|
1242 _AKNTRACE_FUNC_ENTER; |
1164 TInt lineIndex=LineIndex(aLineId); |
1243 TInt lineIndex=LineIndex(aLineId); |
1165 |
1244 _AKNTRACE( "Delete line index: [%d]", lineIndex ); |
1166 if (lineIndex==KErrNotFound) |
1245 if (lineIndex==KErrNotFound) |
1167 return KErrNotFound; |
1246 return KErrNotFound; |
1168 |
1247 |
1169 PrepareForFocusTransitionL(); |
1248 PrepareForFocusTransitionL(); |
1170 // Show whole line, not scroll into line. |
1249 // Show whole line, not scroll into line. |
1171 ChangeFocusToAndExposeL(lineIndex, ETrue); |
1250 ChangeFocusToAndExposeL(lineIndex, ETrue); |
1172 LineChangedL(aLineId); |
1251 LineChangedL(aLineId); |
|
1252 _AKNTRACE_FUNC_EXIT; |
1173 return KErrNone; |
1253 return KErrNone; |
1174 } |
1254 } |
1175 |
1255 |
1176 TInt CEikDialogPage::FocusedLineId() const |
1256 TInt CEikDialogPage::FocusedLineId() const |
1177 { |
1257 { |
1246 } |
1326 } |
1247 |
1327 |
1248 return KErrNotFound; |
1328 return KErrNotFound; |
1249 } |
1329 } |
1250 |
1330 |
1251 TInt CEikDialogPage::YPosToLine2(TInt aYPos) const |
|
1252 { |
|
1253 return iLines->YPosToLine( Rect(), iScroll->Top(), iScroll->Middle(), iScroll->Bottom(), aYPos ); |
|
1254 } |
|
1255 |
|
1256 TInt CEikDialogPage::LineToYPos(TInt& aLine) const |
|
1257 // |
|
1258 // Calcs YPos of line relative to the ViewWin and adjusts aLine if its out of bounds |
|
1259 { |
|
1260 ASSERT(iLines); |
|
1261 const TInt numLines=iLines->Count(); |
|
1262 ASSERT(numLines>0); |
|
1263 if (aLine<0) |
|
1264 aLine=0; |
|
1265 else if (aLine>=numLines) |
|
1266 aLine=numLines-1; |
|
1267 return (*iLines)[aLine]->Position().iY; // TPREMOVAL +iDataWinPos.iY; |
|
1268 } |
|
1269 |
1331 |
1270 void CEikDialogPage::ExposeLine(TInt aLine, TBool aForceResize, TBool aShowWholeLine) |
1332 void CEikDialogPage::ExposeLine(TInt aLine, TBool aForceResize, TBool aShowWholeLine) |
1271 // |
1333 // |
1272 /* 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 |
1273 */ { |
1335 */ { |
|
1336 _AKNTRACE_FUNC_ENTER; |
1274 if ( iSize.iHeight == 0 || aLine == -1 ) |
1337 if ( iSize.iHeight == 0 || aLine == -1 ) |
1275 { |
1338 { |
|
1339 _AKNTRACE_FUNC_EXIT; |
1276 return; |
1340 return; |
1277 } |
1341 } |
1278 |
1342 |
1279 CAknPaneScroll::TScrollChangeType change = iScroll->ExposeLine( aLine, aShowWholeLine ); |
1343 CAknPaneScroll::TScrollChangeType change = iScroll->ExposeLine( aLine, aShowWholeLine ); |
1280 |
1344 |
1281 if ( change == CAknPaneScroll::ENoChange && !aForceResize ) |
1345 if ( change == CAknPaneScroll::ENoChange && !aForceResize ) |
1282 { |
1346 { |
|
1347 _AKNTRACE_FUNC_EXIT; |
1283 return; |
1348 return; |
1284 } |
1349 } |
1285 |
1350 |
1286 CEikCaptionedControl* capCtrl = (*iLines)[aLine]; |
1351 CEikCaptionedControl* capCtrl = (*iLines)[aLine]; |
1287 capCtrl->MinimumSize(); |
1352 capCtrl->MinimumSize(); |
1317 topYPosOfControlWhichMustBeViewable = iLastExposedLineViewWinYPosition; |
1382 topYPosOfControlWhichMustBeViewable = iLastExposedLineViewWinYPosition; |
1318 bottomYPosOfControlWhichMustBeViewable = topYPosOfControlWhichMustBeViewable + controlHeight; |
1383 bottomYPosOfControlWhichMustBeViewable = topYPosOfControlWhichMustBeViewable + controlHeight; |
1319 } |
1384 } |
1320 } |
1385 } |
1321 |
1386 |
|
1387 // If control height is greater then screen. Make sure that edwin's cursor is visible |
|
1388 if (controlType == EEikCtEdwin && controlHeight > Rect().Height()) |
|
1389 { |
|
1390 CEikEdwin* edwin = dynamic_cast<CEikEdwin*>(capCtrl->iControl); |
|
1391 if (edwin) |
|
1392 { |
|
1393 TInt pos = edwin->CursorPos(); |
|
1394 TRect linerect; |
|
1395 TRAP_IGNORE( linerect = edwin->TextLayout()->GetLineRectL(pos, pos) ); |
|
1396 |
|
1397 TPoint capctrlpos = capCtrl->Position(); |
|
1398 TPoint edwinpos = edwin->Position(); |
|
1399 if (edwinpos.iY - capctrlpos.iY + (linerect.iTl.iY + linerect.iBr.iY)/2 > Rect().Height()/2) // cursor not fully visible |
|
1400 { |
|
1401 TInt offset = edwinpos.iY - capctrlpos.iY + (linerect.iTl.iY + linerect.iBr.iY)/2 - Rect().Height()/2; |
|
1402 if (topYPosOfControlWhichMustBeViewable + offset + Rect().Height() <= bottomYPosOfControlWhichMustBeViewable) |
|
1403 { |
|
1404 topYPosOfControlWhichMustBeViewable += offset; |
|
1405 bottomYPosOfControlWhichMustBeViewable = topYPosOfControlWhichMustBeViewable + Rect().Height(); |
|
1406 } |
|
1407 else |
|
1408 { |
|
1409 topYPosOfControlWhichMustBeViewable = bottomYPosOfControlWhichMustBeViewable - Rect().Height(); |
|
1410 } |
|
1411 } |
|
1412 else |
|
1413 { |
|
1414 bottomYPosOfControlWhichMustBeViewable = topYPosOfControlWhichMustBeViewable + Rect().Height(); |
|
1415 } |
|
1416 } |
|
1417 } |
|
1418 |
1322 SetDataPosition( topYPosOfControlWhichMustBeViewable, bottomYPosOfControlWhichMustBeViewable, aForceResize ); |
1419 SetDataPosition( topYPosOfControlWhichMustBeViewable, bottomYPosOfControlWhichMustBeViewable, aForceResize ); |
1323 |
1420 |
1324 if ( aLine != iLastExposedLine ) |
1421 if ( aLine != iLastExposedLine ) |
1325 { |
1422 { |
1326 iLastExposedLine = aLine; |
1423 iLastExposedLine = aLine; |
1327 iLastExposedLineViewWinYPosition = topYPosOfControlWhichMustBeViewable + idealDataWindowPosition; |
1424 iLastExposedLineViewWinYPosition = topYPosOfControlWhichMustBeViewable + idealDataWindowPosition; |
1328 } |
1425 } |
|
1426 _AKNTRACE_FUNC_EXIT; |
1329 } |
1427 } |
1330 |
1428 |
1331 void CEikDialogPage::SetDataPosition( TInt aTopY, TInt aBottomY, TBool aForceResize ) |
1429 void CEikDialogPage::SetDataPosition( TInt aTopY, TInt aBottomY, TBool aForceResize ) |
1332 { |
1430 { |
|
1431 _AKNTRACE_FUNC_ENTER; |
|
1432 _AKNTRACE( "[%s][%s] aTopY: [%d]", "CEikDialogPage", __FUNCTION__, aTopY ); |
1333 // update rect only if the currently focused control doesn't fit |
1433 // update rect only if the currently focused control doesn't fit |
1334 if ( iFormControl ) |
1434 if ( iFormControl ) |
1335 { |
1435 { |
1336 TInt topY = iPhysics->ViewTopY(); |
1436 TInt topY = iPhysics->ViewTopY(); |
1337 TInt maxBottomY = topY + iSize.iHeight; |
1437 TInt maxBottomY = topY + iSize.iHeight; |
1414 return (*iLines)[aLineIndex]->Size().iHeight; |
1515 return (*iLines)[aLineIndex]->Size().iHeight; |
1415 } |
1516 } |
1416 |
1517 |
1417 void CEikDialogPage::SizeChanged() |
1518 void CEikDialogPage::SizeChanged() |
1418 { |
1519 { |
|
1520 _AKNTRACE_FUNC_ENTER; |
|
1521 if ( IsForm() ) |
|
1522 { |
|
1523 iExtension->iInitialLayoutDone = EFalse; |
|
1524 |
|
1525 iScroll->SetOutsideRect( Rect() ); |
|
1526 |
|
1527 // force each line to resize |
|
1528 TInt count = iLines->Count(); |
|
1529 |
|
1530 for ( TInt i = 0; i < count; ++i ) |
|
1531 { |
|
1532 (*iLines)[i]->HandleResourceChange( KEikDynamicLayoutVariantSwitch ); |
|
1533 } |
|
1534 |
|
1535 iLines->SetRect( Rect(), iScroll->Top(), iScroll->Middle(), iScroll->Bottom() ); |
|
1536 iExtension->iInitialLayoutDone = ETrue; |
|
1537 UpdatePhysics(); |
|
1538 |
|
1539 if ( iExtension->iScrolling |
|
1540 || iExtension->iFlags.IsSet( |
|
1541 CDialogPageExtension::EDragEventsAllowed ) ) |
|
1542 { |
|
1543 iPhysics->Stop(); |
|
1544 Synchronize(); |
|
1545 } |
|
1546 |
|
1547 if ( count > 0 && iCurrentLine != KErrNotFound ) |
|
1548 { |
|
1549 if ( iLastExposedLine != -1 ) |
|
1550 { |
|
1551 iLastExposedLineViewWinYPosition = |
|
1552 iLines->LineIndexToYPosition( iLastExposedLine, 0 ); |
|
1553 } |
|
1554 |
|
1555 ExposeLine( iCurrentLine, ETrue ); |
|
1556 |
|
1557 if ( Size() != TSize::EUninitialized ) |
|
1558 { |
|
1559 (*iLines)[iCurrentLine]->DrawDeferred(); |
|
1560 } |
|
1561 } |
|
1562 |
|
1563 TRAP_IGNORE( UpdateScrollBarL() ); // ignore any errors. |
|
1564 AknsUtils::RegisterControlPosition( this ); |
|
1565 |
|
1566 _AKNTRACE_FUNC_EXIT; |
|
1567 return; |
|
1568 } |
|
1569 |
1419 // update form area's size to scroll control |
1570 // update form area's size to scroll control |
1420 iScroll->SetOutsideRect( Rect() ); |
1571 iScroll->SetOutsideRect( Rect() ); |
1421 iLines->SetRect( Rect(), iScroll->Top(), iScroll->Middle(), iScroll->Bottom() ); |
1572 iLines->SetRect( Rect(), iScroll->Top(), iScroll->Middle(), iScroll->Bottom() ); |
1422 |
1573 |
1423 if ( (iLines->Count() > 0 ) && ( iCurrentLine >= 0 ) ) |
1574 if ( (iLines->Count() > 0 ) && ( iCurrentLine >= 0 ) ) |
1505 { |
1659 { |
1506 RecordLineL( i ); |
1660 RecordLineL( i ); |
1507 |
1661 |
1508 if ( i != iCurrentLine ) |
1662 if ( i != iCurrentLine ) |
1509 { |
1663 { |
1510 DrawNow(); |
1664 DrawDeferred(); |
1511 } |
1665 } |
1512 |
1666 |
1513 break; |
1667 break; |
1514 } |
1668 } |
1515 } |
1669 } |
1516 } |
1670 } |
1517 } |
1671 } |
1518 |
1672 |
1519 if( iCurrentLine == iLastExposedLine || iCurrentLine == -1 ) |
1673 if( iCurrentLine == iLastExposedLine || iCurrentLine == -1 ) |
|
1674 { |
|
1675 _AKNTRACE_FUNC_EXIT; |
1520 return; |
1676 return; |
|
1677 } |
1521 if( aEventType == EEventNavigation || aEventType == EEventTextUpdate ) |
1678 if( aEventType == EEventNavigation || aEventType == EEventTextUpdate ) |
1522 { |
1679 { |
1523 ExposeLine( iCurrentLine, EFalse ); |
1680 ExposeLine( iCurrentLine, EFalse ); |
1524 |
1681 |
1525 UpdateScrollBarL(); |
1682 UpdateScrollBarL(); |
1526 } |
1683 } |
|
1684 _AKNTRACE_FUNC_EXIT; |
1527 } |
1685 } |
1528 |
1686 |
1529 /** |
1687 /** |
1530 * Handle events caused by popup field controls, and resize if necessary |
1688 * Handle events caused by popup field controls, and resize if necessary |
1531 */ |
1689 */ |
1532 void CEikDialogPage::HandlePopupFieldEventL(CAknPopupField* aPopupField, TAknPopupFieldEvent aEventType, TInt /*aHint*/) |
1690 void CEikDialogPage::HandlePopupFieldEventL(CAknPopupField* aPopupField, TAknPopupFieldEvent aEventType, TInt /*aHint*/) |
1533 { |
1691 { |
|
1692 _AKNTRACE_FUNC_ENTER; |
1534 switch (aEventType) |
1693 switch (aEventType) |
1535 { |
1694 { |
1536 case EAknPopupFieldEventValueChange: |
1695 case EAknPopupFieldEventValueChange: |
1537 { |
1696 { |
|
1697 _AKNTRACE( "[%s][%s][%d] EAknPopupFieldEventValueChange", |
|
1698 "CEikDialogPage", __FUNCTION__, __LINE__ ); |
1538 CEikCaptionedControl* line = NULL; |
1699 CEikCaptionedControl* line = NULL; |
1539 for ( TInt i = 0; i < iLines->Count(); ++i ) |
1700 for ( TInt i = 0; i < iLines->Count(); ++i ) |
1540 { |
1701 { |
1541 line = (*iLines)[i]; |
1702 line = (*iLines)[i]; |
1542 if ( line->iControl == aPopupField ) |
1703 if ( line->iControl == aPopupField ) |
1543 { |
1704 { |
1544 if ( IsForm() ) |
1705 if ( IsForm() ) |
1545 { |
1706 { |
1546 RecordLineL( i ); |
1707 RecordLineL( i ); |
1547 } |
1708 } |
1548 DrawNow(); |
1709 DrawDeferred(); |
1549 break; |
1710 break; |
1550 } |
1711 } |
1551 } |
1712 } |
1552 break; |
1713 break; |
1553 } |
1714 } |
1554 case EAknPopupFieldEventModeChange: |
1715 case EAknPopupFieldEventModeChange: |
1555 { |
1716 { |
|
1717 _AKNTRACE( "[%s][%s][%d] EAknPopupFieldEventModeChange", |
|
1718 "CEikDialogPage", __FUNCTION__, __LINE__ ); |
1556 TInt index = iCurrentLine; |
1719 TInt index = iCurrentLine; |
1557 |
1720 |
1558 if(iIsEditable && (iExtension->iPopFieldEvents != 0)) |
1721 if(iIsEditable && (iExtension->iPopFieldEvents != 0)) |
1559 { |
1722 { |
1560 iExtension->iPopFieldEvents = 0; |
1723 iExtension->iPopFieldEvents = 0; |
1696 if ( (maximumEdwinHeight > 0) && (height > maximumEdwinHeight)) |
1856 if ( (maximumEdwinHeight > 0) && (height > maximumEdwinHeight)) |
1697 height=maximumEdwinHeight; // Can't be bigger than edwin itself |
1857 height=maximumEdwinHeight; // Can't be bigger than edwin itself |
1698 size.iHeight = height; |
1858 size.iHeight = height; |
1699 |
1859 |
1700 // Must force a size change on current captioned contrl even if control doesn't change size (so that edwin is resized by aknutils) |
1860 // Must force a size change on current captioned contrl even if control doesn't change size (so that edwin is resized by aknutils) |
1701 aEdwin->SetSize(size); |
1861 aEdwin->SetSize(size); |
1702 ReconsiderPageSize(); |
1862 |
1703 ExposeLine(iCurrentLine, ETrue); |
1863 if ( IsForm() ) |
|
1864 { |
|
1865 (*iLines)[iCurrentLine]->SetRect( (*iLines)[iCurrentLine]->Rect() ); |
|
1866 ExposeLine( iCurrentLine, ETrue ); |
|
1867 } |
|
1868 else |
|
1869 { |
|
1870 ReconsiderPageSize(); |
|
1871 ExposeLine(iCurrentLine, ETrue); |
|
1872 } |
|
1873 |
1704 PrepareToDrawVerticalLine(); // do flushes here. |
1874 PrepareToDrawVerticalLine(); // do flushes here. |
1705 |
1875 |
1706 /* improved redraw code |
1876 /* improved redraw code |
1707 Due to some unpleasantness about dialogs, forms and requirements, to get caption controls |
1877 Due to some unpleasantness about dialogs, forms and requirements, to get caption controls |
1708 to draw properly requires a call to draw now. A system initiated draw does not work correctly |
1878 to draw properly requires a call to draw now. A system initiated draw does not work correctly |
1728 } |
1898 } |
1729 return ETrue; |
1899 return ETrue; |
1730 } |
1900 } |
1731 |
1901 |
1732 |
1902 |
1733 static TInt CountNumberOfLines_Edwin(CEikEdwin *aEdwin, TRect aRect, TInt numOfLines) |
|
1734 { |
|
1735 TInt edwinLines = numOfLines; |
|
1736 TInt count = 0; |
|
1737 for(TInt i=0;i<edwinLines;i++) |
|
1738 { |
|
1739 TInt scrolledLines = aEdwin->TextLayout()->FirstLineInBand(); |
|
1740 TInt docPos = aEdwin->TextLayout()->FirstCharOnLine(scrolledLines + i+1); |
|
1741 TPoint point; |
|
1742 aEdwin->TextLayout()->PosInBand(docPos, point); |
|
1743 TInt yPos = point.iY; |
|
1744 TRect lineRect; |
|
1745 aEdwin->TextLayout()->GetLineRect(yPos, lineRect); |
|
1746 lineRect.iTl += aEdwin->Position(); |
|
1747 lineRect.iBr += aEdwin->Position(); |
|
1748 if (aRect.Contains(lineRect.iTl) && aRect.Contains(lineRect.iBr)) |
|
1749 count++; |
|
1750 } |
|
1751 return count; |
|
1752 } |
|
1753 static TInt CountNumberOfLines_Ctrl(CCoeControl *aControl, TRect aRect) |
|
1754 { |
|
1755 TRect rect = TRect(aControl->Position(), aControl->Size()); |
|
1756 TInt count = 0; |
|
1757 if (aRect.Contains(rect.iTl) && aRect.Contains(rect.iBr)) |
|
1758 count ++; |
|
1759 return count; |
|
1760 } |
|
1761 |
|
1762 static TInt CountNumberOfVisibleLines(CEikCaptionedControl *aControl, TRect aClipRect) |
|
1763 { |
|
1764 TInt count = 0; |
|
1765 if (aControl->ControlIsAnEdwin(aControl->iControlType)) |
|
1766 count += CountNumberOfLines_Edwin((CEikEdwin*)aControl->iControl, aClipRect, aControl->NumberOfLines()); |
|
1767 else |
|
1768 count += CountNumberOfLines_Ctrl(aControl->iControl, aClipRect); |
|
1769 count += CountNumberOfLines_Ctrl(aControl->iCaption, aClipRect); |
|
1770 return count; |
|
1771 } |
|
1772 |
|
1773 static TInt NumberOfTextLinesVisible(CEikCapCArray *aLines, TInt aItem, TRect aClipRect) |
|
1774 { |
|
1775 if (aItem < 0) return 0; |
|
1776 CEikCaptionedControl *control = (*aLines)[aItem]; |
|
1777 return CountNumberOfVisibleLines(control, aClipRect); |
|
1778 } |
|
1779 |
|
1780 |
|
1781 void CEikDialogPage::HandleScrollEventL(CEikScrollBar* aScrollBar,TEikScrollEvent aEventType) |
1903 void CEikDialogPage::HandleScrollEventL(CEikScrollBar* aScrollBar,TEikScrollEvent aEventType) |
1782 { |
1904 { |
|
1905 _AKNTRACE_FUNC_ENTER; |
1783 iExtension->iHandlingScrollEvent = ETrue; |
1906 iExtension->iHandlingScrollEvent = ETrue; |
1784 |
1907 |
1785 switch (aEventType) |
1908 switch (aEventType) |
1786 { |
1909 { |
1787 case EEikScrollPageUp: |
1910 case EEikScrollPageUp: |
1788 case EEikScrollPageDown: |
1911 case EEikScrollPageDown: |
1789 case EEikScrollThumbDragVert: |
1912 case EEikScrollThumbDragVert: |
1790 iExtension->iScrolled = ETrue; |
|
1791 iExtension->iScrolling = ETrue; |
1913 iExtension->iScrolling = ETrue; |
1792 iLines->MoveLineToScreen( iCurrentLine, 0, EFalse ); |
1914 iLines->MoveLineToScreen( iCurrentLine, 0, EFalse ); |
1793 break; |
1915 break; |
1794 |
1916 |
1795 default: |
1917 default: |
1827 return mainPaneRect; |
1950 return mainPaneRect; |
1828 } |
1951 } |
1829 |
1952 |
1830 void CEikDialogPage::UpdateScrollBarL() |
1953 void CEikDialogPage::UpdateScrollBarL() |
1831 { |
1954 { |
|
1955 _AKNTRACE_FUNC_ENTER; |
1832 // Only forms in S60 need dialog's scrollbar. |
1956 // Only forms in S60 need dialog's scrollbar. |
1833 if ( !iFormControl || !iPageContainer->ScrollBar() || iSize.iHeight == 0 || iSize.iWidth == 0 || iExtension->iHandlingScrollEvent ) |
1957 if ( !iFormControl || !iPageContainer->ScrollBar() || iSize.iHeight == 0 || iSize.iWidth == 0 || iExtension->iHandlingScrollEvent ) |
1834 { |
1958 { |
|
1959 _AKNTRACE_FUNC_EXIT; |
1835 return; |
1960 return; |
1836 } |
1961 } |
1837 |
1962 |
1838 CAknScrollBar* scrollBar = STATIC_CAST(CAknScrollBar*, iPageContainer->ScrollBar()->VerticalScrollBar()); |
1963 CAknScrollBar* scrollBar = STATIC_CAST(CAknScrollBar*, iPageContainer->ScrollBar()->VerticalScrollBar()); |
1839 |
1964 |
1840 if (scrollBar) |
1965 if (scrollBar) |
1841 { |
1966 { |
1842 TInt top = iScroll->Top(); |
|
1843 TInt middle = iScroll->Middle(); |
|
1844 TInt bottom = iScroll->Bottom(); |
|
1845 TRect parent( Rect() ); |
|
1846 TBool topmostPartial = top == -1; |
|
1847 iLines->CalcItemIndexes(top, middle, bottom, parent.Size()); |
|
1848 TInt extraLines = topmostPartial ? NumberOfTextLinesVisible(iLines, top-1, parent) : 0; |
|
1849 iExtension->iPreviousThumbPosition = iLines->NumberOfTextLinesBeforeLine( top - extraLines ); |
|
1850 |
|
1851 // Using form layout, since this is used by AknForm only |
1967 // Using form layout, since this is used by AknForm only |
1852 TAknWindowComponentLayout layout = TAknWindowComponentLayout::Compose( |
1968 TAknWindowComponentLayout layout = TAknWindowComponentLayout::Compose( |
1853 AknLayoutScalable_Avkon::listscroll_form_pane(), |
1969 AknLayoutScalable_Avkon::listscroll_form_pane(), |
1854 AknLayoutScalable_Avkon::scroll_pane_cp8()); |
1970 AknLayoutScalable_Avkon::scroll_pane_cp8()); |
1855 |
1971 |
1856 TRect scrollBarParent( MainPane().Size()/*mainPaneRect.Size()*/ ); |
1972 //Using Rect() instead of main pane rect for supporting partial input mode. |
1857 |
1973 //TRect scrollBarParent( MainPane().Size() ); |
1858 AknLayoutUtils::LayoutVerticalScrollBar(iPageContainer->ScrollBar(), scrollBarParent, layout.LayoutLine()); |
1974 AknLayoutUtils::LayoutVerticalScrollBar(iPageContainer->ScrollBar(), Rect(), layout.LayoutLine()); |
|
1975 |
1859 if(!ScbState() && iCurrentLine!=-1 && iCurrentLine < iLines->Count() ) |
1976 if(!ScbState() && iCurrentLine!=-1 && iCurrentLine < iLines->Count() ) |
1860 { |
1977 { |
1861 CEikCaptionedControl *ctrl = (*iLines)[iCurrentLine]; |
1978 CEikCaptionedControl *ctrl = (*iLines)[iCurrentLine]; |
1862 if(ctrl->ControlIsAPopfield(ctrl->iControlType)) |
1979 if(ctrl->ControlIsAPopfield(ctrl->iControlType)) |
1863 { |
1980 { |
1864 CAknPopupField::EAknPopupFieldSelectionMode mode = ((CAknPopupField*)ctrl->iControl)->SelectionMode(); |
1981 CAknPopupField::EAknPopupFieldSelectionMode mode = ((CAknPopupField*)ctrl->iControl)->SelectionMode(); |
1865 if (mode == CAknPopupField::EAknPopupFieldSelectionListMode) |
1982 if (mode == CAknPopupField::EAknPopupFieldSelectionListMode) |
1866 { |
1983 { |
|
1984 _AKNTRACE_FUNC_EXIT; |
1867 return; |
1985 return; |
1868 } |
1986 } |
1869 } |
1987 } |
1870 UpdateScrollBarThumb(); |
1988 UpdateScrollBarThumb(); |
1871 } |
1989 } |
1872 } |
1990 } |
|
1991 _AKNTRACE_FUNC_EXIT; |
1873 } |
1992 } |
1874 |
1993 |
1875 |
1994 |
1876 void CEikDialogPage::UpdateScrollBarThumb() |
1995 void CEikDialogPage::UpdateScrollBarThumb() |
1877 { |
1996 { |
|
1997 _AKNTRACE_FUNC_ENTER; |
1878 if ( !iFormControl || !iPageContainer->ScrollBar() || ScbState() ) |
1998 if ( !iFormControl || !iPageContainer->ScrollBar() || ScbState() ) |
1879 { |
1999 { |
|
2000 _AKNTRACE_FUNC_EXIT; |
1880 return; |
2001 return; |
1881 } |
2002 } |
1882 |
2003 |
1883 CAknScrollBar* scrollBar = STATIC_CAST(CAknScrollBar*, iPageContainer->ScrollBar()->VerticalScrollBar()); |
2004 CAknScrollBar* scrollBar = STATIC_CAST(CAknScrollBar*, iPageContainer->ScrollBar()->VerticalScrollBar()); |
1884 |
2005 |
1890 // TODO: replace iLines->MinimumSize with world size, presumably saved in CAknFormPhysics |
2011 // TODO: replace iLines->MinimumSize with world size, presumably saved in CAknFormPhysics |
1891 vertModel.iScrollSpan = iLines->MinimumSize().iHeight; |
2012 vertModel.iScrollSpan = iLines->MinimumSize().iHeight; |
1892 vertModel.iThumbSpan = iSize.iHeight - iSize.iHeight % 2; |
2013 vertModel.iThumbSpan = iSize.iHeight - iSize.iHeight % 2; |
1893 vertModel.iThumbPosition = Max( iPhysics->ViewTopY(), 0 ); |
2014 vertModel.iThumbPosition = Max( iPhysics->ViewTopY(), 0 ); |
1894 |
2015 |
1895 iExtension->iPreviousThumbPosition = vertModel.iThumbPosition; |
|
1896 TRAP_IGNORE(scrollBar->SetModelL(&vertModel)); // won't leave now, but can't guarantee forever |
2016 TRAP_IGNORE(scrollBar->SetModelL(&vertModel)); // won't leave now, but can't guarantee forever |
1897 iPageContainer->ScrollBar()->Tile(&vertModel); |
2017 iPageContainer->ScrollBar()->Tile(&vertModel); |
1898 iPageContainer->ScrollBar()->SetVFocusPosToThumbPos(vertModel.iThumbPosition); |
2018 iPageContainer->ScrollBar()->SetVFocusPosToThumbPos(vertModel.iThumbPosition); |
1899 } |
2019 } |
|
2020 _AKNTRACE_FUNC_EXIT; |
1900 } |
2021 } |
1901 |
2022 |
1902 CCoeControl* CEikDialogPage::ComponentControl(TInt aIndex) const |
2023 CCoeControl* CEikDialogPage::ComponentControl(TInt aIndex) const |
1903 { |
2024 { |
1904 if ( IsForm() && !iExtension->iHandlingResourceChange) |
2025 if ( IsForm() && !iExtension->iHandlingResourceChange) |
1975 if (aRedraw) |
2097 if (aRedraw) |
1976 (*iLines)[iCurrentLine]->DrawNow(); |
2098 (*iLines)[iCurrentLine]->DrawNow(); |
1977 else |
2099 else |
1978 (*iLines)[iCurrentLine]->DrawDeferred(); |
2100 (*iLines)[iCurrentLine]->DrawDeferred(); |
1979 } |
2101 } |
|
2102 _AKNTRACE_FUNC_EXIT; |
1980 } |
2103 } |
1981 |
2104 |
1982 void CEikDialogPage::ChangeFocusTo(TInt aLineIndex) |
2105 void CEikDialogPage::ChangeFocusTo(TInt aLineIndex) |
1983 { |
2106 { |
|
2107 _AKNTRACE_FUNC_ENTER; |
|
2108 _AKNTRACE( "CEikDialogPage::ChangeFocusTo() aLineIndex: [%d]", aLineIndex ); |
1984 TInt oldLine = iCurrentLine; |
2109 TInt oldLine = iCurrentLine; |
1985 |
2110 |
1986 if (aLineIndex==iCurrentLine) |
2111 if (aLineIndex==iCurrentLine) |
1987 return; |
2112 return; |
|
2113 // If current line has settingslist open, close it |
|
2114 CEikCaptionedControl* currentLine = CurrentLine(); |
|
2115 if ( currentLine && |
|
2116 currentLine->ControlIsAPopfield( currentLine->ControlType() ) ) |
|
2117 { |
|
2118 CAknPopupField *field = ( CAknPopupField* )currentLine->iControl; |
|
2119 if ( field && field->SelectionMode() |
|
2120 == CAknPopupField::EAknPopupFieldSelectionListMode ) |
|
2121 { |
|
2122 TRAP_IGNORE( field->CloseSelectionListL() ); |
|
2123 } |
|
2124 } |
|
2125 // If new line is edwin, move cursor to the end of the string. |
|
2126 CEikCaptionedControl* theNewLine = (*iLines)[aLineIndex]; |
|
2127 if ( iExtension->iSetInitialFocusDone |
|
2128 && IsForm() |
|
2129 && theNewLine->ControlIsAnEdwin( theNewLine->iControlType ) |
|
2130 && theNewLine->iIsEditable ) |
|
2131 { |
|
2132 CEikEdwin* edwinPtr = STATIC_CAST( CEikEdwin*, theNewLine->iControl ); |
|
2133 if( edwinPtr->Text() ) |
|
2134 { |
|
2135 TRAP_IGNORE( edwinPtr->SetCursorPosL( edwinPtr->TextLength(), EFalse ) ); |
|
2136 } |
|
2137 } |
|
2138 |
1988 ShowFocus( EFalse, EFalse ); |
2139 ShowFocus( EFalse, EFalse ); |
1989 iCurrentLine=aLineIndex; |
2140 iCurrentLine=aLineIndex; |
1990 ShowFocus(ETrue, EFalse ); |
2141 ShowFocus(ETrue, EFalse ); |
1991 |
2142 |
1992 if ( ( oldLine != iCurrentLine && IsForm() ) && |
2143 if ( ( oldLine != iCurrentLine && IsForm() ) && |
1993 iExtension->iInitialLayoutDone ) |
2144 iExtension->iInitialLayoutDone ) |
1994 { |
2145 { |
|
2146 // Set temporarily for EFalse to prevent one extra physics update |
|
2147 // because of two calls to iLines->MoveLineToScreen |
|
2148 iExtension->iInitialLayoutDone = EFalse; |
|
2149 |
1995 if ( oldLine != -1 ) |
2150 if ( oldLine != -1 ) |
1996 { |
2151 { |
1997 iLines->MoveLineToScreen( oldLine, 0, EFalse ); |
2152 iLines->MoveLineToScreen( oldLine, 0, EFalse ); |
1998 RecordLineL( oldLine ); |
2153 TRAP_IGNORE( RecordLineL( oldLine ) ); |
1999 } |
2154 } |
2000 |
2155 |
2001 RecordLineL( iCurrentLine ); |
2156 // set back to correct value |
|
2157 iExtension->iInitialLayoutDone = ETrue; |
|
2158 |
|
2159 TRAP_IGNORE( RecordLineL( iCurrentLine ) ); |
2002 iLines->MoveLineToScreen( iCurrentLine, iPhysics->ViewTopY(), ETrue ); |
2160 iLines->MoveLineToScreen( iCurrentLine, iPhysics->ViewTopY(), ETrue ); |
2003 } |
2161 } |
|
2162 _AKNTRACE_FUNC_EXIT; |
2004 } |
2163 } |
2005 |
2164 |
2006 TInt CEikDialogPage::FindLineIndex(const CCoeControl* aControl) const |
2165 TInt CEikDialogPage::FindLineIndex(const CCoeControl* aControl) const |
2007 { |
2166 { |
2008 return(iLines->FindLineIndex(aControl)); |
2167 return(iLines->FindLineIndex(aControl)); |
2168 someone accepts the hotkey, to only offering the hot key to the current line and then, only if |
2331 someone accepts the hotkey, to only offering the hot key to the current line and then, only if |
2169 it accepts hotkeys. |
2332 it accepts hotkeys. |
2170 |
2333 |
2171 Added Enter key as a special case... |
2334 Added Enter key as a special case... |
2172 */ |
2335 */ |
|
2336 |
2173 if ( (iCurrentLine!=-1) && (iCurrentLine < iLines->Count()) ) |
2337 if ( (iCurrentLine!=-1) && (iCurrentLine < iLines->Count()) ) |
|
2338 { |
2174 if ( (*iLines)[iCurrentLine]->OfferHotKeys() || |
2339 if ( (*iLines)[iCurrentLine]->OfferHotKeys() || |
2175 (*iLines)[iCurrentLine]->TakesEnterKey() && (aKeyEvent.iCode==EKeyEnter) |
2340 (*iLines)[iCurrentLine]->TakesEnterKey() && (aKeyEvent.iCode==EKeyEnter) |
2176 ) |
2341 ) |
|
2342 { |
|
2343 CEikCaptionedControl* currentLine = ( *iLines )[iCurrentLine]; |
|
2344 const TInt controlType( currentLine->iControlType ); |
|
2345 |
|
2346 if ( currentLine->ControlIsAnEdwin( controlType ) ) |
|
2347 { |
|
2348 CEikEdwin* edwin = ( CEikEdwin* )currentLine->iControl; |
|
2349 TBool readOnly = edwin->IsReadOnly(); |
|
2350 |
|
2351 // The control is an editor which is read-only, |
|
2352 // such as an on/off control |
|
2353 if ( readOnly ) |
|
2354 { |
|
2355 iPageObserver->HandleDialogPageEventL( |
|
2356 MEikDialogPageObserver::EDialogPageTapped ); |
|
2357 return EKeyWasConsumed; |
|
2358 } |
|
2359 } |
|
2360 |
2177 if (!IsForm()|| iIsEditable) |
2361 if (!IsForm()|| iIsEditable) |
|
2362 { |
2178 return (*iLines)[iCurrentLine]->iControl->OfferKeyEventL(aKeyEvent,aType); |
2363 return (*iLines)[iCurrentLine]->iControl->OfferKeyEventL(aKeyEvent,aType); |
|
2364 } |
|
2365 } |
|
2366 } |
2179 return EKeyWasNotConsumed; |
2367 return EKeyWasNotConsumed; |
2180 } |
2368 } |
2181 |
2369 |
2182 TBool CEikDialogPage::TakesEnterKey() |
2370 TBool CEikDialogPage::TakesEnterKey() |
2183 { |
2371 { |
2187 } |
2375 } |
2188 |
2376 |
2189 void CEikDialogPage::SetEditableL( TBool aEditable, TBool /*aActivePage*/ ) |
2377 void CEikDialogPage::SetEditableL( TBool aEditable, TBool /*aActivePage*/ ) |
2190 { |
2378 { |
2191 // Tell each of the controls on the page (which are part of a form) of their editable state. |
2379 // Tell each of the controls on the page (which are part of a form) of their editable state. |
2192 |
2380 _AKNTRACE_FUNC_ENTER; |
|
2381 _AKNTRACE( "CEikDialogPage::SetEditableL() aEditable: [%d]", aEditable ); |
2193 iIsEditable = aEditable; |
2382 iIsEditable = aEditable; |
2194 |
2383 |
|
2384 TBool initialLayoutDone = iExtension->iInitialLayoutDone; |
|
2385 iExtension->iInitialLayoutDone = EFalse; |
|
2386 |
2195 HighlightVisible( aEditable ); |
2387 HighlightVisible( aEditable ); |
2196 |
2388 |
2197 if ( iExtension->iUsesSingleClick ) |
2389 if ( iExtension->iUsesSingleClick && iExtension->iSetInitialFocusDone ) |
2198 { |
2390 { |
2199 ShowFocus( EFalse ); |
2391 ShowFocus( EFalse, EFalse ); |
2200 } |
2392 } |
2201 |
2393 |
2202 const TInt numLines=iLines->Count() ; |
2394 const TInt numLines=iLines->Count() ; |
2203 /* if a form, no currently selected line, in edit mode, and there is a line |
2395 /* if a form, no currently selected line, in edit mode, and there is a line |
2204 available (we know this as iLines->Count()>0), then select the first line. |
2396 available (we know this as iLines->Count()>0), then select the first line. |
2352 * #1 register the the dialog page with the caption control. |
2552 * #1 register the the dialog page with the caption control. |
2353 * #2 register the control on this line (e.g. an edwin) with the one above it |
2553 * #2 register the control on this line (e.g. an edwin) with the one above it |
2354 * #3 call Register component on the line, to set up listeners, etc. |
2554 * #3 call Register component on the line, to set up listeners, etc. |
2355 * #4 Set the editable value to whatever the dialog page's editable value is. |
2555 * #4 Set the editable value to whatever the dialog page's editable value is. |
2356 */ |
2556 */ |
|
2557 _AKNTRACE_FUNC_ENTER; |
|
2558 _AKNTRACE( "aNewLineAdded: [%d]", aNewLineAdded ); |
2357 __ASSERT_DEBUG(iLines && (aNewLineAdded<=iLines->Count()), Panic(EEikDialogPanicErrorDuringAddingLine)); |
2559 __ASSERT_DEBUG(iLines && (aNewLineAdded<=iLines->Count()), Panic(EEikDialogPanicErrorDuringAddingLine)); |
2358 if (aNewLineAdded== -1) |
2560 if (aNewLineAdded== -1) |
|
2561 { |
|
2562 _AKNTRACE_FUNC_EXIT; |
2359 return; // line has not been added yet. |
2563 return; // line has not been added yet. |
|
2564 } |
2360 CEikCaptionedControl* lineAdded = iLines->At(aNewLineAdded); |
2565 CEikCaptionedControl* lineAdded = iLines->At(aNewLineAdded); |
2361 // if aNewLineAdded is zero, then there is no line above, else set value. |
2566 // if aNewLineAdded is zero, then there is no line above, else set value. |
2362 CEikCaptionedControl* lineVisuallyAboveAndNumericallyBelow = |
2567 CEikCaptionedControl* lineVisuallyAboveAndNumericallyBelow = |
2363 (!aNewLineAdded)? 0:iLines->At(aNewLineAdded-1); |
2568 (!aNewLineAdded)? 0:iLines->At(aNewLineAdded-1); |
2364 // #1 |
2569 // #1 |
2691 { |
2891 { |
2692 iExtension->iTopItem = iLines->Count(); |
2892 iExtension->iTopItem = iLines->Count(); |
2693 } |
2893 } |
2694 } |
2894 } |
2695 iExtension->iScrolling = EFalse; |
2895 iExtension->iScrolling = EFalse; |
2696 iExtension->HandleFormFeedback( this, aPointerEvent, touchedLine, iCurrentLine ); |
2896 iExtension->HandleFormFeedback( *this, |
|
2897 aPointerEvent, |
|
2898 touchedLine, |
|
2899 iCurrentLine ); |
2697 |
2900 |
2698 TBool wasScrolling = ( iPhysics->OngoingPhysicsAction() != |
2901 iExtension->iWasScrolling = ( iPhysics->OngoingPhysicsAction() != |
2699 CAknPhysics::EAknPhysicsActionNone ); |
2902 CAknPhysics::EAknPhysicsActionNone ); |
2700 iPhysics->Stop(); |
2903 if(iExtension->iWasScrolling) |
|
2904 { |
|
2905 iPhysics->Stop(); |
|
2906 iExtension->Feedback( *this, ETouchFeedbackList ); |
|
2907 } |
2701 iExtension->iLastTouchedLine = touchedLine; |
2908 iExtension->iLastTouchedLine = touchedLine; |
2702 iExtension->iDragStartPosition = aPointerEvent.iPosition; |
2909 iExtension->iDragStartPosition = aPointerEvent.iPosition; |
2703 iExtension->iLastPointerPos = aPointerEvent.iPosition; |
2910 iExtension->iLastPointerPos = aPointerEvent.iPosition; |
2704 iExtension->iStartTime.HomeTime(); |
2911 iExtension->iStartTime.HomeTime(); |
2705 |
2912 |
2823 |
3048 |
2824 if ( !iExtension->iScrolling ) |
3049 if ( !iExtension->iScrolling ) |
2825 { |
3050 { |
2826 // feedback is given every time when new item |
3051 // feedback is given every time when new item |
2827 // appears to the screen -> follows the visual feedback |
3052 // appears to the screen -> follows the visual feedback |
2828 iExtension->SilentFeedback( this, ETouchFeedbackSensitiveItem, aPointerEvent ); |
3053 iExtension->SilentFeedback( *this, |
|
3054 ETouchFeedbackSensitiveList, |
|
3055 aPointerEvent ); |
|
3056 |
2829 // It might happen that there are no drag events between down and |
3057 // It might happen that there are no drag events between down and |
2830 // up if the distance is short enough. |
3058 // up if the distance is short enough. |
2831 iExtension->iHighlightTimer->Cancel(); |
3059 iExtension->iHighlightTimer->Cancel(); |
2832 iExtension->iScrolling = ETrue; |
3060 iExtension->iScrolling = ETrue; |
2833 iExtension->iScrolled = ETrue; |
|
2834 iLines->MoveLineToScreen( iCurrentLine, 0, EFalse ); |
3061 iLines->MoveLineToScreen( iCurrentLine, 0, EFalse ); |
2835 RemovePressedDownHighlight(); |
3062 RemovePressedDownHighlight(); |
2836 } |
3063 } |
2837 } |
3064 } |
2838 } |
3065 } |
|
3066 |
|
3067 iExtension->iFlags.Clear( CDialogPageExtension::EDragEventsAllowed ); |
2839 } |
3068 } |
2840 |
3069 |
2841 // forward pointer event to line's observer |
3070 // forward pointer event to line's observer |
2842 if ( touchedLine == iCurrentLine && newLine && |
3071 if ( touchedLine == iCurrentLine && newLine && |
2843 ( iExtension->iFocusedClicked || |
3072 ( iExtension->iFocusedClicked || |
2890 |
3119 |
2891 if ( mskPress ) |
3120 if ( mskPress ) |
2892 { |
3121 { |
2893 TKeyEvent key; |
3122 TKeyEvent key; |
2894 key.iCode=EKeyOK; |
3123 key.iCode=EKeyOK; |
2895 key.iModifiers=0; |
3124 key.iModifiers=EModifierSpecial; |
2896 key.iRepeats = 0; |
3125 key.iRepeats = 0; |
2897 CEikonEnv::Static()->SimulateKeyEventL( key, EEventKey ); |
3126 iEikonEnv->SimulateKeyEventL( key, EEventKey ); |
2898 } |
3127 } |
|
3128 _AKNTRACE_FUNC_EXIT; |
2899 } |
3129 } |
2900 |
3130 |
2901 |
3131 |
2902 // --------------------------------------------------------------------------- |
3132 // --------------------------------------------------------------------------- |
2903 // CEikDialogPage::UpdatePhysics |
3133 // CEikDialogPage::UpdatePhysics |
2904 // --------------------------------------------------------------------------- |
3134 // --------------------------------------------------------------------------- |
2905 // |
3135 // |
2906 void CEikDialogPage::UpdatePhysics() |
3136 void CEikDialogPage::UpdatePhysics() |
2907 { |
3137 { |
|
3138 _AKNTRACE_FUNC_ENTER; |
2908 if ( IsForm() ) |
3139 if ( IsForm() ) |
2909 { |
3140 { |
2910 TPoint viewCenter( iSize.iWidth / 2, 0 ); |
3141 TPoint viewCenter( iSize.iWidth / 2, 0 ); |
2911 |
3142 |
2912 if ( iLines->Count() > 0 ) |
3143 if ( iLines->Count() > 0 ) |
2913 { |
3144 { |
2914 viewCenter.iY = Abs( (*iLines)[0]->Rect().iTl.iY - iPosition.iY ); |
3145 viewCenter.iY = Abs( (*iLines)[0]->Rect().iTl.iY - iPosition.iY ); |
2915 } |
3146 } |
2916 |
3147 |
2917 viewCenter.iY += iPhysics->ViewCenterDistance(); |
3148 TInt viewCenterDistance = iPhysics->ViewCenterDistance(); |
|
3149 viewCenter.iY += viewCenterDistance; |
2918 |
3150 |
2919 if ( iExtension->iInitialLayoutDone ) |
3151 if ( iExtension->iInitialLayoutDone ) |
2920 { |
3152 { |
2921 TInt oldScreenHeight = iPhysics->ViewSize().iHeight; |
3153 TInt oldScreenHeight = iPhysics->ViewSize().iHeight; |
2922 TInt delta = ( iPhysics->ViewCenterDistance() ) - |
3154 TInt delta = ( viewCenterDistance ) - ( oldScreenHeight / 2 ); |
2923 ( oldScreenHeight / 2 ); |
|
2924 |
3155 |
2925 viewCenter = iPhysics->ViewCenter(); |
3156 viewCenter = iPhysics->ViewCenter(); |
2926 viewCenter.iY += delta; |
3157 viewCenter.iY += delta; |
2927 } |
3158 } |
2928 |
3159 |
2929 TSize worldSize( iLines->MinimumSize() ); |
3160 TSize worldSize( iLines->MinimumSize() ); |
2930 worldSize.iHeight = Max( worldSize.iHeight, iSize.iHeight ); |
3161 worldSize.iHeight = Max( worldSize.iHeight, iSize.iHeight ); |
2931 |
3162 |
|
3163 // align to borders if those are crossed |
|
3164 if ( viewCenter.iY < viewCenterDistance ) |
|
3165 { |
|
3166 viewCenter.iY = viewCenterDistance; |
|
3167 } |
|
3168 else if ( viewCenter.iY > ( worldSize.iHeight - viewCenterDistance ) ) |
|
3169 { |
|
3170 viewCenter.iY = worldSize.iHeight - viewCenterDistance; |
|
3171 } |
|
3172 |
2932 TRAP_IGNORE( iPhysics->InitPhysicsL( worldSize, iSize, viewCenter ) ); |
3173 TRAP_IGNORE( iPhysics->InitPhysicsL( worldSize, iSize, viewCenter ) ); |
2933 TRAP_IGNORE( UpdateScrollBarL() ); |
3174 TRAP_IGNORE( UpdateScrollBarL() ); |
2934 } |
3175 } |
|
3176 _AKNTRACE_FUNC_EXIT; |
2935 } |
3177 } |
2936 |
3178 |
2937 |
3179 |
2938 // --------------------------------------------------------------------------- |
3180 // --------------------------------------------------------------------------- |
2939 // CEikDialogPage::HighlightTimerCallBack |
3181 // CEikDialogPage::HighlightTimerCallBack |
3026 } |
3269 } |
3027 if ( upperItem == -1 || bottomItem == iLines->Count() ) |
3270 if ( upperItem == -1 || bottomItem == iLines->Count() ) |
3028 { |
3271 { |
3029 if ( upperItem != iExtension->iTopItem || bottomItem != iExtension->iBottomItem ) |
3272 if ( upperItem != iExtension->iTopItem || bottomItem != iExtension->iBottomItem ) |
3030 { |
3273 { |
3031 iExtension->SilentFeedback( this, ETouchFeedbackSensitiveItem, TPointerEvent() ); |
3274 switch(iPhysics->OngoingPhysicsAction()) |
|
3275 { |
|
3276 case CAknPhysics::EAknPhysicsActionBouncing: |
|
3277 case CAknPhysics::EAknPhysicsActionDragging: |
|
3278 case CAknPhysics::EAknPhysicsActionFlicking: |
|
3279 iExtension->SilentFeedback( *this, |
|
3280 ETouchFeedbackSensitiveList, TPointerEvent() ); |
|
3281 break; |
|
3282 default: |
|
3283 break; |
|
3284 } |
3032 } |
3285 } |
3033 } |
3286 } |
3034 else if ( upperItem >= 0 || bottomItem < iLines->Count() ) |
3287 else if ( upperItem >= 0 || bottomItem < iLines->Count() ) |
3035 { |
3288 { |
3036 if ( upperItem < iExtension->iTopItem || bottomItem > iExtension->iBottomItem ) |
3289 if ( upperItem < iExtension->iTopItem || bottomItem > iExtension->iBottomItem ) |
3037 { |
3290 { |
3038 iExtension->SilentFeedback( this, ETouchFeedbackSensitiveItem, TPointerEvent() ); |
3291 switch(iPhysics->OngoingPhysicsAction()) |
|
3292 { |
|
3293 case CAknPhysics::EAknPhysicsActionBouncing: |
|
3294 case CAknPhysics::EAknPhysicsActionDragging: |
|
3295 case CAknPhysics::EAknPhysicsActionFlicking: |
|
3296 iExtension->SilentFeedback( *this, |
|
3297 ETouchFeedbackSensitiveList, TPointerEvent() ); |
|
3298 break; |
|
3299 default: |
|
3300 break; |
|
3301 } |
3039 } |
3302 } |
3040 } |
3303 } |
3041 iExtension->iBottomItem = bottomItem; |
3304 iExtension->iBottomItem = bottomItem; |
3042 iExtension->iTopItem = upperItem; |
3305 iExtension->iTopItem = upperItem; |
3043 if ( aDrawNow ) |
3306 if ( aDrawNow ) |
3140 line->DrawForeground( line->Rect() ); |
3414 line->DrawForeground( line->Rect() ); |
3141 DrawControl( line ); |
3415 DrawControl( line ); |
3142 } |
3416 } |
3143 |
3417 |
3144 Parent()->Parent()->Parent()->SetCustomGc( NULL ); |
3418 Parent()->Parent()->Parent()->SetCustomGc( NULL ); |
|
3419 _AKNTRACE_FUNC_EXIT; |
3145 } |
3420 } |
3146 |
3421 |
3147 |
3422 |
3148 // --------------------------------------------------------------------------- |
3423 // --------------------------------------------------------------------------- |
3149 // CEikDialogPage::RecordLineL |
3424 // CEikDialogPage::RecordLineL |
3150 // --------------------------------------------------------------------------- |
3425 // --------------------------------------------------------------------------- |
3151 // |
3426 // |
3152 void CEikDialogPage::RecordLineL( TInt aLine ) |
3427 void CEikDialogPage::RecordLineL( TInt aLine ) |
3153 { |
3428 { |
|
3429 _AKNTRACE_FUNC_ENTER; |
|
3430 _AKNTRACE( "CEikDialogPage::RecordLineL() aLine: [%d]", aLine ); |
3154 Parent()->Parent()->Parent()->SetCustomGc( iExtension->iRecordingGc ); |
3431 Parent()->Parent()->Parent()->SetCustomGc( iExtension->iRecordingGc ); |
3155 |
3432 |
3156 CEikCaptionedControl* line = (*iLines)[aLine]; |
3433 CEikCaptionedControl* line = (*iLines)[aLine]; |
3157 |
3434 |
3158 if ( line ) |
3435 if ( line ) |
3280 } |
3542 } |
3281 |
3543 |
3282 CCoeControl* grabbingComponent = GrabbingComponent(); |
3544 CCoeControl* grabbingComponent = GrabbingComponent(); |
3283 TBool callDefaultImplementation = ETrue; |
3545 TBool callDefaultImplementation = ETrue; |
3284 TBool focusItem = EFalse; |
3546 TBool focusItem = EFalse; |
3285 // YPosToLine is scaled to iDataWinPos, so add it to pointer Y position |
3547 TInt touchedLineIndex = iLines->YPositionToLineIndex( aPointerEvent.iPosition.iY ); |
3286 TInt yPosition = aPointerEvent.iPosition.iY; // + iDataWinPos.iY; |
3548 |
3287 TInt touchedLineIndex = YPosToLine2( yPosition ); |
|
3288 // If the stylus is down and the touched line is already the current one, |
3549 // If the stylus is down and the touched line is already the current one, |
3289 // mark this fact in iExtension->iFocusedClicked to be used later when the stylus is up. |
3550 // mark this fact in iExtension->iFocusedClicked to be used later when the stylus is up. |
3290 |
|
3291 if ( touchedLineIndex != KErrNotFound && |
3551 if ( touchedLineIndex != KErrNotFound && |
3292 iExtension->iCapturingItem != KErrNotFound && |
3552 iExtension->iCapturingItem != KErrNotFound && |
3293 touchedLineIndex != iExtension->iCapturingItem ) |
3553 touchedLineIndex != iExtension->iCapturingItem ) |
3294 { |
3554 { |
3295 iExtension->iCapturingItem = KErrNotFound; |
3555 iExtension->iCapturingItem = KErrNotFound; |
3469 if ( PageContainer()->PageSelector()->Dialg()->Extension()->iPublicFlags.IsSet( CEikDialogExtension::EUseVirtualInput ) ) |
3729 if ( PageContainer()->PageSelector()->Dialg()->Extension()->iPublicFlags.IsSet( CEikDialogExtension::EUseVirtualInput ) ) |
3470 { |
3730 { |
3471 clear = ETrue; |
3731 clear = ETrue; |
3472 } |
3732 } |
3473 |
3733 |
3474 if ( focusItem || iExtension->iFocusedClicked) |
3734 if ( focusItem || iExtension->iFocusedClicked ) |
3475 { |
3735 { |
3476 iExtension->HandleFormFeedback( this, aPointerEvent, touchedLineIndex, iCurrentLine ); |
3736 iExtension->HandleFormFeedback( *this, |
|
3737 aPointerEvent, |
|
3738 touchedLineIndex, |
|
3739 iCurrentLine ); |
3477 } |
3740 } |
3478 |
3741 |
3479 if ( focusItem ) |
3742 if ( focusItem ) |
3480 { |
3743 { |
3481 PrepareForFocusTransitionL(); |
3744 PrepareForFocusTransitionL(); |
3482 |
3745 |
3483 (*iLines)[iCurrentLine]->ScrollBackEditor(); |
3746 (*iLines)[iCurrentLine]->ScrollBackEditorL(); |
3484 ShowFocus( EFalse, EFalse ); |
3747 ShowFocus( EFalse, EFalse ); |
3485 iCurrentLine = touchedLineIndex; |
3748 iCurrentLine = touchedLineIndex; |
3486 ShowFocus( ETrue, EFalse ); |
3749 ShowFocus( ETrue, EFalse ); |
3487 ExposeLine( iCurrentLine, EFalse ); |
3750 ExposeLine( iCurrentLine, EFalse ); |
3488 LineChangedL((*iLines)[touchedLineIndex]->iId); |
3751 LineChangedL((*iLines)[touchedLineIndex]->iId); |
4170 void CEikDialogPageContainer::SetPageSelector(const CEikDialogPageSelector* aPageSelector) |
4440 void CEikDialogPageContainer::SetPageSelector(const CEikDialogPageSelector* aPageSelector) |
4171 { |
4441 { |
4172 iPageSelector = aPageSelector; |
4442 iPageSelector = aPageSelector; |
4173 } |
4443 } |
4174 |
4444 |
4175 void CEikDialogPageContainer::SetPageFormSized() |
4445 void CEikDialogPageContainer::SetPageFormSized(const TRect& aRect) |
4176 { |
4446 { |
4177 iForm = ETrue; |
4447 iForm = ETrue; |
4178 |
4448 |
4179 // |
4449 // |
4180 // Form layout |
4450 // Form layout |
4181 // |
4451 // |
4182 |
4452 |
4183 /** Dialog page container and page have the same size */ |
4453 SetRect(aRect); |
4184 TRect mainPaneRect; |
|
4185 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPaneRect ); |
|
4186 mainPaneRect = TRect( mainPaneRect.Size() ); // Moving to point (0, 0) |
|
4187 TAknLayoutRect formPaneLt; |
|
4188 formPaneLt.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::listscroll_form_pane().LayoutLine() ); |
|
4189 formPaneLt.LayoutRect( formPaneLt.Rect(), AknLayoutScalable_Avkon::list_form_gen_pane().LayoutLine() ); |
|
4190 |
|
4191 // |
|
4192 // End of form layout |
|
4193 // |
|
4194 |
|
4195 if ( formPaneLt.Rect() != Rect() ) |
|
4196 { |
|
4197 // TODO: use static method to do variation between traditional scrolling and panning when available |
|
4198 //SetRect( formPaneLt.Rect() ); |
|
4199 SetRect( mainPaneRect ); |
|
4200 } |
|
4201 |
4454 |
4202 /** Only forms have line highlight animations. Animation creation is delayed |
4455 /** Only forms have line highlight animations. Animation creation is delayed |
4203 * here. |
4456 * here. |
4204 */ |
4457 */ |
4205 if ( !iAnimation ) |
4458 if ( !iAnimation ) |