startupservices/Startup/inc/StartupWelcomeAnimation.h
branchRCL_3
changeset 20 c2c61fdca848
parent 0 2e3d3ce01487
equal deleted inserted replaced
19:924385140d98 20:c2c61fdca848
       
     1 /*
       
     2 * Copyright (c) 2003-2007 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *           This class is the container class of the CStartupUerWelcomeNote.
       
    16 *           It is used for showing predefined animation.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 #ifndef STARTUPWELCOMEANIMATION_H
       
    23 #define STARTUPWELCOMEANIMATION_H
       
    24 
       
    25 // INCLUDES
       
    26 #include <coecntrl.h>
       
    27 #include "Startup.hrh"
       
    28 
       
    29 // CONSTANTS
       
    30 
       
    31 // FORWARD DECLARATIONS
       
    32 class CStartupModel;
       
    33 class CAknBitmapAnimation;
       
    34 class CStartupAppUi;
       
    35 
       
    36 // CLASS DECLARATION
       
    37 
       
    38 /**
       
    39 *  This class takes care of showing welcome animatio to the user.
       
    40 */
       
    41 class CStartupWelcomeAnimation : public CCoeControl , MCoeControlObserver 
       
    42     {
       
    43     public:  // Constructors and destructor
       
    44 
       
    45         /**
       
    46         *  C++ default constructor.
       
    47         */
       
    48         CStartupWelcomeAnimation( CStartupAppUi* aStartupAppUi );
       
    49 
       
    50         /**
       
    51         * Two-phased constructor.
       
    52         */
       
    53         static CStartupWelcomeAnimation* NewL( CStartupAppUi* aStartupAppUi, const TRect& aRect);
       
    54 
       
    55         /**
       
    56         *  Destructor
       
    57         */
       
    58         ~CStartupWelcomeAnimation();      
       
    59 
       
    60         /**
       
    61         *  This handles the pointer events in this control.
       
    62         */
       
    63         void HandlePointerEventL(const TPointerEvent& aPointerEvent);
       
    64 
       
    65         /**
       
    66         *  This handles the key events in this control.
       
    67         */
       
    68         TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
       
    69 
       
    70         /**
       
    71         *  This cancels the animation.
       
    72         */
       
    73         void CancelAnimation();
       
    74 
       
    75         /**
       
    76         *  This function performs the actual user welcome note showing.
       
    77         */
       
    78         void StartL();
       
    79     
       
    80         /**
       
    81         *  This makes the animation module to stop showing animation.
       
    82         */
       
    83         void EndAnimation() const;
       
    84         
       
    85         /**
       
    86         *  Returns the whole duration of the animation, in milliseconds.
       
    87         */
       
    88         TInt ShowingTime();
       
    89 
       
    90         /**
       
    91         *  Update screen with white bitmap.
       
    92         */
       
    93         void DrawBlankScreen() const;
       
    94 
       
    95         /**
       
    96         *  EPOC default constructor
       
    97         */
       
    98         void ConstructL(const TRect& aRect);
       
    99 
       
   100         /**
       
   101         *  Set the info about which state in execution the 
       
   102         *  application is, so that view class can draw window 
       
   103         *  properly.
       
   104         */
       
   105         void UpdateDrawInfo( TStartupDrawInfo aValue );
       
   106 
       
   107         /**
       
   108         *  Removes the splashscreen
       
   109         *  @return   void
       
   110         */
       
   111         void RemoveSplashScreen() const;
       
   112 
       
   113         /**
       
   114         *  Tells is the animation cancelled by user
       
   115         *  @return   TBool
       
   116         */
       
   117         TBool IsAnimationCancelled();
       
   118 
       
   119         /**
       
   120         *  Sets the iAnimationShowing member value
       
   121         *  @return   void
       
   122         */
       
   123         void SetAnimationShowing(TBool aValue);
       
   124         
       
   125         /**
       
   126         * Handle resource change
       
   127         * @param aType Type of change
       
   128         */
       
   129         void HandleResourceChange(TInt aType);        
       
   130         
       
   131         //TEJ
       
   132         void CancelAnimCancelTimer();
       
   133     private:
       
   134         
       
   135         /**
       
   136         *  Is called when size is changed.
       
   137         */
       
   138         void SizeChanged();
       
   139 
       
   140         /**
       
   141         *  Returns the count of the components in the container.
       
   142         */
       
   143         TInt CountComponentControls() const;
       
   144 
       
   145         /**
       
   146         *  Returns the component specified by aIndex parameter.
       
   147         */
       
   148         CCoeControl* ComponentControl(TInt aIndex) const;
       
   149 
       
   150         /**
       
   151         *  Handles the event of the control.
       
   152         */
       
   153         void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
       
   154 
       
   155         /**
       
   156         *  Is called by Draw()-function and contains
       
   157         *  the drawing intelligence about different states of the execution.
       
   158         */
       
   159         virtual void DoDrawingL() const;
       
   160 
       
   161     private: // Functions from base classes
       
   162         
       
   163         /**
       
   164         *  Returns the count of the components in the container.
       
   165         */
       
   166         void Draw(const TRect& aRect) const;
       
   167     
       
   168     protected: // Data
       
   169 
       
   170         //Used for showing animation    
       
   171         CAknBitmapAnimation *iAnim; //owns
       
   172 
       
   173         //Used for showing white background
       
   174         CFbsBitmap* iBackgroundBitmap; //owns
       
   175 
       
   176         //Is used for setting the timer over the animation
       
   177         TInt iShowingTime; //in milli
       
   178 
       
   179         //stores the information about the execution state
       
   180         //of the application. This information is used
       
   181         //in drawing properly in current situation.
       
   182         TStartupDrawInfo iDrawUpdateInfo;
       
   183 
       
   184         //is uded for guarantee that RStarterSession is made
       
   185         //and used only once when RemoveSplashScreen is called.
       
   186         //In other words it is used for preventing needless work...
       
   187         TBool iSplashScreenRemoved;
       
   188 
       
   189         //is used when user cancels the welcome note showing by
       
   190         //pressing any key. 
       
   191         CStartupAppUi* iStartupAppUi; //uses
       
   192 
       
   193         //is used when user cancels the welcome note showing by
       
   194         //pressing any key. The reason for using callback in OfferKeyEvent()
       
   195         //guarantees that EKeyWasConsumed is returned properly before application
       
   196         //continues the tight execution.
       
   197         CPeriodic* iAnimCancelTimer; //owns
       
   198 
       
   199         //used for telling when the animation is showing
       
   200         TBool iAnimationShowing;
       
   201 
       
   202         //used for telling if animation is cancelled by user.
       
   203         TBool iAnimationCancelled;
       
   204     };
       
   205 
       
   206 #endif      // STARTUPWELCOMEANIMATION_H
       
   207             
       
   208 // End of File