epoc32/include/mw/mclfcustomsorter.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
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@2
     5
* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
williamr@2
     6
* which accompanies this distribution, and is available
williamr@2
     7
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.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 MCLFCUSTOMSORTER_H
williamr@2
    20
#define MCLFCUSTOMSORTER_H
williamr@2
    21
williamr@2
    22
//  INCLUDES
williamr@2
    23
#include <e32std.h>
williamr@2
    24
williamr@2
    25
// FORWARD DECLARATIONS
williamr@2
    26
class MCLFItem;
williamr@2
    27
class MCLFCustomSorterExt;
williamr@2
    28
williamr@2
    29
// CLASS DECLARATION
williamr@2
    30
williamr@2
    31
/**
williamr@2
    32
*  Custom sorter interface for Content Listing Framework.
williamr@2
    33
*  With this interface, client can create a customized sorter for
williamr@2
    34
*  sorting items in list model. For example, items in the List Model
williamr@2
    35
*  can be sorted by Item IDs or it can be randomized.<br><br>
williamr@2
    36
*  Example:
williamr@2
    37
*  @code
williamr@2
    38
*  // Example sorter that sorts items by Item IDs
williamr@2
    39
*  void CMySorter::SortItemsL( RPointerArray<MCLFItem>& aItemArray )
williamr@2
    40
*      {
williamr@2
    41
*      TLinearOrder<MCLFItem> sorter( CMySorter::Compare );
williamr@2
    42
*      aItemArray.Sort( sorter );
williamr@2
    43
*      }
williamr@2
    44
*
williamr@2
    45
*  TInt CMySorter::Compare( const MCLFItem& aFirst, const MCLFItem& aSecond )
williamr@2
    46
*      {
williamr@2
    47
*      return aFirst.ItemId() - aSecond.ItemId();
williamr@2
    48
*      }
williamr@2
    49
*  @endcode
williamr@2
    50
*
williamr@2
    51
*  Custom sorter is activated and removed by calling method
williamr@2
    52
*  MCLFItemListModel::SetCustomSorter
williamr@2
    53
*
williamr@2
    54
*  @lib ContentListingFramework.lib
williamr@2
    55
*  @since S60 3.1
williamr@2
    56
*/
williamr@2
    57
class MCLFCustomSorter
williamr@2
    58
    {
williamr@2
    59
    public: // New functions
williamr@2
    60
williamr@2
    61
        /**
williamr@2
    62
        * Abstract method for sorting Content Listing Framework items in a list
williamr@2
    63
        * model. This method is called when the sorting process is executed
williamr@2
    64
        * by calling refresh to the List Model.
williamr@2
    65
        * @since S60 3.1
williamr@2
    66
        * @param aItemArray The array to sort. Contains all items of
williamr@2
    67
        *        the List Model.
williamr@2
    68
        */
williamr@2
    69
        virtual void SortItemsL( RPointerArray<MCLFItem>& aItemArray ) = 0;
williamr@2
    70
williamr@2
    71
    protected:
williamr@2
    72
williamr@2
    73
        /**
williamr@2
    74
        * Destructor.
williamr@2
    75
        */
williamr@2
    76
        virtual ~MCLFCustomSorter() {}
williamr@2
    77
williamr@2
    78
    private: // Extension interface
williamr@2
    79
williamr@2
    80
        /**
williamr@2
    81
        * This member is internal and not intended for use.
williamr@2
    82
        */
williamr@2
    83
        virtual MCLFCustomSorterExt* Extension() { return NULL; }
williamr@2
    84
williamr@2
    85
    };
williamr@2
    86
williamr@2
    87
#endif      // MCLFCUSTOMSORTER_H
williamr@2
    88
williamr@2
    89
// End of File