psln/Inc/PslnGeneralThemeContainer.h
changeset 37 89c890c70182
parent 34 6b5204869ed5
child 45 667edd0b8678
equal deleted inserted replaced
34:6b5204869ed5 37:89c890c70182
     1 /*
       
     2 * Copyright (c) 2005-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:  General theme container.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef PSLNGENERALTHEMECONTAINER_H
       
    21 #define PSLNGENERALTHEMECONTAINER_H
       
    22 
       
    23 #include "PslnBaseContainer.h"
       
    24 
       
    25 class CAknLocalSkinInstance;
       
    26 
       
    27 /**
       
    28 *  Observer interface for theme preview state changes.
       
    29 *  aPreviewMode new mode for theme preview - ETrue preview is active
       
    30 *                                            EFalse preview is now ready
       
    31 *
       
    32 *  @since S60 v5.0
       
    33 */
       
    34 class MPslnThemePreviewObserver
       
    35     {
       
    36     public:
       
    37         virtual void HandlePreviewStateChange( const TBool& aPreviewMode ) = 0;
       
    38     };
       
    39 
       
    40 /**
       
    41 *  General theme container.
       
    42 *  Contains available skins.
       
    43 *
       
    44 *  @since S60 v3.1
       
    45 */
       
    46 class CPslnGeneralThemeContainer : public CPslnBaseContainer
       
    47     {
       
    48     public:  // Constructors and destructor   
       
    49     
       
    50         /**
       
    51         * C++ default constructor.
       
    52         */
       
    53         CPslnGeneralThemeContainer();
       
    54 
       
    55         /**
       
    56         * By default Symbian 2nd phase constructor is private.
       
    57         * @param aRect client rect.
       
    58         */
       
    59         void ConstructL( const TRect& aRect );        
       
    60         
       
    61         /**
       
    62         * Destructor.
       
    63         */
       
    64         virtual ~CPslnGeneralThemeContainer();
       
    65         
       
    66     public: // New methods
       
    67     
       
    68         /**
       
    69         * Is embedded link visible. 
       
    70         * @return ETrue if link should be shown.
       
    71         */
       
    72         TBool IsEmbeddedLinkVisible() const;
       
    73         
       
    74         /**
       
    75         * Updates skin list.
       
    76         */
       
    77         void UpdateSkinListItemsL( const TInt& aNewIndex );
       
    78 
       
    79         /**
       
    80         * From CPslnBaseContainer.
       
    81         * Constructs list box and items.
       
    82         * @param aResLbxId used resource ID.
       
    83         */
       
    84         void ConstructListBoxL( TInt aResLbxId );
       
    85         
       
    86         /**
       
    87         * From CPslnBaseContainer.
       
    88         * Creates listbox items.
       
    89         */
       
    90         void CreateListBoxItemsL();
       
    91 
       
    92         /**
       
    93         * Updates D column icons when skin preview activates.
       
    94         *
       
    95         * @since 5.0
       
    96         */
       
    97         void UpdateSkinListItemsDColumnOnlyL();
       
    98 
       
    99         /**
       
   100         * Starts theme preview.
       
   101         *
       
   102         * @since 5.0
       
   103         */
       
   104         void StartThemePreviewL( TBool aTouch = ETrue );
       
   105                 
       
   106         
       
   107         /**
       
   108         * Cancel theme preview.
       
   109         *
       
   110         * @since 5.0
       
   111         */
       
   112         void CancelThemePreviewL();
       
   113 
       
   114 
       
   115         /**
       
   116         * Sets theme preview change observer (MPslnThemePreviewObserver).
       
   117         * aObserver observer for theme preview changes.
       
   118         *
       
   119         * @since 5.0
       
   120         */
       
   121         void SetThemePreviewObserver( MPslnThemePreviewObserver* aObserver );
       
   122 
       
   123         /**
       
   124         * Locks/enables up and down key events to this container.
       
   125         *
       
   126         * @since 5.0
       
   127         */
       
   128         void LockUpAndDownKeys( const TBool& aLocked );
       
   129         
       
   130         /**
       
   131         * Restart Quick Preview
       
   132         */
       
   133         void RestartQuickPreviewL();
       
   134 
       
   135         /**
       
   136         * Set theme preview state active.
       
   137         */    
       
   138         void SetPreviewStateActive();
       
   139         
       
   140         /**
       
   141         * Is current focus theme in preview state. 
       
   142         * @return ETrue if theme is in preview state.
       
   143         */    
       
   144         TBool CurrentThemeInPreviewState();
       
   145         
       
   146 
       
   147     private:            
       
   148         
       
   149         // Gets Help context.        
       
   150         void GetHelpContext( TCoeHelpContext& aContext ) const;
       
   151         // From CPslnBaseContainer
       
   152         TKeyResponse OfferKeyEventL(
       
   153             const TKeyEvent& aKeyEvent, 
       
   154             TEventCode aType );
       
   155         // From CCoeControl
       
   156         void HandlePointerEventL( const TPointerEvent &aPointerEvent );
       
   157 
       
   158         /* Creates (&initializes) a locally skinnable item list.*/
       
   159         void CreateSkinItemList();
       
   160         
       
   161         /* Adds skin item to locally skinnable item list. */
       
   162         TInt AddItemToList( const TAknsItemID& aSkinID );
       
   163 
       
   164         /* Callback interface for idle time. */
       
   165         static TInt DoHandleIdleTimeL( TAny* aAny );
       
   166 
       
   167         /* Callback interface for theme effect ending. */
       
   168         static TInt DoHandleEffectEndL( TAny* aAny );
       
   169 
       
   170         /* Handle idle time. */
       
   171         void HandleIdleTimeL();
       
   172 
       
   173         /* Handle theme effect ending. */
       
   174         void HandleEffectEndL();
       
   175         
       
   176         /*
       
   177         * Get Preview Skin Index.
       
   178         */
       
   179         TInt PreviewSkinIndex();
       
   180 
       
   181         /* Initialize theme preview delay time settings. */
       
   182         void InitPreviewTime();
       
   183         
       
   184         /* Show Error Note. */
       
   185         void ShowErrorNoteL( TInt  aResourceId  ); 
       
   186 
       
   187     private: // data
       
   188 
       
   189         /*
       
   190         * List of skin items to skin locally.
       
   191         */
       
   192         RArray<TAknsItemID> iSkinItemList;
       
   193 
       
   194         /*
       
   195         * Timer for delay.
       
   196         * Own.
       
   197         */
       
   198         CPeriodic* iPreviewIdle;
       
   199 
       
   200         /*
       
   201         * Skin preview library instance.
       
   202         * Own.
       
   203         */
       
   204         CAknLocalSkinInstance* iLocalSkinInstance;
       
   205 
       
   206         /*
       
   207         * Theme preview state change observer.
       
   208         * Not own.
       
   209         */
       
   210         MPslnThemePreviewObserver* iObserver;
       
   211 
       
   212         /*
       
   213         * To be used index in highlight when container is updated.
       
   214         * This is used when skin is activated and user has already
       
   215         * highlighted some other theme.
       
   216         */
       
   217         TInt iToBeUsedIndex;
       
   218 
       
   219         /*
       
   220         * Up and down key events are ignored while a skin is activating.
       
   221         * This is to avoid drawing of container when the skin items might
       
   222         * not be valid.
       
   223         */
       
   224         TBool iLockedKeys;
       
   225                 
       
   226         /*
       
   227         * Current preview theme index in listbox.
       
   228         */
       
   229         TInt iActiveSkinItemIndex;
       
   230         
       
   231         /*
       
   232         * Theme preview delay time.
       
   233         */
       
   234         TInt iPreviewDelayTime;
       
   235         
       
   236         /*
       
   237         * Theme preview delay time, arisen by navigation key.
       
   238         */
       
   239         TInt iPreviewDelayTimeOnHardKey;
       
   240         
       
   241         /*
       
   242         * Theme preview interval time.
       
   243         */
       
   244         TInt iPreviewIntervalTime;
       
   245         
       
   246         /*
       
   247         * Old Skin Num.
       
   248         */
       
   249         TInt iOldSkinNum;
       
   250     };
       
   251 
       
   252 #endif      // PSLNGENERALTHEMECONTAINER_H  
       
   253             
       
   254 // End of File