photosgallery/viewframework/uiutilities/inc/glxactivemedialistregistry.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:    Class that stores the active media list pointer
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20  
       
    21 #ifndef __C_GLXACTIVEMEDIALISTREGISTRY_H__
       
    22 #define __C_GLXACTIVEMEDIALISTREGISTRY_H__
       
    23 
       
    24 #include <e32std.h>
       
    25 #include <e32base.h>
       
    26 
       
    27 #include "mglxactivemedialistresolver.h"
       
    28 
       
    29 class MGlxMediaList;
       
    30 class MGlxActiveMediaListChangeObserver;
       
    31 
       
    32 /**
       
    33  * Class to store the active media list
       
    34  */
       
    35 NONSHARABLE_CLASS( CGlxActiveMediaListRegistry ) : public CBase, public MGlxActiveMediaListResolver
       
    36     {
       
    37 public:
       
    38     /**
       
    39      * Return a (singleton) instance of the interface
       
    40      * Close the instance by calling Close() when done with the instance
       
    41      * @param aObserver Observer to add
       
    42      */
       
    43     IMPORT_C static CGlxActiveMediaListRegistry* InstanceL(
       
    44         MGlxActiveMediaListChangeObserver* aObserver = NULL); 
       
    45     
       
    46     /**
       
    47      * Close the instance and remove observer if any
       
    48      * See @ref MGlxActiveMediaListResolver::Close
       
    49      * @param aObserver Observer to remove
       
    50      */
       
    51     void Close(MGlxActiveMediaListChangeObserver* aObserver = NULL);
       
    52 
       
    53     /**
       
    54      * Registers a media list as being active
       
    55      * Calls MGlxActiveMediaListChangeObserver::HandleActiveMediaListChanged
       
    56      * @param aMediaList list to register as active 
       
    57      */
       
    58     IMPORT_C void RegisterActiveMediaList(MGlxMediaList* aMediaList);
       
    59 
       
    60     /**
       
    61      * Deregisters a media list that has previously registerd as active
       
    62      * Takes a pointer to the media list, so that implementation can 
       
    63      * know if the deregistration refers to a list that has been registered 
       
    64      * before the currenlty active list has been registered.
       
    65      * The background is that the DoDeactivateL of the previous view
       
    66      * is called after the DoActivateL of the new view.
       
    67      * Note: This must be called while the media list is still alive,
       
    68      * i.e., not closed!
       
    69      * If no other media list has been registered, the currently active
       
    70      * media list will be set to NULL.
       
    71      * Calls MGlxActiveMediaListChangeObserver::HandleActiveMediaListChanged
       
    72      * @param aMediaList list to deregister as active
       
    73      */
       
    74     IMPORT_C void DeregisterActiveMediaList(MGlxMediaList* aMediaList);
       
    75 
       
    76     /** 
       
    77      * See @ref MGlxActiveMediaListResolver::ActiveMediaList
       
    78      * @return the active media list
       
    79      */
       
    80     MGlxMediaList* ActiveMediaList() const;
       
    81 
       
    82 private:
       
    83     /**
       
    84      * Constructor 
       
    85      */
       
    86     CGlxActiveMediaListRegistry();
       
    87 
       
    88     /** 
       
    89      * Destructor 
       
    90      */
       
    91     ~CGlxActiveMediaListRegistry();
       
    92     
       
    93     /** 
       
    94      * Notify observers of change to the list pointer
       
    95      */
       
    96     void NotifyObservers();
       
    97 
       
    98     /**
       
    99      * 2-phase constructor
       
   100      */
       
   101     static CGlxActiveMediaListRegistry* NewL();
       
   102 
       
   103 private:
       
   104     /** 
       
   105      * The list in the currently open view that the user is navigating, or 
       
   106      * NULL if that media list is not known 
       
   107      */    
       
   108     MGlxMediaList* iActiveMediaList;
       
   109     
       
   110     /** 
       
   111      * True if two views have registered the currently active list 
       
   112      * Allows the current and previous view to register the same list
       
   113      */
       
   114     TBool iRegisteredTwice;
       
   115     
       
   116     /** List of observers */
       
   117     RPointerArray<MGlxActiveMediaListChangeObserver> iObservers;
       
   118     };     
       
   119     
       
   120 #endif // __C_GLXACTIVEMEDIALISTREGISTRY_H__