menucontentsrv/enginc/menuengitemlister.h
changeset 0 79c6a41cd166
equal deleted inserted replaced
-1:000000000000 0:79c6a41cd166
       
     1 /*
       
     2 * Copyright (c) 2009 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:
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __MENUENGITEMLISTER_H__
       
    19 #define __MENUENGITEMLISTER_H__
       
    20 
       
    21 #include "menuengvisitor.h"
       
    22 #include "mcsmenuitem.h"
       
    23 
       
    24 #include <e32base.h>
       
    25 
       
    26 // FORWARD DECLARATION
       
    27 
       
    28 class CMenuEng;
       
    29 class MMenuEngFilter;
       
    30 
       
    31 // CLASS DECLARATION
       
    32 
       
    33 /**
       
    34 * Menu Engine item lister.
       
    35 * Creates a list of item headers.
       
    36 */
       
    37 NONSHARABLE_CLASS( TMenuEngItemLister ): public MMenuEngVisitor
       
    38     {
       
    39 
       
    40 public:     // construction
       
    41 
       
    42     /**
       
    43     * Constructor.
       
    44     * @param aEng Engine.
       
    45     * @param aItemArray Items are appended to this list.
       
    46     * @param aFolder Root folder of query (will be excluded from the listing).
       
    47     * @return aFilter Filter criteria or NULL.
       
    48     * @param aRecursive ETrue for recursive listing.
       
    49     */
       
    50     TMenuEngItemLister( 
       
    51         const CMenuEng& aEng,
       
    52         RArray<TMenuItem>& aItemArray,
       
    53         TInt aFolder,
       
    54         const MMenuEngFilter* aFilter,
       
    55         TBool aRecursive );
       
    56 
       
    57 public:     // new methods
       
    58 
       
    59 	// From MMenuEngVisitor:
       
    60     /**
       
    61     * Enter folder.
       
    62     * @param aFolder Entering this folder.
       
    63     * @return ETrue to visit children of this folder. VisitLeaveL() will
       
    64     *         be called after children of this folder are visited.
       
    65     *         EFalse to skip children of this folder. VisitLeaveL() will
       
    66     *         be called next.
       
    67     */
       
    68     TBool VisitEnterL( CMenuEngObject& aFolder );
       
    69 
       
    70     /**
       
    71     * Leave folder.
       
    72     * @param aFolder Leaving this folder.
       
    73     * @return ETrue to visit next sibling of this folder.
       
    74     *         EFalse to stop visiting items at this level.
       
    75     */
       
    76     TBool VisitLeaveL( CMenuEngObject& aFolder );
       
    77 
       
    78     /**
       
    79     * Visit leaf node.
       
    80     * @param aLeaf Leaf node.
       
    81     * @return ETrue to visit next sibling of this leaf.
       
    82     *         EFalse to stop visiting items at this level.
       
    83     */
       
    84     TBool VisitL( CMenuEngObject& aLeaf );
       
    85 
       
    86 private:    // new methods
       
    87 
       
    88     void AddL( CMenuEngObject& aObject );
       
    89 
       
    90 private:    // data
       
    91 
       
    92     const CMenuEng& iEng; ///< Engine. Not own.
       
    93     RArray<TMenuItem>& iItemArray; ///< Item array. Not own.
       
    94     TInt iFolder; ///< Folder of query (excluded from the listing).
       
    95     const MMenuEngFilter* iFilter; ///< Filter or NULL. Not own.
       
    96     TBool iRecursive; ///< ETrue for recursive listing.
       
    97 
       
    98     };
       
    99 
       
   100 #endif // __MENUENGITEMLISTER_H__