author | William Roberts <williamr@symbian.org> |
Wed, 31 Mar 2010 12:33:34 +0100 | |
branch | Symbian3 |
changeset 4 | 837f303aceeb |
parent 2 | 2fe1408b6811 |
permissions | -rw-r--r-- |
williamr@2 | 1 |
/* |
williamr@2 | 2 |
* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
williamr@2 | 3 |
* All rights reserved. |
williamr@2 | 4 |
* This component and the accompanying materials are made available |
williamr@4 | 5 |
* under the terms of "Eclipse Public License v1.0" |
williamr@2 | 6 |
* which accompanies this distribution, and is available |
williamr@4 | 7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
williamr@2 | 8 |
* |
williamr@2 | 9 |
* Initial Contributors: |
williamr@2 | 10 |
* Nokia Corporation - initial contribution. |
williamr@2 | 11 |
* |
williamr@2 | 12 |
* Contributors: |
williamr@2 | 13 |
* |
williamr@2 | 14 |
* Description: |
williamr@2 | 15 |
* |
williamr@2 | 16 |
*/ |
williamr@2 | 17 |
|
williamr@2 | 18 |
|
williamr@2 | 19 |
#ifndef MCLFSORTINGSTYLE_H |
williamr@2 | 20 |
#define MCLFSORTINGSTYLE_H |
williamr@2 | 21 |
|
williamr@2 | 22 |
// INCLUDES |
williamr@2 | 23 |
#include <CLFContentListing.hrh> |
williamr@2 | 24 |
#include <CLFContentListing.h> |
williamr@2 | 25 |
#include <e32std.h> |
williamr@2 | 26 |
|
williamr@2 | 27 |
// FORWARD DECLARATIONS |
williamr@2 | 28 |
class MCLFSortingStyleExt; |
williamr@2 | 29 |
|
williamr@2 | 30 |
// CLASS DECLARATION |
williamr@2 | 31 |
|
williamr@2 | 32 |
/** |
williamr@2 | 33 |
* Sorting style for Content Listing Framework. |
williamr@2 | 34 |
* This class can be used to define primary and secondary sorting styles for |
williamr@2 | 35 |
* Content Listing Framework list model. Sorting styles are used to sort the |
williamr@2 | 36 |
* list model.<br><br> |
williamr@2 | 37 |
* Secondary sorting style is used to sort items that could not be sorted by |
williamr@2 | 38 |
* the primary sorting style. In other words, items that do not have the |
williamr@2 | 39 |
* field defined by primary or any previous secondary sorting style, the items |
williamr@2 | 40 |
* are sorted using the next secondary sorting style. When a secondary sorting |
williamr@2 | 41 |
* style is appended, it becomes the least significant sorting style until a |
williamr@2 | 42 |
* new one is added after it. Items with undefined fields are placed before or |
williamr@2 | 43 |
* after items with defined fields, depending on the undefined field position |
williamr@2 | 44 |
* setting in MCLFSortingStyle. |
williamr@2 | 45 |
* <br><br> |
williamr@2 | 46 |
* Usage: |
williamr@2 | 47 |
* @code |
williamr@2 | 48 |
* // Create a sorting style instance |
williamr@2 | 49 |
* MCLFSortingStyle* sortingStyle = ContentListingFactory::NewSortingStyleLC(); |
williamr@2 | 50 |
* |
williamr@2 | 51 |
* // Set sort ordering |
williamr@2 | 52 |
* sortingStyle->SetOrdering( ECLFOrderingDescending ); |
williamr@2 | 53 |
* |
williamr@2 | 54 |
* // Set undefied item position. Undefined items are items that doesn't |
williamr@2 | 55 |
* // have field that is defined in sorting style fields |
williamr@2 | 56 |
* sortingStyle->SetUndefinedItemPosition( ECLFSortingStyleUndefinedEnd ); |
williamr@2 | 57 |
* |
williamr@2 | 58 |
* // All sorting style parameter fields are string type |
williamr@2 | 59 |
* sortingStyle->SetSortingDataType( ECLFItemDataTypeDesC ); |
williamr@2 | 60 |
* |
williamr@2 | 61 |
* // Set default sorting parameter |
williamr@2 | 62 |
* sortingStyle->AddFieldL( ECLFFieldIdSongName ); |
williamr@2 | 63 |
* |
williamr@2 | 64 |
* // Set secondary sorting parameter |
williamr@2 | 65 |
* sortingStyle->AddFieldL( ECLFFieldIdFileName ); |
williamr@2 | 66 |
* |
williamr@2 | 67 |
* // If item doesn't have ECLFFieldIdSongName field then |
williamr@2 | 68 |
* // ECLFFieldIdFileName field is used to sort item. |
williamr@2 | 69 |
* @endcode |
williamr@2 | 70 |
* |
williamr@2 | 71 |
* @lib ContentListingFramework.lib |
williamr@2 | 72 |
* @since S60 3.1 |
williamr@2 | 73 |
*/ |
williamr@2 | 74 |
class MCLFSortingStyle |
williamr@2 | 75 |
{ |
williamr@2 | 76 |
public: // Destructor |
williamr@2 | 77 |
|
williamr@2 | 78 |
/** |
williamr@2 | 79 |
* Destructor. |
williamr@2 | 80 |
*/ |
williamr@2 | 81 |
virtual ~MCLFSortingStyle() {} |
williamr@2 | 82 |
|
williamr@2 | 83 |
public: // New functions |
williamr@2 | 84 |
|
williamr@2 | 85 |
/** |
williamr@2 | 86 |
* Reset settings of the sorting style to default. |
williamr@2 | 87 |
* @since S60 3.1 |
williamr@2 | 88 |
*/ |
williamr@2 | 89 |
virtual void ResetL() = 0; |
williamr@2 | 90 |
|
williamr@2 | 91 |
/** |
williamr@2 | 92 |
* Set sort ordering. Ordering can be ascending or descending. See |
williamr@2 | 93 |
* TCLFSortingStyleOrdering |
williamr@2 | 94 |
* @since S60 3.1 |
williamr@2 | 95 |
* @param aOrdering Sort ordering to be set |
williamr@2 | 96 |
*/ |
williamr@2 | 97 |
virtual void SetOrdering( TCLFSortingStyleOrdering aOrdering ) = 0; |
williamr@2 | 98 |
|
williamr@2 | 99 |
/** |
williamr@2 | 100 |
* Get current sort ordering of the sorting style. |
williamr@2 | 101 |
* @since S60 3.1 |
williamr@2 | 102 |
* @return Current sort ordering |
williamr@2 | 103 |
*/ |
williamr@2 | 104 |
virtual TCLFSortingStyleOrdering Ordering() const = 0; |
williamr@2 | 105 |
|
williamr@2 | 106 |
/** |
williamr@2 | 107 |
* Set data type of sorting parameter fields. Data type can be text, |
williamr@2 | 108 |
* time or number. See TCLFItemDataType |
williamr@2 | 109 |
* @since S60 3.1 |
williamr@2 | 110 |
* @param aDataType Data type to be set |
williamr@2 | 111 |
*/ |
williamr@2 | 112 |
virtual void SetSortingDataType( TCLFItemDataType aDataType ) = 0; |
williamr@2 | 113 |
|
williamr@2 | 114 |
/** |
williamr@2 | 115 |
* Get current sorting data type of fields. |
williamr@2 | 116 |
* @since S60 3.1 |
williamr@2 | 117 |
* @return Current data type sorting of sorting fields |
williamr@2 | 118 |
*/ |
williamr@2 | 119 |
virtual TCLFItemDataType SortingDataType() const = 0; |
williamr@2 | 120 |
|
williamr@2 | 121 |
/** |
williamr@2 | 122 |
* Set undefined item position. Items not having information for defined |
williamr@2 | 123 |
* sorting parameter fields are placed to top or bottom of the model. See |
williamr@2 | 124 |
* TCLFUndefinedItemPosition |
williamr@2 | 125 |
* @since S60 3.1 |
williamr@2 | 126 |
* @param aUndefinedItemPosition Position for undefiened items |
williamr@2 | 127 |
*/ |
williamr@2 | 128 |
virtual void SetUndefinedItemPosition( |
williamr@2 | 129 |
TCLFUndefinedItemPosition aUndefinedItemPosition ) = 0; |
williamr@2 | 130 |
|
williamr@2 | 131 |
/** |
williamr@2 | 132 |
* Get current position of undefined items. |
williamr@2 | 133 |
* @since S60 3.1 |
williamr@2 | 134 |
* @return Current position for undefined items |
williamr@2 | 135 |
*/ |
williamr@2 | 136 |
virtual TCLFUndefinedItemPosition UndefinedItemPosition() const = 0; |
williamr@2 | 137 |
|
williamr@2 | 138 |
/** |
williamr@2 | 139 |
* Add new field to the sorting style. First added field will be the |
williamr@2 | 140 |
* default field. Remember to set type of field(s) with |
williamr@2 | 141 |
* SetSortingDataType. Fields that are some other type will be ignored. |
williamr@2 | 142 |
* See TCLFDefaultFieldId in CLFContentListing.hrh |
williamr@2 | 143 |
* @since S60 3.1 |
williamr@2 | 144 |
* @param aFieldId Id of the sorting parameter field |
williamr@2 | 145 |
*/ |
williamr@2 | 146 |
virtual void AddFieldL( TCLFFieldId aFieldId ) = 0; |
williamr@2 | 147 |
|
williamr@2 | 148 |
/** |
williamr@2 | 149 |
* Get IDs of fields that have been set to the sorting style. |
williamr@2 | 150 |
* @since S60 3.1 |
williamr@2 | 151 |
* @param aArray Array of field IDs |
williamr@2 | 152 |
*/ |
williamr@2 | 153 |
virtual void GetFieldsL( RArray<TCLFFieldId>& aArray ) const = 0; |
williamr@2 | 154 |
|
williamr@2 | 155 |
private: // Extension interface |
williamr@2 | 156 |
|
williamr@2 | 157 |
virtual MCLFSortingStyleExt* Extension() { return NULL; } |
williamr@2 | 158 |
|
williamr@2 | 159 |
}; |
williamr@2 | 160 |
|
williamr@2 | 161 |
#endif // MCLFSORTINGSTYLE_H |
williamr@2 | 162 |
|
williamr@2 | 163 |
// End of File |