menufw/hierarchynavigator/hnpresentationmodel/inc/hnitemsorder.h
changeset 0 f72a12da539e
equal deleted inserted replaced
-1:000000000000 0:f72a12da539e
       
     1 /*
       
     2 * Copyright (c) 2007-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:   items order manager class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef HNITEMSORDER_H_
       
    20 #define HNITEMSORDER_H_
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <e32cmn.h>
       
    24 
       
    25 /**
       
    26  * Items order manager.
       
    27  * 
       
    28  * Instances of this class control order of the items 
       
    29  * displayed within a suite. The keep and manage the
       
    30  * complex relation between CHnMdItem, and consequenltly 
       
    31  * created CHnItemModels.
       
    32  * 
       
    33  * @lib hnpresentationmodel
       
    34  * @since S60 5.0
       
    35  * @ingroup group_hnpresentationmodel
       
    36  */
       
    37 NONSHARABLE_CLASS( CHnItemsOrder ) : public CBase
       
    38     {
       
    39     
       
    40 public:
       
    41     
       
    42     /**
       
    43      * Two-phased constructor.
       
    44      * 
       
    45      * @since S60 5.0
       
    46      * @return Fully constructed object.
       
    47      */
       
    48     IMPORT_C static CHnItemsOrder* NewL();
       
    49     
       
    50     /**
       
    51      * Two-phased constructor.
       
    52      * 
       
    53      * @since S60 5.0
       
    54      * @return Fully constructed object.
       
    55      */
       
    56     IMPORT_C static CHnItemsOrder* NewLC();
       
    57 
       
    58     /**
       
    59      * Standard destructor.
       
    60      * 
       
    61      * @since S60 5.0
       
    62      */
       
    63     ~CHnItemsOrder();
       
    64         
       
    65     /**
       
    66      * @since S60 5.0
       
    67      * @param aId Suite id, should be generated by IdGenrator
       
    68      */
       
    69     IMPORT_C void SetSuiteId( TInt aId );
       
    70     
       
    71     /**
       
    72      * @since S60 5.0
       
    73      * @return id of the associated suite 
       
    74      */
       
    75     IMPORT_C TInt GetSuiteId() const;
       
    76     
       
    77     /**
       
    78      * Removes item with given id.
       
    79      * 
       
    80      * @since S60 5.0
       
    81      * @param aId id of the item to be removed
       
    82      */
       
    83     IMPORT_C void RemoveItemId( TInt aId );
       
    84     
       
    85     /**
       
    86      * Insert an item referred to by an aId, to a suite.
       
    87      * It is indicated that this item has been produced from
       
    88      * CHnMdItem at index aDataModelItem. Evaluation indicates also
       
    89      * that this item is produced on the index aIndex in that particular
       
    90      * CHnMdItem.
       
    91      * 
       
    92      * @since S60 5.0
       
    93      * @param aDataModelItem Index of CHnMdItem instance in the CHnMdSuite.
       
    94      * @param aIndex Position in that CHnMdItem instance
       
    95      * @param aId Id of the item model.
       
    96      */
       
    97     IMPORT_C void InsertItemIdToL( TInt aDataModelItem, TInt aIndex, TInt aId );
       
    98     
       
    99     /**
       
   100      * Gets the item id at position aIndex, relative to the beginning
       
   101      * of the items generated from CHnMdItem at index aDataModelItem
       
   102      * 
       
   103      * @since S60 5.0
       
   104      * @param aDataModelItem Index of CHnMdItem instance in the CHnMdSuite.
       
   105      * @param aIndex Position in that CHnMdItem instance.
       
   106      */
       
   107     IMPORT_C TInt GetItemIdAt( TInt aDataModelItem, TInt aIndex );
       
   108     
       
   109     /**
       
   110      * Gets item id at specified position.
       
   111      * 
       
   112      * @since S60 5.0
       
   113      * @param aPosition Position in the suite model. 
       
   114      * @return Item id
       
   115      */
       
   116     IMPORT_C TInt GetItemIdAt( TInt aPosition );
       
   117     
       
   118     /**
       
   119      * Sets item id at given position.
       
   120      * 
       
   121      * @since S60 5.0
       
   122      * @param aPosition Position in the suite model
       
   123      * @param aId Item id
       
   124      */
       
   125     IMPORT_C void SetItemIdAtL( TInt aPosition, TInt aId );
       
   126     
       
   127     /**
       
   128      * Gets item position.
       
   129      * 
       
   130      * @since S60 5.0
       
   131      * @param aId Item id
       
   132      * @return Item position.
       
   133      */
       
   134     IMPORT_C TInt GetItemPosition( TInt aId );
       
   135     
       
   136     /**
       
   137      * Count property getter.
       
   138      * 
       
   139      * @since S60 5.0
       
   140      * @return Count
       
   141      */
       
   142     IMPORT_C TInt Count();
       
   143     
       
   144     /**
       
   145      * Informs the class of the count of CHnMdItem instances
       
   146      * in the suite.
       
   147      * 
       
   148      * @since S60 5.0
       
   149      * @param aItemCounts Number of CHnMdItems in the suite.
       
   150      */
       
   151     IMPORT_C void DefineModelItemCountL( TInt aItemCounts );
       
   152     
       
   153     /**
       
   154      * Gets the count of CHnMdItem instances
       
   155      * in the suite.
       
   156      * 
       
   157      * @since S60 5.0
       
   158      */
       
   159     IMPORT_C TInt GetModelItemCount();
       
   160     
       
   161     /**
       
   162      * Gets the ids for a particular CHnMdItem instance.
       
   163      * 
       
   164      * @since S60 5.0
       
   165      * @param aDataModelItem Index of the CHnMdItem instance
       
   166      * @param aIds Array of ids.
       
   167      */
       
   168     IMPORT_C void GetIdsForL( TInt aDataModelItem, 
       
   169             RArray< TInt >& aIds );
       
   170     
       
   171     /**
       
   172      * Operator to access id at a particular position in the suite.
       
   173      * 
       
   174      * @since S60 5.0
       
   175      * @param aPosition Position in the suite.
       
   176      */
       
   177     IMPORT_C TInt operator[]( TInt aPosition );
       
   178     
       
   179     /**
       
   180      * Informs the instance of the class that the associated suite
       
   181      * has been evaluated.
       
   182      * 
       
   183      * @since S60 5.0
       
   184      */
       
   185     IMPORT_C void SuiteEvaluated();
       
   186     
       
   187     /**
       
   188      * Informs the instance of the class that the associated item
       
   189      * has been evaluated.
       
   190      * 
       
   191      * @since S60 5.0
       
   192      * @param aIndex Item of the model that has been evaluated.
       
   193      */
       
   194     IMPORT_C void ItemEvaluated( TInt aIndex );
       
   195     
       
   196     /**
       
   197      * Determined if the suite is ready to be shown.
       
   198      * 
       
   199      * @since S60 5.0
       
   200      * @return Value determinig if associated suite is ready to show.
       
   201      */
       
   202     IMPORT_C TBool IsSuiteReadyToShow();
       
   203     
       
   204     /**
       
   205      * Marks suite as uninitialized.
       
   206      * 
       
   207      */
       
   208     IMPORT_C void MarkSuiteUninitialized();
       
   209     
       
   210 private:
       
   211     
       
   212     /**
       
   213      * Default constructor.
       
   214      * 
       
   215      * @since S60 5.0
       
   216      */
       
   217     CHnItemsOrder();
       
   218     
       
   219     /**
       
   220      * Stnadard 2nd stage symbian constructor.
       
   221      * 
       
   222      * @since S60 5.0
       
   223      */
       
   224     void ConstructL();
       
   225     
       
   226     /**
       
   227      * @since S60 5.0
       
   228      * @param aDataModelItem data model item
       
   229      * @return start index
       
   230      */
       
   231     TInt CountStartIndexFor( TInt aDataModelItem );
       
   232     
       
   233     /**
       
   234      * @since S60 5.0
       
   235      * @param aIndex index
       
   236      * @return model number
       
   237      */
       
   238     TInt CountModelNumberFor( TInt aIndex );
       
   239     
       
   240 private: // data
       
   241     
       
   242     /**
       
   243      * Unique id for the associated suite. 
       
   244      * Should be generated via IdGenerator mechanism.
       
   245      */ 
       
   246     TInt iSuiteId;
       
   247 
       
   248     /**
       
   249      * Indicates if the associated suite has been initialized
       
   250      * with the first evaluation.
       
   251      */
       
   252     TBool iSuiteEvaluated;
       
   253 
       
   254     /**
       
   255      * Array of values indication if each of associated CHnMdItems
       
   256      * has been initialized with first evaluation.
       
   257      */
       
   258     RArray<TBool> iItemsEvaluated;
       
   259     
       
   260     /**
       
   261      * Items order counts
       
   262      * Holds the counts of CHnItemModels, for each of CHnMdItems
       
   263      */
       
   264     RArray<TInt> iItemsOrderCounts;
       
   265 
       
   266     /**
       
   267      * Complex items order.
       
   268      * Hold the order of CHnItemModels in a suite associated with the
       
   269      * instance of this class.
       
   270      */
       
   271     RArray<TInt> iComplexItemsOrder;
       
   272     
       
   273     };
       
   274 
       
   275 #endif // HNITEMSORDER_H_