menufw/menufwui/mmwidgets/inc/mmlistboxmodel.h
changeset 0 f72a12da539e
child 4 4d54b72983ae
equal deleted inserted replaced
-1:000000000000 0:f72a12da539e
       
     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.3 % << 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 private:
       
   125 
       
   126 	/**
       
   127 	 * Gets the attribute by name.
       
   128 	 * 
       
   129 	 * @since S60 v3.0
       
   130 	 * @param aIndex The index of the item for which the attribute is requested.
       
   131 	 * @param aAttributeName The name of the requested attribute.
       
   132 	 * @return Size of item.
       
   133 	 */
       
   134     CHnAttributeBase* GetAttribute( TInt aIndex, const TDesC8 & aAttributeName );
       
   135 	
       
   136 	/**
       
   137 	 * Updates the item text array when model is reordered or new model is loaded.
       
   138 	 * It is important that the number of elements in the array is the same
       
   139 	 * as number of items in the suite.
       
   140 	 * 
       
   141 	 * @since S60 v3.0
       
   142 	 */
       
   143     void UpdateDummyArrayDataL();  
       
   144 
       
   145 	
       
   146     /**
       
   147 	 * Constructor for performing 1st stage construction
       
   148 	 */
       
   149 	CMmListBoxModel( );
       
   150 
       
   151 	/**
       
   152 	 * Default symbian 2nd stage constructor.
       
   153 	 */
       
   154 	void ConstructL();
       
   155 
       
   156 
       
   157 private:
       
   158     
       
   159     /**
       
   160      * Not own. Suite model being the container for the data.
       
   161      */
       
   162     CHnSuiteModel* iSuiteModel;
       
   163     
       
   164 	};
       
   165 
       
   166 #endif // CMMLISTBOXMODEL_H