cmmanager/cmmgr/Framework/Inc/destlistboxmodel.h
changeset 20 9c97ad6591ae
parent 18 fcbbe021d614
child 21 b8e8e15e80f2
child 23 7ec726f93df1
child 28 860702281757
equal deleted inserted replaced
18:fcbbe021d614 20:9c97ad6591ae
     1 /*
       
     2 * Copyright (c) 2006 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:  Declaration of class CDestListboxModel.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef DESTLISTBOX_LISTBOX_MODEL_H
       
    19 #define DESTLISTBOX_LISTBOX_MODEL_H
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include <eikdialg.h>
       
    23 #include "destlistitemlist.h"
       
    24 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    25 #include <commsdat.h>
       
    26 #else
       
    27 #include <commsdat.h>
       
    28 #include <commsdat_partner.h>
       
    29 #endif
       
    30 
       
    31 // CONSTANTS
       
    32 // Granularity of the model array.
       
    33 const TInt KGranularity = 8;
       
    34 _LIT( KListItemFormatDestProt, "%d\t%S\t%S\t%d" );
       
    35 _LIT( KListItemFormatDest, "%d\t%S\t%S" );
       
    36 const TInt KMaxFormatSize = sizeof( KListItemFormatDest );
       
    37 const TInt KMaxListItemNameLength = CommsDat::KMaxTextLength;
       
    38 const TInt KMaxDestListboxName = KMaxListItemNameLength+KMaxFormatSize;
       
    39 
       
    40 /**
       
    41  *  Model for the destinations listbox.
       
    42  *  pointers; items are owned.
       
    43  *
       
    44  *  @lib cmmanager.lib
       
    45  *  @since S60 v3.2
       
    46  */
       
    47 NONSHARABLE_CLASS( CDestListboxModel ) : public CDestListItemList
       
    48                                        , public MDesCArray
       
    49     {
       
    50     public:     // Construct / Destruct
       
    51 
       
    52         /**
       
    53         * Constructor.
       
    54         * @param aGraphicType   The used graphic type
       
    55         */
       
    56         CDestListboxModel();
       
    57 
       
    58         /**
       
    59         * Destructor.
       
    60         */
       
    61         virtual ~CDestListboxModel();
       
    62 
       
    63     public:     // from MDesCArray
       
    64 
       
    65         /**
       
    66         * Get number of items in the model.
       
    67         * @return Number of items.
       
    68         */
       
    69         TInt MdcaCount() const;
       
    70 
       
    71         /**
       
    72         * Text to be displayed for this item.
       
    73         * @param aIndex Index of item.
       
    74         * @return TPtrC for this item text (text owned by the model).
       
    75         */
       
    76         TPtrC MdcaPoint( TInt aIndex ) const;
       
    77 
       
    78     public:        
       
    79         
       
    80         /**
       
    81         * Sets the icon offset
       
    82         * @param aOffset    The offset of our icons in the iconarray
       
    83         */
       
    84         void SetOwnIconOffset( TInt aOffset );
       
    85 
       
    86     private:    // data
       
    87     
       
    88         /**
       
    89         * Formats the text of the listbox, calls the leaving version trapped.
       
    90         * @param aIndex Index of item.
       
    91         * @param aBuf Buffer to store formatted text.
       
    92         */
       
    93         void FormatListboxText( TInt aIndex, TDes& aBuf ) const;
       
    94 
       
    95         /**
       
    96         * Formats the text of the listbox, leaving version.
       
    97         * @param aIndex Index of item.
       
    98         * @param aBuf Buffer to store formatted text.
       
    99         */
       
   100         void FormatListboxTextL( TInt aIndex,
       
   101                                                 TDes& aBuf ) const;
       
   102         /**
       
   103         * MdcaPoint() cannot leave, so this buffer is allocated
       
   104         * to allow formatting. Fortunately, doesn't have to be very
       
   105         * large.
       
   106         * We have to use MUTABLE CAST, as MdcaPoint is const (odd enough),
       
   107         * so wouldn't allow formatting the text in a member...
       
   108         */
       
   109         __MUTABLE TBuf<KMaxDestListboxName> iBuf;
       
   110         TInt iOffset;
       
   111     };
       
   112 
       
   113 #endif