idlehomescreen/nativeuicontroller/inc/ainavipaneanimator.h
changeset 0 f72a12da539e
child 27 7a8b39b569cb
equal deleted inserted replaced
-1:000000000000 0:f72a12da539e
       
     1 /*
       
     2 * Copyright (c) 2006-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:  Navi pane animator.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_AINAVIPANEANIMATOR_H
       
    20 #define C_AINAVIPANEANIMATOR_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include "ainativeuimodel.h"
       
    24 
       
    25 namespace AiNativeUiController
       
    26 {
       
    27 
       
    28 class CAiStatusPanel;
       
    29 class MAiNaviPaneAnimatorCallback;
       
    30 
       
    31 /**
       
    32  *  Navi pane animator.
       
    33  *
       
    34  *  This class handles the navi pane animation when XML Idle gets the focus.
       
    35  *  It owns an array that is used for storing all data that is shown in form of
       
    36  *  soft indicators. It animates all items in the array in one second intervals. 
       
    37  *
       
    38  *  @since S60 3.2
       
    39  */
       
    40 class CAiNaviPaneAnimator : public CBase
       
    41     {
       
    42 
       
    43 public:
       
    44 
       
    45     static CAiNaviPaneAnimator* NewL( CAiStatusPanel& aStatusPane,
       
    46                 AiNativeUiModel::TRenderingPriorities& aPriorities, 
       
    47                 MAiNaviPaneAnimatorCallback& aCallback );
       
    48 
       
    49     virtual ~CAiNaviPaneAnimator();
       
    50     
       
    51     /**
       
    52      * Adds content item to the animator array.
       
    53      * @param aContentId Content item which value needs to be updated.
       
    54                             If item with same aContentId already exists in 
       
    55                             the array, it's value is updated. If not, new
       
    56                             item is created.
       
    57      * @param aText New value for aContentId.
       
    58      */
       
    59     void AddItemL( TInt aContentId, const TDesC16& aText );
       
    60 
       
    61     /**
       
    62      * Removes content item with given content id.
       
    63      * @param aContentId Content item which needs to be removed.
       
    64      */
       
    65     void RemoveItem( TInt aContentId );
       
    66      
       
    67     /**
       
    68      * Animates the content of the array.
       
    69      */
       
    70     void AnimateL();
       
    71      
       
    72     /**
       
    73      * Cancels ongoing animation (if there is one).
       
    74      */
       
    75     void CancelAnimationL();
       
    76     
       
    77     /**
       
    78      * Called by CPeriodic when timer expires.
       
    79      */
       
    80     static TInt CAiNaviPaneAnimator::AnimCallback( TAny* aPtr );     
       
    81 
       
    82     /**
       
    83      * Draws the text to navi pane.
       
    84      * This method is called by timer. It checks if there still are items left
       
    85      * in the animation array. If yes, it draws the current item's value. 
       
    86      * If not,it cancels the timer.
       
    87      */
       
    88     TBool DrawTextL();
       
    89 
       
    90     /**
       
    91      * Sorts iAnimArray in priority order defined by TRenderingPriorities.
       
    92      */
       
    93     void SortAnimArrayL();
       
    94     
       
    95     /**
       
    96      * Is ongoing animation
       
    97      */
       
    98     TBool IsActive();
       
    99 
       
   100 
       
   101 private:
       
   102 
       
   103     CAiNaviPaneAnimator( CAiStatusPanel& aStatusPane,
       
   104                 AiNativeUiModel::TRenderingPriorities& aPriorities, 
       
   105                 MAiNaviPaneAnimatorCallback& aCallback );
       
   106 
       
   107     void ConstructL();
       
   108     
       
   109     /**
       
   110      * Helper class for animation array items.
       
   111      * Can be defined as an inner class since not used outside parent class.
       
   112      */
       
   113     class CAiNameValuePair : public CBase
       
   114         {
       
   115         public:
       
   116         
       
   117             static CAiNameValuePair* NewLC( const TInt aName, 
       
   118                                             const TDesC& aValue );
       
   119 
       
   120             ~CAiNameValuePair();
       
   121 
       
   122             TInt Name() const;
       
   123 
       
   124             const TDesC16& Value() const;
       
   125 
       
   126             void SetValueL( const TDesC& aValue );
       
   127             
       
   128         private:
       
   129         
       
   130             void ConstructL( const TInt aName, const TDesC& aValue );
       
   131         
       
   132         private:    // data
       
   133         
       
   134             /// Name of the item in name/value pair
       
   135             TInt iName;
       
   136             
       
   137             /// Value or the item in name/value pair
       
   138             HBufC* iValue;
       
   139         };        
       
   140 
       
   141 
       
   142 private: // data
       
   143 
       
   144     /**
       
   145      * Used for doing the animation.
       
   146      * Own.
       
   147      */
       
   148     CPeriodic* iPeriodic;
       
   149     
       
   150     /// Status pane handler.
       
   151     CAiStatusPanel& iStatusPane;
       
   152     
       
   153     /// Navi pane rendering priorities
       
   154     AiNativeUiModel::TRenderingPriorities& iPriorities;
       
   155     
       
   156     /// Reference for informing about completed animation.
       
   157     MAiNaviPaneAnimatorCallback& iCallback;
       
   158 
       
   159     /// Array for holding data to be animated.
       
   160     RPointerArray<CAiNameValuePair> iAnimArray;
       
   161     
       
   162     /// Currently ongoing iteration of the animator array.
       
   163     TInt iCurrentItem;
       
   164 
       
   165     };
       
   166     
       
   167 } // namespace AiNativeUiController
       
   168 
       
   169 #endif // C_AINAVIPANEANIMATOR_H