idlehomescreen/xmluirendering/uiengine/inc/xnbackgroundmanager.h
changeset 2 08c6ee43b396
child 4 4d54b72983ae
equal deleted inserted replaced
1:5315654608de 2:08c6ee43b396
       
     1 /*
       
     2 * Copyright (c) 2009 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 the License "Symbian Foundation License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Background manager
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CXNBACKGROUNDMANAGER_H
       
    19 #define CXNBACKGROUNDMANAGER_H
       
    20 
       
    21 // System includes
       
    22 #include <coecntrl.h>
       
    23 #include <aknssrvclient.h>
       
    24 #include <coeview.h>
       
    25 #include <disknotifyhandler.h>
       
    26 
       
    27 // CLASS DECLARATION
       
    28 class CXnViewManager;
       
    29 class CXnViewData;
       
    30 class CAknsLayeredBackgroundControlContext;
       
    31 
       
    32 namespace hspswrapper
       
    33     {
       
    34     class CHspsWrapper;
       
    35     }
       
    36 
       
    37 using namespace hspswrapper;
       
    38 
       
    39 /**
       
    40 *  Background manager.
       
    41 *
       
    42 *  @since S60 v5.0
       
    43 */
       
    44 NONSHARABLE_CLASS( CXnBackgroundManager ) : public CCoeControl,
       
    45     public MAknsSkinChangeObserver, public MCoeViewActivationObserver,
       
    46     public MDiskNotifyHandlerCallback
       
    47     {
       
    48 public:
       
    49 
       
    50     /**
       
    51      * Two-phased constructor.
       
    52      * @param aWrapper HSPS wrapper
       
    53      * @return new instance of CXnWallpaperView.
       
    54      */
       
    55     static CXnBackgroundManager* NewL( CXnViewManager& aViewManager, CHspsWrapper& aWrapper );
       
    56 
       
    57     /**
       
    58      * Destructor.
       
    59      */
       
    60     ~CXnBackgroundManager();
       
    61 
       
    62     /**
       
    63      * Caches wallpaper image.
       
    64      * 
       
    65      * @since S60 5.0
       
    66      * @param aFileName WallpaperImage image path and filename to be cached
       
    67      * @return Error code.
       
    68      */            
       
    69     TInt CacheWallpaperL( const TDesC& aFileName, CXnViewData& aViewData );
       
    70 
       
    71     /**
       
    72      * Changes wallpaper image of the current page.
       
    73      * 
       
    74      * @since S60 5.0
       
    75      * @param aFileName WallpaperImage image path and filename
       
    76      */            
       
    77     void AddWallpaperL( const TDesC& aFileName );
       
    78 
       
    79     /**
       
    80      * Checks whether page specific wallpaper feature is activated or not.
       
    81      *  
       
    82      * @since S60 5.0
       
    83      */
       
    84     TBool ActivatedL();
       
    85 
       
    86     /**
       
    87      * Shows wallpaper change dialog
       
    88      * 
       
    89      * @since S60 5.0
       
    90      */
       
    91     void SetWallpaperL();
       
    92 
       
    93     /**
       
    94      * Handles wallpaper changing in page change
       
    95      * 
       
    96      * @since S60 5.0
       
    97      * @param aOldView         Old view
       
    98      * @param aNewView         New view 
       
    99      */
       
   100     void WallpaperChanged( CXnViewData& aOldView, CXnViewData& aNewView );
       
   101    
       
   102 private: // Functions from base classes    
       
   103 
       
   104     /**
       
   105      * see CCoeControl 
       
   106      */
       
   107     void Draw(const TRect& aRect) const;  
       
   108 
       
   109     /**
       
   110      * see CCoeControl 
       
   111      */
       
   112     void SizeChanged();
       
   113 
       
   114     /**
       
   115      * see MAknsSkinChangeObserver 
       
   116      */
       
   117     void SkinContentChanged();
       
   118     
       
   119     /**
       
   120      * see MAknsSkinChangeObserver 
       
   121      */
       
   122     void SkinConfigurationChanged(
       
   123         const TAknsSkinStatusConfigurationChangeReason aReason );
       
   124     
       
   125     /**
       
   126      * see MAknsSkinChangeObserver 
       
   127      */
       
   128     void SkinPackageChanged(
       
   129         const TAknsSkinStatusPackageChangeReason aReason );
       
   130 
       
   131     /**
       
   132      * @see MCoeViewActivationObserver
       
   133      */
       
   134     void HandleViewActivation( const TVwsViewId& aNewlyActivatedViewId, 
       
   135         const TVwsViewId& aViewIdToBeDeactivated );
       
   136 
       
   137     /**
       
   138     * From MDiskNotifyHandlerCallback.
       
   139     */
       
   140     void HandleNotifyDisk( TInt aError, const TDiskEvent& aEvent );
       
   141     
       
   142 private:
       
   143     
       
   144     /**
       
   145      * C++ default constructor.
       
   146      */
       
   147     CXnBackgroundManager( CXnViewManager& aViewManager, CHspsWrapper& aWrapper );
       
   148 
       
   149     /**
       
   150      * By default Symbian 2nd phase constructor is private.
       
   151      */
       
   152     void ConstructL();
       
   153 
       
   154     void SaveWallpaperL();
       
   155     TInt SetSettingPropertyL( const TDesC8& aPluginId, const TDesC8& aItemId,
       
   156         const TDesC8& aPropertyName, const TDesC8& aPropertyValue );
       
   157     void UpdateWallpapersL();
       
   158     void CleanCache();
       
   159     void RemoveWallpaperL( CXnViewData& aViewData );
       
   160     void RemoveWallpaperFromCache( const TDesC& aFileName );
       
   161     void RemovableDiskInsertedL();
       
   162     void CheckFeatureTypeL();
       
   163     void AddPageSpecificWallpaperL( const TDesC& aFileName );
       
   164     void AddCommonWallpaperL( const TDesC& aFileName, TBool aSave = ETrue );
       
   165     void ReadWallpaperFromCenrepL();
       
   166 
       
   167 private: // data
       
   168 
       
   169     /**
       
   170      * Provides needed services
       
   171      */
       
   172     CXnViewManager& iViewManager;
       
   173     
       
   174     /** 
       
   175      * Hsps wrapper 
       
   176      */
       
   177     CHspsWrapper& iHspsWrapper;
       
   178     
       
   179     /** 
       
   180      * skin server to detect when wallpaper has changed 
       
   181      * Own.
       
   182      */
       
   183     RAknsSrvSession iSkinSrv;
       
   184 
       
   185     /**
       
   186      * File server session.
       
   187      * Own.
       
   188      */
       
   189     RFs iFsSession;
       
   190 
       
   191     /**
       
   192      * Notifier for disk drive status changes.
       
   193      * Own.
       
   194      */
       
   195     CDiskNotifyHandler* iDiskNotifier;
       
   196 
       
   197     /** 
       
   198      * Background control context. 
       
   199      * Own. 
       
   200      */    
       
   201     CAknsLayeredBackgroundControlContext* iBgContext;
       
   202     
       
   203     /** 
       
   204      * Current view rect, which is basically the whole screen.
       
   205      */        
       
   206     TRect iRect;
       
   207 
       
   208     /** 
       
   209      * States whether page specific wallpaper is supported or
       
   210      * same wallpaper is shown in all pages.
       
   211      */
       
   212     TBool iFeatureSuppoted;
       
   213 
       
   214     /** 
       
   215      * Internal wallpaper update in progress
       
   216      */
       
   217     TInt iIntUpdate;
       
   218         
       
   219     /** 
       
   220      * States whether transparent CBA and status pane is used. 
       
   221      * Homescreen uses transparency, but e.g. Widget catalog does not.
       
   222      */
       
   223     TBool iTransparencyEnabled;
       
   224 
       
   225     /** 
       
   226      * Pointer to wallpaper image. This is used only if same wallpaper 
       
   227      * is shared among all HS pages.
       
   228      * Own. 
       
   229      */   
       
   230     CFbsBitmap* iBgImage;
       
   231     
       
   232     /** 
       
   233      * Path of the wallpaper image, including filename. 
       
   234      * This is used only if same wallpaper 
       
   235      * is shared among all HS pages.
       
   236      * Own. 
       
   237      */  
       
   238     HBufC* iBgImagePath;
       
   239 
       
   240     };
       
   241 
       
   242 #endif      // CXNBACKGROUNDMANAGER_H
       
   243 
       
   244 // End of File