Nokia N97 SDK
Example Applications Guide

CCECustomGrouper.h

00001 /*
00002 * ==============================================================================
00003 *  Name        : CCECustomGrouper.h
00004 *  Part of     : Content Listing Framework Sample Application
00005 *  Interface   :
00006 *  Description :
00007 *  Version     :
00008 *
00009 *  Copyright (c) 2006 Nokia Corporation.
00010 *  This material, including documentation and any related
00011 *  computer programs, is protected by copyright controlled by
00012 *  Nokia Corporation.
00013 * ==============================================================================
00014 */
00015 
00016 
00017 #ifndef __CCECUSTOMGROUPER_H__
00018 #define __CCECUSTOMGROUPER_H__
00019 
00020 // INCLUDES
00021 #include <e32base.h>
00022 #include <e32std.h>
00023 #include <MCLFCustomGrouper.h>
00024 #include <CLFContentListing.hrh>
00025 
00026 // FORWARD DECLARATIONS
00027 class MCLFItem;
00028 class MCLFModifiableItem;
00029 
00030 // CLASS DECLARATION
00031 
00032 /**
00033 *  CLF Custom Grouper.
00034 *  Example of Custom Grouper that can be used to group files in the
00035 *  list model. With Custom Groupers you can create grouping functionality that 
00036 *  is not supported in Content Listing Framework by default. This Custom 
00037 *  Grouper can group items of a list model by any field. In this example
00038 *  application, this Custom Grouper is used to group music items by artist 
00039 *  name.
00040 */
00041 class CCECustomGrouper 
00042     : public CBase,
00043       public MCLFCustomGrouper
00044     {
00045     public:  // Constructors and destructor
00046 
00047                 /**
00048                  * Creates and returns a new instance of this class.
00049                  * @param aGroupingCriteria Group items by this criteria
00050                  * @return Pointer to the CCECustomGrouper object
00051                  */
00052             static CCECustomGrouper* NewL( 
00053                             TCLFDefaultFieldId aGroupingCriteria );
00054 
00055         /**
00056         * Destructor.
00057         */
00058         virtual ~CCECustomGrouper();
00059 
00060     private:    // Constructors
00061         /**
00062         * C++ default constructor.
00063         * @param aGroupingCriteria Group list items by this criteria
00064         */
00065         CCECustomGrouper( TCLFDefaultFieldId aGroupingCriteria );
00066 
00067     protected:     // Functions from base classes
00068 
00069         /**
00070         * From MCLFCustomGrouper. Method for grouping Content Listing 
00071         * Framework items. Will get called when grouping operation is executed
00072         * by calling refresh for the list model.
00073         * @since Series 60 3.0
00074         * @param aSourceList Source list
00075         * @param aGroupedList Grouped/destination list
00076         */
00077         void GroupItemsL( const TArray<MCLFItem*>& aSourceList,
00078                           RPointerArray<MCLFItem>& aGroupedList );
00079         
00080     private:    // New functions
00081 
00082         /**
00083         * Checks if group has been added to the destination array already.
00084         * @param aGroupName Name of the group to be checked
00085         * @return ETrue If group has been added to the model, EFalse if not
00086         */
00087         TBool GroupAlreadyExists( const TDesC& aGroupName );
00088 
00089     private:    // Data
00090 
00091         // Array for keeping track, which items have been added to the 
00092         // model. Deletes items when they are no longer needed.
00093         RPointerArray<MCLFModifiableItem> iModItems;
00094 
00095         // Criteria for grouping
00096         TCLFDefaultFieldId iGroupingCriteria;
00097 
00098     };
00099 
00100 #endif // __CCECUSTOMGROUPER_H__
00101 
00102 // End of File

© Nokia 2009

Back to top