photosgallery/viewframework/views/viewbase/inc/glxmedialistviewbase.h
changeset 0 4e91876724a2
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:    Media List View Base
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef C_GLXMEDIALISTVIEW_H
       
    22 #define C_GLXMEDIALISTVIEW_H
       
    23 
       
    24 #include "glxtoolbarcontroller.h"
       
    25 #include "glxmskcontroller.h"
       
    26 #include "glxviewbase.h"
       
    27 #include "mglxmedialistprovider.h"
       
    28 #include "mglxtitlefetcherobserver.h"
       
    29 #include <glxmedialistiterator.h>
       
    30 
       
    31 class MGlxMediaListFactory;
       
    32 class MMPXCollectionUtility;
       
    33 class CGlxTitleFetcher;
       
    34 class CGlxAttributeContext;
       
    35 
       
    36 /**
       
    37  * Struct to hold resource ids
       
    38  * 
       
    39  */
       
    40 struct TViewWidgetIds
       
    41 	{	
       
    42 	//Instance Id for the View Widget
       
    43 	const char* iViewWidgetId;
       
    44 	//Instance Id for the Widget	
       
    45 	const char* iWidgetId;
       
    46 	// Control Group Id for View Widget
       
    47 	TInt iControlGroup;
       
    48 	};
       
    49 
       
    50 /**
       
    51  * Media Liost View Base
       
    52  */
       
    53 class CGlxMediaListViewBase : public CGlxViewBase, 
       
    54                               public MGlxMediaListProvider,
       
    55                               public MGlxTitleFetcherObserver
       
    56 
       
    57 	{
       
    58 public:
       
    59 	/**
       
    60 	 * Constructor
       
    61 	 */
       
    62 	IMPORT_C CGlxMediaListViewBase();
       
    63 	
       
    64 	/**
       
    65 	 * Destructor
       
    66 	 */
       
    67 	IMPORT_C virtual ~CGlxMediaListViewBase();
       
    68 	
       
    69 public: // From MGlxMediaListProvider
       
    70 	IMPORT_C virtual MGlxMediaList& MediaList();
       
    71 
       
    72 
       
    73     // From MGlxTitleFetcherObserver
       
    74     IMPORT_C void HandleTitleAvailableL(const TDesC& aTitle);
       
    75 
       
    76 
       
    77 
       
    78 protected:
       
    79 	/**
       
    80 	 * This will be called on derived classes when the view is activated
       
    81      * @param aPrevViewId Specifies the view previously active.
       
    82      * @param aCustomMessageId Specifies the message type.
       
    83      * @param aCustomMessage The activation message.
       
    84 	 */
       
    85 	virtual void DoMLViewActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage) = 0;
       
    86 
       
    87 	/**
       
    88 	 * This will be called on derived classes when the view is deactivated
       
    89 	 */
       
    90     virtual void DoMLViewDeactivate() = 0;
       
    91     
       
    92 	/**
       
    93 	 * Derived classes should use this to deal with any view-specific commands
       
    94 	 * @param aCommand The command to respond to
       
    95 	 * @return ETrue iff the command has been handled.
       
    96 	 */
       
    97 	IMPORT_C virtual TBool HandleViewCommandL(TInt aCommand);
       
    98 
       
    99     /**
       
   100      * Handles commands
       
   101 	 * @param aCommand The command to respond to
       
   102 	 * @return ETrue iff the command has been handled.
       
   103      */
       
   104      
       
   105     IMPORT_C virtual TInt DoHandleCommandL(TInt aCommand);
       
   106 
       
   107 protected:
       
   108 	/**
       
   109 	 * Media List View Base Constructor
       
   110      * @param aMediaListFactory A media list provider.
       
   111      * @param aTitle If specified, title to be displayed instead of that from media list
       
   112      * @param aCustomMessage The activation message.
       
   113      * @param aEnableMiddleSoftkey MSK Enabler
       
   114 	 */
       
   115 	IMPORT_C void MLViewBaseConstructL(
       
   116 	                 MGlxMediaListFactory* aMediaListFactory,
       
   117 	                 const TDesC& aTitle = KNullDesC(),TBool aEnableMiddleSoftkey = ETrue );
       
   118 	
       
   119 private: // From CGlxViewBase
       
   120 	IMPORT_C virtual void DoViewActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage);
       
   121     IMPORT_C virtual void DoViewDeactivate();
       
   122 
       
   123     /**
       
   124      * See @ref CGlxViewBase::FetchAttributesL()
       
   125      */
       
   126     IMPORT_C virtual void FetchAttributesL();
       
   127     
       
   128     /**
       
   129      * See @ref CGlxViewBase::FetchAttributesForCommandL()
       
   130      */
       
   131     IMPORT_C virtual void FetchAttributesForCommandL(TInt aCommand);
       
   132     
       
   133     /**
       
   134      * See @ref CGlxViewBase::SetToolbarStateL()
       
   135      */
       
   136     IMPORT_C void SetToolbarStateL();
       
   137     
       
   138 protected: // from CGlxViewBase
       
   139 	/**
       
   140 	 * See @ref CGlxViewBase::DoPrepareCommandHandlerL
       
   141 	 */
       
   142 	IMPORT_C void DoPrepareCommandHandlerL(CGlxCommandHandler* aCommandHandler);
       
   143 	
       
   144 
       
   145 private:
       
   146 	/**
       
   147 	 * Removes the attribute context (iPreloadContextForCommandHandlers) 
       
   148 	 * from the media list and closes the media list.
       
   149 	 */
       
   150 	void CloseMediaList();
       
   151 	
       
   152 	/**
       
   153 	 * Helper method to add attributes to an attribute context.
       
   154 	 * @param aAttributeContext context to add attributes to.
       
   155 	 * @param aCommandHandler command handler to request attributes from.
       
   156 	 * @param aFilterUsingSelection If ETrue, only attributes relevant
       
   157 	 * to the current selection will be appended.
       
   158 	 * @param aFilterUsingCommandId If ETrue, only attributes relevant
       
   159 	 * to the command id specified by aCommandId will be appended
       
   160 	 * @param aCommandId if aFilterUsingCommandId is ETrue, only
       
   161 	 * attributes relevant to aCommandId will be appened.
       
   162 	 */
       
   163 	void AddAttributesToContextL(CGlxAttributeContext& aAttributeContext, 
       
   164 			                     CGlxCommandHandler* aCommandHandler, 
       
   165 			                     TBool aFilterUsingSelection, 
       
   166 			                     TBool aFilterUsingCommandId, 
       
   167 			                     TInt aCommandId = 0);
       
   168 	
       
   169 	/**
       
   170 	 * Helper method to fetch attributes
       
   171 	 * @param aFilterUsingCommandId If ETrue, only attributes relevant
       
   172 	 * to the command id specified by aCommandId will be appended
       
   173 	 * @param aCommandId if aFilterUsingCommandId is ETrue, only
       
   174 	 * attributes relevant to aCommandId will be appened.
       
   175 	 */
       
   176 	void FetchAttributesL(TBool aFilterUsingCommandId, TInt aCommandId = 0);
       
   177 	
       
   178 protected:
       
   179 	MGlxMediaList* iMediaList;
       
   180     MMPXCollectionUtility* iCollectionUtility;
       
   181  	HBufC*    iFixedTitle;
       
   182  	
       
   183 private:
       
   184 	MGlxMediaListFactory* iMediaListFactory; 
       
   185 	CGlxTitleFetcher* iTitleFetcher;
       
   186 	
       
   187 	/**
       
   188 	 * Controlls the ui states of toolbar for all the views
       
   189 	 * (Owned)
       
   190 	 */
       
   191 	CGlxToolbarController* iToolbarControl; 
       
   192 	
       
   193 	/**
       
   194 	 * Controlls the Msk for all the views
       
   195 	 * (Owned)
       
   196 	 */
       
   197 	CGlxMSKController* iCbaControl;
       
   198 	
       
   199     /**
       
   200      * Attribute context used to preload attributes
       
   201      * required by command handlers.
       
   202      * (Owned)
       
   203      */
       
   204     CGlxAttributeContext* iPreloadContextForCommandHandlers;
       
   205     
       
   206     /**
       
   207      * Selection iterator used by iPreloadContextForCommandHandlers above.
       
   208      */
       
   209     TGlxSelectionIterator iSelectionIterator;
       
   210     
       
   211     /**
       
   212      * MSK Enabler used by FullScreen to disable the MSK
       
   213      */
       
   214     TBool iEnableMidddleSoftkey;
       
   215 	};
       
   216 
       
   217 
       
   218 #endif // C_GLXMEDIALISTVIEW_H