diff -r 000000000000 -r f72a12da539e menufw/menufwui/mmwidgets/inc/mmlistboxmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/menufw/menufwui/mmwidgets/inc/mmlistboxmodel.h Thu Dec 17 08:40:49 2009 +0200 @@ -0,0 +1,166 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CMmListBoxItemModel +* Version : %version: MM_18.1.3 % << Don't touch! Updated by Synergy at check-out. +* +*/ + + +#ifndef C_MMLISTBOXMODEL_H +#define C_MMLISTBOXMODEL_H + +#include +#include +#include +#include +#include "hnsuiteobserver.h" + +class CHnSuiteModel; +class CHnAttributeBase; +class CHnAttributeImage; +class CHnIconHolder; + +/** + * Multimedia Menu listbox model + * + * @code + * @endcode + * @lib mmwidgets + * @since S60 v3.0 + * @ingroup group_mmwidgets + */ +NONSHARABLE_CLASS( CMmListBoxModel ): + public CAknFilteredTextListBoxModel, + public MHnSuiteObserver + { +public: + // Constructors and destructor + + /** + * Destructor. + */ + ~CMmListBoxModel(); + + /** + * Two-phased constructor. + */ + static CMmListBoxModel* NewL( ); + + /** + * Two-phased constructor. + */ + static CMmListBoxModel* NewLC( ); + + /** + * Gets the text attribute for a specific item by the name of the attribute. + * + * @since S60 v3.0 + * @param aIndex The index of the item for which the text is requested. + * @param aAttributeName The name of the text attribute to be returned. + * @return Size of item. + */ + const TDesC8& GetAttributeAsText( TInt aIndex, const TDesC8 & aAttributeName ); + + /** + * Gets the graphical attribute for a specific item by the name of the attribute. + * The attribute is returned as an icon holder. Please see @c CHnIconHolder for + * infomation on what icon holder is and what + * it is useful for. + * + * @param aIndex The index of the item for which the graphic is requested. + * @param aAttributeName The name of the graphical attribute to be returned. + * @param aDesiredIconSize The desired icon size. + * @return An icon holder object. + */ + CHnIconHolder* GetAttributeAsRefCountedGraphics( TInt aIndex, + const TDesC8& aAttributeName, TSize* aDesiredIconSize = NULL ); + + /** + * Sets the suite model. This method is used by matrix menu application when suite is loaded. + * + * @since S60 v3.0 + * @param aSuiteModel The suite model to be set. + */ + void SetSuiteModelL( CHnSuiteModel * aSuiteModel ); + + /** + * Gets the suite model of the currently visible suite. + * + * @since S60 v3.0 + * @return The current suite model. + */ + CHnSuiteModel* GetSuiteModel(); + + /** + * Reorders the model when item positions are edited in edit mode. + * + * @since S60 v3.0 + * @param aFromIndex The starting index of items to be shifted. + * @param aToIndex The end index of items to be shifted. + */ + void ReorderModelL(TInt aFromIndex, TInt aToIndex); + + /** + * Handle event triggered by suite. + * + * @since S60 v3.0 + * @param aCustomSuiteEvent Type of suite event. + * @param aModel The suite model that the event concerns. + */ + void HandleSuiteEventL( THnCustomSuiteEvent aCustomSuiteEvent, + CHnSuiteModel* aModel ); + +private: + + /** + * Gets the attribute by name. + * + * @since S60 v3.0 + * @param aIndex The index of the item for which the attribute is requested. + * @param aAttributeName The name of the requested attribute. + * @return Size of item. + */ + CHnAttributeBase* GetAttribute( TInt aIndex, const TDesC8 & aAttributeName ); + + /** + * Updates the item text array when model is reordered or new model is loaded. + * It is important that the number of elements in the array is the same + * as number of items in the suite. + * + * @since S60 v3.0 + */ + void UpdateDummyArrayDataL(); + + + /** + * Constructor for performing 1st stage construction + */ + CMmListBoxModel( ); + + /** + * Default symbian 2nd stage constructor. + */ + void ConstructL(); + + +private: + + /** + * Not own. Suite model being the container for the data. + */ + CHnSuiteModel* iSuiteModel; + + }; + +#endif // CMMLISTBOXMODEL_H