emailuis/uicomponents/inc/fsfadeeffect.h
changeset 0 8466d47a6819
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 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:  Fade effect for a list component.
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_FSFADEEFFECT_H
       
    20 #define C_FSFADEEFFECT_H
       
    21 //<cmail> SF
       
    22 #include <alf/alfeventhandler.h>
       
    23 //</cmail>
       
    24 //////TOOLKIT CLASSES
       
    25 class CAlfVisual;
       
    26 class CAlfControl;
       
    27 
       
    28 class MFsFadeEffectObserver;
       
    29 
       
    30 
       
    31 /**
       
    32  *  Class used for fade in/out effects.
       
    33  *
       
    34  *  @lib 
       
    35  */
       
    36 NONSHARABLE_CLASS(CFsFadeEffect): public CBase, public MAlfEventHandler
       
    37     {
       
    38         
       
    39 public:
       
    40     /**
       
    41      * Two-phased constructor
       
    42      * 
       
    43      * @param aRoot Root visual/layout which of the opacity is controlled
       
    44      * @param aTime Speed of fade in/out effect. Time in miliseconds.
       
    45      * 
       
    46      * @return Pointer to the new fade effect object
       
    47      */
       
    48     static CFsFadeEffect* NewL(CAlfControl* aControl, CAlfVisual* aRoot, TInt aTime);   
       
    49     
       
    50     /**
       
    51      * Two-phased constructor
       
    52      * 
       
    53      * @param aObserver Observer which will receive events about state chages
       
    54      * @param aRoot Root visual/layout which of the opacity is controlled
       
    55      * @param aTime Speed of fade in/out effect. Time in miliseconds.
       
    56      * 
       
    57      * @return Pointer to the new fade effect object
       
    58      */
       
    59     static CFsFadeEffect* NewL(CAlfControl* aControl, MFsFadeEffectObserver* aObserver, 
       
    60         CAlfVisual* aRoot, 
       
    61         TInt aTime);
       
    62     
       
    63     /**
       
    64      * Launches fade in effect
       
    65      */
       
    66     void FadeIn();
       
    67     
       
    68     /**
       
    69      * Launches fade out effect
       
    70      */
       
    71     void FadeOut();
       
    72     
       
    73     /**
       
    74      * Sets duration (in miliseconds) of the fade effects.
       
    75      * @param aTime Fade effect's duration in milisecond. 
       
    76      */
       
    77     void SetTime(const TInt aTime);
       
    78     
       
    79     /**
       
    80      * Returns speed of the fade effect
       
    81      * 
       
    82      * @return Duratin of the fade effect in miliseconds.
       
    83      */
       
    84     TInt Time() const;    
       
    85     
       
    86 public: //From MAlfEventHandler
       
    87 
       
    88     /**
       
    89      * From MAlfEventHandler
       
    90      * Called when an input event is being offered to this object.
       
    91      * 
       
    92      * The implementation must ensure that the function returns EFalse if 
       
    93      * it does not do anything in response to the event, otherwise, other objects
       
    94      * may be prevented from receiving the event. If it is able to process the 
       
    95      * event it should return ETrue.
       
    96      *
       
    97      * @param aEvent  Event to be handled.
       
    98      *
       
    99      * @return  <code>ETrue</code>, if the event was handled.
       
   100      *          Otherwise <code>EFalse</code>.
       
   101      */
       
   102     virtual TBool OfferEventL(const TAlfEvent& aEvent);
       
   103     
       
   104 private:
       
   105     /**
       
   106      * Constructor
       
   107      * 
       
   108      * @param aRoot Root visual/layout which of the opacity is controlled
       
   109      * @param aTime Speed of fade in/out effect. Time in miliseconds.
       
   110      * 
       
   111      */
       
   112     CFsFadeEffect(CAlfControl* aControl,CAlfVisual* aRoot, TInt aTime);
       
   113 
       
   114 
       
   115     /**
       
   116      * Constructor
       
   117      * 
       
   118      * @param aObserver Observer which will receive events about state chages
       
   119      * @param aRoot Root visual/layout which of the opacity is controlled
       
   120      * @param aTime Speed of fade in/out effect. Time in miliseconds.
       
   121      * 
       
   122      * @return Pointer to the new fade effect object
       
   123      */
       
   124     CFsFadeEffect(CAlfControl* aControl,MFsFadeEffectObserver* aObserver, 
       
   125         CAlfVisual* aRoot, 
       
   126         TInt aTime);
       
   127 
       
   128 private:
       
   129 
       
   130     /**
       
   131      * Custom events that informs about ending a fade effect.
       
   132      */
       
   133     enum TCustomEvent
       
   134         {
       
   135         ECustomEventFadeInFinished = 200,
       
   136         ECustomEventFadeOutFinished
       
   137         };
       
   138     
       
   139 private:
       
   140 
       
   141     /**
       
   142      * 
       
   143      */
       
   144     CAlfControl* iControl;
       
   145     
       
   146     /**
       
   147      * Root visual/layout which of the opacity is controlled
       
   148      * Not own.
       
   149      */
       
   150     CAlfVisual* iRoot;
       
   151     
       
   152     /**
       
   153      * Observer of fade eddects
       
   154      * Not own.
       
   155      */
       
   156     MFsFadeEffectObserver* iObserver;
       
   157     
       
   158     /**
       
   159      * Speed of fade in/out effects
       
   160      */
       
   161     TInt iTime;
       
   162 
       
   163     };
       
   164     
       
   165 #endif //C_FSFADEEFFECT_H