|
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 __MENUENGIDCOLLECTOR_H__ |
|
19 #define __MENUENGIDCOLLECTOR_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 collector - recurse the menu tree and collect all |
|
34 * used ID-s, into an array. |
|
35 */ |
|
36 NONSHARABLE_CLASS( TMenuEngIdCollector ): public MMenuEngVisitor |
|
37 { |
|
38 |
|
39 public: // construction |
|
40 |
|
41 /** |
|
42 * Constructor. |
|
43 * @param aIds Ids are appended to this array. |
|
44 */ |
|
45 TMenuEngIdCollector( RArray<TInt>& aIds ): iIds( aIds ) {} |
|
46 |
|
47 public: // new methods |
|
48 |
|
49 /** |
|
50 * Enter folder. |
|
51 * @param aFolder Entering this folder. |
|
52 * @return ETrue (visit children of this folder). |
|
53 */ |
|
54 TBool VisitEnterL( CMenuEngObject& aFolder ) |
|
55 { CollectIdL( aFolder ); return ETrue; } |
|
56 |
|
57 /** |
|
58 * Visit leaf node. |
|
59 * @param aLeaf Leaf node. |
|
60 * @return ETrue (visit next sibling of this leaf). |
|
61 */ |
|
62 TBool VisitL( CMenuEngObject& aLeaf ) |
|
63 { CollectIdL( aLeaf ); return ETrue; } |
|
64 |
|
65 private: // new methods |
|
66 |
|
67 /** |
|
68 * Collect ID from object. |
|
69 * @param aObject Object. |
|
70 */ |
|
71 void CollectIdL( CMenuEngObject& aObject ); |
|
72 |
|
73 private: // data |
|
74 |
|
75 RArray<TInt>& iIds; ///< Id array. Not owned. |
|
76 |
|
77 }; |
|
78 |
|
79 #endif // __MENUENGIDCOLLECTOR_H__ |