gssettingsuis/Gs/GSFramework/inc/GSShimmedView.h
branchRCL_3
changeset 24 8ee96d21d9bf
parent 23 8bda91a87a00
child 25 7e0eff37aedb
equal deleted inserted replaced
23:8bda91a87a00 24:8ee96d21d9bf
     1 /*
       
     2 * Copyright (c) 2002-2006 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:  Shim view
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef GSSHIMMEDVIEW_H
       
    20 #define GSSHIMMEDVIEW_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <vwsdef.h>
       
    25 #include <coeview.h>
       
    26 
       
    27 // CONSTANTS
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class CGSPluginAndViewIdCache;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 
       
    34 /**
       
    35 *  CGSShimmedView is used by CGSPluginAndViewIdCache to provide view-framework
       
    36 *  with all existing plugin views immediately in GS start-up. Shimmed views
       
    37 *  are used to cache actual views: in case GS view is opened outside GS
       
    38 *  application while GS is not running in the background, view-framework needs
       
    39 *  the requested view to exist immediately after GS start-up. This is a problem
       
    40 *  as GS loads plugins asynchronously after GS start-up. Therefore we provide
       
    41 *  view-framework with shimmed views in the GS start-up instead of the actual
       
    42 *  views. Afterwards, when each plugin is loaded, we replace the shimmed view
       
    43 *  representing the plugin with a real view provided by the loaded plugin.
       
    44 *  (Each plugin is normally also a view).
       
    45 *
       
    46 *  Shimmed views are only used and needed for enabling external GS plugin
       
    47 *  view launch.
       
    48 *
       
    49 *  See CGSPluginAndViewIdCache for details.
       
    50 *
       
    51 *  @since Series60_3.1
       
    52 *
       
    53 */
       
    54 class CGSShimmedView : public CActive, public MCoeView
       
    55     {
       
    56     public: // Constructor and destructor
       
    57 
       
    58         /**
       
    59         *
       
    60         */
       
    61         static CGSShimmedView* NewLC( TUid aViewId, CGSPluginAndViewIdCache& aCache, CCoeAppUi& aAppUi );
       
    62 
       
    63         /**
       
    64         * Destructor.
       
    65         */
       
    66         ~CGSShimmedView();
       
    67 
       
    68     private:
       
    69 
       
    70         /**
       
    71         * C++ constructor
       
    72         */
       
    73         CGSShimmedView( TUid aViewId, CGSPluginAndViewIdCache& aCache, CCoeAppUi& aAppUi );
       
    74 
       
    75         /**
       
    76         * Second phase constructor
       
    77         */
       
    78         void ConstructL();
       
    79 
       
    80     public: // API
       
    81 
       
    82         /**
       
    83         *
       
    84         */
       
    85         void RegisterViewL();
       
    86 
       
    87         /**
       
    88         *
       
    89         */
       
    90         void DeregisterView();
       
    91 
       
    92     public: // From MCoeView
       
    93 	    TVwsViewId ViewId() const;
       
    94 	    void ViewActivatedL( const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage );
       
    95 	    void ViewDeactivated();
       
    96 
       
    97     private: // State
       
    98         enum TState
       
    99             {
       
   100             EStateInactive = 0,
       
   101             EStateActivatingPlaceholderView,
       
   102             EStateLoadingPlugin,
       
   103             EStateDeletingSelf
       
   104             };
       
   105 
       
   106         void SetState( TState aState, TBool aCompleteRequest = ETrue );
       
   107         void StateActivatePlaceholderViewL();
       
   108         void StateLoadPluginL();
       
   109 
       
   110     private: // From CActive
       
   111         void RunL();
       
   112         void DoCancel();
       
   113 
       
   114     private: // Data
       
   115         TUid iViewId;
       
   116         CGSPluginAndViewIdCache& iCache;
       
   117         CCoeAppUi& iAppUi;
       
   118         TState iState;
       
   119         TBool iIsRegistered;
       
   120         HBufC8* iCustomMessage;
       
   121         TUid iCustomMessageId;
       
   122     };
       
   123 
       
   124 
       
   125 #endif // GSSHIMMEDVIEW_H
       
   126 // End of File