startupservices/Startup/inc/startupanimationwrapper.h
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 /*
       
     2 * Copyright (c) 2007,2008 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:  Declaration of CStartupAnimationWrapper class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef STARTUPANIMATIONWRAPPER_H
       
    20 #define STARTUPANIMATIONWRAPPER_H
       
    21 
       
    22 #include "sanimstartupctrl.h"
       
    23 
       
    24 class CStartupView;
       
    25 
       
    26 /**
       
    27 *  Wraps asynchronous operations of a CSAnimStartupCtrl to a call-back calls.
       
    28 *
       
    29 *  @lib None
       
    30 *  @since S60 3.2
       
    31 */
       
    32 NONSHARABLE_CLASS( CStartupAnimationWrapper ) : public CActive
       
    33     {
       
    34 
       
    35 public:
       
    36 
       
    37     /**
       
    38     * Constructs a CStartupAnimationWrapper object.
       
    39     *
       
    40     * @since S60 3.2
       
    41     *
       
    42     * @param aView Parent control for the animation control(s).
       
    43     * @return The new object
       
    44     */
       
    45     static CStartupAnimationWrapper* NewL( CStartupView& aView );
       
    46 
       
    47     /**
       
    48     * Destructor.
       
    49     *
       
    50     * @since S60 3.2
       
    51     */
       
    52     virtual ~CStartupAnimationWrapper();
       
    53 
       
    54     /**
       
    55     * Create a startup animation control and load the animation.
       
    56     *
       
    57     * @param aRect Rectangle designated for the control.
       
    58     * @param aContainer The compound control that is the container for the control.
       
    59     * @param aParams Central Repository keys for finding out details of the
       
    60     * animation.
       
    61     * @param aPlayDefaultBeep Indicates whether the default 'beep' tone should
       
    62     * be played during the animation, if the parameters do not specify a valid
       
    63     * tone file.
       
    64     * @param aSyncCommand Identifies the parameters for secondary display
       
    65     * startup sync command (only required if secondary display is supported).
       
    66     */
       
    67     void PreLoad(
       
    68         const TRect& aRect,
       
    69         const CCoeControl& aContainer,
       
    70         const CSAnimStartupCtrl::TAnimationParams& aParams,
       
    71         const TBool aPlayDefaultBeep,
       
    72         const TInt aSyncCommand );
       
    73 
       
    74     /**
       
    75     * Create a startup animation control (if not preloaded) and play the animation.
       
    76     *
       
    77     * @param aRect Rectangle designated for the control.
       
    78     * @param aContainer The compound control that is the container for the control.
       
    79     * @param aParams Central Repository keys for finding out details of the
       
    80     * animation.
       
    81     * @param aPlayDefaultBeep Indicates whether the default 'beep' tone should
       
    82     * be played during the animation, if the parameters do not specify a valid
       
    83     * tone file.
       
    84     * @param aSyncCommand Identifies the parameters for secondary display
       
    85     * startup sync command (only required if secondary display is supported).
       
    86     * @param aCallBack Function to call when animation has finished.
       
    87     */
       
    88     void Play(
       
    89         const TRect& aRect,
       
    90         const CCoeControl& aContainer,
       
    91         const CSAnimStartupCtrl::TAnimationParams& aParams,
       
    92         const TBool aPlayDefaultBeep,
       
    93         const TInt aSyncCommand,
       
    94         const TCallBack& aCallBack );
       
    95 
       
    96     /**
       
    97     * Return ETrue if the animation was cancelled before it finished.
       
    98     */
       
    99     TBool WasCancelled() const;
       
   100 
       
   101     /**
       
   102     * Return ETrue if the animation has any content (image or tone).
       
   103     * Return value is meaningful only after CStartupAnimationWrapper::Play has been called.
       
   104     *
       
   105     * @since S60 3.2
       
   106     *
       
   107     * @return ETrue if the animation has any content (image or tone).
       
   108     */
       
   109     TBool HasContent() const;
       
   110 
       
   111     /**
       
   112     * Makes this application the foreground application.
       
   113     *
       
   114     * @since S60 3.2
       
   115     */
       
   116     void BringToForeground();
       
   117 
       
   118 protected:
       
   119 
       
   120     /**
       
   121     * From CActive.
       
   122     * Implements cancellation of an outstanding request.
       
   123     *
       
   124     * @since S60 3.2
       
   125     */
       
   126     virtual void DoCancel();
       
   127 
       
   128     /**
       
   129     * From CActive.
       
   130     * Handles an active object's request completion event.
       
   131     * Never leaves.
       
   132     *
       
   133     * @since S60 3.2
       
   134     */
       
   135     virtual void RunL();
       
   136 
       
   137 private:
       
   138 
       
   139     /**
       
   140     * First phase constructor.
       
   141     *
       
   142     * @since S60 3.2
       
   143     *
       
   144     * @param aView Parent control for the animation control(s).
       
   145     */
       
   146     CStartupAnimationWrapper( CStartupView& aView );
       
   147 
       
   148     /**
       
   149     * Second phase constructor.
       
   150     *
       
   151     * @since S60 3.2
       
   152     */
       
   153     void ConstructL();
       
   154 
       
   155     /**
       
   156     * Create a startup animation control and load the animation.
       
   157     *
       
   158     * @param aRect Rectangle designated for the control.
       
   159     * @param aContainer The compound control that is the container for the control.
       
   160     * @param aParams Central Repository keys for finding out details of the
       
   161     * animation.
       
   162     * @param aPlayDefaultBeep Indicates whether the default 'beep' tone should
       
   163     * be played during the animation, if the parameters do not specify a valid
       
   164     * tone file.
       
   165     * @param aSyncCommand Identifies the parameters for secondary display
       
   166     * startup sync command (only required if secondary display is supported).
       
   167     */
       
   168     void LoadL(
       
   169         const TRect& aRect,
       
   170         const CCoeControl& aContainer,
       
   171         const CSAnimStartupCtrl::TAnimationParams& aParams,
       
   172         const TBool aPlayDefaultBeep,
       
   173         const TInt aSyncCommand );
       
   174 
       
   175     /**
       
   176     * Start playing an animation which has already been loaded.
       
   177     */
       
   178     void StartPlaying();
       
   179 
       
   180     /**
       
   181     * Cancel the animation if active. Remove animation control from parent
       
   182     * control and delete it.
       
   183     */
       
   184     void DestroyCtrl();
       
   185 
       
   186 private: // data
       
   187 
       
   188     /** Parent control for the animation control(s). */
       
   189     CStartupView& iView;
       
   190 
       
   191     /** Startup animation control. Owned. May be NULL. */
       
   192     CSAnimStartupCtrl* iCtrl;
       
   193 
       
   194     /** Function to call when animation has finished. Owned. Not NULL. */
       
   195     CAsyncCallBack* iCallBackCaller;
       
   196 
       
   197     /** Indicates whether to start playing right after loading completes. */
       
   198     TBool iPlayImmediately;
       
   199 
       
   200     /** Internal state of the object. */
       
   201     enum TState
       
   202         {
       
   203         EIdle = 1,
       
   204         ELoading,
       
   205         EReady,
       
   206         EPlaying,
       
   207         ECancelled
       
   208         };
       
   209     TState iState;
       
   210 
       
   211     /** ETrue if the animation has any content (image or tone). */
       
   212     TBool iHasContent;
       
   213     };
       
   214 
       
   215 #endif // STARTUPANIMATIONWRAPPER_H