emailcontacts/contactactionmenu/inc/mfsccontactactionmenumodel.h
changeset 0 8466d47a6819
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     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:  Definition of class MFscContactActionMenuModel.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef M_FSCCONTACTACTIONMENUMODEL_H
       
    20 #define M_FSCCONTACTACTIONMENUMODEL_H
       
    21 
       
    22 #include <e32base.h>
       
    23 
       
    24 //<cmail>
       
    25 #include "fsccontactactionmenudefines.h"
       
    26 #include "fsccontactactionservicedefines.h"
       
    27 //</cmail>
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class CFscContactActionMenuItem;
       
    31 class CGulIcon;
       
    32 
       
    33 /**
       
    34  *  Contact Action Menu Model interface.
       
    35  *
       
    36  *  @since S60 3.1
       
    37  */
       
    38 class MFscContactActionMenuModel
       
    39     {
       
    40     
       
    41 public: // Public methods
       
    42 
       
    43     /**
       
    44      * Factory method for creating a new menu item. 
       
    45      *   Item is not added to the menu.
       
    46      *   Ownership of new item is transferred and it is not added to 
       
    47      *   the menu automatically
       
    48      *
       
    49      * @param aMenuText Menu text
       
    50      * @param aIcon Icon. Icon ownership is not transferred
       
    51      * @param aPriority Priority
       
    52      * @param aStatic Is static
       
    53      *   Static items are ment to be kept in the menu longer than non-static. 
       
    54      *   Normal use case for static items are custom items set by Action Menu's 
       
    55      *   client. These special items are always in the menu so client does not 
       
    56      *   want to set them again after clearing other items from the menu. All CAS 
       
    57      *   based items are non-static and therefore they can easily be removed from 
       
    58      *   the menu without removing static items also. 
       
    59      * @param aUid Item Uid
       
    60      * @return New menu item
       
    61      */
       
    62     virtual CFscContactActionMenuItem* NewMenuItemL( 
       
    63         const TDesC& aMenuText,
       
    64         const CGulIcon* aIcon,
       
    65         TInt aPriority,
       
    66         TBool aStatic,
       
    67         TUid aUid ) = 0;
       
    68 
       
    69     /**
       
    70      * Add a single item
       
    71      *
       
    72      * @param aItem New item. Ownership of the item is transferred.
       
    73      * @return Index of added item
       
    74      */
       
    75     virtual TInt AddItemL( CFscContactActionMenuItem* aItem ) = 0;   
       
    76     
       
    77     /**
       
    78      * Add pre queried items to the list
       
    79      *   This method can be used when client application is using same 
       
    80      *   instance of cas and it is know that cas's queryresults are ok 
       
    81      *   for the menu. This is usefull when Cas items are used in options 
       
    82      *   menu and action menu
       
    83      *   Previously set CAS items are removed before adding new items.
       
    84      */
       
    85     virtual void AddPreQueriedCasItemsL() = 0;    
       
    86  
       
    87     /**
       
    88      * Remove a single item from the menu
       
    89      *
       
    90      * @param aIndex Index of the item
       
    91      */
       
    92     virtual void RemoveItemL( TInt aIndex ) = 0;  
       
    93  
       
    94     /**
       
    95      * Remove all items from the menu
       
    96      *
       
    97      * @param aStaticAlso If ETrue also static items will be removed
       
    98      */
       
    99     virtual void RemoveAll( TBool aStaticAlso = EFalse ) = 0;  
       
   100  
       
   101     /**
       
   102      * Item getter
       
   103      *   Method leaves with KErrNotFound if given index is invalid
       
   104      *
       
   105      * @param aIndex Index of requested item
       
   106      * @return A reference to requested menu item.
       
   107      */
       
   108     virtual CFscContactActionMenuItem& ItemL( TInt aIndex ) = 0;  
       
   109  
       
   110     /**
       
   111      * Return number of items in the menu
       
   112      *
       
   113      * @return number of items in the menu
       
   114      */
       
   115     virtual TInt ItemCount() = 0; 
       
   116  
       
   117     /**
       
   118      * Visible item getter. 
       
   119      *   Visible items are not hidden or dimmed and they have an icon
       
   120      *
       
   121      * @param aIndex Index of requested item
       
   122      * @return A pointer to requested menu item or NULL if item is not found.
       
   123      */
       
   124     virtual CFscContactActionMenuItem& VisibleItemL( TInt aIndex ) = 0;  
       
   125  
       
   126     /**
       
   127      * Return number of visible items in the menu
       
   128      *   Visible items are not hidden or dimmed and they have an icon
       
   129      *
       
   130      * @return number of items in the menu
       
   131      */
       
   132     virtual TInt VisibleItemCount() = 0;     
       
   133 
       
   134 protected: // destructor
       
   135     
       
   136     /**
       
   137     * Destructor.
       
   138     */
       
   139     virtual ~MFscContactActionMenuModel() {};
       
   140 
       
   141     };
       
   142 
       
   143 #endif // M_FSCCONTACTACTIONMENUMODEL_H