photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlerslideshow.h
changeset 0 4e91876724a2
child 22 2dac0fdba72b
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:    Slideshow command handler
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef C_GLXCOMMANDHANDLERSLIDESHOW_H
       
    22 #define C_GLXCOMMANDHANDLERSLIDESHOW_H
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <shwconstants.h>	// for playback direction
       
    26 #include <glxmedialistcommandhandler.h> 
       
    27 #include <mglxmedialistobserver.h> // for media list observer
       
    28 
       
    29 // Forward Declarations
       
    30 class CGlxDefaultAttributeContext;
       
    31 class MGlxMediaListProvider;
       
    32 class TGlxMedia;
       
    33 class CGlxUiUtility;
       
    34 
       
    35 /**
       
    36  * @class CGlxCommandHandlerSlideshow
       
    37  *
       
    38  * Command handler that either launches slideshow with the selected items
       
    39  * from a media list or launches the slideshow settings.
       
    40  * @internal reviewed 07/06/2007 by Kimmo Hoikka
       
    41  */
       
    42 NONSHARABLE_CLASS (CGlxCommandHandlerSlideshow) :
       
    43             public CGlxMediaListCommandHandler,
       
    44             public MGlxMediaListObserver
       
    45 	{
       
    46 public:
       
    47     /**
       
    48      * Two-phase constructor
       
    49      * @param aMediaListProvider object that provides the media list
       
    50      * @param aStepBack EFalse if the command handler should not change
       
    51      *	 the path's level. E.g. this may depend on whether the view's media 
       
    52      *   list contains media items or if it is a "list of lists"
       
    53      * @param aHasToolbarItem Whether Command Should be toolbar item (ETrue - if toolbar item)
       
    54      */
       
    55 	IMPORT_C static CGlxCommandHandlerSlideshow* NewL(
       
    56 	    MGlxMediaListProvider* aMediaListProvider, TBool aStepBack, TBool aHasToolbarItem );
       
    57 	    
       
    58 	/** Destructor */
       
    59 	IMPORT_C ~CGlxCommandHandlerSlideshow();
       
    60 	
       
    61 protected:
       
    62 
       
    63 	/** @ref CGlxMediaListCommandHandler::ActivateL */
       
    64     void DoActivateL(TInt aViewId);
       
    65 	/** @ref CGlxMediaListCommandHandler::DoExecuteL */
       
    66     TBool DoExecuteL(TInt aCommandId, MGlxMediaList& aList);
       
    67     /// @ref CGlxMediaListCommandHandler::DoIsDisabled
       
    68     TBool DoIsDisabled(TInt aCommandId, MGlxMediaList& aList) const;
       
    69     /// @ref CGlxMediaListCommandHandler::BypassFiltersForExecute
       
    70     TBool BypassFiltersForExecute() const;
       
    71     /// @ref CGlxCommandHandler::PopulateToolbar
       
    72     void PopulateToolbarL();
       
    73 private:    // From MGlxMediaListObserver
       
    74     void HandleItemAddedL(TInt aStartIndex, TInt aEndIndex,
       
    75                 MGlxMediaList* aList);
       
    76     void HandleMediaL(TInt aListIndex, MGlxMediaList* aList);
       
    77     void HandleItemRemovedL(TInt aStartIndex, TInt aEndIndex,
       
    78                 MGlxMediaList* aList);
       
    79     void HandleItemModifiedL(const RArray<TInt>& aItemIndexes,
       
    80                 MGlxMediaList* aList);
       
    81     void HandleAttributesAvailableL(TInt aItemIndex,
       
    82                 const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* aList);	
       
    83     void HandleFocusChangedL(NGlxListDefs::TFocusChangeType aType, TInt aNewIndex,
       
    84                 TInt aOldIndex, MGlxMediaList* aList);
       
    85     void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList);
       
    86     void HandleMessageL(const CMPXMessage& aMessage, MGlxMediaList* aList);
       
    87     
       
    88 private:
       
    89     /** Second phase constructor */
       
    90 	void ConstructL();
       
    91 
       
    92     /** Constructor */
       
    93 	CGlxCommandHandlerSlideshow(MGlxMediaListProvider* aMediaListProvider,
       
    94 		TBool aStepBack, TBool aHasToolbarItem );
       
    95 	
       
    96 	/** 
       
    97 	 * Helper function to activate the view with the relevant playback
       
    98 	 * direction
       
    99 	 */
       
   100 	void ActivateViewL( NShwSlideshow::TPlayDirection aPlaybackDirection );
       
   101 
       
   102 	/**
       
   103 	 * Called when the owning view is deactivated
       
   104 	 */
       
   105 	void Deactivate();	
       
   106 
       
   107     /**
       
   108      * To check whether the focused container contains any slideshow playable item.
       
   109      * @param aCommandId The Command id
       
   110      * @param aList MediaList reference
       
   111      * @return TBool ETrue if container is not slideshow playable
       
   112      */
       
   113 	TBool IsSlideshowNotPlayableOnFocusedContainer(TInt aCommandId, MGlxMediaList& aList);
       
   114 	
       
   115 	/**
       
   116 	 * To update the floating toolbar in case of non-touch
       
   117 	 */
       
   118 	void UpdateToolbar();
       
   119 	
       
   120 private:
       
   121     // ID of owning view 
       
   122     TInt iViewId;
       
   123     // Not owned - HUI utility 
       
   124     CGlxUiUtility* iUiUtility;
       
   125     /// Resource file offset
       
   126 	TInt iResourceOffset;
       
   127 	// Flag to control where in the list we should be
       
   128 	TBool iStepBack;
       
   129 	// Buffer used by the stream
       
   130 	CBufFlat* iBufFlat;
       
   131 	// Storage buffer to pass the path to the view
       
   132 	HBufC* iBuffer;
       
   133     /** Whether the command is shown in the active palette */
       
   134     TBool iShowInToolbar;
       
   135 	};
       
   136 
       
   137 #endif // C_GLXCOMMANDHANDLERSLIDESHOW_H