|
1 /* |
|
2 * Copyright (c) 2002-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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef MCLFCUSTOMSORTER_H |
|
20 #define MCLFCUSTOMSORTER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32std.h> |
|
24 |
|
25 // FORWARD DECLARATIONS |
|
26 class MCLFItem; |
|
27 class MCLFCustomSorterExt; |
|
28 |
|
29 // CLASS DECLARATION |
|
30 |
|
31 /** |
|
32 * Custom sorter interface for Content Listing Framework. |
|
33 * With this interface, client can create a customized sorter for |
|
34 * sorting items in list model. For example, items in the List Model |
|
35 * can be sorted by Item IDs or it can be randomized.<br><br> |
|
36 * Example: |
|
37 * @code |
|
38 * // Example sorter that sorts items by Item IDs |
|
39 * void CMySorter::SortItemsL( RPointerArray<MCLFItem>& aItemArray ) |
|
40 * { |
|
41 * TLinearOrder<MCLFItem> sorter( CMySorter::Compare ); |
|
42 * aItemArray.Sort( sorter ); |
|
43 * } |
|
44 * |
|
45 * TInt CMySorter::Compare( const MCLFItem& aFirst, const MCLFItem& aSecond ) |
|
46 * { |
|
47 * return aFirst.ItemId() - aSecond.ItemId(); |
|
48 * } |
|
49 * @endcode |
|
50 * |
|
51 * Custom sorter is activated and removed by calling method |
|
52 * MCLFItemListModel::SetCustomSorter |
|
53 * |
|
54 * @lib ContentListingFramework.lib |
|
55 * @since S60 3.1 |
|
56 */ |
|
57 class MCLFCustomSorter |
|
58 { |
|
59 public: // New functions |
|
60 |
|
61 /** |
|
62 * Abstract method for sorting Content Listing Framework items in a list |
|
63 * model. This method is called when the sorting process is executed |
|
64 * by calling refresh to the List Model. |
|
65 * @since S60 3.1 |
|
66 * @param aItemArray The array to sort. Contains all items of |
|
67 * the List Model. |
|
68 */ |
|
69 virtual void SortItemsL( RPointerArray<MCLFItem>& aItemArray ) = 0; |
|
70 |
|
71 protected: |
|
72 |
|
73 /** |
|
74 * Destructor. |
|
75 */ |
|
76 virtual ~MCLFCustomSorter() {} |
|
77 |
|
78 private: // Extension interface |
|
79 |
|
80 /** |
|
81 * This member is internal and not intended for use. |
|
82 */ |
|
83 virtual MCLFCustomSorterExt* Extension() { return NULL; } |
|
84 |
|
85 }; |
|
86 |
|
87 #endif // MCLFCUSTOMSORTER_H |
|
88 |
|
89 // End of File |