2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
19 #ifndef MCLFCUSTOMGROUPER_H
20 #define MCLFCUSTOMGROUPER_H
25 // FORWARD DECLARATIONS
26 class MCLFCustomGrouperExt;
32 * Custom grouper interface of Content Listing Framework.
33 * With this interface, client can add own custom grouper
34 * to its List Model. Custom grouper is used for grouping list model items.
35 * For example, List Model of music files can be grouped by genre or artist
36 * name by using this interface.
37 * Use ContentListingFactory to create items for new groups (MCLFModifiableItem).
41 * // This grouper will overwrite the source list and add three items to model.
42 * void CMyGrouper::GroupItemsL( const TArray<MCLFItem*>& aSourceList,
43 * RPointerArray<MCLFItem>& aGroupedList )
45 * _LIT( KTest, "test" );
46 * MCLFModifiableItem* item = ContentListingFactory::NewModifiableItemLC();
47 * item->AddFieldL( ECLFFieldIdName, KTest );
48 * aGroupedList.AppendL( item );
49 * CleanupStack::Pop(); // item
51 * _LIT( KTest1, "test1" );
52 * item = ContentListingFactory::NewModifiableItemLC();
53 * item->AddFieldL( ECLFFieldIdName, KTest1 );
54 * aGroupedList.AppendL( item );
55 * CleanupStack::Pop(); // item
57 * _LIT( KTest2, "test2" );
58 * item = ContentListingFactory::NewModifiableItemLC();
59 * item->AddFieldL( ECLFFieldIdName, KTest2 );
60 * aGroupedList.AppendL( item );
61 * CleanupStack::Pop(); // item
65 * Custom grouper is activated and removed by calling method
66 * MCLFItemListModel::SetCustomGrouper
68 * @lib ContentListingFramework.lib
71 class MCLFCustomGrouper
73 public: // New functions
76 * Abstract method for grouping Content Listing Framework items of
77 * list models. This method is called when the grouping process is
78 * executed by refreshing the model.
80 * @param aSourceList Source list. Contains all items that are in
81 * the list model when the grouping process starts.
82 * @param aGroupedList Grouped/destination list. While grouping, each
83 * group should be added to this list. The list model will
84 * contain only these items when the grouping process is
87 virtual void GroupItemsL( const TArray<MCLFItem*>& aSourceList,
88 RPointerArray<MCLFItem>& aGroupedList ) = 0;
95 virtual ~MCLFCustomGrouper() {}
97 private: // Extension interface
100 * This member is internal and not intended for use.
102 virtual MCLFCustomGrouperExt* Extension() { return NULL; }
106 #endif // MCLFCUSTOMGROUPER_H