Nokia N97 SDK
Example Applications Guide

CAknExPbarContainer Class Reference

#include <aknexpbarcontainer.h>

Inheritance diagram for CAknExPbarContainer:

List of all members.

Detailed Description

CAknExPbarContainer container control class.

Definition at line 66 of file aknexpbarcontainer.h.


Public Member Functions

  CAknExPbarContainer ()
void  ConstructL (const TRect &aRect)
virtual  ~CAknExPbarContainer ()
void  IncrementBarsAndDraw (TInt aIncrement)
void  ReConstructProgressBarsL ()
void  SetFinalValue ()
void  ShowInfo (TInt aBarNo)

Static Public Member Functions

static CAknExPbarContainer *  NewL (const TRect &aRect)
static CAknExPbarContainer *  NewLC (const TRect &aRect)

Private Member Functions

TInt  CountComponentControls () const
CCoeControl *  ComponentControl (TInt aIndex) const
void  Draw (const TRect &aRect) const
void  HandleControlEventL (CCoeControl *aControl, TCoeEvent aEventType)
void  ConstructTimerModel ()
void  ConstructTimerL ()
void  CreateProgressBarsL ()

Private Attributes

CEikProgressInfo *  iPBar [KNumberOfBars]
TBool  iFinalValuesTwisted
CAknExPbarTimer *  iTimer
TAknExPbarTimerModel  iTimerModel


Constructor & Destructor Documentation

CAknExPbarContainer::CAknExPbarContainer (   ) 
 

CAknExPbarContainer C++ default constructor.

Definition at line 64 of file aknexpbarcontainer.cpp.

References iPBar.

Referenced by NewLC().

00065     {
00066     for ( TInt ii = 0; ii < KNumberOfBars; ++ii )
00067         {
00068         iPBar[ii] = NULL;
00069         }
00070     }

CAknExPbarContainer::~CAknExPbarContainer (   )  [virtual]
 

~CAknExPbarContainer. Virtual Destructor.

Definition at line 98 of file aknexpbarcontainer.cpp.

References iPBar, and iTimer.

00099     {
00100     for ( TInt ii = 0; ii < KNumberOfBars; ++ii )
00101         {
00102         delete( iPBar[ii] );
00103         iPBar[ii] = NULL;
00104         }
00105     
00106     delete iTimer;
00107     }


Member Function Documentation

CAknExPbarContainer * CAknExPbarContainer::NewL (  const TRect &  aRect  )  [static]
 

NewL. Two-phased constructor. Construct a CAknExPbarContainer using two phase construction, and return a pointer to the created object

Parameters:
aRect  the rectangle this view will be drawn to
Returns:
A pointer to the created instance of CAknExPbarContainer

Definition at line 38 of file aknexpbarcontainer.cpp.

References NewLC().

Referenced by CAknExPbarAppUi::ConstructL().

00039     {
00040     CAknExPbarContainer* self = CAknExPbarContainer::NewLC( aRect );
00041     CleanupStack::Pop( self );
00042     return self;    
00043     }

CAknExPbarContainer * CAknExPbarContainer::NewLC (  const TRect &  aRect  )  [static]
 

NewLC. Two-phased constructor. Construct a CAknExPbarContainer using two phase construction, and return a pointer to the created object

Parameters:
aRect  the rectangle this view will be drawn to
Returns:
A pointer to the created instance of CAknExPbarContainer

Definition at line 50 of file aknexpbarcontainer.cpp.

References CAknExPbarContainer().

Referenced by NewL().

00051     {
00052     CAknExPbarContainer* self = new ( ELeave ) CAknExPbarContainer();
00053     CleanupStack::PushL( self );
00054     self->ConstructL( aRect );
00055     return self; 
00056     }

void CAknExPbarContainer::ConstructL (  const TRect &  aRect  ) 
 

ConstructL 2nd phase constructor.

Parameters:
aRect  Frame rectangle for container.

Definition at line 77 of file aknexpbarcontainer.cpp.

References ConstructTimerL(), ConstructTimerModel(), CreateProgressBarsL(), and iFinalValuesTwisted.

00078     {
00079     CreateWindowL();
00080 
00081     iFinalValuesTwisted = EFalse;
00082 
00083     Window().SetShadowDisabled( EFalse );
00084     CreateProgressBarsL();
00085     
00086     SetRect( aRect );
00087     ActivateL();
00088     
00089     ConstructTimerModel();
00090     ConstructTimerL();    
00091     }

void CAknExPbarContainer::IncrementBarsAndDraw (  TInt  aIncrement  ) 
 

IncrementBarsAndDraw Increase progress bar length

Parameters:
aIncrement  value The increment value.

Definition at line 114 of file aknexpbarcontainer.cpp.

References iPBar.

Referenced by CAknExPbarAppUi::HandleCommandL(), and CAknExPbarTimer::RunL().

