photosgallery/viewframework/views/fullscreenview/inc/glxfullscreenviewimp.h
changeset 0 4e91876724a2
child 1 9ba538e329bd
equal deleted inserted replaced
-1:000000000000 0:4e91876724a2
       
     1 /*
       
     2 * Copyright (c) 2008-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 "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:    Implementation of Fullscreen view
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef C_CGLXFULLSCREENIMP_C
       
    19 #define C_CGLXFULLSCREENIMP_C
       
    20 
       
    21 #include <alf/ialfwidgeteventhandler.h>
       
    22 #include <mglxuicommandhandler.h>
       
    23 #include <gesturehelper.h>
       
    24 #include <gestureobserver.h>
       
    25 
       
    26 #include "glxfullscreenview.h"
       
    27 #include "glxfullscreenbindingsetfactory.h"
       
    28 #include "glxfullscreenview.hrh"
       
    29 
       
    30 //Gesture Helper namespace 
       
    31 namespace GestureHelper
       
    32     {
       
    33     class CGestureHelper;
       
    34     }
       
    35 
       
    36 // FORWARD DECLARATIONS
       
    37 class CAlfEnv;
       
    38 class CGlxMediaListMulModelProvider;
       
    39 class TGlxMulFullScreenBindingSetFactory;
       
    40 class CEikButtonGroupContainer;
       
    41 class CGlxActiveMediaListRegistry;
       
    42 class CGlxZoomControl;
       
    43 class CGlxSinleLineMetaPane;
       
    44 class CGlxCommandHandlerAiwShowMapHardKey;
       
    45 class CGlxDRMUtility;
       
    46 class CGlxHdmiController;
       
    47 class CGestureHelper;
       
    48 //class CHgContextUtility;
       
    49 
       
    50 namespace Alf
       
    51 	{
       
    52    class IMulCoverFlowWidget;
       
    53    class IMulModel;
       
    54    class IMulSliderWidget;
       
    55    class IMulSliderModel;
       
    56 	}
       
    57 /*
       
    58  Defines the state of the Ui in fullscreen
       
    59  */	
       
    60 namespace NGlxNFullScreenUIState
       
    61     {
       
    62     enum TUiState
       
    63         {
       
    64          EUiOn,EUiOff
       
    65         };
       
    66     }
       
    67 /*
       
    68  Defines the swipe direction
       
    69  */ 
       
    70 enum TSwipe
       
    71     {
       
    72         EForward,EBackward
       
    73     };
       
    74     
       
    75 NONSHARABLE_CLASS (CGlxFullScreenViewImp): public CGlxFullScreenView, 
       
    76                                             public IAlfWidgetEventHandler,
       
    77  											public MGlxUiCommandHandler
       
    78     {
       
    79 public:    
       
    80     /**
       
    81     * Two-phased constructor.`
       
    82     *
       
    83     * @return Pointer to newly created object.
       
    84     */
       
    85     static CGlxFullScreenViewImp* NewL(MGlxMediaListFactory* aMediaListFactory,
       
    86                                  const TFullScreenViewResourceIds& aResourceIds,
       
    87                                  TInt aViewUID,
       
    88                                  const TDesC& aTitle);
       
    89 
       
    90     /**
       
    91     * Two-phased constructor.
       
    92     *
       
    93     * @return Pointer to newly created object.
       
    94     */
       
    95     static CGlxFullScreenViewImp* NewLC(MGlxMediaListFactory* aMediaListFactory,
       
    96             const TFullScreenViewResourceIds& aResourceIds,TInt aViewUID, const TDesC& aTitle);
       
    97     
       
    98     /**
       
    99      * Destructor.
       
   100      */
       
   101     virtual ~CGlxFullScreenViewImp();
       
   102 
       
   103 public:// CGlxViewBase
       
   104     virtual TBool HandleViewCommandL(TInt aCommand);
       
   105 
       
   106     void HandleCommandL(TInt aCommandId, CAlfControl* aControl) ;
       
   107 
       
   108     void HandleResourceChangeL (TInt aType);   
       
   109 
       
   110 public:// CAknView
       
   111     void HandleForegroundEventL(TBool aForeground);
       
   112 
       
   113     TUid Id() const;
       
   114 
       
   115     void DoMLViewActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId,
       
   116         const TDesC8& aCustomMessage);
       
   117     void DoMLViewDeactivate();
       
   118     
       
   119       //Shows the exipry note/dialog for expired DRM files
       
   120       void ShowDrmExpiaryNoteL();
       
   121       
       
   122 	  // Callback for periodic timer, static, 
       
   123 	  static TInt PeriodicCallback( TAny* aPtr );
       
   124 	  //nonstatic func called from periodic timer
       
   125 	  void CallPeriodicCallback();
       
   126 public:
       
   127     //From IAlfWidgetEventHandler
       
   128     bool accept( CAlfWidgetControl& aControl, const TAlfEvent& aEvent ) const;
       
   129     
       
   130     AlfEventStatus offerEvent( CAlfWidgetControl& aControl, const TAlfEvent& aEvent );
       
   131     
       
   132     void setEventHandlerData( const AlfWidgetEventHandlerInitData& aData );
       
   133     
       
   134     AlfWidgetEventHandlerInitData* eventHandlerData();
       
   135     
       
   136     void setActiveStates( unsigned int aStates );
       
   137     
       
   138     IAlfInterfaceBase* makeInterface( const IfId& aType );
       
   139     
       
   140     AlfEventHandlerType eventHandlerType() ;
       
   141 
       
   142     AlfEventHandlerExecutionPhase eventExecutionPhase() ;
       
   143 
       
   144 private:
       
   145     /*
       
   146      * Constructor 
       
   147      */
       
   148     CGlxFullScreenViewImp(const TFullScreenViewResourceIds& aResourceIds,TInt aViewUID);
       
   149 
       
   150     /*
       
   151      * By default Symbian 2nd phase constructor is private.
       
   152      */
       
   153     void ConstructL(MGlxMediaListFactory* aMediaListFactory,const TDesC& aTitle );
       
   154     
       
   155     /*
       
   156      *  Creates a coverflow widget
       
   157      */
       
   158     void CreateCoverflowWidgetL();
       
   159     
       
   160     /*
       
   161      *  Destroys Widgets, Coverflow and also calls DestroySliderWidget()
       
   162      */
       
   163      void DestroyWidgets();
       
   164      
       
   165     /*
       
   166      *  Destroys Slider widget
       
   167      */
       
   168      void DestroySliderWidget();
       
   169      
       
   170     /*
       
   171      * Activate zoomcontrol
       
   172      * @param:aTap: specifies whether zoom control is launched by tapping or by pressing volume keys
       
   173      */
       
   174     void ActivateZoomControlL(TZoomStartMode aStartMode, TPoint* aZoomFocus = NULL); 
       
   175     
       
   176     /*
       
   177      * DeActivate zoomcontrol
       
   178      */
       
   179     void DeactivateZoomControlL();
       
   180     
       
   181     /*
       
   182      * DeactivateFullScreen
       
   183      */
       
   184     void DeactivateFullScreen();
       
   185     
       
   186     /*
       
   187      * ActivateFullScreen
       
   188      */
       
   189     void ActivateFullScreenL();
       
   190     
       
   191     /*
       
   192     * Trun the UI on
       
   193     * @param aStartTimer:Incase of starting the zoom :we shouldn't be starting the timer.
       
   194     * else we  need to start the Ui timer to hide the screen furniture
       
   195     * so for the rest of the cases we need to have  aStartTimer = ETrue
       
   196     */
       
   197     void ShowUiL(TBool aStartTimer);
       
   198     
       
   199     /*
       
   200     * Hide the UI off
       
   201     * @param asliderstatus:When we start zooming using the slider widget,for continous zooming from the 
       
   202     * fullscreen view to zoom control, we need to have the slider visible so in this case we shouldnt 
       
   203     * be hiding the slider so pass EFalse,else case asliderstatus = ETrue
       
   204     */     
       
   205     void HideUi(TBool aSliderStatus);
       
   206     
       
   207     /*
       
   208     * Sets the UI state
       
   209     */     
       
   210     void SetUiSate (NGlxNFullScreenUIState::TUiState  aState);
       
   211     
       
   212     /*
       
   213     * returns the Ui state
       
   214     */     
       
   215     NGlxNFullScreenUIState::TUiState GetUiSate();
       
   216     
       
   217     /*
       
   218     * returns the Ui state
       
   219     */     
       
   220     void CreateScreenFurnitureL();
       
   221     
       
   222     /*
       
   223     * Call back function for the CPeriodic
       
   224     */
       
   225     static TInt TimeOut(TAny* aSelf);
       
   226       
       
   227     /*
       
   228     * Calculates and returns the Initial Zoom factor
       
   229     */		
       
   230     TInt GetIntialZoomLevel();
       
   231     
       
   232     /*
       
   233     * Calls GetIntialZoomLevel() to get the Zoom Level and Sets the Value to the
       
   234     * Slider Level
       
   235     */
       
   236     void SetSliderLevel();
       
   237     
       
   238     /*
       
   239     * Creates and Initializes the slider model/widget
       
   240     */
       
   241     void CreateSliderWidgetL();
       
   242     
       
   243     /**
       
   244      * This function doesnt add any value, added to remove codescanner warnings
       
   245      */
       
   246     AlfEventStatus OfferEventL(const TAlfEvent& aEvent);
       
   247     /**
       
   248      * returns the swipe direction of coverflow
       
   249      */
       
   250     TSwipe GetSwipeDirection();
       
   251     /**
       
   252      * returns the index of item for which texture can be removed for cleanup
       
   253      * The index will be out the iterator offsets w.r.t focssed index.
       
   254      */
       
   255     TInt GetIndexToBeRemoved();
       
   256     /**
       
   257      * Remove the fullscreen texture.
       
   258      */
       
   259     void RemoveTexture();
       
   260 
       
   261 private:
       
   262     /** Softkey resource id's */
       
   263     TFullScreenViewResourceIds iResourceIds; 
       
   264     // /** Avkon unique ViewId */ 
       
   265     TInt iViewUid;
       
   266 
       
   267     /** Alf environment (not owned) */
       
   268     CAlfEnv* iEnv;
       
   269 
       
   270     /// Active media list registry stores the pointer to the active media list
       
   271     /// Allows UPnP to know when list has changed
       
   272     CGlxActiveMediaListRegistry* iActiveMediaListRegistry;
       
   273 
       
   274     /** Data Provider */
       
   275     CGlxMediaListMulModelProvider* iMediaListMulModelProvider;
       
   276     TGlxMulFullScreenBindingSetFactory iFullScreenBindingSet;
       
   277 
       
   278     //creating instance of viewWidget
       
   279     IAlfViewWidget* iViewWidget;
       
   280     
       
   281     /** The 2D Coverflow Widget ( owned )*/
       
   282     IMulCoverFlowWidget* iCoverFlowWidget;
       
   283     IMulSliderWidget*   iSliderWidget;
       
   284     IMulSliderModel*    iSliderModel;
       
   285 
       
   286     //creating zoomcontrol
       
   287     CGlxZoomControl* iZoomControl;
       
   288     
       
   289     // Holds the state of the Ui in Fullscreen
       
   290     NGlxNFullScreenUIState::TUiState iUiState;
       
   291 
       
   292     // used to turn the Ui off,if the screen is inactive for 10 sec
       
   293     CPeriodic* iTimer;
       
   294     CEikButtonGroupContainer* iZoomButtonGroup;
       
   295 	CGlxCommandHandlerAiwShowMapHardKey* iShowOnMapHardKeyhandler;
       
   296     
       
   297     CGlxScreenFurniture* iScreenFurniture;
       
   298     //CGlxSinleLineMetaPane* iSingleLineMetaPane;
       
   299 //    CHgContextUtility* iContextUtility;
       
   300     CGlxHdmiController* iHdmiController;
       
   301 	    
       
   302     CGlxDRMUtility* iDrmUtility;
       
   303     CPeriodic* iPeriodic;
       
   304 	
       
   305     GestureHelper::CGestureHelper* iGestureHelper;
       
   306     TBool   iMultiTouchGestureOngoing   ;
       
   307     
       
   308     // stores the initial zoom percentage
       
   309     TInt iInitialZoomRatio ;
       
   310     //Previous focused index
       
   311     TInt iOldFocusIndex;
       
   312 
       
   313     };
       
   314 
       
   315 #endif
       
   316