uiservicetab/vimpstui/inc/cvimpstuisinglestylelistboxmodel.h
changeset 15 81eeb8c83ce5
parent 0 5e5d6b214f4f
equal deleted inserted replaced
0:5e5d6b214f4f 15:81eeb8c83ce5
     1 /*
       
     2 * Copyright (c) 2008 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:  Custom listbox component for the contact list
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef _CVIMPSTUILISTBOXMODEL_H
       
    20 #define _CVIMPSTUILISTBOXMODEL_H
       
    21 
       
    22 #include <aknutils.h>
       
    23 
       
    24 //FORWARD DECLARATONS
       
    25 class MVIMPSTProcessArray;
       
    26 
       
    27 //CLASS DECLARATON
       
    28 /**
       
    29  *  Custom listbox model for the contact list
       
    30  *
       
    31  *  Enables custom filtering (with find box) for the listbox,
       
    32  *  so it's possible to show also contact list names for the 
       
    33  *  filtered contacts.
       
    34  *
       
    35  *  @lib vimpstui.lib
       
    36  *  @since S60 v5.0
       
    37  */
       
    38 class CVIMPSTUiListBoxModel : public CAknFilteredTextListBoxModel
       
    39     {
       
    40 
       
    41 public: // Constructor and Destructor
       
    42 
       
    43     
       
    44     /**
       
    45      * Default C++ constructor
       
    46      */
       
    47     CVIMPSTUiListBoxModel();
       
    48 
       
    49     /**
       
    50      * Default C++ destructor
       
    51      */
       
    52     ~CVIMPSTUiListBoxModel();
       
    53 
       
    54     
       
    55 public: // from CTextListBoxModel
       
    56 
       
    57     /**
       
    58      * Returns the amount of filtered (searched) 
       
    59      * contacts and their contact lists
       
    60      * @return Total amount of filtered (searched) contacts and their contact lists
       
    61      */
       
    62     TInt NumberOfItems() const;
       
    63     
       
    64     /**
       
    65      * Returns the text of the specified item.
       
    66      * @param aItemIndex Index to the item.
       
    67      * @return The text of item in given index.
       
    68      */
       
    69     TPtrC ItemText(TInt aItemIndex) const;
       
    70 
       
    71     
       
    72 public: // from MEikTextListBoxModel
       
    73 
       
    74     /**
       
    75      * Provides the text array for the find box to search for.
       
    76      * @return Pointer to the text array.
       
    77      */
       
    78     const MDesCArray* MatchableTextArray() const;
       
    79 
       
    80 
       
    81 public: // From MDesCArray
       
    82 
       
    83     /**
       
    84      * @see MDesCArray
       
    85      */
       
    86     TInt MdcaCount() const;
       
    87 
       
    88     /**
       
    89      * @see MDesCArray
       
    90      */
       
    91     TPtrC MdcaPoint( TInt aIndex ) const;
       
    92 
       
    93     
       
    94 public: // New methods
       
    95 
       
    96     /**
       
    97      * For setting the contactlist model to have a direct access to real model
       
    98      * @param aContactListModel Model
       
    99      */
       
   100     void SetContactListModel( MVIMPSTProcessArray& aItemModel );
       
   101 
       
   102     /**
       
   103      * Return the real index of item which is currently visible
       
   104      * @param aVisibleItemIndex Currently visible item index
       
   105      * @return index of the item in the non-filtered list
       
   106      */
       
   107     TInt FilteredItemIndex( TInt aVisibleItemIndex ) const;
       
   108 
       
   109     /**
       
   110      * Return the current index of item in the non-filtered list
       
   111      * @param aOriginalIndex Index of the item in non-filtered list
       
   112      * @return Index of the item in filtered list. KErrNotFound if not visible
       
   113      */
       
   114     TInt VisibleItemIndex( TInt aOriginalIndex ) const;
       
   115    
       
   116 protected:  // New methods
       
   117 
       
   118     /**
       
   119      * Calculates the currently visible items.
       
   120      * @return count of visible items
       
   121      */
       
   122     TInt CountItems() const;
       
   123 
       
   124     /**
       
   125      * Fetch the item text a given position
       
   126      * @param aIndex Position of the item
       
   127      * @return Item text
       
   128      */
       
   129     TPtrC ItemAt( TInt aIndex ) const;
       
   130     
       
   131     /**
       
   132      * Check if filter is active.
       
   133      * @return ETrue: active, EFalse: deactive
       
   134      */
       
   135     TBool IsFilterActive() const;
       
   136     
       
   137     /**
       
   138      * Check if item at given index should be visible contact list.
       
   139      * Meaning that it has to be a contact list and it needs
       
   140      * to have at least 1 visible contact in it.
       
   141      * @param aIndex Position on item
       
   142      * @param aPosArray array of contacts lists positions
       
   143      * @return ETrue: visible contact list, EFalse: something else
       
   144      */
       
   145     TBool IsContactList( TInt aIndex, RArray<TInt>& aPosArray ) const;
       
   146 
       
   147 
       
   148 private: // Data
       
   149 
       
   150     // Not own. Contact list model
       
   151     MVIMPSTProcessArray* iItemModel;
       
   152     };
       
   153 
       
   154 
       
   155 #endif // _CVIMPSTUILISTBOXMODEL_H