uifw/EikStd/dlgsrc/EIKDPAGE.CPP
branchRCL_3
changeset 4 8ca85d2f0db7
parent 0 2f259fa3e83a
child 9 aabf2c525e0f
equal deleted inserted replaced
0:2f259fa3e83a 4:8ca85d2f0db7
    53 #include <AknTasHook.h> // for testability hooks
    53 #include <AknTasHook.h> // for testability hooks
    54 #include "aknformphysics.h"
    54 #include "aknformphysics.h"
    55 #include "aknrecordinggc.h"
    55 #include "aknrecordinggc.h"
    56 #include <aknphysics.h>
    56 #include <aknphysics.h>
    57 #include <aknappui.h>
    57 #include <aknappui.h>
    58 #include <aknPriv.hrh>
    58 #include <AknPriv.hrh>
    59 
    59 #include "akntrace.h"
    60 //
    60 //
    61 // Global constants.
    61 // Global constants.
    62 //
    62 //
    63 
    63 
    64 const TInt KSpaceFromTitle=0 ; 
    64 const TInt KSpaceFromTitle=0 ; 
   331 // CEikDialogPage.
   331 // CEikDialogPage.
   332 //
   332 //
   333 
   333 
   334 CEikDialogPage::~CEikDialogPage()
   334 CEikDialogPage::~CEikDialogPage()
   335     {
   335     {
       
   336 	_AKNTRACE_FUNC_ENTER;
   336     AKNTASHOOK_REMOVE();
   337     AKNTASHOOK_REMOVE();
   337     // Page observer needs to be nulled or an already deleted instance is
   338     // Page observer needs to be nulled or an already deleted instance is
   338     // called when pointer up event is handled. This is valid only for dialogs
   339     // called when pointer up event is handled. This is valid only for dialogs
   339     // that have embedded virtual inputs.
   340     // that have embedded virtual inputs.
   340     iPageObserver = NULL;
   341     iPageObserver = NULL;
   341     delete iPhysics;
   342     delete iPhysics;
   342     delete iLines;
   343     delete iLines;
   343     delete iScroll;    
   344     delete iScroll;    
   344     delete iExtension;
   345     delete iExtension;
       
   346     _AKNTRACE_FUNC_EXIT;
   345     }
   347     }
   346 
   348 
   347 CEikDialogPage* CEikDialogPage::NewL(TInt aPageId,RWindow& aViewWin,CEikScrollBarFrame& aSBFrame,const CEikDialogPageContainer& aParent,MEikDialogPageObserver* aPageObserver)
   349 CEikDialogPage* CEikDialogPage::NewL(TInt aPageId,RWindow& aViewWin,CEikScrollBarFrame& aSBFrame,const CEikDialogPageContainer& aParent,MEikDialogPageObserver* aPageObserver)
   348     {
   350     {
       
   351 	_AKNTRACE_FUNC_ENTER;
   349     CEikDialogPage* self=CEikDialogPage::NewLC(aPageId,aViewWin,aSBFrame,aParent,aPageObserver);
   352     CEikDialogPage* self=CEikDialogPage::NewLC(aPageId,aViewWin,aSBFrame,aParent,aPageObserver);
   350     CleanupStack::Pop();
   353     CleanupStack::Pop();
       
   354     _AKNTRACE_FUNC_EXIT;
   351     return self;
   355     return self;
   352     }
   356     }
   353 
   357 
   354 void CEikDialogPage::CommonConstructCodeBetweenNewL(CEikDialogPage& aDialogPage, const CEikDialogPageContainer& aParent)
   358 void CEikDialogPage::CommonConstructCodeBetweenNewL(CEikDialogPage& aDialogPage, const CEikDialogPageContainer& aParent)
   355     {
   359     {
   363     aDialogPage.CopyControlContextFrom(&aParent);
   367     aDialogPage.CopyControlContextFrom(&aParent);
   364     };
   368     };
   365 
   369 
   366 CEikDialogPage* CEikDialogPage::NewLC(TInt aPageId,RWindow& aViewWin,CEikScrollBarFrame& aSBFrame,const CEikDialogPageContainer& aParent,MEikDialogPageObserver* aPageObserver)
   370 CEikDialogPage* CEikDialogPage::NewLC(TInt aPageId,RWindow& aViewWin,CEikScrollBarFrame& aSBFrame,const CEikDialogPageContainer& aParent,MEikDialogPageObserver* aPageObserver)
   367     {
   371     {
       
   372 	_AKNTRACE_FUNC_ENTER;
   368     CEikDialogPage* self=new(ELeave) CEikDialogPage(aPageId,aViewWin,aSBFrame,aPageObserver);
   373     CEikDialogPage* self=new(ELeave) CEikDialogPage(aPageId,aViewWin,aSBFrame,aPageObserver);
   369     CleanupStack::PushL(self);
   374     CleanupStack::PushL(self);
   370     CommonConstructCodeBetweenNewL(*self,aParent); 
   375     CommonConstructCodeBetweenNewL(*self,aParent); 
   371     AKNTASHOOK_ADDL( self, "CEikDialogPage" );
   376     AKNTASHOOK_ADDL( self, "CEikDialogPage" );
       
   377     _AKNTRACE_FUNC_EXIT;
   372     return self;
   378     return self;
   373     }
   379     }
   374 
   380 
   375 CEikDialogPage* CEikDialogPage::NewL(TInt aPageId,RWindow& aViewWin,CEikScrollBarFrame& aSBFrame,const CEikDialogPageContainer& aParent,MEikDialogPageObserver* aPageObserver,TResourceReader& aReader)
   381 CEikDialogPage* CEikDialogPage::NewL(TInt aPageId,RWindow& aViewWin,CEikScrollBarFrame& aSBFrame,const CEikDialogPageContainer& aParent,MEikDialogPageObserver* aPageObserver,TResourceReader& aReader)
   376     {
   382     {
       
   383 	_AKNTRACE_FUNC_ENTER;
   377     CEikDialogPage* self=CEikDialogPage::NewLC(aPageId,aViewWin,aSBFrame,aParent,aPageObserver,aReader);
   384     CEikDialogPage* self=CEikDialogPage::NewLC(aPageId,aViewWin,aSBFrame,aParent,aPageObserver,aReader);
   378     CleanupStack::Pop();
   385     CleanupStack::Pop();
       
   386     _AKNTRACE_FUNC_EXIT;
   379     return self;
   387     return self;
   380     }
   388     }
   381 
   389 
   382 CEikDialogPage* CEikDialogPage::NewLC(TInt aPageId,RWindow& aViewWin,CEikScrollBarFrame& aSBFrame,const CEikDialogPageContainer& aParent,MEikDialogPageObserver* aPageObserver,TResourceReader& aReader)
   390 CEikDialogPage* CEikDialogPage::NewLC(TInt aPageId,RWindow& aViewWin,CEikScrollBarFrame& aSBFrame,const CEikDialogPageContainer& aParent,MEikDialogPageObserver* aPageObserver,TResourceReader& aReader)
   383     {
   391     {
       
   392 	_AKNTRACE_FUNC_ENTER;
   384     CEikDialogPage* self=new(ELeave) CEikDialogPage(aPageId,aViewWin,aSBFrame,aPageObserver);
   393     CEikDialogPage* self=new(ELeave) CEikDialogPage(aPageId,aViewWin,aSBFrame,aPageObserver);
   385     CleanupStack::PushL(self);
   394     CleanupStack::PushL(self);
   386     CommonConstructCodeBetweenNewL(*self,aParent);
   395     CommonConstructCodeBetweenNewL(*self,aParent);
   387     self->ConstructFromResourceL(aReader);
   396     self->ConstructFromResourceL(aReader);
   388     AKNTASHOOK_ADDL( self, "CEikDialogPage" );
   397     AKNTASHOOK_ADDL( self, "CEikDialogPage" );
       
   398     _AKNTRACE_FUNC_EXIT;
   389     return self;
   399     return self;
   390     }
   400     }
   391 
   401 
   392 CEikDialogPage::CEikDialogPage(TInt aPageId,RWindow& /*aViewWin*/,
   402 CEikDialogPage::CEikDialogPage(TInt aPageId,RWindow& /*aViewWin*/,
   393     CEikScrollBarFrame& /*aSBFrame*/,MEikDialogPageObserver* aPageObserver)
   403     CEikScrollBarFrame& /*aSBFrame*/,MEikDialogPageObserver* aPageObserver)
   394     : iPageObserver(aPageObserver),
   404     : iPageObserver(aPageObserver),
   395         iPageId(aPageId),iCurrentLine(-1)
   405         iPageId(aPageId),iCurrentLine(-1)
   396     {
   406     {
       
   407 	_AKNTRACE_FUNC_ENTER;
   397     SetBlank();
   408     SetBlank();
   398     SetComponentsToInheritVisibility();
   409     SetComponentsToInheritVisibility();
       
   410     _AKNTRACE_FUNC_EXIT;
   399     }
   411     }
   400 
   412 
   401 void CEikDialogPage::ConstructL()
   413 void CEikDialogPage::ConstructL()
   402     {
   414     {
       
   415 	_AKNTRACE_FUNC_ENTER;
   403     iLines=new(ELeave)CEikCapCArray(KLineArrayGranularity);
   416     iLines=new(ELeave)CEikCapCArray(KLineArrayGranularity);
   404     SetContainerWindowL( *iPageContainer );
   417     SetContainerWindowL( *iPageContainer );
   405     Window().SetPointerGrab(ETrue); 
   418     Window().SetPointerGrab(ETrue); 
   406     Window().SetShadowDisabled(ETrue);
   419     Window().SetShadowDisabled(ETrue);
   407     Window().SetBackgroundColor(iEikonEnv->ControlColor(EColorDialogBackground,*this));
   420     Window().SetBackgroundColor(iEikonEnv->ControlColor(EColorDialogBackground,*this));
   408     iScroll = new(ELeave)CAknPaneScroll(this);
   421     iScroll = new(ELeave)CAknPaneScroll(this);
   409     iScroll->SetLines(iLines);
   422     iScroll->SetLines(iLines);
   410     iExtension = CDialogPageExtension::NewL();
   423     iExtension = CDialogPageExtension::NewL();
       
   424     _AKNTRACE_FUNC_EXIT;
   411     }
   425     }
   412 
   426 
   413 void CEikDialogPage::ConstructFromResourceL(TResourceReader& aReader, TBool aFormControl )
   427 void CEikDialogPage::ConstructFromResourceL(TResourceReader& aReader, TBool aFormControl )
   414     {
   428     {
       
   429 	_AKNTRACE_FUNC_ENTER;
   415     iFormControl = aFormControl ;
   430     iFormControl = aFormControl ;
   416 
   431 
   417     if ( IsForm() )
   432     if ( IsForm() )
   418         {
   433         {
   419         if ( iAvkonAppUi )
   434         if ( iAvkonAppUi )
   434             return;
   449             return;
   435         TResourceReader indirectReader;
   450         TResourceReader indirectReader;
   436         iCoeEnv->CreateResourceReaderLC(indirectReader,indirectRid);
   451         iCoeEnv->CreateResourceReaderLC(indirectReader,indirectRid);
   437         ConstructFromResourceL(indirectReader);
   452         ConstructFromResourceL(indirectReader);
   438         CleanupStack::PopAndDestroy();
   453         CleanupStack::PopAndDestroy();
       
   454         _AKNTRACE_FUNC_EXIT;
   439         return;
   455         return;
   440         }
   456         }
   441 
   457 
   442     // This section modified to handle FORM structure (which contains DIALOG_LINE structs )
   458     // This section modified to handle FORM structure (which contains DIALOG_LINE structs )
   443     // There might be lines on the page already
   459     // There might be lines on the page already
   467     if (!iScroll)
   483     if (!iScroll)
   468         {
   484         {
   469         iScroll = new(ELeave)CAknPaneScroll(this);
   485         iScroll = new(ELeave)CAknPaneScroll(this);
   470         }
   486         }
   471     iScroll->SetLines(iLines);
   487     iScroll->SetLines(iLines);
       
   488     _AKNTRACE_FUNC_EXIT;
   472     }
   489     }
   473 
   490 
   474 void CEikDialogPage::ConstructFormFromResourceL( TResourceReader& aReader ) 
   491 void CEikDialogPage::ConstructFormFromResourceL( TResourceReader& aReader ) 
   475     {
   492     {
       
   493 	_AKNTRACE_FUNC_ENTER;
   476     iFormFlags = TInt16(aReader.ReadInt16()) ;
   494     iFormFlags = TInt16(aReader.ReadInt16()) ;
   477     iFormLayout = (iFormFlags&EEikFormUseDoubleSpacedFormat) ? EDouble : ESingle;
   495     iFormLayout = (iFormFlags&EEikFormUseDoubleSpacedFormat) ? EDouble : ESingle;
   478     ConstructFromResourceL( aReader, ETrue ) ;
   496     ConstructFromResourceL( aReader, ETrue ) ;
       
   497     _AKNTRACE_FUNC_EXIT;
   479     }
   498     }
   480 
   499 
   481 CCoeControl* CEikDialogPage::CreateLineByTypeL(const TDesC& aCaption,TInt aLineId,TInt aControlType,TAny* aReturnValue)
   500 CCoeControl* CEikDialogPage::CreateLineByTypeL(const TDesC& aCaption,TInt aLineId,TInt aControlType,TAny* aReturnValue)
   482     {
   501     {
       
   502 	_AKNTRACE_FUNC_ENTER;
   483     ShowFocus( EFalse, EFalse ) ;  // Turn the focus off the current line.  
   503     ShowFocus( EFalse, EFalse ) ;  // Turn the focus off the current line.  
   484     CEikCaptionedControl* line=new(ELeave) CEikCaptionedControl;
   504     CEikCaptionedControl* line=new(ELeave) CEikCaptionedControl;
   485     CleanupStack::PushL(line);
   505     CleanupStack::PushL(line);
   486     line->SetComponentsToInheritVisibility();
   506     line->SetComponentsToInheritVisibility();
   487     // Try to insert line above the currently selected line.  If no line is currently selected then append (TimW 22/5/00)
   507     // Try to insert line above the currently selected line.  If no line is currently selected then append (TimW 22/5/00)
   513 
   533 
   514     ChangeFocusTo( targetLine );
   534     ChangeFocusTo( targetLine );
   515 
   535 
   516     // physics engine needs to be updated when lines are added after the initial layout
   536     // physics engine needs to be updated when lines are added after the initial layout
   517     UpdatePhysics();
   537     UpdatePhysics();
   518 
   538     _AKNTRACE_FUNC_EXIT;
   519     return line->iControl;
   539     return line->iControl;
   520     }
   540     }
   521 
   541 
   522 CEikCaptionedControl* CEikDialogPage::ConstructLineL(TInt aResourceId)
   542 CEikCaptionedControl* CEikDialogPage::ConstructLineL(TInt aResourceId)
   523     {
   543     {
       
   544 	_AKNTRACE_FUNC_ENTER;
   524     TResourceReader resourceReader;
   545     TResourceReader resourceReader;
   525     iCoeEnv->CreateResourceReaderLC(resourceReader,aResourceId);
   546     iCoeEnv->CreateResourceReaderLC(resourceReader,aResourceId);
   526     CEikCaptionedControl* line=ConstructLineL(resourceReader);
   547     CEikCaptionedControl* line=ConstructLineL(resourceReader);
   527     CleanupStack::PopAndDestroy(); // resourceReader
   548     CleanupStack::PopAndDestroy(); // resourceReader
       
   549     _AKNTRACE_FUNC_EXIT;
   528     return line;
   550     return line;
   529     }
   551     }
   530 
   552 
   531 CEikCaptionedControl* CEikDialogPage::ConstructLineL(TResourceReader& aReader)
   553 CEikCaptionedControl* CEikDialogPage::ConstructLineL(TResourceReader& aReader)
   532     {
   554     {
       
   555 	_AKNTRACE_FUNC_ENTER;
   533     CEikCaptionedControl* line=new(ELeave) CEikCaptionedControl;
   556     CEikCaptionedControl* line=new(ELeave) CEikCaptionedControl;
   534     CleanupStack::PushL(line);
   557     CleanupStack::PushL(line);
   535     line->iIsFormControl=iFormControl; 
   558     line->iIsFormControl=iFormControl; 
   536     line->SetComponentsToInheritVisibility();
   559     line->SetComponentsToInheritVisibility();
   537     TInt controlType=aReader.ReadInt16();
   560     TInt controlType=aReader.ReadInt16();
   549     ConstructByTypeL(controlType,line,this);
   572     ConstructByTypeL(controlType,line,this);
   550     line->ConstructFromResourceL(*reader);
   573     line->ConstructFromResourceL(*reader);
   551     if (indirectRid)
   574     if (indirectRid)
   552         CleanupStack::PopAndDestroy();
   575         CleanupStack::PopAndDestroy();
   553     CleanupStack::Pop(); // line
   576     CleanupStack::Pop(); // line
       
   577     _AKNTRACE_FUNC_EXIT;
   554     return line;
   578     return line;
   555     }
   579     }
   556 
   580 
   557 void CEikDialogPage::ConstructByTypeL(TInt aType,CEikCaptionedControl* aLine,CCoeControl* aContainer)
   581 void CEikDialogPage::ConstructByTypeL(TInt aType,CEikCaptionedControl* aLine,CCoeControl* aContainer)
   558     {
   582     {
       
   583 	_AKNTRACE_FUNC_ENTER;
   559     SEikControlInfo controlInfo=EikControlFactory::CreateByTypeL(aType);
   584     SEikControlInfo controlInfo=EikControlFactory::CreateByTypeL(aType);
   560     if (!controlInfo.iControl)
   585     if (!controlInfo.iControl)
   561         controlInfo=CreateCustomControlL(aType);
   586         controlInfo=CreateCustomControlL(aType);
   562     aLine->iIsFormControl=iFormControl; 
   587     aLine->iIsFormControl=iFormControl; 
   563     aLine->iControl=controlInfo.iControl;
   588     aLine->iControl=controlInfo.iControl;
   587         {
   612         {
   588         HBufC* tmp=iCoeEnv->AllocReadResourceLC(controlInfo.iTrailerTextId);
   613         HBufC* tmp=iCoeEnv->AllocReadResourceLC(controlInfo.iTrailerTextId);
   589         aLine->SetTrailerL(tmp->Des());
   614         aLine->SetTrailerL(tmp->Des());
   590         CleanupStack::PopAndDestroy(); // tmp
   615         CleanupStack::PopAndDestroy(); // tmp
   591         }
   616         }
       
   617     _AKNTRACE_FUNC_EXIT;
   592     }
   618     }
   593 
   619 
   594 SEikControlInfo CEikDialogPage::CreateCustomControlL(TInt aControlType)
   620 SEikControlInfo CEikDialogPage::CreateCustomControlL(TInt aControlType)
   595     {
   621     {
   596     ASSERT(iPageObserver);
   622     ASSERT(iPageObserver);
   597     return iPageObserver->CreateCustomControlL(aControlType);
   623     return iPageObserver->CreateCustomControlL(aControlType);
   598     }
   624     }
   599 
   625 
   600 void CEikDialogPage::SetActiveL()
   626 void CEikDialogPage::SetActiveL()
   601     {
   627     {
       
   628 	_AKNTRACE_FUNC_ENTER;
   602     ActivateL();
   629     ActivateL();
   603     MakeVisible(ETrue);        
   630     MakeVisible(ETrue);        
   604     
   631     
   605     if(AknLayoutUtils::PenEnabled())
   632     if(AknLayoutUtils::PenEnabled())
   606     {
   633     {
   644                 );
   671                 );
   645             }
   672             }
   646        }
   673        }
   647 
   674 
   648         }
   675         }
       
   676     _AKNTRACE_FUNC_EXIT;
   649     }
   677     }
   650 
   678 
   651 void CEikDialogPage::SetActiveAndFocusL()
   679 void CEikDialogPage::SetActiveAndFocusL()
   652     {
   680     {
       
   681 	_AKNTRACE_FUNC_ENTER;
   653     SetActiveL();
   682     SetActiveL();
   654     SetEditableL(iIsEditable, ETrue);
   683     SetEditableL(iIsEditable, ETrue);
   655     //When active a page, need to show the focus in that page.
   684     //When active a page, need to show the focus in that page.
   656     ShowFocus( ETrue, EFalse ) ;
   685     ShowFocus( ETrue, EFalse ) ;
   657     // Display the focus on the current line 
   686     // Display the focus on the current line 
   660         SetInitialFocus() ;
   689         SetInitialFocus() ;
   661         }
   690         }
   662     
   691     
   663     ExposeLine( iCurrentLine, EFalse );
   692     ExposeLine( iCurrentLine, EFalse );
   664     UpdateScrollBarL();
   693     UpdateScrollBarL();
       
   694     _AKNTRACE_FUNC_EXIT;
   665     }
   695     }
   666 
   696 
   667 void CEikDialogPage::SetInactiveL()
   697 void CEikDialogPage::SetInactiveL()
   668     {
   698     {
       
   699 	_AKNTRACE_FUNC_ENTER;
   669     MakeEdwinScrollbarsVisibleL(EFalse);
   700     MakeEdwinScrollbarsVisibleL(EFalse);
   670     MakeVisible(EFalse);
   701     MakeVisible(EFalse);
       
   702     _AKNTRACE_FUNC_EXIT;
   671     }
   703     }
   672 
   704 
   673 void CEikDialogPage::MakeEdwinScrollbarsVisibleL(TBool aVisible)
   705 void CEikDialogPage::MakeEdwinScrollbarsVisibleL(TBool aVisible)
   674     {
   706     {
       
   707 	_AKNTRACE_FUNC_ENTER;
   675     const TInt numLines=iLines->Count();
   708     const TInt numLines=iLines->Count();
   676     for (TInt ii=0;ii<numLines;ii++)
   709     for (TInt ii=0;ii<numLines;ii++)
   677         {
   710         {
   678         CEikCaptionedControl* thisLine=(*iLines)[ii];
   711         CEikCaptionedControl* thisLine=(*iLines)[ii];
   679         const TInt controlType(thisLine->iControlType);
   712         const TInt controlType(thisLine->iControlType);
   689                 for (TInt jj=0;jj<count;jj++)
   722                 for (TInt jj=0;jj<count;jj++)
   690                     frame->ComponentControl(jj)->MakeVisible(aVisible);
   723                     frame->ComponentControl(jj)->MakeVisible(aVisible);
   691                 }
   724                 }
   692             }
   725             }
   693         }
   726         }
       
   727     _AKNTRACE_FUNC_EXIT;
   694     }
   728     }
   695 
   729 
   696 TInt CEikDialogPage::PageId() const
   730 TInt CEikDialogPage::PageId() const
   697     {
   731     {
   698     return iPageId;
   732     return iPageId;
   707     return KErrNotFound;
   741     return KErrNotFound;
   708     }
   742     }
   709 
   743 
   710 TBool CEikDialogPage::SetInitialFocus()
   744 TBool CEikDialogPage::SetInitialFocus()
   711     {
   745     {
       
   746 	_AKNTRACE_FUNC_ENTER;
   712     TBool focusSet=EFalse;
   747     TBool focusSet=EFalse;
   713 
   748 
   714     const TInt numLines=iLines->Count();
   749     const TInt numLines=iLines->Count();
   715     for (TInt ii=0;ii<numLines;ii++)
   750     for (TInt ii=0;ii<numLines;ii++)
   716         {
   751         {
   726     		iLines->MoveLineToScreen( ii, iPhysics->ViewTopY(), ETrue );
   761     		iLines->MoveLineToScreen( ii, iPhysics->ViewTopY(), ETrue );
   727             }
   762             }
   728         break;
   763         break;
   729         }
   764         }
   730     iExtension->iSetInitialFocusDone = ETrue;
   765     iExtension->iSetInitialFocusDone = ETrue;
       
   766     _AKNTRACE( "return focusSet;: [%d]", focusSet );
       
   767     _AKNTRACE_FUNC_EXIT;
   731     return focusSet;
   768     return focusSet;
   732     }
   769     }
   733 
   770 
   734 TKeyResponse CEikDialogPage::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
   771 TKeyResponse CEikDialogPage::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
   735     {
   772     {
       
   773 	_AKNTRACE_FUNC_ENTER;
   736     TKeyResponse response=EKeyWasNotConsumed;
   774     TKeyResponse response=EKeyWasNotConsumed;
   737 
   775 
   738     if (!(PageContainer()->PageSelector()->Dialg()->DialogFlags() & EEikDialogFlagDontEatUpDownEvents))
   776     if (!(PageContainer()->PageSelector()->Dialg()->DialogFlags() & EEikDialogFlagDontEatUpDownEvents))
   739         {
   777         {
   740         if (aType != EEventKey)
   778         if (aType != EEventKey)
   741         return response;
   779         	{
       
   780             _AKNTRACE_FUNC_EXIT;	
       
   781             return response;        
       
   782         	}
   742         }
   783         }
   743 
   784 
   744     const TInt numLines=iLines->Count();
   785     const TInt numLines=iLines->Count();
   745     if ((iCurrentLine>-1)&&(iCurrentLine<numLines))
   786     if ((iCurrentLine>-1)&&(iCurrentLine<numLines))
   746         {
   787         {
   760             || aKeyEvent.iCode==EKeyTab
   801             || aKeyEvent.iCode==EKeyTab
   761             || aKeyEvent.iCode==EKeyNext
   802             || aKeyEvent.iCode==EKeyNext
   762             || aKeyEvent.iCode==EKeyPrevious
   803             || aKeyEvent.iCode==EKeyPrevious
   763             ))
   804             ))
   764         response=OfferUpDownKeyEventL(aKeyEvent,aType,ENonCyclic);
   805         response=OfferUpDownKeyEventL(aKeyEvent,aType,ENonCyclic);
       
   806     _AKNTRACE_FUNC_EXIT;
   765     return response;
   807     return response;
   766     }
   808     }
   767 
   809 
   768 TKeyResponse CEikDialogPage::OfferUpDownKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType,TFocusNavigationMode aFocusNavigationMode)
   810 TKeyResponse CEikDialogPage::OfferUpDownKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType,TFocusNavigationMode aFocusNavigationMode)
   769     {
   811     {
       
   812 	_AKNTRACE_FUNC_ENTER;
   770     TKeyResponse response=EKeyWasNotConsumed;
   813     TKeyResponse response=EKeyWasNotConsumed;
   771     if (aType==EEventKey)
   814     if (aType==EEventKey)
   772         {
   815         {
   773         const TInt numLines=iLines->Count();
   816         const TInt numLines=iLines->Count();
   774         if ((iCurrentLine>-1)&&(iCurrentLine<numLines))
   817         if ((iCurrentLine>-1)&&(iCurrentLine<numLines))
   821             }
   864             }
   822         }
   865         }
   823 
   866 
   824     if (response==EKeyWasConsumed)
   867     if (response==EKeyWasConsumed)
   825         UpdateScrollBarThumb();
   868         UpdateScrollBarThumb();
   826 
   869     _AKNTRACE_FUNC_EXIT;
   827     return response;
   870     return response;
   828     }
   871     }
   829 
   872 
   830 TKeyResponse CEikDialogPage::HandleNonCyclicFocusNavigationKeyL(const TKeyEvent& aKeyEvent)
   873 TKeyResponse CEikDialogPage::HandleNonCyclicFocusNavigationKeyL(const TKeyEvent& aKeyEvent)
   831     {
   874     {
   930     return ownsLine;
   973     return ownsLine;
   931     }
   974     }
   932 
   975 
   933 void CEikDialogPage::SetDimmed(TBool aDimmed)
   976 void CEikDialogPage::SetDimmed(TBool aDimmed)
   934     {
   977     {
       
   978 	_AKNTRACE_FUNC_ENTER;
   935     CCoeControl::SetDimmed(aDimmed);
   979     CCoeControl::SetDimmed(aDimmed);
   936 
   980 
   937     const TInt numLines=iLines->Count();
   981     const TInt numLines=iLines->Count();
   938     for (TInt ii=0;ii<numLines;ii++)
   982     for (TInt ii=0;ii<numLines;ii++)
   939         {
   983         {
   940         CEikCaptionedControl* thisLine=(*iLines)[ii];
   984         CEikCaptionedControl* thisLine=(*iLines)[ii];
   941         thisLine->iControl->SetDimmed(aDimmed);
   985         thisLine->iControl->SetDimmed(aDimmed);
   942         thisLine->CheckDimmedDisplayState();
   986         thisLine->CheckDimmedDisplayState();
   943         }
   987         }
       
   988     _AKNTRACE_FUNC_EXIT;
   944     }
   989     }
   945 
   990 
   946 TBool CEikDialogPage::RotateFocusByL(TInt aDelta)
   991 TBool CEikDialogPage::RotateFocusByL(TInt aDelta)
   947     {
   992     {
       
   993 	_AKNTRACE_FUNC_ENTER;
   948     TInt numLines=iLines->Count();
   994     TInt numLines=iLines->Count();
   949     if (numLines == 0)
   995     if (numLines == 0)
       
   996         {
       
   997         _AKNTRACE_FUNC_EXIT;
   950         return(EFalse);
   998         return(EFalse);
       
   999         }
   951     
  1000     
   952     // If form is in view mode and highlight is hidden then the first
  1001     // If form is in view mode and highlight is hidden then the first
   953     // navigation key press just displays the highlight.
  1002     // navigation key press just displays the highlight.
   954     if ( IsForm() && !IsEditable() && !HighlightVisible() )
  1003     if ( IsForm() && !IsEditable() && !HighlightVisible() )
   955         {
  1004         {
   969                 {
  1018                 {
   970                 iExtension->iLastTouchedLine = lineIndex;
  1019                 iExtension->iLastTouchedLine = lineIndex;
   971                 HandleHighlightTimer();
  1020                 HandleHighlightTimer();
   972                 }
  1021                 }
   973             }
  1022             }
   974         
  1023         _AKNTRACE_FUNC_EXIT;
   975         return ETrue;
  1024         return ETrue;
   976         }
  1025         }
   977     
  1026     
   978     TInt max=numLines-1;
  1027     TInt max=numLines-1;
   979     TInt currentLine=iCurrentLine;
  1028     TInt currentLine=iCurrentLine;
   998             continue;
  1047             continue;
   999 
  1048 
  1000         ChangeFocusToAndExposeL(currentLine);
  1049         ChangeFocusToAndExposeL(currentLine);
  1001         LineChangedL((*iLines)[currentLine]->iId);
  1050         LineChangedL((*iLines)[currentLine]->iId);
  1002         iExtension->iFocusedClicked = ETrue;
  1051         iExtension->iFocusedClicked = ETrue;
       
  1052         _AKNTRACE_FUNC_EXIT;
  1003         return(ETrue);
  1053         return(ETrue);
  1004         }
  1054         }
  1005         
  1055     _AKNTRACE_FUNC_EXIT;    
  1006     return EFalse;
  1056     return EFalse;
  1007     }
  1057     }
  1008 
  1058 
  1009 void CEikDialogPage::ChangeFocusToAndExposeL( TInt aLine, TBool /*aShowWholeControl*/ )
  1059 void CEikDialogPage::ChangeFocusToAndExposeL( TInt aLine, TBool /*aShowWholeControl*/ )
  1010     {
  1060     {
       
  1061 	_AKNTRACE_FUNC_ENTER;
       
  1062 	_AKNTRACE( "CEikDialogPage::ChangeFocusToAndExposeL() aLine: [%d]", aLine );
  1011     if ( aLine < 0 || aLine == iCurrentLine )
  1063     if ( aLine < 0 || aLine == iCurrentLine )
       
  1064         {
       
  1065         _AKNTRACE_FUNC_EXIT;
  1012         return;
  1066         return;
       
  1067         }
  1013     
  1068     
  1014     TInt oldLine = iCurrentLine;
  1069     TInt oldLine = iCurrentLine;
  1015     
  1070     
  1016     if( aLine != iCurrentLine )
  1071     if( aLine != iCurrentLine )
  1017         (*iLines)[iCurrentLine]->ScrollBackEditor();
  1072         (*iLines)[iCurrentLine]->ScrollBackEditor();
  1030             ShowFocus(ETrue, EFalse);
  1085             ShowFocus(ETrue, EFalse);
  1031             }
  1086             }
  1032         
  1087         
  1033         DrawDeferred();
  1088         DrawDeferred();
  1034         }
  1089         }
       
  1090     _AKNTRACE_FUNC_EXIT;
  1035     }
  1091     }
  1036 
  1092 
  1037 TInt CEikDialogPage::TopFocusableLine() const
  1093 TInt CEikDialogPage::TopFocusableLine() const
  1038     {
  1094     {
  1039     const TInt numLines=iLines->Count();
  1095     const TInt numLines=iLines->Count();
  1058     return KErrNotFound;
  1114     return KErrNotFound;
  1059     }
  1115     }
  1060 
  1116 
  1061 TBool CEikDialogPage::LineIsFocusable(TInt aLine) const
  1117 TBool CEikDialogPage::LineIsFocusable(TInt aLine) const
  1062     {
  1118     {
       
  1119 	_AKNTRACE_FUNC_ENTER;
  1063     TBool focusable(ETrue);
  1120     TBool focusable(ETrue);
  1064     CEikCaptionedControl* line=(*iLines)[aLine];
  1121     CEikCaptionedControl* line=(*iLines)[aLine];
  1065 
  1122 
  1066     if (line->IsNonFocusing() || line->IsDimmed() || !(line->IsVisible()))
  1123     if (line->IsNonFocusing() || line->IsDimmed() || !(line->IsVisible()))
  1067         focusable=EFalse;
  1124         focusable=EFalse;
  1068 
  1125     _AKNTRACE( "focusable: [%d]", focusable );
       
  1126     _AKNTRACE_FUNC_EXIT;
  1069     return focusable;
  1127     return focusable;
  1070     }
  1128     }
  1071 
  1129 
  1072 void CEikDialogPage::SetDensePacking(TBool aDensePacking)
  1130 void CEikDialogPage::SetDensePacking(TBool aDensePacking)
  1073     {
  1131     {
  1074     iLines->SetDensePacking(aDensePacking);
  1132     iLines->SetDensePacking(aDensePacking);
  1075     }
  1133     }
  1076 
  1134 
  1077 void CEikDialogPage::InsertLineL(TInt aPosition,TInt aResourceId)
  1135 void CEikDialogPage::InsertLineL(TInt aPosition,TInt aResourceId)
  1078     {
  1136     {
       
  1137 	_AKNTRACE_FUNC_ENTER;
       
  1138 	_AKNTRACE( "aPosition: [%d]", aPosition );
  1079     // alteration is bloated but should not provide any side-effects.
  1139     // alteration is bloated but should not provide any side-effects.
  1080     if (!iFormControl)
  1140     if (!iFormControl)
  1081         {
  1141         {
  1082         CEikCaptionedControl* line=ConstructLineL(aResourceId);
  1142         CEikCaptionedControl* line=ConstructLineL(aResourceId);
  1083         CleanupStack::PushL(line);
  1143         CleanupStack::PushL(line);
  1097 iCurrentLine should be increased as it is relative to the lines in that page
  1157 iCurrentLine should be increased as it is relative to the lines in that page
  1098 and we have just added a new line before it in the page.
  1158 and we have just added a new line before it in the page.
  1099 */
  1159 */
  1100     if (iCurrentLine>=aPosition) 
  1160     if (iCurrentLine>=aPosition) 
  1101         iCurrentLine++;
  1161         iCurrentLine++;
       
  1162     _AKNTRACE_FUNC_EXIT;
  1102     }
  1163     }
  1103 
  1164 
  1104 void CEikDialogPage::DeleteLine(TInt aLineId, TBool aRedraw)
  1165 void CEikDialogPage::DeleteLine(TInt aLineId, TBool aRedraw)
  1105     {
  1166     {
       
  1167 	_AKNTRACE_FUNC_ENTER;
  1106     TInt index( LineIndex( aLineId ) ) ;
  1168     TInt index( LineIndex( aLineId ) ) ;
       
  1169 	_AKNTRACE( "Delete line index: [%d]", index );
  1107     if ( index == iCurrentLine ) // we're deleting the current line
  1170     if ( index == iCurrentLine ) // we're deleting the current line
  1108         {
  1171         {
  1109 // If this is the last line then move the focus to the line above.  (becomes -1 if last line)
  1172 // If this is the last line then move the focus to the line above.  (becomes -1 if last line)
  1110         if( iCurrentLine == iLines->Count() - 1 )
  1173         if( iCurrentLine == iLines->Count() - 1 )
  1111             iCurrentLine-- ;
  1174             iCurrentLine-- ;
  1151             }
  1214             }
  1152 
  1215 
  1153         DrawNow();
  1216         DrawNow();
  1154         TRAP_IGNORE(UpdateScrollBarL()); // if OOM, scrollbar will not be updated - No great loss.
  1217         TRAP_IGNORE(UpdateScrollBarL()); // if OOM, scrollbar will not be updated - No great loss.
  1155         }
  1218         }
       
  1219     _AKNTRACE_FUNC_EXIT;
  1156     }
  1220     }
  1157 
  1221 
  1158 void CEikDialogPage::AdjustAllIds(TInt aControlIdDelta)
  1222 void CEikDialogPage::AdjustAllIds(TInt aControlIdDelta)
  1159     {
  1223     {
  1160     iLines->AdjustAllIds(aControlIdDelta);
  1224     iLines->AdjustAllIds(aControlIdDelta);
  1161     }
  1225     }
  1162 
  1226 
  1163 TInt CEikDialogPage::FocusLineL(TInt aLineId)
  1227 TInt CEikDialogPage::FocusLineL(TInt aLineId)
  1164     {
  1228     {
       
  1229     _AKNTRACE_FUNC_ENTER;
  1165     TInt lineIndex=LineIndex(aLineId);
  1230     TInt lineIndex=LineIndex(aLineId);
  1166 
  1231     _AKNTRACE( "Delete line index: [%d]", lineIndex );
  1167     if (lineIndex==KErrNotFound)
  1232     if (lineIndex==KErrNotFound)
  1168         return KErrNotFound;
  1233         return KErrNotFound;
  1169 
  1234 
  1170     PrepareForFocusTransitionL();
  1235     PrepareForFocusTransitionL();
  1171 // Show whole line, not scroll into line.
  1236 // Show whole line, not scroll into line.
  1172     ChangeFocusToAndExposeL(lineIndex, ETrue); 
  1237     ChangeFocusToAndExposeL(lineIndex, ETrue); 
  1173     LineChangedL(aLineId);
  1238     LineChangedL(aLineId);
       
  1239     _AKNTRACE_FUNC_EXIT;
  1174     return KErrNone;
  1240     return KErrNone;
  1175     }
  1241     }
  1176 
  1242 
  1177 TInt CEikDialogPage::FocusedLineId() const
  1243 TInt CEikDialogPage::FocusedLineId() const
  1178     {
  1244     {
  1256 
  1322 
  1257 TInt CEikDialogPage::LineToYPos(TInt& aLine) const
  1323 TInt CEikDialogPage::LineToYPos(TInt& aLine) const
  1258 //
  1324 //
  1259 // Calcs YPos of line relative to the ViewWin and adjusts aLine if its out of bounds
  1325 // Calcs YPos of line relative to the ViewWin and adjusts aLine if its out of bounds
  1260     {
  1326     {
       
  1327 	_AKNTRACE_FUNC_ENTER;
  1261     ASSERT(iLines);
  1328     ASSERT(iLines);
  1262     const TInt numLines=iLines->Count();
  1329     const TInt numLines=iLines->Count();
  1263     ASSERT(numLines>0);
  1330     ASSERT(numLines>0);
  1264     if (aLine<0)
  1331     if (aLine<0)
  1265         aLine=0;
  1332         aLine=0;
  1266     else if (aLine>=numLines)
  1333     else if (aLine>=numLines)
  1267         aLine=numLines-1;
  1334         aLine=numLines-1;
       
  1335     _AKNTRACE( "[%s][%s][%d]", "CEikDialogPage", __FUNCTION__, (*iLines)[aLine]->Position().iY );
       
  1336     _AKNTRACE_FUNC_EXIT;
  1268     return (*iLines)[aLine]->Position().iY; // TPREMOVAL +iDataWinPos.iY;
  1337     return (*iLines)[aLine]->Position().iY; // TPREMOVAL +iDataWinPos.iY;
  1269     }
  1338     }
  1270 
  1339 
  1271 void CEikDialogPage::ExposeLine(TInt aLine, TBool aForceResize, TBool aShowWholeLine) 
  1340 void CEikDialogPage::ExposeLine(TInt aLine, TBool aForceResize, TBool aShowWholeLine) 
  1272 //
  1341 //
  1273 /* Exposes the given line so that its fully visible in the ViewWin
  1342 /* Exposes the given line so that its fully visible in the ViewWin
  1274 */  {
  1343 */  {
       
  1344 	_AKNTRACE_FUNC_ENTER;
  1275     if ( iSize.iHeight == 0 || aLine == -1 )
  1345     if ( iSize.iHeight == 0 || aLine == -1 )
  1276         {
  1346         {
       
  1347         _AKNTRACE_FUNC_EXIT;
  1277         return;
  1348         return;
  1278         }
  1349         }
  1279 
  1350 
  1280     CAknPaneScroll::TScrollChangeType change = iScroll->ExposeLine( aLine, aShowWholeLine );
  1351     CAknPaneScroll::TScrollChangeType change = iScroll->ExposeLine( aLine, aShowWholeLine );
  1281     
  1352     
  1282     if ( change == CAknPaneScroll::ENoChange && !aForceResize )
  1353     if ( change == CAknPaneScroll::ENoChange && !aForceResize )
  1283         {
  1354         {
       
  1355         _AKNTRACE_FUNC_EXIT;
  1284         return;
  1356         return;
  1285         }
  1357         }
  1286 
  1358 
  1287     CEikCaptionedControl* capCtrl = (*iLines)[aLine];
  1359     CEikCaptionedControl* capCtrl = (*iLines)[aLine];
  1288     capCtrl->MinimumSize();
  1360     capCtrl->MinimumSize();
  1325     if ( aLine != iLastExposedLine )
  1397     if ( aLine != iLastExposedLine )
  1326         {
  1398         {
  1327         iLastExposedLine = aLine;
  1399         iLastExposedLine = aLine;
  1328         iLastExposedLineViewWinYPosition = topYPosOfControlWhichMustBeViewable + idealDataWindowPosition;
  1400         iLastExposedLineViewWinYPosition = topYPosOfControlWhichMustBeViewable + idealDataWindowPosition;
  1329         }
  1401         }
       
  1402     _AKNTRACE_FUNC_EXIT;
  1330     }
  1403     }
  1331 
  1404 
  1332 void CEikDialogPage::SetDataPosition( TInt aTopY, TInt aBottomY, TBool aForceResize )
  1405 void CEikDialogPage::SetDataPosition( TInt aTopY, TInt aBottomY, TBool aForceResize )
  1333     {
  1406     {
       
  1407 	_AKNTRACE_FUNC_ENTER;
       
  1408 	_AKNTRACE( "[%s][%s] aTopY: [%d]", "CEikDialogPage", __FUNCTION__, aTopY );
  1334     // update rect only if the currently focused control doesn't fit
  1409     // update rect only if the currently focused control doesn't fit
  1335     if ( iFormControl )
  1410     if ( iFormControl )
  1336         {
  1411         {
  1337         TInt topY = iPhysics->ViewTopY();
  1412         TInt topY = iPhysics->ViewTopY();
  1338         TInt maxBottomY = topY + iSize.iHeight;
  1413         TInt maxBottomY = topY + iSize.iHeight;
  1374 
  1449 
  1375             iPhysics->SetViewCenter( viewCenter );
  1450             iPhysics->SetViewCenter( viewCenter );
  1376             iLines->MoveLineToScreen( iCurrentLine, iPhysics->ViewTopY(), ETrue );
  1451             iLines->MoveLineToScreen( iCurrentLine, iPhysics->ViewTopY(), ETrue );
  1377             }
  1452             }
  1378         }
  1453         }
       
  1454     _AKNTRACE_FUNC_EXIT;
  1379     }
  1455     }
  1380                     
  1456                     
  1381 /*
  1457 /*
  1382 class CDummy: public CCoeControl
  1458 class CDummy: public CCoeControl
  1383     {
  1459     {
  1415     return (*iLines)[aLineIndex]->Size().iHeight;
  1491     return (*iLines)[aLineIndex]->Size().iHeight;
  1416     }
  1492     }
  1417 
  1493 
  1418 void CEikDialogPage::SizeChanged()
  1494 void CEikDialogPage::SizeChanged()
  1419     {
  1495     {
       
  1496 	_AKNTRACE_FUNC_ENTER;
  1420     // update form area's size to scroll control
  1497     // update form area's size to scroll control
  1421     iScroll->SetOutsideRect( Rect() );
  1498     iScroll->SetOutsideRect( Rect() );
  1422     iLines->SetRect( Rect(), iScroll->Top(), iScroll->Middle(), iScroll->Bottom() );
  1499     iLines->SetRect( Rect(), iScroll->Top(), iScroll->Middle(), iScroll->Bottom() );
  1423 
  1500 
  1424     if ( (iLines->Count() > 0 ) && ( iCurrentLine >= 0 ) )
  1501     if ( (iLines->Count() > 0 ) && ( iCurrentLine >= 0 ) )
  1429     TRAP_IGNORE( UpdateScrollBarL() ); // ignore any errors.
  1506     TRAP_IGNORE( UpdateScrollBarL() ); // ignore any errors.
  1430     AknsUtils::RegisterControlPosition( this ); 
  1507     AknsUtils::RegisterControlPosition( this ); 
  1431 
  1508 
  1432     UpdatePhysics();
  1509     UpdatePhysics();
  1433     iExtension->iInitialLayoutDone = ETrue;
  1510     iExtension->iInitialLayoutDone = ETrue;
       
  1511     _AKNTRACE_FUNC_EXIT;
  1434     }
  1512     }
  1435 
  1513 
  1436 TSize CEikDialogPage::MinimumSize()
  1514 TSize CEikDialogPage::MinimumSize()
  1437     {
  1515     {
       
  1516 	_AKNTRACE( "[%s][%s] MinimumSize: w = %d, h = %d.",
       
  1517 	                "CEikDialogPage", __FUNCTION__, iLines->MinimumSize().iWidth, 0 );
  1438     return TSize( iLines->MinimumSize().iWidth, 0 );   // Can be zero height
  1518     return TSize( iLines->MinimumSize().iWidth, 0 );   // Can be zero height
  1439     }
  1519     }
  1440 
  1520 
  1441 void CEikDialogPage::PrepareForFocusLossL()
  1521 void CEikDialogPage::PrepareForFocusLossL()
  1442     {
  1522     {
  1487  * From MEikEdwinObserver. Look for navigation and editor text update events, as scrolling
  1567  * From MEikEdwinObserver. Look for navigation and editor text update events, as scrolling
  1488  might be required to keep cursor visible.
  1568  might be required to keep cursor visible.
  1489  */
  1569  */
  1490 void CEikDialogPage::HandleEdwinEventL(CEikEdwin* aEdwin,TEdwinEvent aEventType)
  1570 void CEikDialogPage::HandleEdwinEventL(CEikEdwin* aEdwin,TEdwinEvent aEventType)
  1491     {
  1571     {
       
  1572 	_AKNTRACE_FUNC_ENTER;
  1492     if ( IsForm() && ( aEventType == EEventTextUpdate
  1573     if ( IsForm() && ( aEventType == EEventTextUpdate
  1493             || aEventType == EEventTextUpdateAPI ) )
  1574             || aEventType == EEventTextUpdateAPI ) )
  1494         {
  1575         {
  1495         CEikCaptionedControl* line = NULL;
  1576         CEikCaptionedControl* line = NULL;
  1496         TInt controlType = -1;
  1577         TInt controlType = -1;
  1516                 }
  1597                 }
  1517             }
  1598             }
  1518         }
  1599         }
  1519     
  1600     
  1520     if( iCurrentLine == iLastExposedLine || iCurrentLine == -1 )
  1601     if( iCurrentLine == iLastExposedLine || iCurrentLine == -1 )
       
  1602         {
       
  1603         _AKNTRACE_FUNC_EXIT;
  1521         return;
  1604         return;
       
  1605         }
  1522     if( aEventType == EEventNavigation || aEventType == EEventTextUpdate )
  1606     if( aEventType == EEventNavigation || aEventType == EEventTextUpdate )
  1523         {
  1607         {
  1524         ExposeLine( iCurrentLine, EFalse );
  1608         ExposeLine( iCurrentLine, EFalse );
  1525             
  1609             
  1526         UpdateScrollBarL();
  1610         UpdateScrollBarL();
  1527         }
  1611         }
       
  1612     _AKNTRACE_FUNC_EXIT;
  1528     }
  1613     }
  1529 
  1614 
  1530 /**
  1615 /**
  1531  * Handle events caused by popup field controls, and resize if necessary
  1616  * Handle events caused by popup field controls, and resize if necessary
  1532  */
  1617  */
  1533 void CEikDialogPage::HandlePopupFieldEventL(CAknPopupField* aPopupField, TAknPopupFieldEvent aEventType, TInt /*aHint*/)
  1618 void CEikDialogPage::HandlePopupFieldEventL(CAknPopupField* aPopupField, TAknPopupFieldEvent aEventType, TInt /*aHint*/)
  1534     {
  1619     {
       
  1620 	_AKNTRACE_FUNC_ENTER;
  1535     switch (aEventType)
  1621     switch (aEventType)
  1536         {
  1622         {
  1537     case EAknPopupFieldEventValueChange:
  1623     case EAknPopupFieldEventValueChange:
  1538         {
  1624         {
       
  1625         _AKNTRACE( "[%s][%s][%d] EAknPopupFieldEventValueChange", 
       
  1626         		   "CEikDialogPage", __FUNCTION__, __LINE__ );
  1539         CEikCaptionedControl* line = NULL;
  1627         CEikCaptionedControl* line = NULL;
  1540         for ( TInt i = 0; i < iLines->Count(); ++i )
  1628         for ( TInt i = 0; i < iLines->Count(); ++i )
  1541             {
  1629             {
  1542             line = (*iLines)[i];
  1630             line = (*iLines)[i];
  1543             if ( line->iControl == aPopupField )
  1631             if ( line->iControl == aPopupField )
  1552             }
  1640             }
  1553         break;  
  1641         break;  
  1554         }
  1642         }
  1555     case EAknPopupFieldEventModeChange:
  1643     case EAknPopupFieldEventModeChange:
  1556         {
  1644         {
       
  1645         _AKNTRACE( "[%s][%s][%d] EAknPopupFieldEventModeChange", 
       
  1646         		   "CEikDialogPage", __FUNCTION__, __LINE__ );
  1557         TInt index = iCurrentLine;
  1647         TInt index = iCurrentLine;
  1558         
  1648         
  1559         if(iIsEditable && (iExtension->iPopFieldEvents != 0))
  1649         if(iIsEditable && (iExtension->iPopFieldEvents != 0))
  1560             {           
  1650             {           
  1561             iExtension->iPopFieldEvents = 0;
  1651             iExtension->iPopFieldEvents = 0;
  1575         break;
  1665         break;
  1576         }
  1666         }
  1577     default:
  1667     default:
  1578         break;
  1668         break;
  1579         }
  1669         }
       
  1670     _AKNTRACE_FUNC_EXIT;
  1580     }
  1671     }
  1581 
  1672 
  1582 void CEikDialogPage::PrepareToDrawVerticalLine() const
  1673 void CEikDialogPage::PrepareToDrawVerticalLine() const
  1583     { // to avoid flushes, we resize skin frame bitmaps before actual draw.
  1674     { // to avoid flushes, we resize skin frame bitmaps before actual draw.
  1584       // NOTE, this should be possiblie to call from SizeChanged() or OfferKeyEventL() method :-) (the GC?)
  1675       // NOTE, this should be possiblie to call from SizeChanged() or OfferKeyEventL() method :-) (the GC?)
  1613     {       
  1704     {       
  1614     }
  1705     }
  1615 
  1706 
  1616 void CEikDialogPage::HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType)
  1707 void CEikDialogPage::HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType)
  1617     {
  1708     {
       
  1709 	_AKNTRACE_FUNC_ENTER;
  1618     switch (aEventType)
  1710     switch (aEventType)
  1619         {
  1711         {
  1620     case EEventPrepareFocusTransition:
  1712     case EEventPrepareFocusTransition:
  1621         PrepareForFocusTransitionL();
  1713         PrepareForFocusTransitionL();
  1622         break;
  1714         break;
  1664     case EEventRequestCancel:
  1756     case EEventRequestCancel:
  1665     case EEventInteractionRefused:
  1757     case EEventInteractionRefused:
  1666     default:
  1758     default:
  1667         break;
  1759         break;
  1668         }
  1760         }
       
  1761     _AKNTRACE_FUNC_EXIT;
  1669     }
  1762     }
  1670 
  1763 
  1671 void CEikDialogPage::PassOnEventL(CCoeControl* aControl,MCoeControlObserver::TCoeEvent aEvent)
  1764 void CEikDialogPage::PassOnEventL(CCoeControl* aControl,MCoeControlObserver::TCoeEvent aEvent)
  1672     {
  1765     {
  1673     MCoeControlObserver* observer=Observer();
  1766     MCoeControlObserver* observer=Observer();
  1779     }
  1872     }
  1780 
  1873 
  1781 
  1874 
  1782 void CEikDialogPage::HandleScrollEventL(CEikScrollBar* aScrollBar,TEikScrollEvent aEventType)
  1875 void CEikDialogPage::HandleScrollEventL(CEikScrollBar* aScrollBar,TEikScrollEvent aEventType)
  1783     {
  1876     {
       
  1877 	_AKNTRACE_FUNC_ENTER;
  1784     iExtension->iHandlingScrollEvent = ETrue;
  1878     iExtension->iHandlingScrollEvent = ETrue;
  1785 
  1879 
  1786     switch (aEventType)
  1880     switch (aEventType)
  1787         {
  1881         {
  1788         case EEikScrollPageUp:
  1882         case EEikScrollPageUp:
  1812         default:
  1906         default:
  1813             break;
  1907             break;
  1814         }
  1908         }
  1815     
  1909     
  1816     iExtension->iHandlingScrollEvent = EFalse;
  1910     iExtension->iHandlingScrollEvent = EFalse;
       
  1911     _AKNTRACE_FUNC_EXIT;
  1817     }
  1912     }
  1818 
  1913 
  1819 TBool CEikDialogPage::LineHandlerCalled() const
  1914 TBool CEikDialogPage::LineHandlerCalled() const
  1820     {
  1915     {
  1821     return iExtension->iFlags.IsSet( CDialogPageExtension::ELineHandlerCalled );
  1916     return iExtension->iFlags.IsSet( CDialogPageExtension::ELineHandlerCalled );
  1828     return mainPaneRect;
  1923     return mainPaneRect;
  1829     }
  1924     }
  1830 
  1925 
  1831 void CEikDialogPage::UpdateScrollBarL()
  1926 void CEikDialogPage::UpdateScrollBarL()
  1832     {
  1927     {
       
  1928 	_AKNTRACE_FUNC_ENTER;
  1833     // Only forms in S60 need dialog's scrollbar.
  1929     // Only forms in S60 need dialog's scrollbar.
  1834     if ( !iFormControl || !iPageContainer->ScrollBar() || iSize.iHeight == 0 || iSize.iWidth == 0 || iExtension->iHandlingScrollEvent )
  1930     if ( !iFormControl || !iPageContainer->ScrollBar() || iSize.iHeight == 0 || iSize.iWidth == 0 || iExtension->iHandlingScrollEvent )
  1835         {
  1931         {
       
  1932         _AKNTRACE_FUNC_EXIT;
  1836         return;
  1933         return;
  1837         }
  1934         }
  1838 
  1935 
  1839     CAknScrollBar* scrollBar = STATIC_CAST(CAknScrollBar*, iPageContainer->ScrollBar()->VerticalScrollBar());
  1936     CAknScrollBar* scrollBar = STATIC_CAST(CAknScrollBar*, iPageContainer->ScrollBar()->VerticalScrollBar());
  1840 
  1937 
  1863         	if(ctrl->ControlIsAPopfield(ctrl->iControlType))
  1960         	if(ctrl->ControlIsAPopfield(ctrl->iControlType))
  1864 				{
  1961 				{
  1865 	            CAknPopupField::EAknPopupFieldSelectionMode mode = ((CAknPopupField*)ctrl->iControl)->SelectionMode();
  1962 	            CAknPopupField::EAknPopupFieldSelectionMode mode = ((CAknPopupField*)ctrl->iControl)->SelectionMode();
  1866 	            if (mode == CAknPopupField::EAknPopupFieldSelectionListMode)
  1963 	            if (mode == CAknPopupField::EAknPopupFieldSelectionListMode)
  1867 	                {
  1964 	                {
       
  1965 	                _AKNTRACE_FUNC_EXIT;
  1868 	                return;
  1966 	                return;
  1869 	                }
  1967 	                }
  1870 				}        		
  1968 				}        		
  1871         	UpdateScrollBarThumb();
  1969         	UpdateScrollBarThumb();
  1872         	}
  1970         	}
  1873         }
  1971         }
       
  1972     _AKNTRACE_FUNC_EXIT;
  1874     }
  1973     }
  1875     
  1974     
  1876 
  1975 
  1877 void CEikDialogPage::UpdateScrollBarThumb()
  1976 void CEikDialogPage::UpdateScrollBarThumb()
  1878     {
  1977     {
       
  1978 	_AKNTRACE_FUNC_ENTER;
  1879     if ( !iFormControl || !iPageContainer->ScrollBar() || ScbState() )
  1979     if ( !iFormControl || !iPageContainer->ScrollBar() || ScbState() )
  1880         {
  1980         {
       
  1981         _AKNTRACE_FUNC_EXIT;
  1881         return;
  1982         return;
  1882         }
  1983         }
  1883 
  1984 
  1884     CAknScrollBar* scrollBar = STATIC_CAST(CAknScrollBar*, iPageContainer->ScrollBar()->VerticalScrollBar());
  1985     CAknScrollBar* scrollBar = STATIC_CAST(CAknScrollBar*, iPageContainer->ScrollBar()->VerticalScrollBar());
  1885     
  1986     
  1896         iExtension->iPreviousThumbPosition = vertModel.iThumbPosition;
  1997         iExtension->iPreviousThumbPosition = vertModel.iThumbPosition;
  1897         TRAP_IGNORE(scrollBar->SetModelL(&vertModel)); // won't leave now, but can't guarantee forever        
  1998         TRAP_IGNORE(scrollBar->SetModelL(&vertModel)); // won't leave now, but can't guarantee forever        
  1898         iPageContainer->ScrollBar()->Tile(&vertModel);
  1999         iPageContainer->ScrollBar()->Tile(&vertModel);
  1899         iPageContainer->ScrollBar()->SetVFocusPosToThumbPos(vertModel.iThumbPosition);
  2000         iPageContainer->ScrollBar()->SetVFocusPosToThumbPos(vertModel.iThumbPosition);
  1900         }
  2001         }
       
  2002     _AKNTRACE_FUNC_EXIT;
  1901     }
  2003     }
  1902 
  2004 
  1903 CCoeControl* CEikDialogPage::ComponentControl(TInt aIndex) const
  2005 CCoeControl* CEikDialogPage::ComponentControl(TInt aIndex) const
  1904     {
  2006     {
  1905     if ( IsForm() && !iExtension->iHandlingResourceChange)
  2007     if ( IsForm() && !iExtension->iHandlingResourceChange)
  1962     PrepareToDrawVerticalLine();
  2064     PrepareToDrawVerticalLine();
  1963     }
  2065     }
  1964 
  2066 
  1965 void CEikDialogPage::ShowFocus(TBool aFocus, TBool aRedraw)
  2067 void CEikDialogPage::ShowFocus(TBool aFocus, TBool aRedraw)
  1966     {
  2068     {
       
  2069 	_AKNTRACE_FUNC_ENTER;
  1967     if (iCurrentLine>=0)
  2070     if (iCurrentLine>=0)
  1968         {
  2071         {
  1969         if ( iExtension && iExtension->iUsesSingleClick && aFocus )
  2072         if ( iExtension && iExtension->iUsesSingleClick && aFocus )
  1970             {
  2073             {
  1971             aFocus = HighlightVisible();
  2074             aFocus = HighlightVisible();
  1976         if (aRedraw)
  2079         if (aRedraw)
  1977             (*iLines)[iCurrentLine]->DrawNow();
  2080             (*iLines)[iCurrentLine]->DrawNow();
  1978         else 
  2081         else 
  1979             (*iLines)[iCurrentLine]->DrawDeferred(); 
  2082             (*iLines)[iCurrentLine]->DrawDeferred(); 
  1980         }
  2083         }
       
  2084     _AKNTRACE_FUNC_EXIT;
  1981     }
  2085     }
  1982 
  2086 
  1983 void CEikDialogPage::ChangeFocusTo(TInt aLineIndex)
  2087 void CEikDialogPage::ChangeFocusTo(TInt aLineIndex)
  1984     {
  2088     {
       
  2089 	_AKNTRACE_FUNC_ENTER;
       
  2090 	_AKNTRACE( "CEikDialogPage::ChangeFocusTo() aLineIndex: [%d]", aLineIndex );
  1985     TInt oldLine = iCurrentLine;
  2091     TInt oldLine = iCurrentLine;
  1986     
  2092     
  1987     if (aLineIndex==iCurrentLine)
  2093     if (aLineIndex==iCurrentLine)
  1988         return;
  2094         return;
       
  2095     // If current line has settingslist open, close it
       
  2096     CEikCaptionedControl* currentLine = CurrentLine();
       
  2097     if ( currentLine && 
       
  2098          currentLine->ControlIsAPopfield( currentLine->ControlType() ) )
       
  2099         {
       
  2100         CAknPopupField *field = ( CAknPopupField* )currentLine->iControl;
       
  2101         if ( field && field->SelectionMode() 
       
  2102             == CAknPopupField::EAknPopupFieldSelectionListMode )
       
  2103             {
       
  2104             TRAP_IGNORE( field->CloseSelectionListL() );
       
  2105             }
       
  2106         }
       
  2107 
  1989     ShowFocus( EFalse, EFalse );
  2108     ShowFocus( EFalse, EFalse );
  1990     iCurrentLine=aLineIndex;
  2109     iCurrentLine=aLineIndex;
  1991     ShowFocus(ETrue, EFalse );
  2110     ShowFocus(ETrue, EFalse );
  1992 
  2111 
  1993     if ( ( oldLine != iCurrentLine && IsForm() ) && 
  2112     if ( ( oldLine != iCurrentLine && IsForm() ) && 
  2000             }
  2119             }
  2001 
  2120 
  2002 		RecordLineL( iCurrentLine );
  2121 		RecordLineL( iCurrentLine );
  2003 		iLines->MoveLineToScreen( iCurrentLine, iPhysics->ViewTopY(), ETrue );
  2122 		iLines->MoveLineToScreen( iCurrentLine, iPhysics->ViewTopY(), ETrue );
  2004 		}
  2123 		}
       
  2124     _AKNTRACE_FUNC_EXIT;
  2005     }
  2125     }
  2006 
  2126 
  2007 TInt CEikDialogPage::FindLineIndex(const CCoeControl* aControl) const
  2127 TInt CEikDialogPage::FindLineIndex(const CCoeControl* aControl) const
  2008     {
  2128     {
  2009     return(iLines->FindLineIndex(aControl));
  2129     return(iLines->FindLineIndex(aControl));
  2025  * Handles a change to the control's resources of type aType
  2145  * Handles a change to the control's resources of type aType
  2026  * which are shared across the environment, e.g. colors or fonts.
  2146  * which are shared across the environment, e.g. colors or fonts.
  2027  */
  2147  */
  2028 void CEikDialogPage::HandleResourceChange(TInt aType)
  2148 void CEikDialogPage::HandleResourceChange(TInt aType)
  2029     {
  2149     {
       
  2150 	_AKNTRACE_FUNC_ENTER;
  2030     if ( aType==KEikDynamicLayoutVariantSwitch )
  2151     if ( aType==KEikDynamicLayoutVariantSwitch )
  2031         {
  2152         {
  2032         const TInt numLines=iLines->Count();
  2153         const TInt numLines=iLines->Count();
  2033         for ( TInt i=0; i < numLines; i++ )
  2154         for ( TInt i=0; i < numLines; i++ )
  2034             {
  2155             {
  2105 
  2226 
  2106             default:
  2227             default:
  2107                 break;
  2228                 break;
  2108             }
  2229             }
  2109         }
  2230         }
       
  2231     _AKNTRACE_FUNC_EXIT;
  2110     }
  2232     }
  2111 
  2233 
  2112 CCoeControl* CEikDialogPage::Control(TInt aLineId) const
  2234 CCoeControl* CEikDialogPage::Control(TInt aLineId) const
  2113     {
  2235     {
  2114     return(Line(aLineId)->iControl);
  2236     return(Line(aLineId)->iControl);
  2148     return NULL;
  2270     return NULL;
  2149     }
  2271     }
  2150 
  2272 
  2151 void CEikDialogPage::FocusChanged(TDrawNow /*aDrawNow*/)
  2273 void CEikDialogPage::FocusChanged(TDrawNow /*aDrawNow*/)
  2152     {
  2274     {
       
  2275 	_AKNTRACE_FUNC_ENTER;
  2153     if (iCurrentLine>=0 && !IsFocused())
  2276     if (iCurrentLine>=0 && !IsFocused())
  2154         {
  2277         {
  2155         CEikCaptionedControl* currentLine=(*iLines)[iCurrentLine];
  2278         CEikCaptionedControl* currentLine=(*iLines)[iCurrentLine];
  2156         currentLine->SetCurrent(EFalse);
  2279         currentLine->SetCurrent(EFalse);
  2157         }
  2280         }
       
  2281     _AKNTRACE_FUNC_EXIT;
  2158     }
  2282     }
  2159 
  2283 
  2160 void CEikDialogPage::ResetLineMinimumSizes()
  2284 void CEikDialogPage::ResetLineMinimumSizes()
  2161     {
  2285     {
  2162     iLines->ResetMinimumSizes();
  2286     iLines->ResetMinimumSizes();
  2188     }
  2312     }
  2189 
  2313 
  2190 void CEikDialogPage::SetEditableL( TBool aEditable, TBool /*aActivePage*/ ) 
  2314 void CEikDialogPage::SetEditableL( TBool aEditable, TBool /*aActivePage*/ ) 
  2191     {
  2315     {
  2192     // Tell each of the controls on the page (which are part of a form) of their editable state.  
  2316     // Tell each of the controls on the page (which are part of a form) of their editable state.  
  2193 
  2317     _AKNTRACE_FUNC_ENTER;
       
  2318     _AKNTRACE( "CEikDialogPage::SetEditableL() aEditable: [%d]", aEditable );
  2194     iIsEditable = aEditable;
  2319     iIsEditable = aEditable;
  2195 
  2320 
  2196     HighlightVisible( aEditable );
  2321     HighlightVisible( aEditable );
  2197     
  2322     
  2198     if ( iExtension->iUsesSingleClick && iExtension->iSetInitialFocusDone )
  2323     if ( iExtension->iUsesSingleClick && iExtension->iSetInitialFocusDone )
  2267 
  2392 
  2268     if ((iLines->Count()>0) && (iCurrentLine >= 0))
  2393     if ((iLines->Count()>0) && (iCurrentLine >= 0))
  2269         {
  2394         {
  2270         ExposeLine(iCurrentLine,ETrue); 
  2395         ExposeLine(iCurrentLine,ETrue); 
  2271         }
  2396         }
       
  2397   _AKNTRACE_FUNC_EXIT;
  2272   }
  2398   }
  2273 
  2399 
  2274 TBool CEikDialogPage::AnythingToDisplay() const
  2400 TBool CEikDialogPage::AnythingToDisplay() const
  2275     {
  2401     {
  2276     // assume Form control... shouldnt be called otherwise (Panic?)
  2402     // assume Form control... shouldnt be called otherwise (Panic?)
  2294     CleanupStack::PopAndDestroy(); // finished with current val of dataBuffer 
  2420     CleanupStack::PopAndDestroy(); // finished with current val of dataBuffer 
  2295     }
  2421     }
  2296 
  2422 
  2297 void CEikDialogPage::Draw(const TRect& /*aRect*/) const
  2423 void CEikDialogPage::Draw(const TRect& /*aRect*/) const
  2298     {
  2424     {
       
  2425 	_AKNTRACE_FUNC_ENTER;
  2299     if ( iFormControl )
  2426     if ( iFormControl )
  2300         {
  2427         {
  2301         // added this to see if anything on the page is visible.
  2428         // added this to see if anything on the page is visible.
  2302         // if not, this is used to display the No data found screen.
  2429         // if not, this is used to display the No data found screen.
  2303         TBool anythingToShow= AnythingToDisplay();
  2430         TBool anythingToShow= AnythingToDisplay();
  2337                 }
  2464                 }
  2338             
  2465             
  2339             iExtension->iRecordingGc->FlushBuffer( targetRect, lineToSkip );
  2466             iExtension->iRecordingGc->FlushBuffer( targetRect, lineToSkip );
  2340             }
  2467             }
  2341         }
  2468         }
       
  2469     _AKNTRACE_FUNC_EXIT;
  2342     }
  2470     }
  2343 
  2471 
  2344 void CEikDialogPage::AfterAddingNewLinesL(TInt aNewLineAdded)
  2472 void CEikDialogPage::AfterAddingNewLinesL(TInt aNewLineAdded)
  2345     {
  2473     {
  2346 /**
  2474 /**
  2353 *   #1 register the the dialog page with the caption control.
  2481 *   #1 register the the dialog page with the caption control.
  2354 *   #2 register the control on this line (e.g. an edwin) with the one above it 
  2482 *   #2 register the control on this line (e.g. an edwin) with the one above it 
  2355 *   #3 call Register component on the line, to set up listeners, etc.
  2483 *   #3 call Register component on the line, to set up listeners, etc.
  2356 *   #4 Set the editable value to whatever the dialog page's editable value is.
  2484 *   #4 Set the editable value to whatever the dialog page's editable value is.
  2357 */
  2485 */
       
  2486 	_AKNTRACE_FUNC_ENTER;
       
  2487 	_AKNTRACE( "aNewLineAdded: [%d]", aNewLineAdded );
  2358     __ASSERT_DEBUG(iLines && (aNewLineAdded<=iLines->Count()), Panic(EEikDialogPanicErrorDuringAddingLine));
  2488     __ASSERT_DEBUG(iLines && (aNewLineAdded<=iLines->Count()), Panic(EEikDialogPanicErrorDuringAddingLine));
  2359     if (aNewLineAdded== -1)
  2489     if (aNewLineAdded== -1)
       
  2490         {
       
  2491         _AKNTRACE_FUNC_EXIT;
  2360         return; // line has not been added yet.
  2492         return; // line has not been added yet.
       
  2493         }
  2361     CEikCaptionedControl* lineAdded = iLines->At(aNewLineAdded);
  2494     CEikCaptionedControl* lineAdded = iLines->At(aNewLineAdded);
  2362 // if aNewLineAdded is zero, then there is no line above, else set value.
  2495 // if aNewLineAdded is zero, then there is no line above, else set value.
  2363     CEikCaptionedControl* lineVisuallyAboveAndNumericallyBelow = 
  2496     CEikCaptionedControl* lineVisuallyAboveAndNumericallyBelow = 
  2364                         (!aNewLineAdded)? 0:iLines->At(aNewLineAdded-1);
  2497                         (!aNewLineAdded)? 0:iLines->At(aNewLineAdded-1);
  2365     // #1
  2498     // #1
  2400 
  2533 
  2401     ExposeLine( aNewLineAdded, EFalse );
  2534     ExposeLine( aNewLineAdded, EFalse );
  2402 
  2535 
  2403     if ( IsForm() && iSize.iHeight != 0 && aNewLineAdded != -1 )
  2536     if ( IsForm() && iSize.iHeight != 0 && aNewLineAdded != -1 )
  2404         iLines->MoveLineToScreen( aNewLineAdded, iPhysics->ViewTopY(), EFalse );
  2537         iLines->MoveLineToScreen( aNewLineAdded, iPhysics->ViewTopY(), EFalse );
       
  2538     _AKNTRACE_FUNC_EXIT;
  2405     }
  2539     }
  2406 
  2540 
  2407 TInt CEikDialogPage::GetFormFlags() const
  2541 TInt CEikDialogPage::GetFormFlags() const
  2408     {return iFormFlags;};
  2542     {return iFormFlags;};
  2409 
  2543 
  2610 // CEikDialogPage::HandleFormPointerEventL
  2744 // CEikDialogPage::HandleFormPointerEventL
  2611 // ---------------------------------------------------------------------------
  2745 // ---------------------------------------------------------------------------
  2612 //
  2746 //
  2613 void CEikDialogPage::HandleFormPointerEventL( const TPointerEvent& aPointerEvent )
  2747 void CEikDialogPage::HandleFormPointerEventL( const TPointerEvent& aPointerEvent )
  2614     {
  2748     {
       
  2749 	_AKNTRACE_FUNC_ENTER;
  2615     if ( LineHandlerCalled() )
  2750     if ( LineHandlerCalled() )
  2616         {
  2751         {
       
  2752         _AKNTRACE_FUNC_EXIT;
  2617         return;
  2753         return;
  2618         }
  2754         }
  2619     
  2755     
  2620     TInt touchedLine = iLines->YPositionToLineIndex( aPointerEvent.iPosition.iY + iPhysics->ViewTopY() );
  2756     TInt touchedLine = iLines->YPositionToLineIndex( aPointerEvent.iPosition.iY + iPhysics->ViewTopY() );
  2621     TBool callDefaultImplementation = ETrue;
  2757     TBool callDefaultImplementation = ETrue;
  2623     // Tapping form's empty area takes no action of any kind. Also bounce
  2759     // Tapping form's empty area takes no action of any kind. Also bounce
  2624     // effect can't be stopped.
  2760     // effect can't be stopped.
  2625     if ( ( aPointerEvent.iType == TPointerEvent::EButton1Down && touchedLine == KErrNotFound ) || !iPhysics->CanBeStopped() )
  2761     if ( ( aPointerEvent.iType == TPointerEvent::EButton1Down && touchedLine == KErrNotFound ) || !iPhysics->CanBeStopped() )
  2626         {
  2762         {
  2627         IgnoreEventsUntilNextPointerUp();
  2763         IgnoreEventsUntilNextPointerUp();
       
  2764         _AKNTRACE_FUNC_EXIT;
  2628         return;
  2765         return;
  2629         }
  2766         }
  2630 
  2767 
  2631     CEikCaptionedControl* newLine = NULL;
  2768     CEikCaptionedControl* newLine = NULL;
  2632     TInt controlType = KErrNotFound;
  2769     TInt controlType = KErrNotFound;
  2664             }
  2801             }
  2665         }
  2802         }
  2666         
  2803         
  2667     if ( aPointerEvent.iType == TPointerEvent::EButton1Down && touchedLine != KErrNotFound )
  2804     if ( aPointerEvent.iType == TPointerEvent::EButton1Down && touchedLine != KErrNotFound )
  2668         {
  2805         {
       
  2806         _AKNTRACE( "TPointerEvent::EButton1Down" );
  2669         iExtension->iOldCenterY = iPhysics->ViewCenter().iY;
  2807         iExtension->iOldCenterY = iPhysics->ViewCenter().iY;
  2670         TInt bottom = iExtension->iOldCenterY + iSize.iHeight - iSize.iHeight / 2;
  2808         TInt bottom = iExtension->iOldCenterY + iSize.iHeight - iSize.iHeight / 2;
  2671         if ( bottom < 0 )
  2809         if ( bottom < 0 )
  2672             {
  2810             {
  2673             iExtension->iBottomItem = -1;
  2811             iExtension->iBottomItem = -1;
  2742             }
  2880             }
  2743         }
  2881         }
  2744 
  2882 
  2745     if ( aPointerEvent.iType == TPointerEvent::EDrag )
  2883     if ( aPointerEvent.iType == TPointerEvent::EDrag )
  2746         {
  2884         {
       
  2885         _AKNTRACE( "TPointerEvent::EDrag" );
  2747         TPoint drag( iExtension->iDragStartPosition - aPointerEvent.iPosition );
  2886         TPoint drag( iExtension->iDragStartPosition - aPointerEvent.iPosition );
  2748         
  2887         
  2749         if ( Abs( drag.iY ) > iPhysics->DragThreshold() )
  2888         if ( Abs( drag.iY ) > iPhysics->DragThreshold() )
  2750             {
  2889             {
  2751             iExtension->iHighlightTimer->Cancel();
  2890             iExtension->iHighlightTimer->Cancel();
  2789             }
  2928             }
  2790         }                                
  2929         }                                
  2791     
  2930     
  2792     if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
  2931     if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
  2793         {
  2932         {
       
  2933     _AKNTRACE( "TPointerEvent::EButton1Up" );
  2794         iExtension->HandleFormFeedback( this, aPointerEvent, touchedLine, iCurrentLine );
  2934         iExtension->HandleFormFeedback( this, aPointerEvent, touchedLine, iCurrentLine );
  2795         if ( !IsEditable() && iExtension->iUsesSingleClick && 
  2935         if ( !IsEditable() && iExtension->iUsesSingleClick && 
  2796              HighlightVisible() )
  2936              HighlightVisible() )
  2797             {
  2937             {
  2798             HighlightVisible( EFalse );
  2938             HighlightVisible( EFalse );
  2895         key.iCode=EKeyOK;
  3035         key.iCode=EKeyOK;
  2896         key.iModifiers=0;
  3036         key.iModifiers=0;
  2897         key.iRepeats = 0;
  3037         key.iRepeats = 0;
  2898         CEikonEnv::Static()->SimulateKeyEventL( key, EEventKey );
  3038         CEikonEnv::Static()->SimulateKeyEventL( key, EEventKey );
  2899         }
  3039         }
       
  3040     _AKNTRACE_FUNC_EXIT;
  2900     }
  3041     }
  2901 
  3042 
  2902 
  3043 
  2903 // ---------------------------------------------------------------------------
  3044 // ---------------------------------------------------------------------------
  2904 // CEikDialogPage::UpdatePhysics
  3045 // CEikDialogPage::UpdatePhysics
  2905 // ---------------------------------------------------------------------------
  3046 // ---------------------------------------------------------------------------
  2906 //
  3047 //
  2907 void CEikDialogPage::UpdatePhysics()
  3048 void CEikDialogPage::UpdatePhysics()
  2908     {
  3049     {
       
  3050 	_AKNTRACE_FUNC_ENTER;
  2909     if ( IsForm() )
  3051     if ( IsForm() )
  2910         {
  3052         {
  2911         TPoint viewCenter( iSize.iWidth / 2, 0 );
  3053         TPoint viewCenter( iSize.iWidth / 2, 0 );
  2912         
  3054         
  2913         if ( iLines->Count() > 0 )
  3055         if ( iLines->Count() > 0 )
  2931         worldSize.iHeight = Max( worldSize.iHeight, iSize.iHeight );
  3073         worldSize.iHeight = Max( worldSize.iHeight, iSize.iHeight );
  2932 
  3074 
  2933         TRAP_IGNORE( iPhysics->InitPhysicsL( worldSize, iSize, viewCenter ) );
  3075         TRAP_IGNORE( iPhysics->InitPhysicsL( worldSize, iSize, viewCenter ) );
  2934         TRAP_IGNORE( UpdateScrollBarL() );
  3076         TRAP_IGNORE( UpdateScrollBarL() );
  2935         }
  3077         }
       
  3078     _AKNTRACE_FUNC_EXIT;
  2936     }
  3079     }
  2937 
  3080 
  2938 
  3081 
  2939 // ---------------------------------------------------------------------------
  3082 // ---------------------------------------------------------------------------
  2940 // CEikDialogPage::HighlightTimerCallBack
  3083 // CEikDialogPage::HighlightTimerCallBack
  3056 // CEikDialogPage::UpdateLineInCache
  3199 // CEikDialogPage::UpdateLineInCache
  3057 // ---------------------------------------------------------------------------
  3200 // ---------------------------------------------------------------------------
  3058 //
  3201 //
  3059 void CEikDialogPage::UpdateLineInCache( CEikCaptionedControl* aLine )
  3202 void CEikDialogPage::UpdateLineInCache( CEikCaptionedControl* aLine )
  3060     {
  3203     {
       
  3204 	_AKNTRACE_FUNC_ENTER;
  3061     TInt lineIndex = iLines->FindLineIndex( aLine );
  3205     TInt lineIndex = iLines->FindLineIndex( aLine );
  3062     
  3206     
  3063     if ( lineIndex != KErrNotFound )
  3207     if ( lineIndex != KErrNotFound )
  3064         {
  3208         {
  3065         if ( aLine->Position() != TPoint( 1000, 0 ) )
  3209         if ( aLine->Position() != TPoint( 1000, 0 ) )
  3082 
  3226 
  3083     if ( iExtension->iInitialLayoutDone )
  3227     if ( iExtension->iInitialLayoutDone )
  3084         {
  3228         {
  3085         UpdatePhysics();
  3229         UpdatePhysics();
  3086         }
  3230         }
       
  3231     _AKNTRACE_FUNC_EXIT;
  3087     }
  3232     }
  3088 
  3233 
  3089 
  3234 
  3090 // ---------------------------------------------------------------------------
  3235 // ---------------------------------------------------------------------------
  3091 // CEikDialogPage::Synchronize
  3236 // CEikDialogPage::Synchronize
  3129 // CEikDialogPage::RecordLinesL
  3274 // CEikDialogPage::RecordLinesL
  3130 // ---------------------------------------------------------------------------
  3275 // ---------------------------------------------------------------------------
  3131 //
  3276 //
  3132 void CEikDialogPage::RecordLinesL()
  3277 void CEikDialogPage::RecordLinesL()
  3133     {
  3278     {
       
  3279 	_AKNTRACE_FUNC_ENTER;
  3134     Parent()->Parent()->Parent()->SetCustomGc( iExtension->iRecordingGc );
  3280     Parent()->Parent()->Parent()->SetCustomGc( iExtension->iRecordingGc );
  3135     
  3281     
  3136     iExtension->iRecordingGc->PurgeBuffer();
  3282     iExtension->iRecordingGc->PurgeBuffer();
  3137 
  3283 
  3138     CEikCaptionedControl* line = NULL;
  3284     CEikCaptionedControl* line = NULL;
  3144         line->DrawForeground( line->Rect() );
  3290         line->DrawForeground( line->Rect() );
  3145         DrawControl( line );
  3291         DrawControl( line );
  3146         }
  3292         }
  3147 
  3293 
  3148     Parent()->Parent()->Parent()->SetCustomGc( NULL );
  3294     Parent()->Parent()->Parent()->SetCustomGc( NULL );
       
  3295     _AKNTRACE_FUNC_EXIT;
  3149     }
  3296     }
  3150 
  3297 
  3151 
  3298 
  3152 // ---------------------------------------------------------------------------
  3299 // ---------------------------------------------------------------------------
  3153 // CEikDialogPage::RecordLineL
  3300 // CEikDialogPage::RecordLineL
  3154 // ---------------------------------------------------------------------------
  3301 // ---------------------------------------------------------------------------
  3155 //
  3302 //
  3156 void CEikDialogPage::RecordLineL( TInt aLine )
  3303 void CEikDialogPage::RecordLineL( TInt aLine )
  3157     {
  3304     {
       
  3305 	_AKNTRACE_FUNC_ENTER;
       
  3306 	_AKNTRACE( "CEikDialogPage::RecordLineL() aLine: [%d]", aLine );
  3158     Parent()->Parent()->Parent()->SetCustomGc( iExtension->iRecordingGc );
  3307     Parent()->Parent()->Parent()->SetCustomGc( iExtension->iRecordingGc );
  3159     
  3308     
  3160     CEikCaptionedControl* line = (*iLines)[aLine];
  3309     CEikCaptionedControl* line = (*iLines)[aLine];
  3161     
  3310     
  3162     if ( line )
  3311     if ( line )
  3165         line->DrawForeground( (line->Rect() ) );
  3314         line->DrawForeground( (line->Rect() ) );
  3166         DrawControl( line );
  3315         DrawControl( line );
  3167         }
  3316         }
  3168     
  3317     
  3169     Parent()->Parent()->Parent()->SetCustomGc( NULL );
  3318     Parent()->Parent()->Parent()->SetCustomGc( NULL );
       
  3319     _AKNTRACE_FUNC_EXIT;
  3170     }
  3320     }
  3171 
  3321 
  3172 
  3322 
  3173 // ---------------------------------------------------------------------------
  3323 // ---------------------------------------------------------------------------
  3174 // CEikDialogPage::ScrollByPixels
  3324 // CEikDialogPage::ScrollByPixels
  3646     ASSERT(EFalse); // aPageIndex not found.
  3796     ASSERT(EFalse); // aPageIndex not found.
  3647     }
  3797     }
  3648 
  3798 
  3649 TInt CEikDialogPageContainer::ActivateFirstPageL()
  3799 TInt CEikDialogPageContainer::ActivateFirstPageL()
  3650     {
  3800     {
       
  3801 	_AKNTRACE_FUNC_ENTER;
  3651     // Activate first page that isn't dimmed.
  3802     // Activate first page that isn't dimmed.
  3652     // SetToolTips() ;
  3803     // SetToolTips() ;
  3653     const TInt numPages=iPageArray->Count();
  3804     const TInt numPages=iPageArray->Count();
  3654     for (TInt ii=0;ii<numPages;ii++)
  3805     for (TInt ii=0;ii<numPages;ii++)
  3655         {
  3806         {
  3662             if(iActivePage!=ii)
  3813             if(iActivePage!=ii)
  3663                 {
  3814                 {
  3664                 thisPage->ReportPageChangedL();
  3815                 thisPage->ReportPageChangedL();
  3665                 iActivePage=ii;
  3816                 iActivePage=ii;
  3666                 }
  3817                 }
       
  3818             _AKNTRACE_FUNC_EXIT;
  3667             return thisPage->PageId();
  3819             return thisPage->PageId();
  3668             }
  3820             }
  3669         }
  3821         }
  3670 
  3822 
  3671     // All dimmed, so activate first.
  3823     // All dimmed, so activate first.
  3676     if(iActivePage!=0)
  3828     if(iActivePage!=0)
  3677         {
  3829         {
  3678         firstPage->ReportPageChangedL();
  3830         firstPage->ReportPageChangedL();
  3679         iActivePage=0;
  3831         iActivePage=0;
  3680         }
  3832         }
       
  3833     _AKNTRACE_FUNC_EXIT;
  3681     return firstPage->PageId();
  3834     return firstPage->PageId();
  3682     }
  3835     }
  3683 
  3836 
  3684 TInt CEikDialogPageContainer::PageId(TInt aIndex) const
  3837 TInt CEikDialogPageContainer::PageId(TInt aIndex) const
  3685  
  3838  
  4014     return preferredSize;
  4167     return preferredSize;
  4015     }
  4168     }
  4016 
  4169 
  4017 void CEikDialogPageContainer::ActivateL()
  4170 void CEikDialogPageContainer::ActivateL()
  4018     {
  4171     {
       
  4172 	_AKNTRACE_FUNC_ENTER;
  4019     // Pass the activate event to child controls always.
  4173     // Pass the activate event to child controls always.
  4020     CCoeControl::ActivateL();
  4174     CCoeControl::ActivateL();
  4021     //
  4175     //
  4022     // Have to do this here instead of CEikCaptionedControl::ActivateL, because CaptionedControl has no
  4176     // Have to do this here instead of CEikCaptionedControl::ActivateL, because CaptionedControl has no
  4023     // activateL overridden.
  4177     // activateL overridden.
  4041                            );
  4195                            );
  4042                      }
  4196                      }
  4043                  }
  4197                  }
  4044              }
  4198              }
  4045          }  
  4199          }  
       
  4200     _AKNTRACE_FUNC_EXIT;
  4046     }
  4201     }
  4047 
  4202 
  4048 void CEikDialogPageContainer::FocusChanged(TDrawNow aDrawNow)
  4203 void CEikDialogPageContainer::FocusChanged(TDrawNow aDrawNow)
  4049     {
  4204     {
  4050     (*iPageArray)[iActivePage]->SetFocus(IsFocused(),aDrawNow);
  4205     (*iPageArray)[iActivePage]->SetFocus(IsFocused(),aDrawNow);