photosgallery/slideshow/engine/controlsrc/shweffectcontrol.h
changeset 0 4e91876724a2
child 35 420f6808bf21
equal deleted inserted replaced
-1:000000000000 0:4e91876724a2
       
     1 /*
       
     2 * Copyright (c) 2007-2008 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:    The effect control for the slideshow
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __CSHWEFFECTCONTROL_H__
       
    22 #define __CSHWEFFECTCONTROL_H__
       
    23 
       
    24 // INCLUDES
       
    25 #include <e32std.h>
       
    26 #include <e32base.h>
       
    27 
       
    28 #include <mglxvisuallistobserver.h>
       
    29 #include <mglxvisuallist.h>
       
    30 #include <glxlayoutsplitter.h>
       
    31 #include <glxsetvaluelayout.h>
       
    32 
       
    33 #include "shwevent.h"
       
    34 #include "shweventobserver.h"
       
    35 #include "shweventpublisherbase.h"
       
    36 #include "shwthumbnailloader.h"
       
    37 
       
    38 // FORWARD DECLARATIONS
       
    39 class MShwEffectManager;
       
    40 class MGlxVisualList;
       
    41 class MGlxMediaList;
       
    42 class MShwEffect;
       
    43 class CAlfVisual;
       
    44 class CShwTimer;
       
    45 
       
    46 // CLASS DECLARATION
       
    47 
       
    48 /**
       
    49  *  CShwEffectControl
       
    50  * 
       
    51  * @lib shwslideshowengine.lib
       
    52  * @internal reviewed 07/06/2007 by Loughlin
       
    53  */
       
    54 NONSHARABLE_CLASS( CShwEffectControl )
       
    55 	: public CShwEventPublisherBase, 
       
    56 	public MShwEventObserver, 
       
    57 	public MGlxVisualListObserver,
       
    58 	public MShwThumbnailLoadObserver
       
    59 	{
       
    60 	private:
       
    61 
       
    62 		/// effect control state
       
    63 		enum TShwEffectState
       
    64 			{
       
    65 			EShwEffectStateInView = 1,
       
    66 			EShwEffectStateInTransition
       
    67 			};
       
    68 
       
    69 	public: // Constructors and destructor
       
    70         
       
    71 		/**
       
    72 		 * Constructor.
       
    73 		 * @param aEffectManager the owner and manager of the effects
       
    74 		 * @param aVisualList the visual list where to apply the effects
       
    75 		 * @param aMediaList the media list which is used for item loading
       
    76 		 * @param aScreenSize the screen size for the default layout
       
    77 		 */
       
    78 		static CShwEffectControl* NewL(
       
    79 			MShwEffectManager& aEffectManager, 
       
    80 			MGlxVisualList& aVisualList,
       
    81 			MGlxMediaList& aMediaList,
       
    82 			TSize aScreenSize );
       
    83 
       
    84 		/**
       
    85 		 * Destructor.
       
    86 		 */
       
    87 		~CShwEffectControl();
       
    88 
       
    89 	private:
       
    90 
       
    91 		/**
       
    92 		 * Constructor
       
    93 		 * See NewL for parameters 
       
    94 		 */
       
    95 		CShwEffectControl(
       
    96 			MShwEffectManager& aEffectManager, 
       
    97 			MGlxVisualList& aVisualList,
       
    98 			MGlxMediaList& aMediaList,
       
    99 			TSize aScreenSize );
       
   100 
       
   101 		/**
       
   102 		 * 2nd stage constructor
       
   103 		 */
       
   104 		void ConstructL();
       
   105 		
       
   106 	public: // Callback API, dont use directly
       
   107 
       
   108 		/**
       
   109 		 * This method is called when the transition is complete
       
   110 		 * @param aEffectControl, pointer to this object
       
   111 		 */
       
   112 		TInt SendTransitionReadyL();
       
   113 		
       
   114 	public: // From MShwEventObserver
       
   115 
       
   116 		/// @ref MShwEventObserver::NotifyL
       
   117 		void NotifyL( MShwEvent* aEvent );
       
   118 
       
   119     public: // from MGlxVisualListObserver
       
   120 
       
   121 		/// @ref MGlxVisualListObserver::HandleFocusChangedL
       
   122 		void HandleFocusChangedL(
       
   123 			TInt aFocusIndex, TReal32 aItemsPerSecond, 
       
   124 			MGlxVisualList* aList, NGlxListDefs::TFocusChangeType aType );
       
   125 		/// @ref MGlxVisualListObserver::HandleSizeChanged
       
   126 		void HandleSizeChanged(
       
   127 			const TSize& aSize, MGlxVisualList* aList );
       
   128 		/// @ref MGlxVisualListObserver::HandleVisualRemoved
       
   129 		void HandleVisualRemoved(
       
   130 			const CAlfVisual* aVisual,  MGlxVisualList* aList );
       
   131 		/// @ref MGlxVisualListObserver::HandleVisualAddedL
       
   132 		void HandleVisualAddedL( 
       
   133 			CAlfVisual* aVisual, TInt aIndex, MGlxVisualList* aList );
       
   134 
       
   135 	private: // from MShwThumbnailLoadObserver
       
   136 
       
   137 		/// @ref MShwThumbnailLoadObserver::HandleThumbnailLoadedL
       
   138 		void HandleThumbnailLoadedL( TInt aIndex );
       
   139 		/// @ref MShwThumbnailLoadObserver::HandleThumbnailLoadFailureL
       
   140 		void HandleThumbnailLoadFailureL( TInt aIndex );
       
   141 		/// @ref MShwThumbnailLoadObserver::HandleMediaListEmpty
       
   142         void HandleMediaListEmpty();
       
   143 
       
   144 	private: // Implementation
       
   145 
       
   146 		/**
       
   147 		 * Prepare view for given effect for focus index
       
   148 		 * and load the thumbnail in correct size
       
   149 		 * @param aEffect the effect
       
   150 		 */
       
   151         void PrepareAndLoadImageToViewL();
       
   152 
       
   153 		/**
       
   154 		 * StartView event handler
       
   155 		 * @param the start view event
       
   156 		 */
       
   157 		void HandleStartViewEventL( TShwEventStartView& aEvent );
       
   158 		
       
   159 		/**
       
   160 		 * StartTransition event handler
       
   161 		 * @param the start transition event
       
   162 		 */
       
   163 		void HandleStartTransitionEventL( TShwEventStartTransition& aEvent );
       
   164 
       
   165 		/**
       
   166 		 * Pause event handler
       
   167 		 */
       
   168 		void HandlePauseEventL();
       
   169 
       
   170 		/**
       
   171 		 * Resume event handler
       
   172 		 */
       
   173 		void HandleResumeEventL();
       
   174 
       
   175 		/**
       
   176 		 * Next item event handler
       
   177 		 */
       
   178 		void HandleNextImageEventL();		
       
   179 
       
   180 		/**
       
   181 		 * Previous item event handler
       
   182 		 */
       
   183 		void HandlePreviousImageEventL();
       
   184 		
       
   185 		/**
       
   186          * Toogle Control Ui event handler
       
   187          */
       
   188 		void HandleToggleControlUiEventL();
       
   189 		/**
       
   190 		 * Navigates the list and effects to given direction
       
   191 		 * @param the direction
       
   192 		 */
       
   193 		void NavigateListL( TInt aDirection );
       
   194 
       
   195 		/**
       
   196 		 * Returns the next index to the left or right
       
   197 		 * @param the direction
       
   198 		 * @return the next index in the visual list
       
   199 		 */
       
   200 		TInt NextListIndex( TInt aDirection );
       
   201 
       
   202 	private:	// Implementation
       
   203 
       
   204 		/// Ref: the effect manager
       
   205 		MShwEffectManager& iEffectManager;
       
   206 		/// Ref: the visual list
       
   207 		MGlxVisualList& iVisualList;
       
   208 		/// Ref: the media list
       
   209 		MGlxMediaList& iMediaList;
       
   210 
       
   211 		/// Own: the timer
       
   212 		CShwTimer* iTransitionTimer;
       
   213 		/// Own: the layout splitter
       
   214 		TGlxLayoutSplitter iSplitter;
       
   215         /// Own: the default size layout
       
   216 		TGlxSetValueLayout iDefaultIconLayout; 
       
   217         /// Own: the default opacity layout
       
   218 		TGlxSetValueLayout iPausedLayout;
       
   219         /// Own: the default layout when a visual is not visible
       
   220 		TGlxSetValueLayout iNotVisibleLayout;
       
   221 		/// Own: state flag to know if loop is started
       
   222 		TBool iEffectLoopRestarted;
       
   223 		/// Own: the context id
       
   224 		TGlxViewContextId iContextId;
       
   225 		/// Own: the thumbnail loader
       
   226 		CShwThumbnailLoader* iThumbnailLoader;
       
   227 		/// Ref: the previous effect (fading out)
       
   228 		MShwEffect* iPreviousEffect;
       
   229 		/// Ref: the current visual (shown in view)
       
   230 		CAlfVisual* iCurrentVisual;
       
   231 		/// Ref: the previous visual (fading out)
       
   232 		CAlfVisual* iPreviousVisual;
       
   233 		/// Own: current state
       
   234 		TShwEffectState iState;
       
   235 		/// Own: current view duration
       
   236 		TInt iViewDuration;
       
   237 		/// Own: flag to tell if user navigated during pause
       
   238 		TBool iUserNavigated;
       
   239 		RPointerArray<CAlfVisual> iPausedVisuals;
       
   240 		
       
   241 		TInt iFailedThumbnailIndex;
       
   242 
       
   243 	};
       
   244 
       
   245 #endif // __CSHWEFFECTCONTROL_H__