×
Namespaces

Variants
Actions

How to show marquee on navi pane

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: rathodavinash (28 Jun 2007)
Last edited: hamishwillee (30 May 2013)

The following code shows how to get the marquee effect on the navi pane

#include <eikspane.h>
#include <aknnavi.h>
#include <aknnavide.h>
#include <eikenv.h>
#include <aknappui.h>
#include <e32base.h>
 
#include "NaviInfo.h"
 
#define KWaster 16
 
#define KMaxLength 20
 
CNaviInfo::CNaviInfo():CTimer(0),iNaviText(NULL),iNaviPane(NULL),iNaviDecorator(NULL)
{
 
}
 
CNaviInfo::~CNaviInfo()
{
if ( !iNaviPane )
{
CEikStatusPane* sp=CEikonEnv::Static()->AppUiFactory()->StatusPane();
iNaviPane = ( CAknNavigationControlContainer * )sp->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) );
}
iNaviPane->Pop( NULL );
 
delete iNaviDecorator;
 
Cancel();
}
 
CNaviInfo* CNaviInfo::NewL()
{
CNaviInfo* self = new (ELeave) CNaviInfo();
CleanupStack::PushL(self);
self->ConstructL();
CleanupStack::Pop(self);
return self;
}
 
void CNaviInfo::ConstructL()
{
if ( !iNaviPane )
{
CEikStatusPane* sp=CEikonEnv::Static()->AppUiFactory()->StatusPane();
iNaviPane = ( CAknNavigationControlContainer * )sp->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) );
}
 
iWaster=0;
CTimer::ConstructL();
CActiveScheduler::Add(this);
}
 
 
void CNaviInfo::SetNaviText(TDesC& aText,TBool aBlank)
{
Cancel();
iWaster=0;
iBlankAfterScroll=aBlank;
iNaviText.Zero();
iOrigText.Zero();
SetBlankNavi();
iNaviText.Copy(aText);
delete iNaviDecorator;
iNaviDecorator = NULL;
iNaviDecorator = iNaviPane->CreateNavigationLabelL(iNaviText);
iNaviPane->PushL( *iNaviDecorator );
 
if(iNaviText.Length()>KMaxLength)
{
iConstOrig.Copy(iNaviText);
iOrigText.Copy(iNaviText);
StartScroller();
}
}
 
void CNaviInfo::SetBlankNavi()
{
iNaviText.Zero();
delete iNaviDecorator;
iNaviDecorator = NULL;
iNaviDecorator = iNaviPane->CreateNavigationLabelL( iNaviText );
iNaviPane->PushL( *iNaviDecorator );
}
 
void CNaviInfo::StartScroller()
{
Cancel();
After(100000);
if(!IsActive())
SetActive();
}
 
void CNaviInfo::RunL()
{
if(iWaster < KWaster)
{
iWaster++;
StartScroller();
return;
}
 
if(iNaviText.Length()!=0)
{
iNaviText.Copy(iNaviText.Right(iNaviText.Length()-1));
delete iNaviDecorator;
iNaviDecorator = NULL;
iNaviDecorator = iNaviPane->CreateNavigationLabelL( iNaviText );
iNaviPane->PushL( *iNaviDecorator );
StartScroller();
}
else
{
if(iBlankAfterScroll)
{
SetBlankNavi();
}
else
{
delete iNaviDecorator;
iNaviDecorator = NULL;
iNaviDecorator = iNaviPane->CreateNavigationLabelL( iConstOrig );
iNaviPane->PushL( *iNaviDecorator );
iWaster=0;
}
 
}
}
This page was last modified on 30 May 2013, at 04:38.
28 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×