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