Nokia N97 SDK
Example Applications Guide

aknexpbarcontainer.h

00001 /*
00002 * ==============================================================================
00003 *  Name        : aknexpbarcontainer.h
00004 *  Part of     : ProgressBar
00005 *  Interface   :
00006 *  Description :
00007 *  Version     :
00008 *
00009 *  Copyright (c) 2004 - 2006 Nokia Corporation.
00010 *  This material, including documentation and any related
00011 *  computer programs, is protected by copyright controlled by
00012 *  Nokia Corporation.
00013 * ==============================================================================
00014 */
00015 
00016 
00017 #ifndef __AKNEXPBARCONTAINER_H__
00018 #define __AKNEXPBARCONTAINER_H__
00019 
00020 
00021 // INCLUDES
00022 #include <coecntrl.h>
00023 #include <eikon.hrh>
00024 #include "AknExPbar.hrh"
00025 #include "AknExPbartimermodel.h"
00026 
00027 
00028 // CONSTANTS
00029 const TInt KInitIncrement = 0;
00030 const TInt KStepBackValueView = -8;
00031 const TInt KTimerModelHundredths = 10;
00032 const TInt KTimerModelIncrement = 1;
00033 const TBool KTimerModelRunning = ETrue;
00034 
00035 const TInt KProgressBarResetValue = 0;
00036 const TInt KAknExPbarBlack = 0xffffff;
00037 
00038 const TInt KProgressBar0Position_X = 4;
00039 const TInt KProgressBar0Position_Y = 30; 
00040 const TInt KProgressBar1Position_X = 4;
00041 const TInt KProgressBar1Position_Y = 70;
00042 
00043 const TInt KProgressBarHeight = 10;
00044 const TInt KProgressBarSplitsInBlock = 0;
00045 
00046 const TInt KProgressBar1EmptyLeftSpace = 15; 
00047 
00048 const TInt KProgressBar0FinalValue = 15; 
00049 const TInt KProgressBar1FinalValue = 40; 
00050 
00051 const TInt KLengthOfTempString = 100;
00052 const TInt KNumberOfBars = 2;
00053 
00054 
00055 // FORWARD DECLARATIONS
00056 class CEikProgressInfo;
00057 class CAknTitlePane;
00058 class CAknExPbarTimer;
00059 struct TAknExPbarTimerModel;
00060 
00061 // CLASS DECLARATION
00062 /**
00063 *  CAknExPbarContainer  container control class.
00064 *  
00065 */
00066 class CAknExPbarContainer : public CCoeControl, MCoeControlObserver
00067     {
00068     public: // Constructors and destructor
00069         
00070         /**
00071         * CAknExPbarContainer
00072         * C++ default constructor.
00073         */
00074         CAknExPbarContainer();    
00075             
00076         /**
00077         * NewL.
00078         * Two-phased constructor.
00079         * Construct a CAknExPbarContainer using two phase construction,
00080         * and return a pointer to the created object
00081         * @param aRect the rectangle this view will be drawn to
00082         * @return A pointer to the created instance of CAknExPbarContainer
00083         */
00084         static CAknExPbarContainer* NewL( const TRect& aRect );
00085 
00086         /**
00087         * NewLC.
00088         * Two-phased constructor.
00089         * Construct a CAknExPbarContainer using two phase construction,
00090         * and return a pointer to the created object
00091         * @param aRect the rectangle this view will be drawn to
00092         * @return A pointer to the created instance of CAknExPbarContainer
00093         */
00094         static CAknExPbarContainer* NewLC( const TRect& aRect );
00095             
00096         /**
00097         * ConstructL
00098         * 2nd phase constructor.
00099         * @param aRect Frame rectangle for container.
00100         */
00101         void ConstructL( const TRect& aRect );
00102 
00103         /**
00104         * ~CAknExPbarContainer.
00105         * Virtual Destructor.
00106         */
00107         virtual ~CAknExPbarContainer();
00108 
00109 
00110     public: // New functions
00111 
00112         /**
00113         * IncrementBarsAndDraw
00114         * Increase progress bar length
00115         * @param aIncrement value The increment value.
00116         */
00117         void IncrementBarsAndDraw( TInt aIncrement );
00118 
00119 
00120         /**
00121         * ReConstructProgressBarsL
00122         * Deletes old progressbars and creates new ones. Called  from 
00123         * CAknExPbarAppUi::HandleResourceChangeL() when display layout 
00124         * is changed.
00125         */        
00126         void ReConstructProgressBarsL();
00127 
00128 
00129     private: // Functions from base classes
00130 
00131        /**
00132         * From CoeControl,CountComponentControls.
00133         * @return number of controls inside this container.
00134         */
00135         TInt CountComponentControls() const;
00136 
00137         /**
00138         * From CCoeControl,ComponentControl.
00139         * @param aIndex number of the control.
00140         * @return Pointer of controls inside this container.
00141         */
00142         CCoeControl* ComponentControl( TInt aIndex ) const;
00143 
00144         /**
00145         * From CCoeControl,Draw.
00146         * @param aRect Specified area for drawing
00147         */
00148         void Draw( const TRect& aRect ) const;
00149         
00150         
00151     private : // Functions from base classes
00152 
00153         /**
00154         * From CCoeControl, HandleControlEventL
00155         * Handles an event of type aEventType
00156         * @param aControl Pointer to component control
00157         * @param aEventType Event code
00158         */
00159         void HandleControlEventL( CCoeControl* aControl, 
00160                                   TCoeEvent aEventType );
00161 
00162 
00163     private: // New functions
00164 
00165         /**
00166         * ConstructTimerModel
00167         * Constructs Timer's Model
00168         */
00169         void ConstructTimerModel();
00170 
00171         /**
00172         * ConstructTimerL
00173         * Constructs Timer itself
00174         */
00175         void ConstructTimerL();
00176         
00177         /**
00178         * CreateProgressBarsL
00179         * Creates progress bars
00180         */
00181         void CreateProgressBarsL();
00182 
00183     public: // New functions
00184 
00185          /**
00186         * SetFinalValue
00187         * Set Final Value. Changes final values between progress bar 1 and 2.
00188         */
00189         void SetFinalValue();
00190 
00191         /**
00192         * ShowInfo
00193         * Shows progressbars Info
00194         * @param aBarNo progressbars number
00195         */
00196         void ShowInfo( TInt aBarNo );
00197 
00198     private: // Data
00199         
00200         /**
00201         * iPBar 
00202         * owned by CAknExPbarContainer object.
00203         */
00204         CEikProgressInfo* iPBar[ KNumberOfBars ]; 
00205         
00206         /** 
00207         * Indicates are progressbar final values twisted so that final value 
00208         * for progressbar 1 is set for progressbar 0 and otherwise. If ETrue, 
00209         * values are twisted. 
00210         */
00211         TBool               iFinalValuesTwisted;
00212         
00213         /**
00214         * iTimer, pointer to timer class.
00215         * Owned by CAknExPbarContainer object.
00216         */    
00217         CAknExPbarTimer*     iTimer;
00218 
00219         /** iTimerModel, struct to TAknExPbarTimerModel **/
00220         TAknExPbarTimerModel iTimerModel; 
00221         
00222     };
00223 
00224 #endif // __AKNEXPBARCONTAINER_H__
00225 
00226 // End of File

© Nokia 2009

Back to top