Nokia N97 SDK
Example Applications Guide

CNaviScrollTimer Class Reference

#include <NaviScrollTimer.h>

Inheritance diagram for CNaviScrollTimer:

List of all members.

Detailed Description

CNaviScrollTimer class. This class is used to scroll text on navigation pane.

Definition at line 29 of file NaviScrollTimer.h.


Public Member Functions

  CNaviScrollTimer ()
  ~CNaviScrollTimer ()
void  StartScroll ()

Static Public Member Functions

static CNaviScrollTimer *  NewL (const TDesC &aNavitext)

Private Member Functions

TBool  UpdateNaviPaneL ()
void  ConstructL (const TDesC &aNavitext)
void  RunL ()

Private Attributes

CAknNavigationControlContainer *  iNaviPane
CAknNavigationDecorator *  iDecorator
TInt  iCount
HBufC *  iNaviText


Constructor & Destructor Documentation

CNaviScrollTimer::CNaviScrollTimer (   ) 
 

C++ default constructor.

Definition at line 37 of file NaviScrollTimer.cpp.

Referenced by NewL().

00038     : CTimer( CActive::EPriorityStandard )
00039     {        
00040     }

CNaviScrollTimer::~CNaviScrollTimer (   ) 
 

Destructor

Definition at line 47 of file NaviScrollTimer.cpp.

References iDecorator, iNaviPane, and iNaviText.

00048     {
00049     Cancel();   
00050     delete iNaviText;
00051     
00052     if( iDecorator )
00053         {
00054         if( iNaviPane ) iNaviPane->Pop( iDecorator );   
00055         delete iDecorator;
00056         }
00057     }


Member Function Documentation

CNaviScrollTimer * CNaviScrollTimer::NewL (  const TDesC &  aNavitext  )  [static]
 

Two-phased constructor.

Parameters:
aNavitext  A string to navipane.

Definition at line 83 of file NaviScrollTimer.cpp.

References CNaviScrollTimer().

Referenced by CListboxSettingList::ConstructL(), CListboxNumberContainer::ConstructL(), and CListboxGraphicContainer::ConstructL().

00084     {
00085     CNaviScrollTimer* self = new ( ELeave ) CNaviScrollTimer();
00086     CleanupStack::PushL( self );
00087     self->ConstructL( aNavitext );
00088     CleanupStack::Pop( self );
00089     return self;    
00090     }

void CNaviScrollTimer::StartScroll (   ) 
 

Starts to scroll navigation pane text. Scrolling is not started if given text fits to navigation pane. In this case it only adds text to navigation pane.

Definition at line 114 of file NaviScrollTimer.cpp.

References iNaviText, and UpdateNaviPaneL().

Referenced by CListboxSettingList::ConstructL(), CListboxNumberContainer::ConstructL(), and CListboxGraphicContainer::ConstructL().

00115     {   
00116     // Start scrolling only if text do not fit to navi pane 
00117     if( iNaviText->Des().Length() > KMaxVisibleStringLenth ) 
00118         After( 1 );
00119     else
00120         UpdateNaviPaneL();
00121     }

TBool CNaviScrollTimer::UpdateNaviPaneL (   )  [private]
 

Updates the Navigation pane. Every time when this function is called, it moves the text to the left by one character.

Returns:
ETrue if text is scrolled totally out of navigation pane, otherwise EFalse.

Definition at line 129 of file NaviScrollTimer.cpp.

References iCount, iDecorator, iNaviPane, and iNaviText.

Referenced by RunL(), and StartScroll().

00130     {
00131     TBool returnVal( EFalse );
00132     // Return ETrue if text is scrolled totally to left
00133     if( iCount == iNaviText->Des().Length() )
00134         returnVal = ETrue;
00135     
00136     // NaviLabel can only be updated by creating a new navidecorator.
00137     if( iDecorator )
00138         {
00139         iNaviPane->Pop( iDecorator );
00140         delete iDecorator;
00141         iDecorator = NULL;
00142         }
00143     // Create new decorator    
00144     iDecorator = iNaviPane->CreateNavigationLabelL();
00145     // Push decorator object to the navigation pane's object stack.
00146     iNaviPane->PushL( *iDecorator );    
00147     // Get the control inside of decorator object as CAknNaviLabel.
00148     CAknNaviLabel* naviLabel = 
00149             static_cast<CAknNaviLabel*>( iDecorator->DecoratedControl() );
00150     // Finally set label text
00151     naviLabel->SetTextL( iNaviText->Des().Right(iCount) ); 
00152     
00153     iCount--;
00154     if(iCount == 0) 
00155         iCount = iNaviText->Des().Length();
00156     
00157     return returnVal;    
00158     }

void CNaviScrollTimer::ConstructL (  const TDesC &  aNavitext  )  [private]
 

2nd phase constructor.

Parameters:
aNavitext  A string to navipane.

Definition at line 64 of file NaviScrollTimer.cpp.

References iCount, iNaviPane, and iNaviText.

00065     {
00066     CActiveScheduler::Add( this );
00067     CTimer::ConstructL(); 
00068     
00069     iNaviText = aNavitext.AllocL();
00070     iCount = iNaviText->Des().Length();
00071     
00072     // Get the navigation pane
00073     CEikStatusPane* sp = CEikonEnv::Static()->AppUiFactory()->StatusPane();
00074     iNaviPane = static_cast<CAknNavigationControlContainer*>(
00075         sp->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) );         
00076     }

void CNaviScrollTimer::RunL (   )  [private]
 

After completed timer period, execution comes to RunL

Definition at line 97 of file NaviScrollTimer.cpp.

References UpdateNaviPaneL().

00098     {    
00099     TInt timeout;
00100  
00101     if( UpdateNaviPaneL() )
00102         timeout = KScrollStartTimeout;
00103     else 
00104         timeout = KScrollTimeout;
00105     
00106     After( timeout );
00107     }


Member Data Documentation

CAknNavigationControlContainer* CNaviScrollTimer::iNaviPane [private]
 

A pointer to default control in navigation pane.

Not owned

Definition at line 90 of file NaviScrollTimer.h.

Referenced by ConstructL(), UpdateNaviPaneL(), and ~CNaviScrollTimer().

CAknNavigationDecorator* CNaviScrollTimer::iDecorator [private]
 

A pointer to navigation pane decorator.

Owned

Definition at line 97 of file NaviScrollTimer.h.

Referenced by UpdateNaviPaneL(), and ~CNaviScrollTimer().

TInt CNaviScrollTimer::iCount [private]
 

Integer indicating current shown text length in navigation pane.

Definition at line 102 of file NaviScrollTimer.h.

Referenced by ConstructL(), and UpdateNaviPaneL().

HBufC* CNaviScrollTimer::iNaviText [private]
 

Text shown in navigation pane.

Owned.

Definition at line 109 of file NaviScrollTimer.h.

Referenced by ConstructL(), StartScroll(), UpdateNaviPaneL(), and ~CNaviScrollTimer().


The documentation for this class was generated from the following files:

© Nokia 2009

Back to top