menufw/menufwui/mmwidgets/inc/mmlistboxmodel.h
branchRCL_3
changeset 83 5456b4e8b3a8
equal deleted inserted replaced
82:5f0182e07bfb 83:5456b4e8b3a8
       
     1 /*
       
     2 * Copyright (c) 2007 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:  CMmListBoxItemModel
       
    15 *  Version     : %version: MM_18.1.5 % << Don't touch! Updated by Synergy at check-out.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef C_MMLISTBOXMODEL_H
       
    21 #define C_MMLISTBOXMODEL_H
       
    22 
       
    23 #include <e32std.h>
       
    24 #include <e32base.h>
       
    25 #include <gulicon.h>
       
    26 #include <AknUtils.h>
       
    27 #include "hnsuiteobserver.h"
       
    28 
       
    29 class CHnSuiteModel;
       
    30 class CHnAttributeBase;
       
    31 class CHnAttributeImage;
       
    32 class CHnIconHolder;
       
    33 
       
    34 /**
       
    35  *  Multimedia Menu listbox model
       
    36  *
       
    37  *  @code
       
    38  *  @endcode
       
    39  *  @lib mmwidgets
       
    40  *  @since S60 v3.0
       
    41  *  @ingroup group_mmwidgets
       
    42  */
       
    43 NONSHARABLE_CLASS( CMmListBoxModel ):
       
    44     public CAknFilteredTextListBoxModel,
       
    45     public MHnSuiteObserver
       
    46   {
       
    47 public:
       
    48   // Constructors and destructor
       
    49 
       
    50   /**
       
    51    * Destructor.
       
    52    */
       
    53   ~CMmListBoxModel();
       
    54 
       
    55   /**
       
    56    * Two-phased constructor.
       
    57    */
       
    58   static CMmListBoxModel* NewL( );
       
    59 
       
    60   /**
       
    61    * Two-phased constructor.
       
    62    */
       
    63   static CMmListBoxModel* NewLC( );
       
    64 
       
    65   /**
       
    66    * Gets the text attribute for a specific item by the name of the attribute.
       
    67    *
       
    68    * @since S60 v3.0
       
    69    * @param aIndex The index of the item for which the text is requested.
       
    70    * @param aAttributeName The name of the text attribute to be returned.
       
    71    * @return Size of item.
       
    72    */
       
    73   const TDesC8& GetAttributeAsText( TInt aIndex, const TDesC8 & aAttributeName );
       
    74 
       
    75     /**
       
    76      * Gets the graphical attribute for a specific item by the name of the attribute.
       
    77      * The attribute is returned as an icon holder. Please see @c CHnIconHolder for
       
    78      * infomation on what icon holder is and what
       
    79      * it is useful for.
       
    80      *
       
    81      * @param aIndex The index of the item for which the graphic is requested.
       
    82      * @param aAttributeName The name of the graphical attribute to be returned.
       
    83      * @param aDesiredIconSize The desired icon size.
       
    84      * @return An icon holder object.
       
    85      */
       
    86     CHnIconHolder* GetAttributeAsRefCountedGraphics( TInt aIndex,
       
    87             const TDesC8& aAttributeName, TSize* aDesiredIconSize = NULL );
       
    88 
       
    89   /**
       
    90    * Sets the suite model. This method is used by matrix menu application when suite is loaded.
       
    91    *
       
    92    * @since S60 v3.0
       
    93    * @param aSuiteModel The suite model to be set.
       
    94    */
       
    95   void SetSuiteModelL( CHnSuiteModel * aSuiteModel );
       
    96 
       
    97   /**
       
    98    * Gets the suite model of the currently visible suite.
       
    99    *
       
   100    * @since S60 v3.0
       
   101    * @return The current suite model.
       
   102    */
       
   103   CHnSuiteModel* GetSuiteModel();
       
   104 
       
   105   /**
       
   106    * Reorders the model when item positions are edited in edit mode.
       
   107    *
       
   108    * @since S60 v3.0
       
   109    * @param aFromIndex The starting index of items to be shifted.
       
   110    * @param aToIndex The end index of items to be shifted.
       
   111    */
       
   112   void ReorderModelL(TInt aFromIndex, TInt aToIndex);
       
   113 
       
   114   /**
       
   115    * Handle event triggered by suite.
       
   116    *
       
   117    * @since S60 v3.0
       
   118    * @param aCustomSuiteEvent Type of suite event.
       
   119    * @param aModel The suite model that the event concerns.
       
   120    */
       
   121     void HandleSuiteEventL( THnCustomSuiteEvent aCustomSuiteEvent,
       
   122             CHnSuiteModel* aModel );
       
   123 
       
   124     /**
       
   125      * Determines the number of item-specific menu items for given item.
       
   126      *
       
   127      * @since S60 v3.0
       
   128      * @param aItemIndex Item index.
       
   129      * @return Number of item-specific menu items.
       
   130      */
       
   131     TInt GetNumberOfSpecificMenuItemsL( TInt aItemIndex );
       
   132 
       
   133 private:
       
   134 
       
   135   /**
       
   136    * Gets the attribute by name.
       
   137    *
       
   138    * @since S60 v3.0
       
   139    * @param aIndex The index of the item for which the attribute is requested.
       
   140    * @param aAttributeName The name of the requested attribute.
       
   141    * @return Size of item.
       
   142    */
       
   143     CHnAttributeBase* GetAttribute( TInt aIndex, const TDesC8 & aAttributeName );
       
   144 
       
   145   /**
       
   146    * Updates the item text array when model is reordered or new model is loaded.
       
   147    * It is important that the number of elements in the array is the same
       
   148    * as number of items in the suite.
       
   149    *
       
   150    * @since S60 v3.0
       
   151    */
       
   152     void UpdateDummyArrayDataL();
       
   153 
       
   154 
       
   155     /**
       
   156    * Constructor for performing 1st stage construction
       
   157    */
       
   158   CMmListBoxModel( );
       
   159 
       
   160   /**
       
   161    * Default symbian 2nd stage constructor.
       
   162    */
       
   163   void ConstructL();
       
   164 
       
   165 
       
   166 private:
       
   167 
       
   168     /**
       
   169      * Not own. Suite model being the container for the data.
       
   170      */
       
   171     CHnSuiteModel* iSuiteModel;
       
   172 
       
   173   };
       
   174 
       
   175 #endif // CMMLISTBOXMODEL_H