menucontentsrv/enginc/menuengidsetter.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 __MENUENGIDSETTER_H__
       
    19 #define __MENUENGIDSETTER_H__
       
    20 
       
    21 // INCLUDES
       
    22 
       
    23 #include <e32base.h>
       
    24 #include "menuengvisitor.h"
       
    25 
       
    26 // FORWARD DECLARATION
       
    27 
       
    28 class CMenuEngIdManager;
       
    29 
       
    30 // CLASS DECLARATION
       
    31 
       
    32 /**
       
    33 * Menu Engine ID setter - recurse the menu tree and, allocate and set ID to
       
    34 * all objects that does not have one.
       
    35 */
       
    36 NONSHARABLE_CLASS( TMenuEngIdSetter ): public MMenuEngVisitor
       
    37     {
       
    38 
       
    39 public:     // construction
       
    40 
       
    41     /**
       
    42     * Constructor.
       
    43     * @param aIdManager Ids are allocated from this manager.
       
    44     */
       
    45     TMenuEngIdSetter( CMenuEngIdManager& aIdManager )
       
    46         : iIdManager( aIdManager ) {}
       
    47 
       
    48 public:     // new methods
       
    49 
       
    50     /**
       
    51     * Enter folder.
       
    52     * @param aFolder Entering this folder.
       
    53     * @return ETrue (visit children of this folder).
       
    54     */
       
    55     TBool VisitEnterL( CMenuEngObject& aFolder )
       
    56         { SetIdL( aFolder ); return ETrue; }
       
    57 
       
    58     /**
       
    59     * Visit leaf node.
       
    60     * @param aLeaf Leaf node.
       
    61     * @return ETrue (visit next sibling of this leaf).
       
    62     */
       
    63     TBool VisitL( CMenuEngObject& aLeaf )
       
    64         { SetIdL( aLeaf ); return ETrue; }
       
    65 
       
    66 private:    // new methods
       
    67 
       
    68     /**
       
    69     * Set ID from for this object.
       
    70     * @param aObject Object.
       
    71     */
       
    72     void SetIdL( CMenuEngObject& aObject );
       
    73 
       
    74 private:    // data
       
    75 
       
    76     CMenuEngIdManager& iIdManager; ///< Id manager.
       
    77 
       
    78     };
       
    79 
       
    80 #endif // __MENUENGIDSETTER_H__