photosgallery/viewframework/medialists/tsrc/src/glxlistreconstruction.h
changeset 0 4e91876724a2
equal deleted inserted replaced
-1:000000000000 0:4e91876724a2
       
     1 /*
       
     2 * Copyright (c) 2007 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:    Unit tests
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __C_GLXLISTCONSTRUCTION_H__
       
    22 #define __C_GLXLISTCONSTRUCTION_H__
       
    23 
       
    24 //  EXTERNAL INCLUDES
       
    25 #include <e32std.h>
       
    26 
       
    27 //  INTERNAL INCLUDES
       
    28 #include "glxmediaid.h"
       
    29 #include "mglxnavigablelistobserver.h"
       
    30 #include "_glxnotification.h"
       
    31 
       
    32 //  FORWARD DECLARATIONS
       
    33 class CGlxItemList;
       
    34 class CGlxStaticItemList;
       
    35 class CGlxNavigableList;
       
    36 class TGlxMedia;
       
    37 class CMPXCollectionPath;
       
    38 
       
    39 /**
       
    40  * Reconstruction of a list
       
    41  *
       
    42  */
       
    43 class CGlxListReconstructionBase : public CBase, public MGlxNavigableListObserver
       
    44     {
       
    45     public:     
       
    46         ~CGlxListReconstructionBase();
       
    47         
       
    48         void ClearNotifications();
       
    49         
       
    50         TBool NotificationListEquals( const TNotification::TData* aNotificationList );
       
    51         
       
    52         // From MGlxNavigableListObserver
       
    53         void HandleItemsAdded( TInt aAddedAtIndex, TInt aCount );
       
    54         void HandleItemsRemoved( TInt aRemovedFromIndex, TInt aCount );
       
    55         void HandleFocusChanged( NGlxListDefs::TFocusChangeType aType, 
       
    56             TInt aNewIndex, TInt aOldIndex );
       
    57         void HandleItemSelected( TInt aIndex, TBool aSelected );
       
    58         
       
    59         virtual const TGlxMediaId& OriginalItem( TInt aIndex ) const = 0;
       
    60         virtual TBool ReconstructionEquals() const = 0;
       
    61     
       
    62     protected:
       
    63         void ConstructL( TInt aReservationCount = 400 );
       
    64     
       
    65     protected:
       
    66         // List of notifications received
       
    67         RArray< TNotification > iNotifications;
       
    68         // list that has been reconstructed from notifications
       
    69         RArray< TGlxMediaId > iReconstructedList;
       
    70         // focus index reconstructed from notifications
       
    71         TInt iFocusIndex;
       
    72         // selection reconstructed from notifications
       
    73         RArray< TInt> iSelectedItemIndices;
       
    74     };
       
    75 
       
    76 /**
       
    77  * Reconstruction of a item list
       
    78  */
       
    79 template < class _ListClass >
       
    80 class CGlxListReconstruction : public CGlxListReconstructionBase
       
    81     {
       
    82     public:     
       
    83         inline CGlxListReconstruction();
       
    84         inline void SetList( _ListClass& aList );
       
    85         
       
    86         inline TBool ItemsEqual() const;
       
    87         
       
    88         // From CGlxListReconstructionBase
       
    89         inline const TGlxMediaId& OriginalItem( TInt aIndex ) const;
       
    90         
       
    91     protected: 
       
    92         _ListClass* iList;
       
    93     };
       
    94 
       
    95 #include "glxlistreconstruction.inl"
       
    96 
       
    97 #endif      //  __C_GLXITEMLISTCONSTRUCTION_H__