00115     {
00116     TInt index = 0;
00117     while ( index < KNumberOfBars )
00118         {
00119         iPBar[ index ]->IncrementAndDraw( aIncrement );
00120         ++index;
00121         }
00122     }

void CAknExPbarContainer::ReConstructProgressBarsL (   ) 
 

ReConstructProgressBarsL Deletes old progressbars and creates new ones. Called from CAknExPbarAppUi::HandleResourceChangeL() when display layout is changed.

Definition at line 222 of file aknexpbarcontainer.cpp.

References CreateProgressBarsL(), and iPBar.

Referenced by CAknExPbarAppUi::HandleResourceChangeL().

00223     {
00224     //If Progressbars are already created, delete those first.
00225     if( iPBar[KNumberOfBars - 1] )
00226         {
00227         for ( TInt ii = 0; ii < KNumberOfBars; ++ii )
00228             {
00229             delete( iPBar[ii] );
00230             iPBar[ii] = NULL;
00231             }
00232         }        
00233      
00234     CreateProgressBarsL();
00235     
00236     for ( TInt ii = 0; ii < KNumberOfBars; ++ii )
00237         {
00238         iPBar[ ii ]->ActivateL();
00239         }      
00240     }

TInt CAknExPbarContainer::CountComponentControls (   )  const [private]
 

From CoeControl,CountComponentControls.

Returns:
number of controls inside this container.

Definition at line 129 of file aknexpbarcontainer.cpp.

00130     {
00131     return KNumberOfBars;
00132     }

CCoeControl * CAknExPbarContainer::ComponentControl (  TInt  aIndex  )  const [private]
 

From CCoeControl,ComponentControl.

Parameters:
aIndex  number of the control.
Returns:
Pointer of controls inside this container.

Definition at line 139 of file aknexpbarcontainer.cpp.

References iPBar.

00140     {
00141     return ( iPBar[ aIndex ] );
00142     }

void CAknExPbarContainer::Draw (  const TRect &  aRect  )  const [private]
 

From CCoeControl,Draw.

Parameters:
aRect  Specified area for drawing

Definition at line 149 of file aknexpbarcontainer.cpp.

00150     {
00151     TRgb MyRgb;
00152     MyRgb = KAknExPbarBlack;
00153 
00154     CWindowGc& gc = SystemGc();
00155     gc.SetPenStyle( CGraphicsContext::ENullPen );
00156     gc.SetBrushColor( MyRgb );
00157     gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
00158     gc.DrawRect( aRect );
00159     }

void CAknExPbarContainer::HandleControlEventL (  CCoeControl *  aControl,
TCoeEvent  aEventType
)  [private]
 

From CCoeControl, HandleControlEventL Handles an event of type aEventType

Parameters:
aControl  Pointer to component control
aEventType  Event code

Definition at line 167 of file aknexpbarcontainer.cpp.

00169     {
00170     // No implementation required
00171     }

void CAknExPbarContainer::ConstructTimerModel (   )  [private]
 

ConstructTimerModel Constructs Timer's Model

Definition at line 295 of file aknexpbarcontainer.cpp.

References TAknExPbarTimerModel::iHundredths, TAknExPbarTimerModel::iIncrement, TAknExPbarTimerModel::iRunning, and iTimerModel.

Referenced by ConstructL().

00296     {
00297     iTimerModel.iHundredths = KTimerModelHundredths;
00298     iTimerModel.iIncrement = KTimerModelIncrement;
00299     iTimerModel.iRunning = KTimerModelRunning;
00300     }    

void CAknExPbarContainer::ConstructTimerL (   )  [private]
 

ConstructTimerL Constructs Timer itself

Definition at line 306 of file aknexpbarcontainer.cpp.

References iTimer, iTimerModel, and CAknExPbarTimer::NewL().

Referenced by ConstructL().

00307     {
00308     iTimer = CAknExPbarTimer::NewL( &iTimerModel, this );
00309     }

void CAknExPbarContainer::CreateProgressBarsL (   )  [private]
 

CreateProgressBarsL Creates progress bars

Definition at line 179 of file aknexpbarcontainer.cpp.

References iPBar.

Referenced by ConstructL(), and ReConstructProgressBarsL().

