idlehomescreen/exths/inc/plugincontainer/caiplugincontainercontrol.h
changeset 0 f72a12da539e
equal deleted inserted replaced
-1:000000000000 0:f72a12da539e
       
     1 /*
       
     2 * Copyright (c) 2002 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: 
       
    15 *       It is the control container for the AI plugins
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef CAIPLUGINCONTROL_H
       
    21 #define CAIPLUGINCONTROL_H
       
    22 
       
    23 #include <e32base.h>
       
    24 #include <cenrepnotifyhandler.h>
       
    25 
       
    26 #include <babackup.h>
       
    27 
       
    28 #include "extrstandbycontainerif.h"
       
    29 
       
    30 #include "ExtrStandbyScr.h"
       
    31 
       
    32 #include "propertyobserver.h"
       
    33 
       
    34 enum TAIPluginAlignment
       
    35     {
       
    36     EAITop = 1,
       
    37     EAIBottom
       
    38     };
       
    39 
       
    40 // Background layers
       
    41 enum TIdleBgLayers
       
    42     {
       
    43     EAIBgLayerBackground     = 0,
       
    44     EAIBgLayerWallpaper      = 1,
       
    45     EAIBgLayersN             = 2
       
    46     };
       
    47 
       
    48 enum TAIPluginState
       
    49     {
       
    50     EAIPluginOff = 0,
       
    51     EAIPluginOn,
       
    52     EAIPluginError
       
    53     };
       
    54 
       
    55 // Structure containing plugin information
       
    56 struct TPluginInfo
       
    57     {
       
    58     CExtrStandbyScr*        iPlugin;
       
    59     TBool                   iResizeable ;
       
    60     TBool                   iOnScreen ;
       
    61     TUid                    iPluginId;
       
    62     TAIPluginAlignment      iAlignment;
       
    63     TAIPluginState          iState;
       
    64     TInt                    iWeight;
       
    65     TInt32                  iCRKeyId;
       
    66     };
       
    67 
       
    68 class CAknsLayeredBackgroundControlContext;
       
    69 
       
    70 // CLASS DECLARATION
       
    71 /**
       
    72 *  It is the control for the Active Idle.
       
    73 *
       
    74 *  @since 2.6
       
    75 */
       
    76 NONSHARABLE_CLASS(CAIPluginContainerControl) :
       
    77     public CExtrStandbyContainerIF,
       
    78     public MCoeControlObserver,
       
    79     public MCenRepNotifyHandlerCallback,
       
    80     public MPropertyChangeHandler
       
    81     {
       
    82     public: // Constructors and destructor
       
    83 
       
    84         /**
       
    85         * Two-phased constructor.
       
    86         * @param aViewId View identifier.
       
    87         * @param aContainer Container object.
       
    88         * @return Pointer to the CAIPluginContainerControl object.
       
    89         */
       
    90         static CAIPluginContainerControl* NewL(CCoeControl *aContainer) ;
       
    91         /**
       
    92         * Destructor.
       
    93         */
       
    94         ~CAIPluginContainerControl();
       
    95 
       
    96     public: // From CCoeControl
       
    97 
       
    98         /**
       
    99         * From CCoeControl, returns the amount of component controls.
       
   100         * @return amount of component controls.
       
   101         */
       
   102         TInt CountComponentControls() const;
       
   103 
       
   104         /**
       
   105         * From CCoeControl, returns a control by index.
       
   106         * @param aIndex Index of the control.
       
   107         * @return Control by index.
       
   108         */
       
   109         CCoeControl* ComponentControl( TInt aIndex ) const;
       
   110 
       
   111         /**
       
   112         * From CCoeControl, informs that the size is changed to update the
       
   113         * sizes of component controls appropriately.
       
   114         */
       
   115         void SizeChanged();
       
   116 
       
   117         /**
       
   118         * From CCoeControl, informs that the focus is changed
       
   119         */
       
   120         void FocusChanged(TDrawNow aDrawNow);
       
   121 
       
   122         /**
       
   123         * From CCoeControl, draws the contents of the view.
       
   124         * @param aRect Area to be redrawn.
       
   125         */
       
   126         void Draw( const TRect& aRect ) const;
       
   127 
       
   128         /**
       
   129         * From CCoeControl, offers a key event to the view.
       
   130         * @param  aKeyEvent Information about the key event.
       
   131         * @param  aType Type of the event.
       
   132         * @return Information which indicates whether the keypress
       
   133         *           was processed or not.
       
   134         */
       
   135         TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
       
   136             TEventCode aType );
       
   137 
       
   138         /**
       
   139         * From CCoeControl : Notifier for resourse changing
       
   140         * @param aType : Type of resource change
       
   141         */
       
   142         void HandleResourceChange( TInt aType );
       
   143 
       
   144         /**
       
   145         * From CCoeControl : Sets all the plugins dimmed. When dimmed the plugin must not draw anythings
       
   146         * @param aDimmed
       
   147         */
       
   148         void SetDimmed(TBool aDimmed);
       
   149 
       
   150 
       
   151         /**
       
   152         * From CCoeControl
       
   153         * @param TTypeUid aId
       
   154         */
       
   155         TTypeUid::Ptr CAIPluginContainerControl::MopSupplyObject(TTypeUid aId);
       
   156 
       
   157     public: // from CExtrStandbyContainerIF
       
   158 
       
   159         /**
       
   160         * Start loading plugin
       
   161         */
       
   162         void StartL();
       
   163         /**
       
   164         * Sets mode for External Homescreen (Full screen or normal)
       
   165         */
       
   166         void SetFullScreenMode(TBool aFullScreenMode);
       
   167 
       
   168     public: // from MCoeControlObserver
       
   169 
       
   170         void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
       
   171 
       
   172     public: // From PropertyObserver
       
   173         /**
       
   174          * Called when a backup or restore operation either starts or ends.
       
   175          * @param aBackupOperationAttributes Operation attributes
       
   176          */
       
   177         void HandlePropertyChange(const TUid& aCategory, const TUint& aKey, const TInt& aValue);
       
   178 
       
   179     protected:  // From MCenRepNotifyHandlerCallback
       
   180 
       
   181         void HandleNotifyGeneric(TUint32 aId);
       
   182 
       
   183     private:
       
   184 
       
   185         /**
       
   186         * C++ constructor.
       
   187         */
       
   188         CAIPluginContainerControl();
       
   189 
       
   190         /**
       
   191         * Symbian OS constructor.
       
   192         */
       
   193         void ConstructL(CCoeControl* aContainer);
       
   194 
       
   195 
       
   196         /**
       
   197         * change the plugin focus
       
   198         */
       
   199         void ChangeFocusPluginL( TInt aDirection );
       
   200 
       
   201         /**
       
   202         * focus on the default focusing plugin
       
   203         */
       
   204         void FocusOnDefaultFocusingPlugin(TDrawNow aDrawNow=ENoDrawNow);
       
   205 
       
   206         /**
       
   207         * Calculate the rect for each plugin and draw
       
   208         */
       
   209         void CalculateRectPlugins();
       
   210 
       
   211         /**
       
   212         * Handle the Top Plugin
       
   213         */
       
   214         void HandleTopPlugins(TInt& aTopPluginX, TInt& aBottomPluginX);
       
   215 
       
   216         /**
       
   217         * Handle the bottom Plugin
       
   218         */
       
   219         void HandleBottomPlugins(TInt& aTopPluginX, TInt& aBottomPluginX);
       
   220 
       
   221         /**
       
   222         * Calculate the rect for a plugin (top or bottom allignment)
       
   223         */
       
   224         void HandlePlugin(TInt aIndex,
       
   225                           TAIPluginAlignment aAlign,
       
   226                           TInt& aTopPluginX,
       
   227                           TInt& aBottomPluginX);
       
   228 
       
   229         /**
       
   230         * Return the next visible plugin with content
       
   231         */
       
   232         TInt NextVisiblePlugin(TInt aStartIndex);
       
   233 
       
   234         /**
       
   235         * Return the previous visible plugin with content
       
   236         */
       
   237         TInt PreviousVisiblePlugin(TInt aStartIndex);
       
   238 
       
   239         /**
       
   240         * Return the index of the reduceable plugin with the lower weight
       
   241         */
       
   242         TInt FindReduceablePlugin(TInt aOverRunHeight, TInt aCurrentIndex);
       
   243 
       
   244         /**
       
   245         * Return the index of the plugin with the lower weight
       
   246         */
       
   247         TInt FindLowerWeightPlugin(TInt aCurrentIndex);
       
   248 
       
   249         /**
       
   250         * Reduce the plugin and move the others plugin till the current
       
   251         */
       
   252         void ReducePlugin(TInt aPluginToBeReducedIndex,TInt aCurrentIndex,TInt aReduceHeight);
       
   253 
       
   254         /**
       
   255         * Hide the plugin
       
   256         */
       
   257         void HidePlugin(TInt aPluginIndex);
       
   258 
       
   259         /**
       
   260         * Read Plugin Configuration
       
   261         */
       
   262         void ReadPluginsConfigurationsL();
       
   263 
       
   264         /**
       
   265         * Load all the plugins
       
   266         */
       
   267         void LoadPluginsL();
       
   268 
       
   269         /**
       
   270         * Load a specific plugin
       
   271         */
       
   272         void LoadPluginL(TInt aIndex);
       
   273 
       
   274         /**
       
   275         * Destroy all the plugins
       
   276         */
       
   277         void DestroyPlugins();
       
   278 
       
   279         /**
       
   280         * Resets plugin state to default one
       
   281         */
       
   282         void ResetToDefault( TPluginInfo& aPluginInfo );
       
   283 
       
   284         /*
       
   285         * Checks in which mode AI1 will be executed
       
   286         * fullscreen or normal
       
   287         * @since S60 3.2
       
   288         * @return TBool
       
   289         */
       
   290         TBool IsInFullScreenModeL();
       
   291 
       
   292         /*
       
   293         * updates background bitmap
       
   294         * @since S60 3.2
       
   295         * @return void
       
   296         */
       
   297         void UpdateBackgroundL();
       
   298 
       
   299     private:    // Data
       
   300 
       
   301         // Current plugin Index
       
   302         TInt            iIndexPlugin;
       
   303 
       
   304         // Default focusing plugin Index
       
   305         TInt            iIndexDefaultFocusingPlugin;
       
   306 
       
   307         // Contains array of plugin loaded.
       
   308         RPointerArray<TPluginInfo> iPlugins;
       
   309 
       
   310         // Current plugin info
       
   311         TPluginInfo*    iCurrentPlugin ;
       
   312 
       
   313         // Container
       
   314         CCoeControl*    iContainer; //not own
       
   315 
       
   316         //Flag for a status change notification.
       
   317         // This flag is used only if the notification come when the component is dimmed
       
   318         TBool           iContentStatusChangedNotification ;
       
   319 
       
   320         // Previous rect of the AI container
       
   321         TRect           iPrevRect;
       
   322 
       
   323         CRepository*            iAIRepository;
       
   324         CCenRepNotifyHandler*   iNotifyHandler;
       
   325 
       
   326         // ?one_line_short_description_of_data
       
   327         CPropertyObserver* iBackupObserver;
       
   328 
       
   329         // Background context.
       
   330         CAknsLayeredBackgroundControlContext* iBgContext;
       
   331 
       
   332         // Current AI mode, fullscreen - ETrue / normal - EFalse
       
   333         TBool iIsFullScreenMode;
       
   334 
       
   335         // Flag for checking if FW already started
       
   336         TBool iStarted;
       
   337    };
       
   338 
       
   339 #endif      // CAIPLUGINCONTROL_H
       
   340 
       
   341 // End of File