uifw/EikStd/dlginc/EIKFANIM.H
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2005 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:  ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __EIKFANIM_H__
       
    19 #define __EIKFANIM_H__
       
    20 
       
    21 #include <AknsEffectAnim.h>
       
    22 #include <coemain.h> // For MCoeForegroundObserver
       
    23 #include <babitflags.h>
       
    24 
       
    25 /**
       
    26 * Interface for CEikFormAnim observer.
       
    27 *
       
    28 * @since 3.0
       
    29 */
       
    30 NONSHARABLE_CLASS( MEikFormAnimObserver )
       
    31     {
       
    32     public:
       
    33         virtual void AnimFrameReady() =0;
       
    34         virtual TBool AnimDrawHighlightBackground( CFbsBitGc& aGc ) =0;
       
    35     };
       
    36 
       
    37 /**
       
    38 * Wrapper class for using AknSkins effect animations. Used by
       
    39 * CEikCaptionedControls and stored as a singleton in CEikDialogPageContainer
       
    40 * (captioned controls acquire/unacquire the animation as they are set/unset
       
    41 * current).
       
    42 *
       
    43 * @since 3.0
       
    44 */
       
    45 NONSHARABLE_CLASS( CEikFormAnim ):
       
    46     public CActive,
       
    47     public MCoeForegroundObserver,
       
    48     public MAknsEffectAnimObserver
       
    49     {
       
    50 public:
       
    51     enum TFlag
       
    52         {
       
    53         /**
       
    54         * If set, animation creation is attempted. If not set, animation will
       
    55         * never be created.
       
    56         */
       
    57         EFlagUseAnimation = 0
       
    58         };
       
    59 
       
    60 private:
       
    61     CEikFormAnim();
       
    62     void ConstructL();
       
    63 
       
    64 public:
       
    65     static CEikFormAnim* NewL();
       
    66     ~CEikFormAnim();
       
    67 
       
    68     void SetObserver( MEikFormAnimObserver* aObserver );
       
    69     MEikFormAnimObserver* Observer();
       
    70 
       
    71     void SetHighlightSize( const TSize& aItemCellSize );
       
    72     CAknsEffectAnim* Animation() const;
       
    73 
       
    74     void Play();
       
    75     void Pause();
       
    76 
       
    77     void ChangeHighlightBackground();
       
    78 
       
    79     TSize Size() const;
       
    80     void ReleaseAnimation();
       
    81 
       
    82 public: // Implementation of MCoeForegroundObserver
       
    83     void HandleGainingForeground();
       
    84     void HandleLosingForeground();
       
    85 
       
    86 public: // Implementation of MAknsEffectAnimObserver
       
    87     void AnimFrameReady( TInt aError, TInt );
       
    88 
       
    89 public: // CActive overloads
       
    90     void DoCancel();
       
    91     void RunL();
       
    92 
       
    93 private: // New internal methods
       
    94     void NoAnimIfError( TInt aError );
       
    95     void UseNoAnimation();
       
    96     void PostDeleteAnimation();
       
    97     void CreateAnimationL( const TSize& aHighlightSize );
       
    98     void DoResizeL( const TSize& aHighlightSize, TBool aAboutToStart );
       
    99 
       
   100 private:
       
   101     CAknsEffectAnim* iAnimation;
       
   102     /**
       
   103     * Stored flags are explained in enumeration TFlags.
       
   104     */
       
   105     TBitFlags32 iAnimFlags;
       
   106     MEikFormAnimObserver* iObserver;
       
   107     };
       
   108 
       
   109 #endif