00180     {        
00181     TResourceReader reader;
00182     
00183     // Set Progress Bar property, using resource
00184     iCoeEnv->CreateResourceReaderLC( reader, R_AKNEXPBAR_PROGRESS_BAR_0 );            
00185     iPBar[ 0 ] = new( ELeave ) CEikProgressInfo();
00186     iPBar[ 0 ]->ConstructFromResourceL( reader );
00187     
00188     // PopAndDestroy reader from CleanupStack
00189     CleanupStack::PopAndDestroy();    
00190       
00191     iPBar[ 0 ]->SetPosition( ( TPoint( KProgressBar0Position_X,
00192                                KProgressBar0Position_Y ) ) );
00193     iPBar[ 0 ]->SetContainerWindowL( *this );
00194         
00195     
00196     TRect rect;
00197     AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect);
00198     
00199     // Set Progress Bar property, coding directly
00200     CEikProgressInfo::SInfo info;
00201     info.iHeight = KProgressBarHeight;
00202     info.iSplitsInBlock = KProgressBarSplitsInBlock;
00203     info.iTextType = EEikProgressTextNone;
00204     
00205     //Set progress bar widht using current rectangle width
00206     info.iWidth = (rect.Width() - KProgressBar1EmptyLeftSpace);
00207     info.iFinalValue = KProgressBar1FinalValue;
00208     iPBar[ 1 ] = new( ELeave ) CEikProgressInfo( info );
00209     iPBar[ 1 ]->ConstructL();
00210     iPBar[ 1 ]->SetPosition( ( TPoint( KProgressBar1Position_X,
00211                                KProgressBar1Position_Y ) ) );
00212     
00213     iPBar[ 1 ]->SetContainerWindowL( *this );       
00214     }

void CAknExPbarContainer::SetFinalValue (   ) 
 

SetFinalValue Set Final Value. Changes final values between progress bar 1 and 2.

Definition at line 247 of file aknexpbarcontainer.cpp.

References iFinalValuesTwisted, and iPBar.

Referenced by CAknExPbarAppUi::HandleCommandL().

00248     {    
00249     if ( iFinalValuesTwisted )
00250         {
00251         iPBar[ 0 ]->SetFinalValue( KProgressBar0FinalValue );
00252         
00253         iPBar[ 1 ]->SetFinalValue( KProgressBar1FinalValue );
00254         iFinalValuesTwisted = EFalse;
00255         }
00256     else
00257         {
00258         iPBar[ 0 ]->SetFinalValue( KProgressBar1FinalValue );
00259         iPBar[ 1 ]->SetFinalValue( KProgressBar0FinalValue );
00260         iFinalValuesTwisted = ETrue;
00261         }
00262 
00263     for ( TInt ii = 0; ii < KNumberOfBars; ++ii )
00264         iPBar[ ii ]->SetAndDraw( KProgressBarResetValue );   
00265     }

void CAknExPbarContainer::ShowInfo (  TInt  aBarNo  ) 
 

ShowInfo Shows progressbars Info

Parameters:
aBarNo  progressbars number

Definition at line 272 of file aknexpbarcontainer.cpp.

References iPBar.

Referenced by CAknExPbarAppUi::HandleCommandL().

00273     {
00274     //Allocate TBuf with constant length.
00275     TBuf<KLengthOfTempString> str;
00276     TBuf<KLengthOfTempString> format;
00277 
00278     iCoeEnv->ReadResource( format, R_AKNEXPBAR_FORMATSTRING_INFO );
00279 
00280    str.Format( format, iPBar[ aBarNo ]->Info().iTextType, 
00281                         iPBar[ aBarNo ]->Info().iSplitsInBlock,
00282                         iPBar[ aBarNo ]->Info().iFinalValue,
00283                         iPBar[ aBarNo ]->Info().iWidth, 
00284                         iPBar[ aBarNo ]->Info().iHeight,
00285                         iPBar[ aBarNo ]->CurrentValue() );
00286 
00287         CAknInformationNote* note = new (ELeave) CAknInformationNote;
00288         note->ExecuteLD( str );
00289     }


Member Data Documentation

CEikProgressInfo* CAknExPbarContainer::iPBar[KNumberOfBars] [private]
 

iPBar owned by CAknExPbarContainer object.

Definition at line 204 of file aknexpbarcontainer.h.

Referenced by CAknExPbarContainer(), ComponentControl(), CreateProgressBarsL(), IncrementBarsAndDraw(), ReConstructProgressBarsL(), SetFinalValue(), ShowInfo(), and ~CAknExPbarContainer().

TBool CAknExPbarContainer::iFinalValuesTwisted [private]
 

Indicates are progressbar final values twisted so that final value for progressbar 1 is set for progressbar 0 and otherwise. If ETrue, values are twisted.

Definition at line 211 of file aknexpbarcontainer.h.

Referenced by ConstructL(), and SetFinalValue().

CAknExPbarTimer* CAknExPbarContainer::iTimer [private]
 

iTimer, pointer to timer class. Owned by CAknExPbarContainer object.

Definition at line 217 of file aknexpbarcontainer.h.

Referenced by ConstructTimerL(), and ~CAknExPbarContainer().

TAknExPbarTimerModel CAknExPbarContainer::iTimerModel [private]
 

iTimerModel, struct to TAknExPbarTimerModel

Definition at line 220 of file aknexpbarcontainer.h.

Referenced by ConstructTimerL(), and ConstructTimerModel().


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

© Nokia 2009

Back to top